Skip to content

Practical Linux server hardening covering SSH, users, firewall, kernel, file permissions, and auditing per CIS practice.

CCM score
65 of 100
skills.sh installs
957
GitHub stars
1.2K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers SSH lockdown, password policy, firewall rules, kernel sysctl settings, file permissions, and auditd rules
  • Includes ready-to-apply config snippets for /etc/ssh/sshd_config, /etc/security/pwquality.conf, /etc/sysctl.d/99-security.conf, and /etc/audit/rules.d/audit.rules
  • Provides both UFW and iptables firewall examples, with a default-deny inbound policy and SSH allowed
  • Designed for hardening production servers and meeting security compliance or baseline requirements

Install

$ npx -y skills add bagelhole/devops-security-agent-skills --skill linux-hardening -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

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

Details

Repository
github.com/bagelhole/devops-security-agent-skills
Categories
Security, DevOps & Cloud
First seen
Jun 3, 2026

Questions

What does the linux-hardening skill do?

The linux-hardening skill applies CIS benchmarks to secure Linux servers. It covers SSH configuration, user management, firewall rules and security features such as kernel hardening and audit rules.

When should I use the linux-hardening skill?

Use the linux-hardening skill when hardening Linux systems for production or meeting security compliance requirements. The SKILL.md also lists hardening production servers, meeting compliance requirements and configuring secure SSH access as use cases.

How do I install the linux-hardening skill?

Run npx -y skills add bagelhole/devops-security-agent-skills --skill linux-hardening -y in your project. After that, the linux-hardening skill gives your agent the SSH, firewall, kernel and audit hardening steps from its SKILL.md.

Where does linux-hardening stand in the Security category?

The linux-hardening skill is listed in the Security category alongside azure-compliance, entra-agent-id, firebase-security-rules-auditor, security-audit and cloudflare-one. Its SKILL.md links to the cis-benchmarks and firewall-config skills as related work.

More from bagelhole/devops-security-agent-skills

All 2

Similar to Linux Hardening

More Security