Launcher Products Bitnami Documentationimaxe CLI Blog Contact
imaxe lynis hardening v1.0.0

Audit your hardening, no guessing

Runs a CIS hardening audit on your server and returns an actionable report: a hardening index, the warnings to resolve and concrete suggestions, each with its test id so you know exactly what to touch.

$ imaxe lynis audit
Version
v1.0.0
Subcommands
4
Config
/etc/imaxe/lynis.yml
Requires root
yes
Standard
CIS · hardening

What this module does #

Hardening is the work of closing doors: removing unneeded services, adjusting permissions, tightening boot and network… But knowing what's left to harden is the hard part. That's where this module comes in.

The lynis module runs a hardening audit backed by Lynis, checking your system against the best practices of the CIS standard. When it finishes it hands you an actionable report with three things: a hardening index (a score from 0 to 100 that sums up how hardened the system is), the list of warnings worth resolving, and a set of suggestions you can prioritize — each accompanied by its test id (for example SSH-7408), so you know exactly what it checks and where to act.

Before you begin

The audit reads system configuration, permissions and services, so it needs root privileges (use sudo). A full pass can take a couple of minutes; if you're in a hurry, there's a quick pass with --quick.

Quick startstep-by-step tasks

Common tasks #

Choose what you want to do. Each recipe comes with the command already written — just copy it and hit Copy.

1

Run my first audit

Measure how hardened your server is in a couple of minutes.

Connect to your server over SSH with the ubuntu user.

Run the full audit. When it finishes you'll see a summary with the hardening index and how many warnings and suggestions there are:

terminal
$ sudo imaxe lynis audit

In a hurry? The quick pass skips the longest tests and gives you a rough snapshot right away:

terminal
$ sudo imaxe lynis audit --quick
You now have your hardening score. To see the detail with the suggestions and their test ids, jump to the View the latest report recipe.
2

View the latest report

Review the index, the warnings and the suggestions with their test id.

Show the report from the latest audit, with the hardening index at the top and the list of warnings and suggestions below:

terminal
$ sudo imaxe lynis report

Want it for a tool or a dashboard? Add --json and you'll get the same report in a structured format:

terminal
$ sudo imaxe lynis report --json
Each suggestion comes with its test id (e.g. SSH-7408): use it to know what it checks and to prioritize what to harden first.
3

View the current status

A quick glance: when it was last audited and what score you have.

Check the date of the last audit, the current hardening index and whether a custom profile is in play:

terminal
$ sudo imaxe lynis status

Also available in JSON, ideal for monitoring:

terminal
$ sudo imaxe lynis status --json
If the audit is old or the index has dropped, run a new one with the Run audit recipe.
4

See which tests are skipped

Check which checks are skipped and why.

List the skipped tests —both those from the AWS baseline and the ones you add in lynis.yml— along with the reason for each skip:

terminal
$ sudo imaxe lynis show-skips
This is how you understand why a test doesn't appear in the report: it may be skipped on purpose because it doesn't apply in this environment.
Is the report coming up empty?

The report only exists after an audit. If report or status show nothing, run sudo imaxe lynis audit first and then check again.

CLI referencecommands, flags and files

Synopsis #

usage
imaxe lynis <subcomando> [flags]

The audit needs root privileges (use sudo) because it inspects the system's configuration, permissions and services. Add --json to report, status or show-skips to get machine-readable output suitable for scripting and dashboards.

Subcommands #

SubcommandWhat it doesRelevant flags
auditRuns the hardening audit and summarizes the result (index, warnings and suggestions).--quick
reportShows the latest report: index, warnings and suggestions with their test id.--json
statusStatus: date of the last audit, current index and whether a custom profile is in use.--json
show-skipsLists the skipped tests (AWS baseline + lynis.yml) and their reason.--json

Arguments and flags #

FlagTypeDefaultDescription
--quickboolfalseIn audit: quick pass that skips the longest tests. Gives a rough snapshot in less time.
--jsonboolfalseIn report/status/show-skips: emits the result as structured JSON on stdout.

Files and paths #

PathContents
/etc/imaxe/lynis.ymlModule configuration: profile, tests to skip (skip_tests), remediation and audit defaults.
/var/log/lynis-report.datData from the latest Lynis report: hardening index, warnings and suggestions with their test id.
/var/log/imaxe/lynis.logStructured record of each audit run by the module.

Example of lynis.yml:

/etc/imaxe/lynis.yml
profile:
  deploy: true
skip_tests: []
remediation:
  enabled: true
audit:
  quick_default: false

Exit codes and logs #

Each run returns a code you can check with echo $? — handy for chaining in scripts:

0OKOperation completed successfully.
1ERRGeneric unclassified error. Check the log.
2USAGEInvalid arguments or subcommand.
3NOAUDITNo previous report: run audit first.
4WARNAudit OK but with warnings pending review.

Follow the log live while you review an audit:

terminal
$ sudo journalctl -u imaxe-lynis -f
$ sudo tail -f /var/log/imaxe/lynis.log

Troubleshooting #

SymptomLikely causeFix
You get NOAUDIT (code 3)report or status before ever having audited.Run sudo imaxe lynis audit and check again.
The report takes a long timeThe full pass also runs the long tests.Use sudo imaxe lynis audit --quick for a quick snapshot.
An expected check is missingThe test is on the skip list.Review sudo imaxe lynis show-skips to see the reason.
The index doesn't improve after changesThe report shows the latest audit, not the live state.Run audit again to recalculate the index.

Stuck with the Lynis module?

Write to us with the output of «imaxe <module> status --json» and we'll get back to you fast.

Contact support