Overview
Lynis is an open-source security auditing tool that performs in-depth system scans directly on Linux hosts — no agent required. It checks over 300 security controls covering kernel hardening, authentication configuration, filesystem permissions, network services, software patches, and logging posture. Each scan produces a hardening index score and a prioritized list of remediation suggestions. Xloud bundles Lynis in XOS and makes it available via the XDeploy automation pipeline for both individual node audits and fleet-wide compliance sweeps.Xloud-Developed — Lynis is one of three independent scanners in the Xloud triple compliance system. XAVS runs SCA benchmarks, system audit, and SCAP profile scans in parallel across all nodes, providing layered compliance coverage. Results from all three scanners are aggregated in the Security Operations Dashboard.
Prerequisites
- SSH access to the target host (or run directly on the node)
- Lynis installed (pre-installed on XOS nodes; install via
apt install lynison guest VMs) - Root or sudo access on the target system
How Lynis Works
Lynis runs as a shell script directly on the host. It does not require a daemon, network connection, or external service. It tests the live system state — not a snapshot — and reports findings immediately.| Phase | What Lynis Checks |
|---|---|
| Boot & Services | GRUB password, bootloader permissions, running services, inetd |
| Kernel | Kernel parameters (sysctl), loaded modules, ASLR, core dumps |
| Authentication | PAM configuration, password policies, sudo rules, SSH settings |
| File Systems | Mount options (noexec, nosuid), world-writable files, SUID binaries |
| Networking | Open ports, firewall status, TCP wrappers, IPv6 configuration |
| Logging | Syslog daemon, log rotation, audit daemon (auditd) status |
| Software | Package manager integrity, outdated packages, compiler availability |
| Malware | Rootkit indicators, suspicious files, integrity tool presence |
Run a Security Audit
- Single Host
- Non-Interactive (CI/CD)
- Fleet Audit (Ansible)
Run the full system audit
Run Lynis audit
/var/log/lynis.log and the report data to /var/log/lynis-report.dat.Review the hardening index
At the end of the scan output, Lynis shows:Scores above 80 indicate a well-hardened system. Scores below 60 indicate significant gaps.
Common Findings and Fixes
SSH configuration weaknesses
SSH configuration weaknesses
Finding: Lynis warns that root login is permitted or password authentication is enabled.
Harden SSH
Kernel parameters not hardened
Kernel parameters not hardened
Finding: ASLR disabled, IP forwarding enabled unnecessarily, or core dumps allowed.
Apply kernel hardening via sysctl
Audit daemon not running
Audit daemon not running
Finding:
auditd not installed or not running — system activity is not being logged.Install and enable auditd
Add basic audit rules
World-writable files detected
World-writable files detected
Finding: Files or directories are world-writable, creating privilege escalation risk.
Find world-writable files
Compiler available on production host
Compiler available on production host
Finding: Build tools (
gcc, cc) present on a production node — unnecessary attack surface.Remove compilers from production hosts
Hardening Index Targets
| Environment | Target Score | Notes |
|---|---|---|
| Development VMs | 60+ | Baseline — essential controls only |
| Staging / Test | 70+ | Near-production hardening |
| Production workloads | 80+ | Full hardening applied |
| Regulated environments (PCI, HIPAA) | 85+ | Compliance-grade hardening |
Scheduled Audits
Run Lynis on a schedule to detect configuration drift:/etc/cron.weekly/lynis-audit
Next Steps
Wazuh HIDS
Add real-time intrusion detection and file integrity monitoring on top of periodic Lynis audits
OpenSCAP
Perform SCAP-based compliance scans against CIS, STIG, and PCI-DSS profiles
Hardening Guide
Apply the Xloud pre-deployment hardening checklist before running production audits
Compliance
Map Lynis findings to SOC 2, ISO 27001, and HIPAA compliance requirements