- Version: 2.0.0
- Last Updated: 2026-07-27
- Author: SudoShea
- License: MIT
A non-destructive, read-only Linux security auditing and compliance suite designed to inspect host OS configurations, evaluate runtime OpenSSH settings, audit rootless Podman containers, parse authentication logs for brute-force attacks, and detect security drift over time.
- Evaluates Live Runtime SSH (
sshd -T): Evaluates the active, merged OpenSSH configuration directly, correctly catching drop-in files (/etc/ssh/sshd_config.d/*.conf). - CIS Benchmark Alignment: Verifies kernel network stack parameters (
sysctl), shadow file permissions (/etc/shadow), active host firewalls (ufw/firewalld), and audit logging (auditd). - Rootless Podman Inspection: Audits running containers for privileged execution (
--privileged), root user execution (UID 0), host network bindings (--net=host), and sensitive host volume mounts. - Systemd Journal Integration: Streams auth logs dynamically via
journalctl -u sshdwith fallback to/var/log/auth.logor/var/log/secure. - Security Drift Detection: Compares historic JSON audit reports to instantly highlight new regressions or resolved findings.
linux-security-auditor/
├── audit.py # Unified CLI wrapper entrypoint
├── CHANGELOG.md # Version history
├── LICENSE # MIT License
├── README.md # Project documentation
├── VERSION # Current release version (2.0.0)
├── modules/ # Core security auditor package
│ ├── __init__.py
│ ├── container.py # Podman container security inspector
│ ├── diff.py # JSON audit report drift analyzer
│ ├── ssh.py # SSH log & journalctl brute-force parser
│ └── system.py # OS & CIS compliance security scanner
└── scripts/
└── bump_version.py # Repository version & header sync tool
- OS: Linux (Debian, Ubuntu, RHEL, Fedora, Rocky Linux, AlmaLinux)
- Python: Python 3.8+ (Standard library only — no
pip installrequired!) - Privileges: Root /
sudoaccess (required for/etc/shadow,sshd -T, and systemd checks) - Optional: Podman (for container security inspection via
audit.py container)
Clone the Repository & Make the CLI Wrapper Executable:
git clone https://github.com/SudoShea/linux-security-auditor.git
cd linux-security-auditor
chmod +x audit.pyEvaluates SSH, active firewalls, unencrypted listening ports, kernel sysctl rules, /etc/shadow permissions, and auditd:
sudo ./audit.py systemInspects active Podman containers for high-risk flags and sensitive volume mounts:
./audit.py containerParses systemd auth logs for failed login attempts exceeding a threshold:
sudo ./audit.py ssh -t 3 --since "12 hours ago"Compares two JSON audit reports generated by system audits to detect regressions:
./audit.py diff audit_report_baseline.json audit_report_target.jsonRuns OS compliance, container risk, and SSH log audits sequentially in a single pass:
sudo ./audit.py allaudit.py evaluates the local host where it is executed. To audit remote servers across your infrastructure without installing the repository on every host, use one of the following methods:
Stream and execute the audit suite directly on a target host over SSH without leaving files behind:
# Run full system audit on a remote host
ssh -t user@remote-host "git clone https://github.com/SudoShea/linux-security-auditor.git /tmp/auditor && sudo /tmp/auditor/audit.py system && rm -rf /tmp/auditor"If you maintain an Ansible inventory (e.g., in ansible-system-hardening or homelab-infrastructure), dispatch audit.py across all target hosts in a single command:
# Run audit.py across all hosts in your inventory
ansible all -i inventory.ini -m script -a "audit.py system" --becomeExecuting ./audit.py system automatically generates a timestamped JSON report (audit_report_YYYYMMDD_HHMMSS.json) formatted for automated compliance tracking and drift analysis:
{
"timestamp": "2026-07-27T17:40:00.000000",
"summary": {
"total_checks": 12,
"passed": 12,
"failed": 0,
"score_percentage": 100.0
},
"results": [
{
"category": "SSH",
"check": "Directive: permitrootlogin",
"status": "PASS",
"details": "Evaluated runtime as 'no'"
}
]
}Distributed under the MIT License. See LICENSE for details.