Linux Policy Auditor is a Python-based security tool designed to evaluate the authentication policies of a Linux system.
It inspects PAM configuration files and /etc/login.defs to identify weak password settings and generate actionable, CIS-aligned recommendations.
The tool is lightweight, modular, and fully dependency-free. It automatically detects the correct configuration paths across Debian-based (Ubuntu, WSL) and RHEL-based (CentOS, Fedora) distributions.
Note: Requires sudo to read protected
/etcconfiguration files.
python3 auditor.py --helpsudo python3 auditor.pysudo python3 auditor.py --pam-file <path> --html report.htmlsudo python3 auditor.py --login-defs <path> --json audit.jsonThis tool directly inspects live system configuration—no external dataset needed.
/etc/pam.d/common-password(Debian)/etc/pam.d/system-auth(RHEL)/etc/pam.d/password-auth(RHEL)/etc/login.defs(All Linux)
Goal: Classify each policy as Secure, Moderate, or Weak.
-
Detects active PAM file based on OS type
-
Parses
login.defs+ PAM rules -
Extracts:
pam_pwquality.so→ complexitypam_unix.so→ password history
Output: Raw policy dictionary
- Normalizes/cleans extracted values
- Applies defaults where missing
- Evaluates against CIS-like security baselines
Output: Object with findings + recommendations
-
Supports console, JSON, HTML reporting
-
Generates:
report.htmlaudit.json
Output: Full visual security audit
| Category | Parameter | Recommendation |
|---|---|---|
| Complexity | pam_pwquality.so | Must be installed & configured |
| Complexity | minlen | Set minlen=14+ |
| Complexity | dcredit | Set dcredit=-1 |
| Complexity | ucredit | Set ucredit=-1 |
| Complexity | lcredit | Set lcredit=-1 |
| Complexity | ocredit | Set ocredit=-1 |
| History | remember | Set remember>=5 |
| Lifetime | PASS_MAX_DAYS | ≤ 90 days |
| Lifetime | PASS_MIN_DAYS | ≥ 1 day |
Linux-Policy-Auditor/
│
├── auditor.py # Main entry point (CLI controller)
├── policy_parser.py # Extracts values from PAM + login.defs
├── policy_analyzer.py # Evaluates policy & assigns security ratings
├── report.py # Generates Console / JSON / HTML reports
│
├── report.html # (Generated output)
├── audit.json # (Generated output)
│
└── README.md # Documentation
- 🔍 Complete Authentication Policy Audit
- 🧩 Auto-Detects Debian/RHEL File Paths
- 📤 Exports Results as Console, JSON, HTML
- 🟩 Zero Dependencies — Pure Python
- 🧱 Modular Architecture (extend anytime)
- 🛑 Handles Missing Files Gracefully
Alexander P.B. Cybersecurity Researcher & Penetration Tester IoT Security Specialist
📎 GitHub: https://github.com/Alexander-50
📧 Open for research collaborations.