hardening

hardening is a skill for Claude Code, Codex from chaterm/terminal-skills. It costs 6 tokens per session (1,507 once invoked), scanned B, original, Apache-2.0.

A set of Linux instructions for hardening systems, meaning reducing unsafe settings and limiting unnecessary access.

In plain words
What is it for?
Use it to disable root or password-based SSH login, limit allowed users, check SSH settings, apply kernel security parameters, and set password policies.
Why use it?
It helps turn general security advice into concrete configuration changes for SSH, the Linux kernel, passwords, and login controls.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it to disable root or password-based SSH login, limit allowed users, check SSH settings, apply kernel security parameters, and set password policies.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/chaterm/terminal-skills/hardening
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add chaterm/terminal-skills --skill hardening
Clone the repo
git clone --depth 1 https://github.com/chaterm/terminal-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for hardening

README.md
[![agentmods](https://agentmods.dev/badge/skills/chaterm/terminal-skills/hardening/github.svg)](https://agentmods.dev/skills/chaterm/terminal-skills/hardening)
Your own site
<a href="https://agentmods.dev/skills/chaterm/terminal-skills/hardening"><img src="https://agentmods.dev/badge/skills/chaterm/terminal-skills/hardening/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for hardening

Your own site · 80×15
<a href="https://agentmods.dev/skills/chaterm/terminal-skills/hardening"><img src="https://agentmods.dev/badge/skills/chaterm/terminal-skills/hardening.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 6 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,507 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00006 $0.01507
Opus 5 $0.00003 $0.00754
Sonnet 5 $0.00001 $0.00301
Haiku 4.5 $0.00001 $0.00151

Measured 12d ago against content hash c774530d514f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade B, and why

hardening scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootlowPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

chmod 600 /etc/shadow

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Reaches for credential filesmediumPrivilege escalation

SSH keys, cloud credentials, git-credentials, .npmrc, /etc/shadow: reading these is how a config file becomes a credential leak.

awk -F: '($2 == "") {print $1}' /etc/shadow

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

security/hardening/SKILL.md · 260 lines

How it starts

The opening of the file, as written. The whole thing — 260 lines — stays where its author put it; the contents beside it link to each section on GitHub.

系统加固

概述

系统加固、基线配置、CIS 标准技能。

SSH 加固

配置优化

# /etc/ssh/sshd_config
# 禁用 root 登录
PermitRootLogin no

# 禁用密码认证
PasswordAuthentication no
PubkeyAuthentication yes

# 限制用户
AllowUsers admin deploy
AllowGroups sshusers

# 修改端口
Port 2222

# 超时设置
ClientAliveInterval 300
ClientAliveCountMax 2

# 禁用空密码
PermitEmptyPasswords no

# 协议版本
Protocol 2

# 日志级别
LogLevel VERBOSE

应用配置

# 检查配置
sshd -t

# 重启服务
systemctl restart sshd

内核参数加固

sysctl 配置

# /etc/sysctl.d/99-security.conf

# 禁用 IP 转发
net.ipv4.ip_forward = 0

# 禁用 ICMP 重定向
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0

# 启用 SYN Cookie
net.ipv4.tcp_syncookies = 1

# 忽略 ICMP 广播
net.ipv4.icmp_echo_ignore_broadcasts = 1

# 禁用源路由
net.ipv4.conf.all.accept_source_route = 0

# 启用反向路径过滤
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1

# 记录可疑包
net.ipv4.conf.all.log_martians = 1

# 禁用 IPv6(如不需要)
net.ipv6.conf.all.disable_ipv6 = 1

应用配置

sysctl -p /etc/sysctl.d/99-security.conf

用户安全

密码策略

# /etc/login.defs
PASS_MAX_DAYS   90
PASS_MIN_DAYS   7
PASS_MIN_LEN    12
PASS_WARN_AGE   14

# /etc/security/pwquality.conf
minlen = 12
dcredit = -1
ucredit = -1
ocredit = -1
lcredit = -1

账户锁定

# /etc/pam.d/common-auth (Debian)
auth required pam_tally2.so deny=5 unlock_time=900

# /etc/pam.d/system-auth (RHEL)
auth required pam_faillock.so preauth deny=5 unlock_time=900
auth required pam_faillock.so authfail deny=5 unlock_time=900

清理无用账户

# 锁定账户
usermod -L username
passwd -l username

# 禁用 shell
usermod -s /sbin/nologin username

# 查找无密码账户
awk -F: '($2 == "") {print $1}' /etc/shadow

文件权限

关键文件

# 设置权限
chmod 600 /etc/shadow
chmod 644 /etc/passwd
chmod 600 /etc/gshadow
chmod 644 /etc/group
chmod 700 /root
chmod 600 /boot/grub/grub.cfg

# 设置属性
chattr +i /etc/passwd
chattr +i /etc/shadow

查找问题文件

# 查找 SUID/SGID 文件
find / -perm /4000 -type f 2>/dev/null
find / -perm /2000 -type f 2>/dev/null

# 查找无主文件
find / -nouser -o -nogroup 2>/dev/null

# 查找全局可写文件
find / -perm -002 -type f 2>/dev/null

Read the full file on GitHub · 260 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 260 lines · 6 tokens per session scan B c774530d514f

Subscribe to this mod's changes

hardening is a skill published in the GitHub repository chaterm/terminal-skills (59 stars, last pushed 6mo ago), licensed Apache-2.0. It adds 6 tokens to every session and 1,507 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it B with 2 findings (asks for root, reaches for credential files). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.