Repository navigation
Ultimate Hardening 2.7.0
2.7.0 adds a 23rd module for the base system (/dev/shm mount options, time sync and sudo logging), a --verify health check after hardening, and stronger defaults in the SSH, Fail2Ban, kernel, audit and module-blacklist modules. --cis-only, --json and --sarif now run without root. It also fixes several revert gaps and a ufw setting that undid one kernel parameter at every reboot. One thing to check if you filter the JSON or SARIF output: the password check's id changed to password-max-age-is-365-days-or-fewer.
Added
- Module 23, Base system:
/dev/shmmounted nodev,nosuid,noexec (CIS
1.1.2.2.x; the fstab line is checked withfindmnt --verifyfirst), time
sync turned on where nothing syncs time (systemd-timesyncd, else chrony),
and sudouse_ptyandlogfile(CIS 5.2.2, 5.2.3) in a drop-in that
visudomust accept, only where sudoers reads/etc/sudoers.d. Its own
revert and the full revert put fstab and the mount options back, return
the time daemon to its earlier state and remove the drop-in. The menu's
"apply all" entries move to 24 and 25. --verify: a health check after hardening (sshd running and listening,
no newly failed systemd unit, firewall loaded where expected). Exit
status 20 when it finds a problem.- Module 2 writes an allowlist of ciphers, key exchange, MACs and host key
algorithms (CIS 5.1.x), limited to what the installed OpenSSH supports, so
post-quantum key exchange is used where OpenSSH has it. Hosts with
crypto-policies (RHEL, Fedora) keep the system policy. - Module 4: repeat bans grow longer (fail2ban 0.11 and later, up to a week),
a recidive jail, and nginx, Apache and Postfix jails where those are
installed with a log to read.fail2ban-client -tmust accept the jails,
or the module keeps the SSH jail alone. - Module 6: 9 more sysctl parameters (36 in all), each with its CIS or STIG
source in the file. IPv6 router adverts are left on where the host gets its
IPv6 address from them. - Module 7: the CIS 6.3.3 audit rule groups, for 32- and 64-bit syscalls,
each syscall checked against the kernel's table soauditctlloads the
whole file. Privileged-program rules cover root-owned setuid and setgid
files with plain names only, so a file a user names to look like rule
options cannot stop the rest loading.UH_AUDIT_IMMUTABLE=truelocks the
rules until reboot. - Module 19: ATM, CAN and FireWire are blacklisted (STIG), Bluetooth too with
UH_BLACKLIST_BLUETOOTH=true.
Changed
- Module 8 sets the password maximum age to 365 days instead of 90, and the
--cis-onlycheck now passes at 365 days or fewer, as in current CIS
Benchmarks. Short forced rotation leads to weaker, predictable passwords,
and NIST SP 800-63B advises against periodic changes. The check's JSON
and SARIF id changes frompassword-max-age-is-90-days-or-fewerto
password-max-age-is-365-days-or-fewer; update any waiver or filter that
names the old id.login.defsonly applies to accounts created later, so
existing accounts keep their expiry until changed withchage. - CI now runs a PR risk check on every pull request
(scripts/pr-risk-check.sh). It marks the parts a reviewer must read
closely, such as changes to CI, packaging, install and update code, binary
files, symlinks, new executables, encoded blobs, network calls and
eval/exec, and it fails on hidden or bidirectional Unicode. The script is
taken frommain, so a PR cannot change the check that checks it. - CI now audits the workflow files with zizmor. Its findings are fixed: no
checkout leaves the git token on disk (persist-credentials: false), and
the release build no longer uses the Go cache. --cis-only,--jsonand--sarifrun without root. A check that needs
root to see its answer (SSH settings wheresshd_configis root-only, as
on Fedora and RHEL; a firewall loaded without a running service; AppArmor's
enforcing profiles) is reported as not checked instead of failed, and is
left out of the score. JSON gives each check anot_checkedstatus and a
not_checkedcount; SARIF lists those checks as notes. A normal user's run
log goes to~/.local/state/ultimate-hardening/. Every other mode,
--dry-runincluded, still needs root.- The site's interactive replay (
docs/demo.html) was re-recorded on a
Debian 12 VM with the 23-module menu, apply-all on 24 and 25. Every line
of the platform screen can now be clicked: Debian plays the recording,
the same as auto-detect, and the others say only the Debian run is
recorded.
Fixed
- On Debian and Ubuntu with ufw, module 6's
log_martians = 1(CIS 3.3.4)
was undone at every reboot: ufw loads its own sysctl file
(/etc/ufw/sysctl.conf) when it starts, after the system's sysctl files,
and that file setslog_martians=0. Modules 6 and 3 now set any value
there that disagrees with module 6 to module 6's value, and revert puts
the file back. - Module 16 (GRUB password) skipped every Fedora, RHEL and openSUSE host
with "no GRUB on this system". It looked only forgrub-mkpasswd-pbkdf2,
and those distributions name the toolgrub2-mkpasswd-pbkdf2. Both names
are now found. - Full revert to the original state refused with "No backup matches
'genesis'" when module 3 on firewalld was the only change (Rocky 9), and
the drop zone stayed. Module 3 now also backs upfirewalld.confand the
zone files in/etc/firewalld/zones. When the revert keeps the live zone
to avoid locking SSH out, the restoredfirewalld.confis set back to that
zone too, so a reload or reboot does not switch zones later. - A restore point picked in the interactive
--revertchooser now stays in
UH_REVERT_TARGET, so the Pro and Enterprise revert step can tell a
point-in-time revert from a revert to the original state. A cancel in the
chooser setsUH_REVERT_CANCELLED=true, so that step does nothing either. - A full revert to a chosen earlier backup restored no file that the
original (genesis) backup also held, which is almost every file, and
reported "Reverted 0 files". It now restores every file in the chosen
backup. - A run that finds a file unchanged since an earlier backup takes no new copy,
so a revert to that run left the file as it was. The run now records which
backup holds the copy (unchanged_files.txt), and the revert restores the
file from there. When that earlier backup is pruned, the file is first
copied into the run that points at it.