server-hardening
БесплатноБез исполняемых скриптовНе проверенLinux server security hardening covering CIS Benchmark areas: automatic security updates, AppArmor/SELinux MAC, auditd, intrusion detection, login security…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
Server Hardening — Production Linux Security
Hardening Philosophy
Apply the principle of least privilege at every layer:
- Services run as dedicated non-root users
- Only required ports are open
- Only required packages are installed
- All privilege changes are audited
- System is kept patched automatically
Automatic Security Updates
unattended-upgrades (Ubuntu/Debian)
sudo apt install -y unattended-upgrades update-notifier-common apt-listchanges
sudo dpkg-reconfigure --priority=low unattended-upgrades
/etc/apt/apt.conf.d/50unattended-upgrades:
Unattended-Upgrade::Allowed-Origins {
// Apply security updates from Ubuntu's security channel
"${distro_id}:${distro_codename}-security";
// Optional: ESM security updates (Ubuntu Pro)
"UbuntuESMApps:${distro_codename}-apps-security";
"UbuntuESM:${distro_codename}-infra-security";
};
// Automatically remove obsolete packages after upgrade
Unattended-Upgrade::Remove-Unused-Dependencies "true";
Unattended-Upgrade::Remove-New-Unused-Dependencies "true";
// Reboot automatically if required (kernel/libc updates)
Unattended-Upgrade::Automatic-Reboot "true";
Unattended-Upgrade::Automatic-Reboot-WithUsers "false";
Unattended-Upgrade::Automatic-Reboot-Time "03:00";
// Email notification on errors
Unattended-Upgrade::Mail "[email protected]";
Unattended-Upgrade::MailReport "on-change";
// Block packages that have failed for too long
Unattended-Upgrade::SyslogEnable "true";
Unattended-Upgrade::SyslogFacility "daemon";
// Split the upgrade into smaller batches to reduce memory pressure
Unattended-Upgrade::MinimalSteps "true";
/etc/apt/apt.conf.d/20auto-upgrades:
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "7";
APT::Periodic::Unattended-Upgrade "1";
# Test dry run — verify which packages would be upgraded
sudo unattended-upgrades --dry-run --debug
# Check service status
sudo systemctl status unattended-upgrades
# View upgrade log
sudo cat /var/log/unattended-upgrades/unattended-upgrades.log
needrestart — prompts (or automatically restarts) services after library upgrades:
sudo apt install -y needrestart
# Configure automatic restart mode (no prompt in CI/automated contexts):
sudo sed -i "s/#\$nrconf{restart} = 'i';/\$nrconf{restart} = 'a';/" /etc/needrestart/needrestart.conf
SSH Hardening
/etc/ssh/sshd_config.d/99-hardening.conf (drop-in, overrides defaults):
# Disable root login entirely — use sudo from a named user account
PermitRootLogin no
# Disable password authentication — keys only
PasswordAuthentication no
ChallengeResponseAuthentication no
# Disable X11 forwarding unless required
X11Forwarding no
# Disable agent forwarding (prevents lateral movement via forwarded SSH agent)
AllowAgentForwarding no
# Limit login window (default 120s is excessive)
LoginGraceTime 30
# Maximum authentication attempts before disconnection
MaxAuthTries 3
# Restrict SSH to specific users or groups
AllowUsers deploy admin
# AllowGroups sshusers
# Use only strong algorithms
KexAlgorithms curve25519-sha256,[email protected],diffie-hellman-group16-sha512,diffie-hellman-group18-sha512
Ciphers [email protected],[email protected],[email protected]
MACs [email protected],[email protected]
# Disable SSH protocol 1 (already default, but explicit is better)
Protocol 2
# Enable strict mode checking on key file permissions
StrictModes yes
# Log logins at verbose level (captures key fingerprints)
LogLevel VERBOSE
# Disable TCP port forwarding unless required
AllowTcpForwarding no
sudo sshd -t # Test config before reloading
sudo systemctl reload sshd
AppArmor (Ubuntu/Debian)
# Check status
sudo aa-status
# Put a profile in complain mode (log violations, do not enforce)
sudo aa-complain /usr/sbin/nginx
# Enforce a profile
sudo aa-enforce /usr/sbin/nginx
# Load all profiles in /etc/apparmor.d/
sudo apparmor_parser -r /etc/apparmor.d/
# View recent violations
sudo journalctl -k | grep apparmor | tail -30
# OR
sudo cat /var/log/kern.log | grep apparmor | tail -30
Custom AppArmor profile skeleton (/etc/apparmor.d/usr.local.bin.myapp):
#include <tunables/global>
/usr/local/bin/myapp {
#include <abstractions/base>
#include <abstractions/nameservice>
# Read app files
/opt/myapp/** r,
# Write to log directory
/var/log/myapp/ rw,
/var/log/myapp/** rw,
# Read config
/etc/myapp/** r,
# Network access (outbound only)
network inet stream,
# Deny everything else
deny /** w,
}
SELinux Basics (RHEL/CentOS/Fedora)
# Check enforcement status
getenforce # Enforcing / Permissive / Disabled
sestatus # Detailed status
# Temporarily set permissive (testing — does not persist reboot)
sudo setenforce 0
# Re-enable enforcement
sudo se
Установить server-hardening в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobWriteEditBashFAQ
Что делает скилл server-hardening?
Linux server security hardening covering CIS Benchmark areas: automatic security updates, AppArmor/SELinux MAC, auditd, intrusion detection, login security (PAM), network hardening sysctl, filesystem security, and service minimization. USE WHEN: - Hardening a new Ubuntu/Debian or RHEL/CentOS server before production use - Configuring automatic security updates with unattended-upgrades - Setting up auditd to track privilege escalation and file modifications - Enabling AppArmor enforcement or writing custom profiles - Running rkhunter or Wazuh for intrusion detection - Locking down PAM login policies (account lockout, password quality) - Auditing SUID/SGID binaries and open ports DO NOT USE FOR: - Application-layer WAF rules (use the waf skill instead) - Network firewall and UFW/iptables rules (use the firewall skill instead) - SSL/TLS certificate management (use the ssl-tls skill instead) - Container security (seccomp profiles, AppArmor with Docker — use the docker skill)
Как установить скилл server-hardening?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл server-hardening запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic