
Scan a Linux machine, fix findings one setting at a time, rescan, undo. Vulnerability scanner + per-setting hardening (RHEL/Debian families, CIS templates) with a GUI and SSH fleet mode.
Scan a Linux machine, fix what the scan finds one setting at a time, scan again, and undo any of it later. Works on the RHEL family (Fedora, RHEL, Rocky, Alma, Oracle) and the Debian family (Debian, Ubuntu, Mint), on one machine or a fleet over SSH.
vuln_scan.sh: a standalone audit script. It covers SSH, sysctl, PAM,
sudo, auditd, mounts, services, firewall, packages, MAC, containers and more,
prints PASS / FAIL / WARN with a 0–100 score, and tags each finding with the
setting that fixes it.harden_gui.py / fleet.py: a Tk control panel and a headless CLI that
run the scan, select the fixes for what failed, apply them locally or over SSH,
rescan, and show what changed.git clone https://gitlab.com/TariqJenkins/linux-hardening.git
cd linux-hardening
sudo ./vuln_scan.sh # audit this machine
./harden-workstation.sh --list-settings # what can be applied
./harden-workstation.sh --template templates/cis-server-level1.tpl --dry-run # preview a profile
python3 harden_gui.py # or do it all from the GUI
Read a script before you run it as root. That includes this one: clone it and
look first, rather than piping a URL into sudo bash.
vuln_scan.sh needs no install and nothing from the rest of this repository. It
needs root to read logs, sysctls and protected config files (--help and
--version work without it).
Usage: vuln_scan.sh [OPTIONS]
-o, --output <file> Write the report to <file> instead of
/var/log/vuln-scan/vuln_scan_<timestamp>.log
--no-color Disable ANSI color in terminal output.
--version Print version and exit.
-h, --help Show this help and exit.
0 = no FAIL findings, 1 = one or more FAILs (or not run as
root), 2 = usage error. That makes it safe to wire into cron, a systemd
OnFailure= or CI./etc/vuln-scan/vuln-scan.conf, if present, is sourced and can
override REPORT_DIR and the thresholds (AUTH_FAIL_WARN_THRESHOLD,
AUTH_FAIL_HIGH_THRESHOLD, AUTH_FAIL_CRIT_THRESHOLD, SUDO_LOCKOUT_DENY_MAX,
PASS_MAX_DAYS_RECOMMENDED). Because it is sourced as shell, keep it root-owned
and not writable by anyone else.[fix: <setting-id>].
The tag is hidden on PASS lines unless SCAN_TAGS=1.Every hardening change is an individually selectable setting with its own script, driven by the scanner's findings.
| File | What it is |
|---|---|
vuln_scan.sh | The scanner. Audits ~50 areas, prints PASS/FAIL/WARN and a 0–100 score. Version 3.4 has a check for every setting here; findings end in [fix: <setting-id>], which the GUI uses to tick the matching settings. |
harden-workstation.sh | The runner. Picks the OS family, runs the chosen setting scripts in order, reloads sysctl/sshd once. |
settings/rhel/, settings/debian/ | One script per setting, one tree per OS family. |
lib/ | Shell helpers the settings share: common.sh, rhel.sh, debian.sh, and journal.sh (the undo journal). |
templates/, templates.py | Named selections of settings (shipped examples; yours are saved elsewhere). |
harden_gui.py | Tk control panel: pick settings, pick hosts, apply, scan, undo. |
compare.py | Before/after comparison of two scans (fixed / still failing / new). |
tests/ | Container tests for the undo journal and lockout guards, unit tests for the GUI logic. |
.gitlab-ci.yml | CI: unit tests, the root tests on Fedora/Ubuntu/Debian, package builds. |
fleet.py | SSH transport and host inventory. Also runs headlessly. |
install.sh | Installs it as a desktop app. No root needed. |
packaging/ | Icon, desktop entry, and the .deb / .rpm builders. |
./install.sh # just you, no root (~/.local)
sudo ./install.sh --system # everyone (/usr/local)
./install.sh --uninstall # remove it again
Workstation Hardening then appears in your application menu, and
harden-gui (the app) and harden-fleet (the CLI) land on your PATH.
Uninstalling never touches ~/.config/harden-gui/hosts.json.
./packaging/build-rpm.sh # dist/harden-gui-<version>-1.*.noarch.rpm
./packaging/build-deb.sh # dist/harden-gui_<version>_all.deb
Neither needs a build toolchain installed: if rpmbuild or dpkg-deb is
missing, the script builds inside a container instead. The version comes from
the VERSION file; set VERSION= to override it. CI builds both packages on
every push and keeps them as job artifacts.
sudo dnf install ./dist/harden-gui-<version>-1.*.noarch.rpm
sudo apt install ./dist/harden-gui_<version>_all.deb
Both install to /usr, depend only on python3 (3.10+), Tk and an SSH
client, and remove cleanly.
Running from a git checkout still works too: python3 harden_gui.py.
settings/
rhel/ssh_disable_root_login.sh Fedora, RHEL, CentOS, Rocky, Alma
debian/ssh_disable_root_login.sh Debian, Ubuntu, Mint, Pop!_OS
groups group ids, labels and their order in the GUI
The runner reads /etc/os-release (ID and ID_LIKE, so derivatives work) and
uses the matching tree; the two never mix, so a setting file contains no
if rhel … else …. Where a control is the same on both families (a sysctl key,
an sshd directive) both files say so independently, on purpose: you can change
one family without touching the other. A setting that only makes sense on one
family — SELinux boot parameters, SETroubleshoot — exists only in rhel/; on a
Debian host the runner reports it as not available rather than failing.
Any setting can be run on its own, with no GUI and no runner:
sudo settings/debian/ssh_banner.sh # apply this one setting
settings/rhel/sysctl_aslr.sh --dry-run # preview it, no root needed
A setting is a short file: a metadata header the GUI reads without running
anything, then one apply() function.
#!/usr/bin/env bash
# group: kernel
# risk: safe safe | moderate | disruptive
# order: 230 where it runs relative to the others
# label: Full ASLR (randomize_va_space=2)
# desc: Randomises memory layout including the heap.
# cis: 1.5.3 optional
. "${HARDEN_LIB:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../lib" && pwd)}/debian.sh"
apply() {
sysctl_opt "kernel.randomize_va_space = 2"
note "ASLR set to full"
}
harden_run "$@"
The file name is the setting id. Source rhel.sh or debian.sh to match the
directory. lib/common.sh has the helpers (sysctl_opt, ssh_opt, write_file,
set_kv, fix_perm, svc_disable, modprobe_disable, ensure_pkg, …); each
writes its own drop-in file named after the setting, so settings stay independent
and individually reversible. Use note to report what was done, and do the work
through run / if_changed so --dry-run stays truthful. order matters only
when one setting needs another to have run first (auditd before its rules).