Use when performing security audits or system hardening. Teaches security assessment principles and prioritization.
Principles for security auditing and system hardening. Platform-specific commands in docs/security-audit/.
No single security measure is sufficient. Layer multiple controls.
Network → Firewall → Service → Application → Data
↓ ↓ ↓ ↓ ↓
Block Filter Harden Validate Encrypt
Grant minimum access required. Remove what's not needed.
When things break, they should fail closed, not open.
If you can't see it, you can't secure it. Log all access.
All findings must be rated by severity:
| Level | Meaning | Action |
|---|---|---|
| CRITICAL | Active exploitation possible | Fix NOW |
| HIGH | Significant risk | Fix within 24h |
| MEDIUM | Best practice violation | Fix within 1 week |
| LOW | Minor improvement | Fix when convenient |
What can attackers reach?
How do users and services authenticate?
What can authenticated users do?
How is sensitive data protected?
Can you detect attacks?
| Tool | Purpose | Usage |
|---|---|---|
composer audit |
PHP vulnerabilities | composer audit |
npm audit |
Node vulnerabilities | npm audit |
pip-audit |
Python vulnerabilities | pip-audit -r requirements.txt |
| Trivy | Multi-language scanner | docker run aquasec/trivy fs . |
| Gitleaks | Secrets in code | docker run zricethezav/gitleaks detect |
Add to your pipeline:
GitLab CI:
security:
image: aquasec/trivy:latest
script: trivy fs --exit-code 0 --severity HIGH,CRITICAL .
allow_failure: true
GitHub Actions:
- name: Security scan
run: |
docker run aquasec/trivy:latest fs --severity HIGH,CRITICAL .
continue-on-error: true
================================================================================
SECURITY AUDIT REPORT
Date: YYYY-MM-DD
Host: hostname
================================================================================
CRITICAL (0)
------------
None found.
HIGH (2)
--------
[HIGH] Issue description
Location: where
Fix: how to fix
MEDIUM (1)
----------
[MEDIUM] Issue description
Fix: how to fix
================================================================================
SUMMARY: 0 Critical | 2 High | 1 Medium | 0 Low
================================================================================
After completing an audit:
# Log summary
docchange "Security audit completed - X critical, Y high, Z medium issues"
# Log fixes
docchange "FIXED: Disabled SSH root login"
Platform-specific audit commands:
| Platform | Location |
|---|---|
| Linux | docs/security-audit/linux.md |
| Windows | docs/security-audit/windows.md |
| Docker | docs/security-audit/docker.md |
| Issue | Fix |
|---|---|
| SSH root login | PermitRootLogin no in sshd_config |
| SSH password auth | PasswordAuthentication no in sshd_config |
| No firewall | Enable ufw/firewalld/Windows Firewall |
| Database exposed | Bind to 127.0.0.1 |
| No fail2ban | Install and enable fail2ban |
| Docker privileged | Remove --privileged flag |
| Ports on 0.0.0.0 | Bind to 127.0.0.1:port:port |
Works with:
server-documentation skill for loggingdefense-in-depth skill for layered securityci-templates skill for security scanning in CI