Skip to content

Releases

Ultimate Hardening 2.8.0

Choose a tag to compare

@Kal1010101 Kal1010101 released this 26 Nov 21:59

2.8.0 adds two hardening profiles, chosen on a new first screen or with --profile modern|cis: cis keeps the CIS Benchmark values, and modern follows NIST SP 800-63B-4 for shared, multi-user servers (no forced password expiry, compilers left out of "apply all", and umask 007 with optional group workspaces, falling back to 027 wherever users could share a primary group). Container and Kubernetes hosts keep IP forwarding and Kubernetes-owned sysctl keys and get a bigger audit buffer, and new CIS checks cover /tmp's mount options and lost audit events. Two things to check when you upgrade: existing automation is unchanged (without --profile or UH_PROFILE, a run uses the profile last applied on the host, else cis), but a script that answers the interactive menus on stdin now needs one more answer first, for the profile screen; and the new /tmp checks can lower the score on hosts whose /tmp lacks nodev, nosuid or noexec.

Added

  • Two hardening profiles, chosen on a new first screen: cis (CIS
    Benchmark defaults, as before) and modern (shared/multi-user servers,
    NIST SP 800-63B-4 password guidance). They differ in modules 8, 20 and 22
    only. Modern sets no forced password expiry and reports the age check as
    waived, leaves module 20 out of "apply all", and sets umask 007, falling
    back to 027 where users share a primary group. A primary group counts as
    shared when another account of any UID uses it (a useradd -r -g alice
    service account too), when it lists any member besides its own user (for
    example www-data added to read a home directory), or when another group
    has the same GID. It also falls back when accounts come from
    a directory service (an LDAP, NIS or winbind source in nsswitch.conf, sss
    with an SSSD domain configured, or +/- lines in passwd or group): those
    users' groups are not in the local files and are often shared, such as
    AD's Domain Users.

  • --profile modern|cis and UH_PROFILE for runs without a menu. Without
    either, a run uses the profile last applied on the host, else cis, so
    existing automation is unchanged.

  • UH_SHARED_DIRS (modern): turns listed directories into group workspaces
    (setgid 2770 and default ACLs). Module 22's revert and the full revert put
    each directory's mode and ACLs back. Both work from inside the directory
    and revert touches only the very directory that was recorded (same inode
    and owner), so a symlink swapped in by a user cannot redirect them.

  • The menu tags a module applied with the other profile [modern ] or
    [cis ]; --json gains a profile field; the score footer names the
    profile and counts waived checks.

  • Module 6 leaves IP forwarding as it is on hosts that route traffic:
    container hosts and Kubernetes nodes (dockerd, containerd, podman, crio,
    kubelet, k3s, rke2, lxd, incusd installed), WireGuard or tun interfaces, or
    a sysctl file (or ufw's) that turns forwarding on. The log says why, an
    interactive run asks first (Enter keeps it), and the CIS check reports kept
    forwarding as waived with the reason. UH_KEEP_FORWARDING=auto|yes|no.

  • Module 6 leaves out any key that a Kubernetes sysctl file also sets
    (RKE2's 60-rke2-cis.conf, the hardening guides' 90-kubelet.conf), so
    kubelet's protect-kernel-defaults check is never overridden, and warns when
    RKE2's CIS profile is configured without its sysctl file. RKE2's documented
    CIS values do not overlap with module 6 today.

  • CIS checks for /tmp's mount options (nodev, nosuid, noexec; CIS 1.1.2.1.x)
    when /tmp is its own mount. They are reported, not fixed: no module changes
    mount options. On a container or Kubernetes host a missing noexec is waived
    with the reason, since container tools run programs from /tmp. Scores can
    drop on hosts whose /tmp lacks these options. The options are read from
    /proc/self/mountinfo, where the mount point is its own field, so a
    user's FUSE mount named like a hardened /tmp cannot make the checks pass.

  • Audit load: module 7 sets the kernel audit buffer to 32768 events on
    container or Kubernetes hosts (8192, the CIS value, elsewhere; override
    with UH_AUDIT_BACKLOG), since container starts and volume mounts fire
    the mounts and setuid/setgid rules in bursts. A new CIS check, "No audit
    events lost", reads auditctl -s as root and names the fix when the
    kernel has dropped events. Every CIS audit rule stays.

Changed

  • The interactive run opens on the profile screen, then the OS menu (first
    pass only), then the hardening menu. Q in the hardening menu is replaced by
    P, back to the profile screen; Q there quits. Ctrl-C still quits anywhere.
  • A CIS check's label and detail are kept to one line: newlines and carriage
    returns become spaces when the result is recorded, so exports that read
    results line by line (Enterprise's evidence pack from the state database)
    cannot be given a forged extra row.

Ultimate Hardening 2.7.0

Choose a tag to compare

@Kal1010101 Kal1010101 released this 24 Nov 17:49

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/shm mounted nodev,nosuid,noexec (CIS
    1.1.2.2.x; the fstab line is checked with findmnt --verify first), time
    sync turned on where nothing syncs time (systemd-timesyncd, else chrony),
    and sudo use_pty and logfile (CIS 5.2.2, 5.2.3) in a drop-in that
    visudo must 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 -t must 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 so auditctl loads 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=true locks 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-only check 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 from password-max-age-is-90-days-or-fewer to
    password-max-age-is-365-days-or-fewer; update any waiver or filter that
    names the old id. login.defs only applies to accounts created later, so
    existing accounts keep their expiry until changed with chage.
  • 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 from main, 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, --json and --sarif run without root. A check that needs
    root to see its answer (SSH settings where sshd_config is 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 a not_checked status and a
    not_checked count; SARIF lists those checks as notes. A normal user's run
    log goes to ~/.local/state/ultimate-hardening/. Every other mode,
    --dry-run included, 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 sets log_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 for grub-mkpasswd-pbkdf2,
    and those distributions name the tool grub2-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 up firewalld.conf and the
    zone files in /etc/firewalld/zones. When the revert keeps the live zone
    to avoid locking SSH out, the restored firewalld.conf is set back to that
    zone too, so a reload or reboot does not switch zones later.
  • A restore point picked in the interactive --revert chooser 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 sets UH_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.

Ultimate Hardening 2.6.4

Choose a tag to compare

@Kal1010101 Kal1010101 released this 18 Nov 02:36

The update check now tells you when your installed version is affected by a published security advisory, not just that a newer release exists. Run it from the menu (U) or with --check-update.

Added

  • The update check (menu U, --check-update) now also reads this
    project's published GitHub security advisories and warns when the running
    version is affected, with the advisory, its severity, the fixed version and
    a link. It still runs only when you ask for it; it now makes two requests
    to the public GitHub API instead of one.

Fixed

  • The run log is now opened after the library resets PATH. A caller whose
    PATH lacked dirname or readlink (a stripped cron or test environment)
    got "Refusing to run: the run log ... was replaced" with an empty path
    instead of a log.

Ultimate Hardening 2.6.3

Choose a tag to compare

@Kal1010101 Kal1010101 released this 17 Nov 13:38

Security release. On every version up to 2.6.2, someone who can write to /var/log but is not root (on Ubuntu, the syslog group) could plant or swap in a symlink at the run log's predictable name and make root append its output to a file of their choosing, a path to root. See GHSA-x3vq-fxmf-vjh3 for the workaround and how to check a host.

Security

  • The run log can no longer be redirected through a symlink, on versions up
    to 2.6.2. Where someone other than root can write to /var/log (Ubuntu's
    syslog group), a link planted at the log's predictable name, or swapped in
    during a run, made root append its output to a file of their choosing.
    Update to 2.6.3. The log is now created exclusively, or under a fresh random
    name next to it with a warning, and every write goes to the file the run
    opened, whatever happens to its name.
    Advisory: GHSA-x3vq-fxmf-vjh3.

Ultimate Hardening 2.6.2

Choose a tag to compare

@Kal1010101 Kal1010101 released this 17 Nov 12:07

Security release. Reverting the compiler restriction (module 20) on 2.3.0 to 2.6.1 could leave the real compiler binaries world-writable, a local path to root; see GHSA-wff7-cm5c-jw75 for how to check and repair a host that already reverted. Also: macOS runs under a newer bash and stays read-only, and a revert that finds nothing to undo returns to the menu.

Security

  • Reverting module 20 (compiler restriction), on versions 2.3.0 to 2.6.1,
    could leave the real compiler binaries world-writable (mode 777), letting
    any local user replace gcc before root's next build. Update to 2.6.2. The
    module recorded symlinks such as /usr/bin/cc with the link's own mode. It
    now records the real binary, and the revert never restores group or other
    write, including from inventories written by earlier versions. A host that
    already reverted needs chmod go-w on its compilers and a package check;
    the advisory has the commands.
    Advisory: GHSA-wff7-cm5c-jw75.

Fixed

  • On macOS the tool crashed at once ("unbound variable" in lib/menu.sh):
    macOS ships bash 3.2 as /bin/bash and the library needs bash 4. The script
    now restarts itself under a newer bash when one is installed (Homebrew's),
    and otherwise stops and says to run brew install bash.
  • On macOS, runs that would apply hardening now stop before changing anything
    and say that macOS is read-only for now. Most modules write Linux
    configuration (sysctl.d, auditd, AppArmor, GRUB, modprobe) that does nothing
    useful there. The read-only checks and --dry-run work as before.
  • A revert that finds nothing to revert now returns to the menu instead of
    ending the program. On a host the tool had not hardened, menu choices R
    (full revert), S (SUID/SGID), 9, 12 and 20 (module reverts), and the Pro and
    Enterprise revert menu, printed their error and exited to the shell.
  • The full-revert error no longer tells free-tier users to run
    --list-backups, an option only Pro and Enterprise accept. It now lists the
    available restore points itself.

Changed

  • Dependabot now opens one grouped pull request a week for GitHub Actions
    updates, keeping the SHA pins in .github/workflows/ current.
  • The Ansible role tests (tests/ansible/run.sh) now run in CI on every
    push and pull request, and weekly to catch a new ansible-core release
    breaking the role.
  • ShellCheck now also lints tests/ansible/run.sh, which the helper-script
    globs had missed.
  • CodeQL now analyses the GitHub Actions workflows on every push, pull
    request and weekly. CodeQL cannot read Bash; ShellCheck still covers the
    scripts.
  • CI now runs on a real macOS machine (.github/workflows/macos.yml): the
    read-only checks, the dry run, the bash 3.2 restart, and that applying is
    refused.
  • tests/run.sh now saves each failed case's full output to
    tests/results/, and prints its exit code and last lines when the case
    died before any assertion, so a crash or timeout is no longer a bare FAIL.

Documentation

  • README, site and comparison page now say plainly that on macOS the tool
    runs the read-only checks and dry run only, and needs bash 4 (brew install bash), instead of "detected and adapted".
  • The project earned the OpenSSF Best Practices "passing" badge; the README
    and the site show it.
  • The site has an interactive replay (docs/demo.html): click through the
    real menu and see what each choice printed in --dry-run on a fresh
    Debian 12 VM. docs/capture-demo.sh records it and docs/build-demo.sh
    builds the page.
  • The README demo GIF was re-recorded on a Debian 12 VM with 2.6.1.
  • The README's local ShellCheck command now includes tests/ansible/*.sh,
    matching CI.

Ultimate Hardening 2.6.1

Choose a tag to compare

@Kal1010101 Kal1010101 released this 15 Nov 23:55

Fix release, with security hardening for the Ansible role. A dry run no longer claims module 1 updated packages, --check-update no longer crashes on a large GitHub response, and the Ansible role can pin the exact package or commit it installs, accepts only UH_* settings and saves reports readable by their owner only.

Fixed

  • --dry-run no longer says "System packages updated" for module 1 or counts
    it as a fix, so a preview that changes nothing now ends with
    "0 fixes applied".
  • --check-update died silently with exit 141 when GitHub's release response
    was larger than a pipe buffer (64 KB): echo was killed by SIGPIPE once
    grep -m1 had its match, and set -o pipefail ended the run. It now
    searches the saved response directly.
  • Reading AIDE's database path and an --aide-verify fingerprint file no
    longer depends on sed finishing before head exits.
  • Ansible role: uh_install_method: git failed on every run after the first
    (ansible-core 2.19's git module cannot update a shallow tag checkout). The
    role now makes a full clone, about 11 MB.

Changed

  • The test that keeps cmd | grep -q out of the code now also catches
    pipes into head, grep -m and awk … exit that do not handle their
    status, the same SIGPIPE-under-pipefail bug class.
  • OpenSSF Scorecard runs on every push to main and weekly, publishing its
    results to the Security tab and the public Scorecard API.

Security

  • Ansible role: uh_settings accepts only UH_* keys. It becomes the
    environment of the tool, which runs as root, so a key such as BASH_ENV
    or LD_PRELOAD could run code as root.
  • Ansible role: uh_package_sha256 pins the package's hash in your own
    playbook, checked instead of the release's SHA256SUMS, so a release whose
    package and checksums were both replaced is caught. uh_git_commit does
    the same for a git install: the role stops if the release tag does not
    point at that commit.
  • Ansible role: saved compliance reports are mode 0600 instead of 0644; they
    list each host's failed checks.

Documentation

  • docs/comparison.md compares the tool with Lynis, OpenSCAP and
    ComplianceAsCode, ansible-lockdown and dev-sec, says when to pick one of
    those instead, and how to use them together. The README links it.
  • The README opens with a demo of a preview, an apply and a revert, recorded
    in a Debian 12 container.
  • The README says how to upgrade from 2.5.0 or earlier, and mentions the KVM
    virtual machine round trips run before a release.

Ultimate Hardening 2.6.0

Choose a tag to compare

@Kal1010101 Kal1010101 released this 15 Nov 01:06

Feature release. The compliance checks can print JSON or SARIF for scripts, CI and code scanning, UH_SKIP_SETTINGS leaves single settings alone instead of whole modules, the Docker dry run says what this host would get, and a new Ansible role hardens a fleet.

Added

  • --json and --sarif print the compliance results as JSON or SARIF 2.1.0
    on stdout, with everything else on stderr, for scripts, CI and code
    scanning. JSON gives the score and, per check, an id, title, result,
    detail, owning module and suggested fix; SARIF lists each failed check as a
    result with the file it concerns.
  • UH_SKIP_SETTINGS leaves single settings alone (sshd keywords, login.defs
    keys, sysctl keys; shell patterns work) instead of skipping their whole
    module. Skipped settings are named in the output and counted by
    --dry-run, and revert does not record them.
  • An Ansible role in ansible/: installs the release package after checking
    it against SHA256SUMS, then previews, applies or scores the hardening and
    can save each host's results as JSON. It defaults to a dry run, --check
    runs the tool's dry run, and tests/ansible/run.sh tests it in containers.
  • --dry-run for module 17 (Docker) now says what a real run would do on
    this host: whether userns-remap would be turned on, and whether Docker
    would be restarted or left alone so running containers keep going.

Changed

  • Module 17 warns when two or more running containers share Docker's default
    bridge network, since turning off inter-container traffic stops them
    reaching each other there.
  • The README's Quick start begins with a throwaway-container demo and the
    checksum-verified package install. The pricing table moved to the website.

Ultimate Hardening 2.5.3

Choose a tag to compare

@Kal1010101 Kal1010101 released this 14 Nov 06:22

Bug-fix release. Module 2 (SSH) no longer turns off password login and root login when no account other than root can log in with a key, so a run cannot lock you out of a host you reach as root or with a password.

Fixed

  • Module 2 (SSH) turned off password login and root login even when no other
    account could log in with a key, which locked operators out of hosts they
    reach as root or with a password (the usual fresh cloud VPS). It now writes
    those two settings only when an account other than root has a key sshd
    accepts in an authorized_keys file, or sshd trusts a TrustedUserCAKeys CA.
    Otherwise it applies the other 11 settings and says how to finish.
    --dry-run reports the same. Keys served by an AuthorizedKeysCommand
    (LDAP, SSSD) cannot be checked, so those hosts set UH_SSH_LOCKOUT_CHECK=false.

Ultimate Hardening 2.5.2

Choose a tag to compare

@Kal1010101 Kal1010101 released this 13 Nov 00:26

Bug-fix release. A revert now puts firewalld, auditd and the SSH banner back the way they were before hardening, and a full revert works when the backup folder's path holds glob characters. No change to what hardening applies.

Fixed

  • A revert left auditd running where it was installed but stopped before
    hardening (Arch), and still reported it as put back: auditd's systemd unit
    refuses systemctl stop. The revert now stops it the way auditd documents,
    and warns if a service it should have stopped is still running.
  • A full revert left firewalld on the drop zone. It now puts back the default
    zone, the drop zone's SSH setting and whether firewalld was running, as
    reverting module 3 on its own already did.
  • Reverting module 2 (SSH) on its own, or a full revert, left the
    /etc/issue.net banner behind on hosts that ship no such file (Alpine,
    Arch). It is now removed when it still holds only the module's banner; an
    admin's own banner is restored as before.
  • A full revert restored nothing when the backup folder's path held [, *
    or ? (for example UH_BACKUP_ROOT=/mnt/backups[1]), reporting every file
    as "could not restore".

Ultimate Hardening 2.5.1

Choose a tag to compare

@Kal1010101 Kal1010101 released this 11 Nov 07:24

Security release. The SUID/SGID revert in 2.5.0 and earlier could be made to set the SUID bit on files the hardening never touched, a path to root on hosts where untrusted users have local accounts. Update to 2.5.1. Module 9 now leaves SUID files on paths someone other than root could change, and lists them for review; see Changed below.

Security

  • The SUID/SGID revert (--revert-suid, and the SUID step of a full revert)
    could be made, on versions up to 2.5.0, to set the SUID bit on files the
    hardening never touched. On a host where untrusted users have local accounts,
    that is a path to root. Update to 2.5.1. The revert now puts back only a SUID
    bit module 9 removed, on a root-owned file whose path only root can change.
  • Module 9 writes its SUID inventory in a new format, one entry per file. Files
    whose name contains a line break are not recorded or stripped, and are
    reported instead.
  • An inventory written by 2.5.0 or earlier is never restored unattended
    (--auto-mode). Interactively, the files are listed and restored only after
    typing "yes". Re-running module 9 writes an inventory in the new format.

Changed

  • Module 9 no longer strips SUID from files on a path someone other than root
    could change: a symlink, a file not owned by root, or a directory owned by
    another account or writable by its group or everyone. It lists each one as
    "not stripped, path is not under root's sole control (review by hand)". The
    menu's module 9 state (UH_SUID_SCAN=1) ignores those files too.