linux-hardening – skill DevOps & Hạ tầng cho agent AI
Áp dụng benchmark CIS và bảo mật máy chủ Linux.
Cài skill linux-hardening bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/linux-hardening-d48fd.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /linux-hardening – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/linux-hardening-d48fd.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $linux-hardening – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/linux-hardening-d48fd.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /linux-hardening – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/linux-hardening-d48fd.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /linux-hardening – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
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
Target and recovery
Confirm distribution/version, selected CIS profile, current service config and user-authorized changes. Keep a known-working access session and out-of-band recovery, back up affected files privately, preview changes and validate before reload. These examples are fragments, not a universal CIS-compliance script. Do not apply firewall/default-deny rules before verifying management access and IPv4/IPv6 requirements.
SSH Hardening
# Example sshd configuration; merge with existing policy
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
AllowUsers <confirmed-management-users>User Security
# Debian/Ubuntu package example; review the transaction first
sudo apt install libpam-pwqualityMerge these settings into /etc/security/pwquality.conf after reviewing the distribution PAM policy; these are configuration entries, not shell commands:
minlen = 14
dcredit = -1
ucredit = -1
ocredit = -1
lcredit = -1# Set the default for FUTURE accounts: inactivity after password expiry,
# not 30 days since last login; review service-account consequences first.
useradd -D -f 30
# Audit sudo usage
# Edit a reviewed /etc/sudoers.d/ fragment with visudo and validate with visudo -c.
# Do not append blindly to /etc/sudoers.Firewall Configuration
# UFW setup
ufw default deny incoming
ufw default allow outgoing
ufw allow ssh
ufw allow 443/tcp
ufw enable
# Alternative iptables changes require an isolated validated ruleset,
# management allow rules, conntrack, DNS/IPv6 decisions and timed rollback.
# Do not set INPUT DROP first on a live remote host.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
# After reviewing a supported value set, apply the exact file separately:
# sudo sysctl -p /etc/sysctl.d/99-security.confFile Permissions
# Inspect distro-prescribed owner/group/mode before any authorized repair.
# /etc/shadow group readability may be required; do not blanket chmod it.
# Find world-writable files
find / -xdev -type f -perm -0002 -ls
# Find SUID files
find / -xdev -perm -4000 -type f -lsAudit Configuration
Package installation and audit rules are separate steps. Validate and load the actual rules file through the installed audit tooling; execve auditing can capture secret command arguments and large volumes, so scope access and retention.
# Install auditd
apt install auditdExample rule-file content for /etc/audit/rules.d/audit.rules (not shell commands):
-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 execBest 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 (
cis-benchmarks) - Compliance scanning - firewall-config (
firewall-config) - Firewall rules
Limitations
- Apply guidance only within authorized scope; test destructive steps in non-production first.
- Docs-only import: upstream scripts and templates not bundled.
Example
# Read-only first: inventory before any active step.
which <tool> && <tool> --help | head -n 20> Adapted from [BagelHole/DevOps-Security-Agent-Skills](https://github.com/BagelHole/DevOps-Security-Agent-Skills) (MIT); frontmatter, When to Use/Limitations, and safety boundaries added for upstream compliance. Docs-only import: helper scripts and templates not bundled.
Skill liên quan
- linux-privilege-escalation – Thực hiện đánh giá leo thang đặc quyền có hệ thống trên Linux để tìm và khai thác cấu…
- linux-shell-scripting – Cung cấp mẫu shell script sẵn sàng cho môi trường production cho các tác vụ quản trị…
- linux-troubleshooting – Quy trình xử lý sự cố Linux để chẩn đoán và khắc phục lỗi hệ thống, vấn đề hiệu năng và…
- llm-cost-optimization – Giảm chi phí API LLM và hạ tầng thông qua chọn mô hình, prompt caching, xử lý theo lô…
- llm-fine-tuning – Thiết lập hạ tầng để fine-tune LLM với QLoRA, LoRA và full fine-tuning, sử dụng Hugging…
- llm-gateway – Triển khai API gateway cho lưu lượng LLM với cân bằng tải, giới hạn tốc độ, quản lý…
- llm-inference-scaling – Tự động mở rộng cụm suy luận LLM trên Kubernetes bằng KEDA, metric GPU tùy chỉnh và…
- llmops-platform-engineering – Xây dựng nền tảng LLMOps cấp production với CI/CD, quy trình thăng hạng mô hình, cổng…