Skip to main content

Comprehensive Linux security auditing and hardening tool

Project description

Linux Security Audit Tool

A comprehensive CLI tool for auditing Linux system security posture.

For all the checks to effectively be done this tool it needs root access.

PyPI Python Ruff

Install

python3 -m venv venv
source venv/bin/activate
pip install linux-security-audit-tool

Usage

sudo env "PATH=$PATH" security-audit --help
sudo env "PATH=$PATH" security-audit audit
sudo env "PATH=$PATH" security-audit audit -p 0 -1           # Run specific phases
sudo env "PATH=$PATH" security-audit audit -o report.md      # Save markdown report
sudo env "PATH=$PATH" security-audit audit --quiet           # Summary only
sudo env "PATH=$PATH" security-audit audit --debug           # Show executed commands
sudo env "PATH=$PATH" security-audit audit --remediate-all   # Generate remediation script for all findings
sudo env "PATH=$PATH" security-audit audit --remediate-only-critical  # Generate remediation script for CRITICAL only
sudo env "PATH=$PATH" security-audit audit --remediate-non-critical   # Generate remediation script for non-CRITICAL
sudo env "PATH=$PATH" security-audit audit --pdf report.pdf  # Generate PDF report

CLI

security-audit [OPTIONS] COMMAND [ARGS]...

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  audit    Run a full security audit.
  version  Show version information.

Audit Command Options

  • --output, -o FILE - Output file for markdown report
  • --phases, -p [0-9] - Specific phases to run (can be repeated)
  • --quiet, -q - Suppress detailed output
  • --verbose, -v - Show descriptions and remediation
  • --debug, -d - Show low-level commands being executed
  • --remediate-all, -r - Generate remediation script for all findings
  • --remediate-only-critical - Generate remediation script for CRITICAL findings only
  • --remediate-non-critical - Generate remediation script for non-CRITICAL findings
  • --remediate-script FILE - Save remediation script to file
  • --pdf FILE - Generate PDF executive report
  • --cache - Enable caching of check results
  • --cache-ttl INTEGER - Cache TTL in seconds (default: 3600)

Development

git clone https://github.com/daedalus/linux-security-audit-tool.git
cd linux-security-audit-tool
pip install -e ".[test]"

# run tests
pytest

# format
ruff format src/ tests/

# lint
ruff check src/ tests/

# type check
mypy src/

API

from security_audit import gather_context, run_identity_checks, calculate_security_score
from security_audit.core import Finding, Severity

# Run a full audit
context = gather_context()
findings = run_identity_checks()
score = calculate_security_score(findings)

Audit Phases

The tool performs security checks across 9 phases:

  • Phase 0: Context Gathering (hostname, OS, kernel)
  • Phase 1: Identity & Access Control (users, sudo, SSH)
  • Phase 2: Network Exposure (listening services, firewall, sysctl)
  • Phase 3: File System & Permissions (SUID, world-writable, cron)
  • Phase 4: Process & Service Posture (services, AppArmor, SELinux, rkhunter)
  • Phase 5: Kernel & OS Hardening (sysctl, ASLR, module blacklist)
  • Phase 6: Logging & Monitoring (auditd, logs, syslog)
  • Phase 7: Package & Update Hygiene (updates, repos)
  • Phase 8: Cryptographic Posture (SSH keys, TLS, password hashing)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

linux_security_audit_tool-0.1.5.tar.gz (29.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

linux_security_audit_tool-0.1.5-py3-none-any.whl (38.0 kB view details)

Uploaded Python 3

File details

Details for the file linux_security_audit_tool-0.1.5.tar.gz.

File metadata

File hashes

Hashes for linux_security_audit_tool-0.1.5.tar.gz
Algorithm Hash digest
SHA256 d66e43cf46167c2b0faa0b7ebebedabb64b08b6a4f6dc88f168e15ae8c839602
MD5 9eed9d86086227c86c232c56615e3374
BLAKE2b-256 daea23872a5606c8340dc5995535ec6e00c120d2f702791f767ba251852628de

See more details on using hashes here.

Provenance

The following attestation bundles were made for linux_security_audit_tool-0.1.5.tar.gz:

Publisher: pypi-publish.yml on daedalus/linux-security-audit-tool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file linux_security_audit_tool-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for linux_security_audit_tool-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1b808ae9ff30568e4fdd1801b5ec1c75062bba59982872037bae789d5c4ba3dd
MD5 662aa344c2558c1588ede32aa4b355cf
BLAKE2b-256 c8128242ebaf07bf2d5b5aa163a6dccd090aecc4fe1645181e64ba539218b179

See more details on using hashes here.

Provenance

The following attestation bundles were made for linux_security_audit_tool-0.1.5-py3-none-any.whl:

Publisher: pypi-publish.yml on daedalus/linux-security-audit-tool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page