Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
bagelhole avatar

Linux Hardening

  • 300 installs
  • 44 repo stars
  • Updated May 22, 2026
  • bagelhole/devops-security-agent-skills

linux-hardening is a Claude Code skill that guides CIS-aligned Linux server hardening—SSH, services, permissions, kernel params, and audit logging—for developers who must secure production hosts.

About

linux-hardening is a security-focused agent skill from bagelhole/devops-security-agent-skills that walks developers through hardening Linux production servers. The skill covers disabling unused services, applying CIS benchmark recommendations, tightening SSH configuration, fixing file permissions, tuning kernel parameters, and enabling audit logging so hosts meet baseline compliance. Developers reach for linux-hardening when provisioning or auditing VMs, containers, or bare-metal nodes before go-live or after a security review flags excessive attack surface. It pairs naturally with infrastructure-as-code workflows where agents need explicit checklists rather than ad-hoc shell one-liners.

  • CIS benchmark alignment
  • SSH and sudo hardening
  • Service minimization
  • Kernel sysctl tuning

Linux Hardening by the numbers

  • 300 all-time installs (skills.sh)
  • Ranked #632 of 2,203 Security skills by installs in the Skillselion catalog
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/bagelhole/devops-security-agent-skills --skill linux-hardening

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs300
repo stars44
Last updatedMay 22, 2026
Repositorybagelhole/devops-security-agent-skills

How do you harden Linux servers with CIS benchmarks?

Harden Linux servers by disabling unused services, applying CIS benchmarks, configuring SSH, permissions, kernel params, and audit logging for production hosts.

Who is it for?

Backend and DevOps engineers provisioning or auditing production Linux hosts who need CIS-aligned hardening checklists an agent can execute step by step.

Skip if: Developers who only need application-level security reviews or who run fully managed PaaS workloads where the cloud provider owns OS hardening.

When should I use this skill?

A developer asks to secure, harden, or CIS-benchmark a Linux server, SSH access, kernel params, or production host audit logging.

What you get

Hardened SSH config, disabled services list, kernel sysctl settings, permission fixes, and audit logging configuration ready to apply.

  • hardened SSH configuration
  • CIS-aligned sysctl and service changes
  • audit logging setup

Files

SKILL.mdMarkdownGitHub ↗

Linux Hardening

Secure Linux servers following CIS benchmarks and security best practices.

When to Use This Skill

Use this skill when:

  • Hardening production servers
  • Meeting compliance requirements
  • Implementing security baselines
  • Configuring secure SSH access

SSH Hardening

# /etc/ssh/sshd_config
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
AllowUsers deploy admin
Protocol 2

User Security

# Password policy
sudo apt install libpam-pwquality
# /etc/security/pwquality.conf
minlen = 14
dcredit = -1
ucredit = -1
ocredit = -1
lcredit = -1

# Lock inactive accounts
useradd -D -f 30

# Audit sudo usage
echo "Defaults logfile=/var/log/sudo.log" >> /etc/sudoers

Firewall Configuration

# UFW setup
ufw default deny incoming
ufw default allow outgoing
ufw allow ssh
ufw allow 443/tcp
ufw enable

# Or iptables
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT

Kernel Hardening

# /etc/sysctl.d/99-security.conf
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.icmp_echo_ignore_broadcasts = 1
kernel.randomize_va_space = 2
fs.suid_dumpable = 0

# Apply
sysctl -p

File Permissions

# Critical files
chmod 600 /etc/shadow
chmod 644 /etc/passwd
chmod 700 /root
chmod 600 /etc/ssh/sshd_config

# Find world-writable files
find / -type f -perm -0002 -ls

# Find SUID files
find / -perm -4000 -type f -ls

Audit Configuration

# Install auditd
apt install auditd

# /etc/audit/rules.d/audit.rules
-w /etc/passwd -p wa -k identity
-w /etc/shadow -p wa -k identity
-w /etc/sudoers -p wa -k actions
-a always,exit -F arch=b64 -S execve -k exec

Best Practices

  • Disable unused services
  • Keep system updated
  • Use fail2ban for intrusion prevention
  • Enable SELinux/AppArmor
  • Regular security audits
  • Monitor log files
  • Implement least privilege

Related Skills

  • cis-benchmarks - Compliance scanning
  • firewall-config - Firewall rules

Related skills

How it compares

Choose linux-hardening when the task is OS-level baseline compliance on Linux hosts rather than application code review or cloud IAM policy design.

FAQ

What does linux-hardening configure on a server?

linux-hardening guides disabling unused services, applying CIS benchmark checks, tightening SSH, fixing permissions, tuning kernel parameters, and enabling audit logging so a Linux production host meets a documented security baseline.

When should developers use linux-hardening?

linux-hardening fits new VM or bare-metal provisioning, pre-launch security reviews, and post-incident hardening when an agent must translate CIS-style controls into concrete sshd, sysctl, and auditd changes.

Securityauditappsecsecrets

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.