ServerHandbook live check: run log ------------------------------------------------------------------------------ Article https://serverhandbook.com/kb/fail2ban-ubuntu Check scripts/live/checks/fail2ban-ubuntu.mjs (sha256 7a3c963f0814126b65684c7b0ac0491af2a4e99a9bb399013612d113adedf9f7) Ran at 2026-11-18T21:58:55Z (577 s) Result PASS, all 38 claims held Tested on System Ubuntu 24.04.4 LTS Kernel 6.8.0-138-generic Package fail2ban 1.0.2-3ubuntu0.1 Package python3 3.12.3-0ubuntu2.1 Package nftables 1.0.9-1ubuntu0.1 Package openssh-server 1:9.6p1-3ubuntu13.18 Setup A fresh Ubuntu 24.04 server (a rented cloud server) with the UFW firewall on (SSH allowed), reached over SSH as a sudo user. The failed logins came from two other computers on its network, 198.51.100.2 and 192.0.2.2. Every version above was read from the server at run time. Passwords used on the throwaway test server are shown as [password]. How we test: https://serverhandbook.com/how-we-test ------------------------------------------------------------------------------ What the steps changed on the server (recorded before the first step and after the last) Packages added (4) fail2ban 1.0.2-3ubuntu0.1 python3-pyasyncore 1.0.2-2 python3-pyinotify 0.9.6-2ubuntu1 whois 5.5.22 Packages upgraded (0) Packages removed (0) Services enabled at boot (1) fail2ban.service Services disabled (0) Listening sockets opened (0) Listening sockets closed (0) Files added in /etc (179) /etc/default/fail2ban /etc/fail2ban/action.d/abuseipdb.conf /etc/fail2ban/action.d/apf.conf /etc/fail2ban/action.d/apprise.conf /etc/fail2ban/action.d/blocklist_de.conf /etc/fail2ban/action.d/bsd-ipfw.conf /etc/fail2ban/action.d/cloudflare-token.conf /etc/fail2ban/action.d/cloudflare.conf /etc/fail2ban/action.d/complain.conf /etc/fail2ban/action.d/dshield.conf /etc/fail2ban/action.d/dummy.conf /etc/fail2ban/action.d/firewallcmd-allports.conf /etc/fail2ban/action.d/firewallcmd-common.conf /etc/fail2ban/action.d/firewallcmd-ipset.conf /etc/fail2ban/action.d/firewallcmd-multiport.conf /etc/fail2ban/action.d/firewallcmd-new.conf /etc/fail2ban/action.d/firewallcmd-rich-logging.conf /etc/fail2ban/action.d/firewallcmd-rich-rules.conf /etc/fail2ban/action.d/helpers-common.conf /etc/fail2ban/action.d/hostsdeny.conf /etc/fail2ban/action.d/ipfilter.conf /etc/fail2ban/action.d/ipfw.conf /etc/fail2ban/action.d/iptables-allports.conf /etc/fail2ban/action.d/iptables-ipset-proto4.conf /etc/fail2ban/action.d/iptables-ipset-proto6-allports.conf /etc/fail2ban/action.d/iptables-ipset-proto6.conf /etc/fail2ban/action.d/iptables-ipset.conf /etc/fail2ban/action.d/iptables-multiport-log.conf /etc/fail2ban/action.d/iptables-multiport.conf /etc/fail2ban/action.d/iptables-new.conf /etc/fail2ban/action.d/iptables-xt_recent-echo.conf /etc/fail2ban/action.d/iptables.conf /etc/fail2ban/action.d/ipthreat.conf /etc/fail2ban/action.d/mail-buffered.conf /etc/fail2ban/action.d/mail-whois-common.conf /etc/fail2ban/action.d/mail-whois-lines.conf /etc/fail2ban/action.d/mail-whois.conf /etc/fail2ban/action.d/mail.conf /etc/fail2ban/action.d/mynetwatchman.conf /etc/fail2ban/action.d/netscaler.conf /etc/fail2ban/action.d/nftables-allports.conf /etc/fail2ban/action.d/nftables-multiport.conf /etc/fail2ban/action.d/nftables.conf /etc/fail2ban/action.d/nginx-block-map.conf /etc/fail2ban/action.d/npf.conf /etc/fail2ban/action.d/nsupdate.conf /etc/fail2ban/action.d/osx-afctl.conf /etc/fail2ban/action.d/osx-ipfw.conf /etc/fail2ban/action.d/pf.conf /etc/fail2ban/action.d/route.conf /etc/fail2ban/action.d/sendmail-buffered.conf /etc/fail2ban/action.d/sendmail-common.conf /etc/fail2ban/action.d/sendmail-geoip-lines.conf /etc/fail2ban/action.d/sendmail-whois-ipjailmatches.conf /etc/fail2ban/action.d/sendmail-whois-ipmatches.conf /etc/fail2ban/action.d/sendmail-whois-lines.conf /etc/fail2ban/action.d/sendmail-whois-matches.conf /etc/fail2ban/action.d/sendmail-whois.conf /etc/fail2ban/action.d/sendmail.conf /etc/fail2ban/action.d/shorewall-ipset-proto6.conf /etc/fail2ban/action.d/shorewall.conf /etc/fail2ban/action.d/smtp.py /etc/fail2ban/action.d/symbiosis-blacklist-allports.conf /etc/fail2ban/action.d/ufw.conf /etc/fail2ban/action.d/xarf-login-attack.conf /etc/fail2ban/fail2ban.conf /etc/fail2ban/filter.d/3proxy.conf /etc/fail2ban/filter.d/apache-auth.conf /etc/fail2ban/filter.d/apache-badbots.conf /etc/fail2ban/filter.d/apache-botsearch.conf /etc/fail2ban/filter.d/apache-common.conf /etc/fail2ban/filter.d/apache-fakegooglebot.conf /etc/fail2ban/filter.d/apache-modsecurity.conf /etc/fail2ban/filter.d/apache-nohome.conf /etc/fail2ban/filter.d/apache-noscript.conf /etc/fail2ban/filter.d/apache-overflows.conf /etc/fail2ban/filter.d/apache-pass.conf /etc/fail2ban/filter.d/apache-shellshock.conf /etc/fail2ban/filter.d/assp.conf /etc/fail2ban/filter.d/asterisk.conf /etc/fail2ban/filter.d/bitwarden.conf /etc/fail2ban/filter.d/botsearch-common.conf /etc/fail2ban/filter.d/centreon.conf /etc/fail2ban/filter.d/common.conf /etc/fail2ban/filter.d/counter-strike.conf /etc/fail2ban/filter.d/courier-auth.conf /etc/fail2ban/filter.d/courier-smtp.conf /etc/fail2ban/filter.d/cyrus-imap.conf /etc/fail2ban/filter.d/directadmin.conf /etc/fail2ban/filter.d/domino-smtp.conf /etc/fail2ban/filter.d/dovecot.conf /etc/fail2ban/filter.d/dropbear.conf /etc/fail2ban/filter.d/drupal-auth.conf /etc/fail2ban/filter.d/ejabberd-auth.conf /etc/fail2ban/filter.d/exim-common.conf /etc/fail2ban/filter.d/exim-spam.conf /etc/fail2ban/filter.d/exim.conf /etc/fail2ban/filter.d/freeswitch.conf /etc/fail2ban/filter.d/froxlor-auth.conf /etc/fail2ban/filter.d/gitlab.conf /etc/fail2ban/filter.d/grafana.conf /etc/fail2ban/filter.d/groupoffice.conf /etc/fail2ban/filter.d/gssftpd.conf /etc/fail2ban/filter.d/guacamole.conf /etc/fail2ban/filter.d/haproxy-http-auth.conf /etc/fail2ban/filter.d/horde.conf /etc/fail2ban/filter.d/ignorecommands/apache-fakegooglebot /etc/fail2ban/filter.d/kerio.conf /etc/fail2ban/filter.d/lighttpd-auth.conf /etc/fail2ban/filter.d/mongodb-auth.conf /etc/fail2ban/filter.d/monit.conf /etc/fail2ban/filter.d/monitorix.conf /etc/fail2ban/filter.d/mssql-auth.conf /etc/fail2ban/filter.d/murmur.conf /etc/fail2ban/filter.d/mysqld-auth.conf /etc/fail2ban/filter.d/nagios.conf /etc/fail2ban/filter.d/named-refused.conf /etc/fail2ban/filter.d/nginx-bad-request.conf /etc/fail2ban/filter.d/nginx-botsearch.conf /etc/fail2ban/filter.d/nginx-http-auth.conf /etc/fail2ban/filter.d/nginx-limit-req.conf /etc/fail2ban/filter.d/nsd.conf /etc/fail2ban/filter.d/openhab.conf /etc/fail2ban/filter.d/openwebmail.conf /etc/fail2ban/filter.d/oracleims.conf /etc/fail2ban/filter.d/pam-generic.conf /etc/fail2ban/filter.d/perdition.conf /etc/fail2ban/filter.d/php-url-fopen.conf /etc/fail2ban/filter.d/phpmyadmin-syslog.conf /etc/fail2ban/filter.d/portsentry.conf /etc/fail2ban/filter.d/postfix.conf /etc/fail2ban/filter.d/proftpd.conf /etc/fail2ban/filter.d/pure-ftpd.conf /etc/fail2ban/filter.d/qmail.conf /etc/fail2ban/filter.d/recidive.conf /etc/fail2ban/filter.d/roundcube-auth.conf /etc/fail2ban/filter.d/scanlogd.conf /etc/fail2ban/filter.d/screensharingd.conf /etc/fail2ban/filter.d/selinux-common.conf /etc/fail2ban/filter.d/selinux-ssh.conf /etc/fail2ban/filter.d/sendmail-auth.conf /etc/fail2ban/filter.d/sendmail-reject.conf /etc/fail2ban/filter.d/sieve.conf /etc/fail2ban/filter.d/slapd.conf /etc/fail2ban/filter.d/softethervpn.conf /etc/fail2ban/filter.d/sogo-auth.conf /etc/fail2ban/filter.d/solid-pop3d.conf /etc/fail2ban/filter.d/squid.conf /etc/fail2ban/filter.d/squirrelmail.conf /etc/fail2ban/filter.d/sshd.conf /etc/fail2ban/filter.d/stunnel.conf /etc/fail2ban/filter.d/suhosin.conf /etc/fail2ban/filter.d/tine20.conf /etc/fail2ban/filter.d/traefik-auth.conf /etc/fail2ban/filter.d/uwimap-auth.conf /etc/fail2ban/filter.d/vsftpd.conf /etc/fail2ban/filter.d/webmin-auth.conf /etc/fail2ban/filter.d/wuftpd.conf /etc/fail2ban/filter.d/xinetd-fail.conf /etc/fail2ban/filter.d/znc-adminlog.conf /etc/fail2ban/filter.d/zoneminder.conf /etc/fail2ban/jail.conf /etc/fail2ban/jail.d/defaults-debian.conf /etc/fail2ban/jail.local /etc/fail2ban/paths-arch.conf /etc/fail2ban/paths-common.conf /etc/fail2ban/paths-debian.conf /etc/fail2ban/paths-opensuse.conf /etc/init.d/fail2ban /etc/logrotate.d/fail2ban /etc/monit/monitrc.d/fail2ban /etc/rc0.d/K01fail2ban /etc/rc1.d/K01fail2ban /etc/rc2.d/S01fail2ban /etc/rc3.d/S01fail2ban /etc/rc4.d/S01fail2ban /etc/rc5.d/S01fail2ban /etc/rc6.d/K01fail2ban /etc/systemd/system/multi-user.target.wants/fail2ban.service Files changed in /etc (0) Files removed from /etc (0) Disk used on / (includes logs written during the run): +5.5 MB ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Audit: Lynis 3.1.7, the whole server, before the first step and after the last ------------------------------------------------------------------------------ Hardening index 61 -> 62 (Lynis's own score for this server; not a certification) Warnings 2 -> 2 Suggestions 43 -> 43 Resolved by the steps (0) New after the steps (0) ------------------------------------------------------------------------------ Audit: nmap ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Check-your-server script (2 items): https://cdn.serverhandbook.com/check/fail2ban-ubuntu/ubuntu-24.04.4-20261118t215855z.sh SHA-256 acc00365cde2bd14d62359a684a7d14d9f98de203e9b6ef2c6fa0b891cbbfe1a ------------------------------------------------------------------------------ On the stock server, before the first step: FAIL fail2ban is running FAIL the sshd jail is on After the last step: PASS fail2ban is running PASS the sshd jail is on ------------------------------------------------------------------------------ Claims (38), each with what the run saw ------------------------------------------------------------------------------ 1. ok a bare Ubuntu 24.04 server box (web-server) starts 2. ok (setup) the other computer reaches the server’s SSH and is refused a login (no key) | admin@203.0.113.10: Permission denied (publickey,password). 3. ok the starting server has ufw on with SSH allowed | Status: active | | To Action From | -- ------ ---- | OpenSSH ALLOW Anywhere | OpenSSH (v6) ALLOW Anywhere (v6) 4. ok apt update reads the package lists | InRelease | Hit:2 https://mirror.hetzner.com/ubuntu/packages noble-updates InRelease | Hit:3 https://mirror.hetzner.com/ubuntu/packages noble-backports InRelease | Hit:4 https://mirror.hetzner.com/ubuntu/security noble-security InRelease | Reading package lists... Done | Building dependency tree... Done | Reading state information... Done | 143 packages can be upgraded. Run 'apt list --upgradable' to see them. 5. ok apt install -y fail2ban installs it | in | grep -oP '@addr6-set-j-w-nft-ap\s+.*\s+\Khandle\s+(\d+)$'; } | while read -r hdl; do`", | Created symlink /etc/systemd/system/multi-user.target.wants/fail2ban.service → /usr/lib/systemd/system/fail2ban.service. | Setting up python3-pyinotify (0.9.6-2ubuntu1) ... | Processing triggers for man-db (2.12.0-4build2) ... | | Scanning processes... | Scanning linux images... | | Running kernel seems to be up-to-date. | | No services need to be restarted. | | No containers need to be restarted. | | No user sessions are running outdated binaries. | | No VM guests are running outdated hypervisor (qemu) binaries on this host. 6. ok it pulls in python3-pyasyncore (the module Python 3.12 no longer ships) | Reading package lists... Done | Building dependency tree... Done | Reading state information... Done | The following additional packages will be installed: | python3-pyasyncore python3-pyinotify whois | Suggested packages: | mailx monit sqlite3 python-pyinotify-doc | The following NEW packages will be installed: | fail2ban python3-pyasyncore python3-pyinotify whois | 0 upgraded, 4 newly installed, 0 to remove and 143 not upgraded. | Need to get 496 kB of archives. | After this operation, 2,572 kB of additional disk space will be used. | Get:1 https://mirror.hetzner.com/ubuntu/packages noble/main amd64 python3-p 7. ok the service is enabled and active (running) straight after install | ● fail2ban.service - Fail2Ban Service | Loaded: loaded (/usr/lib/systemd/system/fail2ban.service; enabled; preset: enabled) | Active: active (running) since Wed 2026-11-18 22:02:16 UTC; 8s ago | Docs: man:fail2ban(1) | Main PID: 33213 (fail2ban-server) | Tasks: 5 (limit: 4538) | Memory: 25.8M (peak: 28.7M) | CPU: 455ms | CGroup: /system.slice/fail2ban.service | └─33213 /usr/bin/python3 /usr/bin/fail2ban-server -xf start | | Nov 18 22:02:16 web-server systemd[1]: Started fail2ban.service - Fail2Ban Service. | Nov 18 22:02:17 web-server fail2ban-server[33213]: 2026-11-18 22:02:17,022 fail2ban.configreader [33213]: WARN… 'auto' | Nov 18 22:02:17 web-server fail2ban-server[33213]: Server ready | Hint: Some lines were ellipsized, use -l to show in full. 8. ok the installed version is the fixed update 1.0.2-3ubuntu0.1, not the release’s 1.0.2-3 | fail2ban: | Installed: 1.0.2-3ubuntu0.1 | Candidate: 1.0.2-3ubuntu0.1 | Version table: | *** 1.0.2-3ubuntu0.1 500 | 500 https://mirror.hetzner.com/ubuntu/packages noble-updates/universe amd64 Packages | 100 /var/lib/dpkg/status | 1.0.2-3 500 | 500 https://mirror.hetzner.com/ubuntu/packages noble/universe amd64 Packages 9. ok Ubuntu enables the sshd jail, reads the systemd journal and bans with nftables | [DEFAULT] | banaction = nftables | banaction_allports = nftables[type=allports] | backend = systemd | | [sshd] | enabled = true 10. ok fail2ban-client status lists one jail: sshd | Status | |- Number of jail: 1 | `- Jail list: sshd 11. ok the defaults: 5 tries in 600 s (10 min) gets a 600 s (10 min) ban | 5 | 600 | 600 12. ok the bot’s tries are refused at the login (or dropped by sshd) until the ban | admin@203.0.113.10: Permission denied (publickey,password). | admin@203.0.113.10: Permission denied (publickey,password). | admin@203.0.113.10: Permission denied (publickey,password). | admin@203.0.113.10: Permission denied (publickey,password). | admin@203.0.113.10: Permission denied (publickey,password). | ssh: connect to host 203.0.113.10 port 22: Connection refused 13. ok sshd logs each try as "Invalid user admin from 198.51.100.2" | Nov 18 22:03:20 web-server sshd[33933]: Invalid user admin from 198.51.100.2 port 45464 | Nov 18 22:03:31 web-server sshd[33998]: Invalid user opc from 198.18.0.3 port 35086 14. ok after 5 failures the sshd jail has banned 198.51.100.2 | Status for the jail: sshd | |- Filter | | |- Currently failed: 4 | | |- Total failed: 23 | | `- Journal matches: _SYSTEMD_UNIT=sshd.service + _COMM=sshd | `- Actions | |- Currently banned: 3 | |- Total banned: 3 | `- Banned IP list: 198.18.0.4 198.18.0.5 198.51.100.2 15. ok /var/log/fail2ban.log: NOTICE [sshd] Ban 198.51.100.2 | 2026-11-18 22:02:17,617 fail2ban.actions [33213]: NOTICE [sshd] Ban 198.18.0.4 | 2026-11-18 22:02:25,868 fail2ban.actions [33213]: NOTICE [sshd] Ban 198.18.0.5 | 2026-11-18 22:03:20,503 fail2ban.actions [33213]: NOTICE [sshd] Ban 198.51.100.2 16. ok the banned computer now gets "Connection refused" (not a login prompt) | ssh: connect to host 203.0.113.10 port 22: Connection refused 17. ok the ban is an nftables set with a reject rule at priority filter - 1, before ufw’s rules | table inet f2b-table { | set addr-set-sshd { | type ipv4_addr | elements = { 198.18.0.4, 198.18.0.5, | 198.51.100.2 } | } | | chain f2b-chain { | type filter hook input priority filter - 1; policy accept; | tcp dport 22 ip saddr @addr-set-sshd reject with icmp port-unreachable | } | } 18. ok ufw still lists SSH as allowed: the ban is not a ufw rule | Status: active | | To Action From | -- ------ ---- | OpenSSH ALLOW Anywhere | OpenSSH (v6) ALLOW Anywhere (v6) 19. ok your own login is not affected (only the failing address is banned) | deploy 20. ok fail2ban-client set sshd unbanip prints 1 (one address unbanned) | 1 21. ok the unbanned computer reaches sshd again at once | admin@203.0.113.10: Permission denied (publickey,password). 22. ok jail.conf itself says YOU SHOULD NOT MODIFY THIS FILE | 11:# YOU SHOULD NOT MODIFY THIS FILE. 23. ok (the jail.local file is exactly as the article shows it) | [DEFAULT] | ignoreip = 127.0.0.1/8 ::1 192.0.2.2 | bantime = 1h 24. ok fail2ban-client reload prints OK | 2026-11-18 22:04:36,113 fail2ban.configreader [34825]: WARNING 'allowipv6' not defined in 'Definition'. Using default one: 'auto' | OK 25. ok the sshd jail now has a 3600 s ban and ignores 192.0.2.2 | 3600 | These IP addresses/networks are ignored: | |- 127.0.0.0/8 | |- 192.0.2.2 | `- ::1 26. ok 6 failed tries from the whitelisted address: fail2ban logs "Ignore 192.0.2.2 by ip" | 2026-11-18 22:05:15,676 fail2ban.filter [33213]: INFO [sshd] Ignore 192.0.2.2 by ip 27. ok …and does not ban it | Status for the jail: sshd | |- Filter | | |- Currently failed: 5 | | |- Total failed: 30 | | `- Journal matches: _SYSTEMD_UNIT=sshd.service + _COMM=sshd | `- Actions | |- Currently banned: 3 | |- Total banned: 4 | `- Banned IP list: 198.18.0.4 198.18.0.5 198.18.0.6 28. ok (the whitelisted computer still reaches sshd) | admin@203.0.113.10: Permission denied (publickey,password). 29. ok (fail2ban is running at the end of the steps) | active 30. ok (the sshd jail is on) | Status for the jail: sshd | |- Filter | | |- Currently failed: 5 | | |- Total failed: 31 | | `- Journal matches: _SYSTEMD_UNIT=sshd.service + _COMM=sshd | `- Actions | |- Currently banned: 3 | |- Total banned: 4 | `- Banned IP list: 198.18.0.4 198.18.0.5 198.18.0.6 31. ok (tested on) the box reports its OS, kernel and the version of 4 package(s) | PRETTY_NAME="Ubuntu 24.04.4 LTS" | VIRT=none | KERNEL=6.8.0-138-generic | PKG fail2ban 1.0.2-3ubuntu0.1 | PKG nftables 1.0.9-1ubuntu0.1 | PKG openssh-server 1:9.6p1-3ubuntu13.18 | PKG python3 3.12.3-0ubuntu2.1 32. ok with the release package 1.0.2-3 the service does not start | failed 33. ok its log says: ERROR No module named 'asynchat' | Nov 18 22:07:38 web-server fail2ban-server[66591]: 2026-11-18 22:07:38,585 fail2ban [66591]: ERROR No module named 'asynchat' 34. ok apt-cache policy shows 1.0.2-3 installed and the fixed 1.0.2-3ubuntu0.1 as the candidate | fail2ban: | Installed: 1.0.2-3 | Candidate: 1.0.2-3ubuntu0.1 | Version table: | 1.0.2-3ubuntu0.1 500 | 500 https://mirror.hetzner.com/ubuntu/packages noble-updates/universe amd64 Packages | *** 1.0.2-3 500 | 500 https://mirror.hetzner.com/ubuntu/packages noble/universe amd64 Packages | 100 /var/lib/dpkg/status 35. ok apt update + apt install fail2ban installs the fixed version | hdl; do`", | /usr/lib/python3/dist-packages/fail2ban/tests/servertestcase.py:1424: SyntaxWarning: invalid escape sequence '\s' | "`{ nft -a list chain inet f2b-table f2b-chain | grep -oP '@addr6-set-j-w-nft-ap\s+.*\s+\Khandle\s+(\d+)$'; } | while read -r hdl; do`", | Processing triggers for man-db (2.12.0-4build2) ... | | Scanning processes... | Scanning linux images... | | Running kernel seems to be up-to-date. | | No services need to be restarted. | | No containers need to be restarted. | | No user sessions are running outdated binaries. | | No VM guests are running outdated hypervisor (qemu) binaries on this host. 36. ok fail2ban is active again, and jail.local was kept | active 37. ok systemctl disable --now stops fail2ban and keeps it off after a reboot | Synchronizing state of fail2ban.service with SysV service script with /usr/lib/systemd/systemd-sysv-install. | Executing: /usr/lib/systemd/systemd-sysv-install disable fail2ban | Removed "/etc/systemd/system/multi-user.target.wants/fail2ban.service". 38. ok stopping fail2ban removes its nftables table (no ban is left behind) | table ip filter | table ip6 filter ------------------------------------------------------------------------------ Commands and what they printed (30) ------------------------------------------------------------------------------ $ sudo ufw status Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6) $ sudo apt update Hit:1 https://mirror.hetzner.com/ubuntu/packages noble InRelease Hit:2 https://mirror.hetzner.com/ubuntu/packages noble-updates InRelease Hit:3 https://mirror.hetzner.com/ubuntu/packages noble-backports InRelease Hit:4 https://mirror.hetzner.com/ubuntu/security noble-security InRelease Reading package lists... Done Building dependency tree... Done Reading state information... Done 143 packages can be upgraded. Run 'apt list --upgradable' to see them. $ sudo apt install -y fail2ban Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: python3-pyasyncore python3-pyinotify whois Suggested packages: mailx monit sqlite3 python-pyinotify-doc The following NEW packages will be installed: fail2ban python3-pyasyncore python3-pyinotify whois 0 upgraded, 4 newly installed, 0 to remove and 143 not upgraded. Need to get 496 kB of archives. After this operation, 2,572 kB of additional disk space will be used. Get:1 https://mirror.hetzner.com/ubuntu/packages noble/main amd64 python3-pyasyncore all 1.0.2-2 [10.1 kB] Get:2 https://mirror.hetzner.com/ubuntu/packages noble-updates/universe amd64 fail2ban all 1.0.2-3ubuntu0.1 [409 kB] Get:3 https://mirror.hetzner.com/ubuntu/packages noble/main amd64 python3-pyinotify all 0.9.6-2ubuntu1 [25.0 kB] Get:4 https://mirror.hetzner.com/ubuntu/packages noble/main amd64 whois amd64 5.5.22 [51.7 kB] Fetched 496 kB in 0s (1,327 kB/s) Selecting previously unselected package python3-pyasyncore. (Reading database ... 38731 files and directories currently installed.) Preparing to unpack .../python3-pyasyncore_1.0.2-2_all.deb ... Unpacking python3-pyasyncore (1.0.2-2) ... Selecting previously unselected package fail2ban. Preparing to unpack .../fail2ban_1.0.2-3ubuntu0.1_all.deb ... Unpacking fail2ban (1.0.2-3ubuntu0.1) ... Selecting previously unselected package python3-pyinotify. Preparing to unpack .../python3-pyinotify_0.9.6-2ubuntu1_all.deb ... Unpacking python3-pyinotify (0.9.6-2ubuntu1) ... Selecting previously unselected package whois. Preparing to unpack .../whois_5.5.22_amd64.deb ... Unpacking whois (5.5.22) ... Setting up whois (5.5.22) ... Setting up python3-pyasyncore (1.0.2-2) ... Setting up fail2ban (1.0.2-3ubuntu0.1) ... /usr/lib/python3/dist-packages/fail2ban/tests/fail2banregextestcase.py:224: SyntaxWarning: invalid escape sequence '\s' "1490349000 test failed.dns.ch", "^\s*test \S+" /usr/lib/python3/dist-packages/fail2ban/tests/fail2banregextestcase.py:435: SyntaxWarning: invalid escape sequence '\S' '^'+prefix+'User \S+ not allowed\n' /usr/lib/python3/dist-packages/fail2ban/tests/fail2banregextestcase.py:443: SyntaxWarning: invalid escape sequence '\S' '^'+prefix+'User \S+ not allowed\n' /usr/lib/python3/dist-packages/fail2ban/tests/fail2banregextestcase.py:444: SyntaxWarning: invalid escape sequence '\d' '^'+prefix+'Received disconnect from port \d+' /usr/lib/python3/dist-packages/fail2ban/tests/fail2banregextestcase.py:451: SyntaxWarning: invalid escape sequence '\s' _test_variants('common', prefix="\s*\S+ sshd\[\d+\]:\s+") /usr/lib/python3/dist-packages/fail2ban/tests/fail2banregextestcase.py:537: SyntaxWarning: invalid escape sequence '\[' 'common[prefregex="^svc\[\d+\] connect .+$"' /usr/lib/python3/dist-packages/fail2ban/tests/servertestcase.py:1375: SyntaxWarning: invalid escape sequence '\s' "`{ nft -a list chain inet f2b-table f2b-chain | grep -oP '@addr-set-j-w-nft-mp\s+.*\s+\Khandle\s+(\d+)$'; } | while read -r hdl; do`", /usr/lib/python3/dist-packages/fail2ban/tests/servertestcase.py:1378: SyntaxWarning: invalid escape sequence '\s' "`{ nft -a list chain inet f2b-table f2b-chain | grep -oP '@addr6-set-j-w-nft-mp\s+.*\s+\Khandle\s+(\d+)$'; } | while read -r hdl; do`", /usr/lib/python3/dist-packages/fail2ban/tests/servertestcase.py:1421: SyntaxWarning: invalid escape sequence '\s' "`{ nft -a list chain inet f2b-table f2b-chain | grep -oP '@addr-set-j-w-nft-ap\s+.*\s+\Khandle\s+(\d+)$'; } | while read -r hdl; do`", /usr/lib/python3/dist-packages/fail2ban/tests/servertestcase.py:1424: SyntaxWarning: invalid escape sequence '\s' "`{ nft -a list chain inet f2b-table f2b-chain | grep -oP '@addr6-set-j-w-nft-ap\s+.*\s+\Khandle\s+(\d+)$'; } | while read -r hdl; do`", Created symlink /etc/systemd/system/multi-user.target.wants/fail2ban.service → /usr/lib/systemd/system/fail2ban.service. Setting up python3-pyinotify (0.9.6-2ubuntu1) ... Processing triggers for man-db (2.12.0-4build2) ... Scanning processes... Scanning linux images... Running kernel seems to be up-to-date. No services need to be restarted. No containers need to be restarted. No user sessions are running outdated binaries. No VM guests are running outdated hypervisor (qemu) binaries on this host. $ sudo systemctl status fail2ban --no-pager ● fail2ban.service - Fail2Ban Service Loaded: loaded (/usr/lib/systemd/system/fail2ban.service; enabled; preset: enabled) Active: active (running) since Wed 2026-11-18 22:02:16 UTC; 8s ago Docs: man:fail2ban(1) Main PID: 33213 (fail2ban-server) Tasks: 5 (limit: 4538) Memory: 25.8M (peak: 28.7M) CPU: 455ms CGroup: /system.slice/fail2ban.service └─33213 /usr/bin/python3 /usr/bin/fail2ban-server -xf start Nov 18 22:02:16 web-server systemd[1]: Started fail2ban.service - Fail2Ban Service. Nov 18 22:02:17 web-server fail2ban-server[33213]: 2026-11-18 22:02:17,022 fail2ban.configreader [33213]: WARN… 'auto' Nov 18 22:02:17 web-server fail2ban-server[33213]: Server ready Hint: Some lines were ellipsized, use -l to show in full. $ apt-cache policy fail2ban fail2ban: Installed: 1.0.2-3ubuntu0.1 Candidate: 1.0.2-3ubuntu0.1 Version table: *** 1.0.2-3ubuntu0.1 500 500 https://mirror.hetzner.com/ubuntu/packages noble-updates/universe amd64 Packages 100 /var/lib/dpkg/status 1.0.2-3 500 500 https://mirror.hetzner.com/ubuntu/packages noble/universe amd64 Packages $ cat /etc/fail2ban/jail.d/defaults-debian.conf [DEFAULT] banaction = nftables banaction_allports = nftables[type=allports] backend = systemd [sshd] enabled = true $ sudo fail2ban-client status Status |- Number of jail: 1 `- Jail list: sshd $ sudo fail2ban-client get sshd maxretry && sudo fail2ban-client get sshd findtime && sudo fail2ban-client get sshd bantime 5 600 600 $ sudo journalctl -u ssh --no-pager | grep 'Invalid user' | tail -n 2 Nov 18 22:03:20 web-server sshd[33933]: Invalid user admin from 198.51.100.2 port 45464 Nov 18 22:03:31 web-server sshd[33998]: Invalid user opc from 198.18.0.3 port 35086 $ sudo fail2ban-client status sshd Status for the jail: sshd |- Filter | |- Currently failed: 4 | |- Total failed: 23 | `- Journal matches: _SYSTEMD_UNIT=sshd.service + _COMM=sshd `- Actions |- Currently banned: 3 |- Total banned: 3 `- Banned IP list: 198.18.0.4 198.18.0.5 198.51.100.2 $ sudo grep 'Ban ' /var/log/fail2ban.log 2026-11-18 22:02:17,617 fail2ban.actions [33213]: NOTICE [sshd] Ban 198.18.0.4 2026-11-18 22:02:25,868 fail2ban.actions [33213]: NOTICE [sshd] Ban 198.18.0.5 2026-11-18 22:03:20,503 fail2ban.actions [33213]: NOTICE [sshd] Ban 198.51.100.2 $ ssh admin@203.0.113.10 ssh: connect to host 203.0.113.10 port 22: Connection refused $ sudo nft list table inet f2b-table table inet f2b-table { set addr-set-sshd { type ipv4_addr elements = { 198.18.0.4, 198.18.0.5, 198.51.100.2 } } chain f2b-chain { type filter hook input priority filter - 1; policy accept; tcp dport 22 ip saddr @addr-set-sshd reject with icmp port-unreachable } } $ sudo ufw status Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6) $ whoami deploy $ sudo fail2ban-client set sshd unbanip 198.51.100.2 1 $ ssh admin@203.0.113.10 admin@203.0.113.10: Permission denied (publickey,password). $ grep -n 'YOU SHOULD NOT MODIFY' /etc/fail2ban/jail.conf 11:# YOU SHOULD NOT MODIFY THIS FILE. $ cat /etc/fail2ban/jail.local [DEFAULT] ignoreip = 127.0.0.1/8 ::1 192.0.2.2 bantime = 1h $ sudo fail2ban-client reload 2026-11-18 22:04:36,113 fail2ban.configreader [34825]: WARNING 'allowipv6' not defined in 'Definition'. Using default one: 'auto' OK $ sudo fail2ban-client get sshd bantime && sudo fail2ban-client get sshd ignoreip 3600 These IP addresses/networks are ignored: |- 127.0.0.0/8 |- 192.0.2.2 `- ::1 $ sudo grep 'Ignore 192.0.2.2' /var/log/fail2ban.log | tail -n 1 2026-11-18 22:05:15,676 fail2ban.filter [33213]: INFO [sshd] Ignore 192.0.2.2 by ip $ sudo fail2ban-client status sshd Status for the jail: sshd |- Filter | |- Currently failed: 5 | |- Total failed: 30 | `- Journal matches: _SYSTEMD_UNIT=sshd.service + _COMM=sshd `- Actions |- Currently banned: 3 |- Total banned: 4 `- Banned IP list: 198.18.0.4 198.18.0.5 198.18.0.6 $ sudo systemctl is-active fail2ban failed $ sudo journalctl -u fail2ban --no-pager | grep asynchat | tail -n 1 Nov 18 22:07:38 web-server fail2ban-server[66591]: 2026-11-18 22:07:38,585 fail2ban [66591]: ERROR No module named 'asynchat' $ apt-cache policy fail2ban fail2ban: Installed: 1.0.2-3 Candidate: 1.0.2-3ubuntu0.1 Version table: 1.0.2-3ubuntu0.1 500 500 https://mirror.hetzner.com/ubuntu/packages noble-updates/universe amd64 Packages *** 1.0.2-3 500 500 https://mirror.hetzner.com/ubuntu/packages noble/universe amd64 Packages 100 /var/lib/dpkg/status $ sudo apt update && sudo apt install -y fail2ban Hit:1 https://mirror.hetzner.com/ubuntu/packages noble InRelease Hit:2 https://mirror.hetzner.com/ubuntu/packages noble-updates InRelease Hit:3 https://mirror.hetzner.com/ubuntu/packages noble-backports InRelease Hit:4 https://mirror.hetzner.com/ubuntu/security noble-security InRelease Reading package lists... Done Building dependency tree... Done Reading state information... Done 144 packages can be upgraded. Run 'apt list --upgradable' to see them. Reading package lists... Done Building dependency tree... Done Reading state information... Done Suggested packages: mailx monit sqlite3 The following packages will be upgraded: fail2ban 1 upgraded, 0 newly installed, 0 to remove and 143 not upgraded. Need to get 409 kB of archives. After this operation, 15.4 kB of additional disk space will be used. Get:1 https://mirror.hetzner.com/ubuntu/packages noble-updates/universe amd64 fail2ban all 1.0.2-3ubuntu0.1 [409 kB] Fetched 409 kB in 0s (1,039 kB/s) (Reading database ... 39217 files and directories currently installed.) Preparing to unpack .../fail2ban_1.0.2-3ubuntu0.1_all.deb ... Unpacking fail2ban (1.0.2-3ubuntu0.1) over (1.0.2-3) ... Setting up fail2ban (1.0.2-3ubuntu0.1) ... /usr/lib/python3/dist-packages/fail2ban/tests/fail2banregextestcase.py:224: SyntaxWarning: invalid escape sequence '\s' "1490349000 test failed.dns.ch", "^\s*test \S+" /usr/lib/python3/dist-packages/fail2ban/tests/fail2banregextestcase.py:435: SyntaxWarning: invalid escape sequence '\S' '^'+prefix+'User \S+ not allowed\n' /usr/lib/python3/dist-packages/fail2ban/tests/fail2banregextestcase.py:443: SyntaxWarning: invalid escape sequence '\S' '^'+prefix+'User \S+ not allowed\n' /usr/lib/python3/dist-packages/fail2ban/tests/fail2banregextestcase.py:444: SyntaxWarning: invalid escape sequence '\d' '^'+prefix+'Received disconnect from port \d+' /usr/lib/python3/dist-packages/fail2ban/tests/fail2banregextestcase.py:451: SyntaxWarning: invalid escape sequence '\s' _test_variants('common', prefix="\s*\S+ sshd\[\d+\]:\s+") /usr/lib/python3/dist-packages/fail2ban/tests/fail2banregextestcase.py:537: SyntaxWarning: invalid escape sequence '\[' 'common[prefregex="^svc\[\d+\] connect .+$"' /usr/lib/python3/dist-packages/fail2ban/tests/servertestcase.py:1375: SyntaxWarning: invalid escape sequence '\s' "`{ nft -a list chain inet f2b-table f2b-chain | grep -oP '@addr-set-j-w-nft-mp\s+.*\s+\Khandle\s+(\d+)$'; } | while read -r hdl; do`", /usr/lib/python3/dist-packages/fail2ban/tests/servertestcase.py:1378: SyntaxWarning: invalid escape sequence '\s' "`{ nft -a list chain inet f2b-table f2b-chain | grep -oP '@addr6-set-j-w-nft-mp\s+.*\s+\Khandle\s+(\d+)$'; } | while read -r hdl; do`", /usr/lib/python3/dist-packages/fail2ban/tests/servertestcase.py:1421: SyntaxWarning: invalid escape sequence '\s' "`{ nft -a list chain inet f2b-table f2b-chain | grep -oP '@addr-set-j-w-nft-ap\s+.*\s+\Khandle\s+(\d+)$'; } | while read -r hdl; do`", /usr/lib/python3/dist-packages/fail2ban/tests/servertestcase.py:1424: SyntaxWarning: invalid escape sequence '\s' "`{ nft -a list chain inet f2b-table f2b-chain | grep -oP '@addr6-set-j-w-nft-ap\s+.*\s+\Khandle\s+(\d+)$'; } | while read -r hdl; do`", Processing triggers for man-db (2.12.0-4build2) ... Scanning processes... Scanning linux images... Running kernel seems to be up-to-date. No services need to be restarted. No containers need to be restarted. No user sessions are running outdated binaries. No VM guests are running outdated hypervisor (qemu) binaries on this host. $ sudo systemctl is-active fail2ban active $ sudo systemctl disable --now fail2ban Synchronizing state of fail2ban.service with SysV service script with /usr/lib/systemd/systemd-sysv-install. Executing: /usr/lib/systemd/systemd-sysv-install disable fail2ban Removed "/etc/systemd/system/multi-user.target.wants/fail2ban.service". $ sudo nft list tables table ip filter table ip6 filter ------------------------------------------------------------------------------ The check-your-server script, its full screen before the steps ------------------------------------------------------------------------------ ServerHandbook check, fail2ban-ubuntu (proved 2026-11-18) FAIL fail2ban is running fix: https://serverhandbook.com/kb/fail2ban-ubuntu#step-1-install FAIL the sshd jail is on fix: https://serverhandbook.com/kb/fail2ban-ubuntu#step-3-defaults 0 passed, 2 failed To fix a FAIL, follow the steps in https://serverhandbook.com/kb/fail2ban-ubuntu ------------------------------------------------------------------------------ The check-your-server script, its full screen after the steps ------------------------------------------------------------------------------ ServerHandbook check, fail2ban-ubuntu (proved 2026-11-18) PASS fail2ban is running PASS the sshd jail is on 2 passed, 0 failed ------------------------------------------------------------------------------ lynis: its full screen before the first step ------------------------------------------------------------------------------ [ Lynis 3.1.7 ] ################################################################################ Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the terms of the GNU General Public License. See the LICENSE file for details about using this software. 2007-2025, CISOfy - https://cisofy.com/lynis/ Enterprise support available (compliance, plugins, interface and tools) ################################################################################ [+] Initializing program ------------------------------------ - Detecting OS...  [ DONE ] - Checking profiles... [ DONE ] --------------------------------------------------- Program version: 3.1.7 Operating system: Linux Operating system name: Ubuntu Operating system version: 24.04 End-of-life: NO Kernel version: 6.8.0 Hardware platform: x86_64 Hostname: web-server --------------------------------------------------- Profiles: /tmp/shb-audit/lynis/default.prf Log file: /dev/null Report file: /tmp/shb-audit/report.dat Report version: 1.0 Plugin directory: ./plugins --------------------------------------------------- Auditor: [Not Specified] Language: en Test category: all Test group: all --------------------------------------------------- - Program update status...  [ NO UPDATE ] [+] System tools ------------------------------------ - Scanning available tools... - Checking system binaries... [+] Plugins (phase 1) ------------------------------------ Note: plugins have more extensive tests and may take several minutes to complete   - Plugins enabled [ NONE ] [+] Boot and services ------------------------------------ - Service Manager [ systemd ] - Checking UEFI boot [ DISABLED ] - Checking presence GRUB2 [ FOUND ] - Checking for password protection [ NONE ] - Check running services (systemctl) [ DONE ] Result: found 17 running services - Check enabled services at boot (systemctl) [ DONE ] Result: found 45 enabled services - Check startup files (permissions) [ OK ] - Running 'systemd-analyze security' Unit name (exposure value) and predicate -------------------------------- - acpid.service (value=9.6) [ UNSAFE ] - atd.service (value=9.6) [ UNSAFE ] - cron.service (value=9.6) [ UNSAFE ] - dbus.service (value=9.5) [ UNSAFE ] - dm-event.service (value=9.5) [ UNSAFE ] - dmesg.service (value=9.6) [ UNSAFE ] - emergency.service (value=9.5) [ UNSAFE ] - getty@tty1.service (value=9.6) [ UNSAFE ] - iscsid.service (value=9.5) [ UNSAFE ] - lvm2-lvmpolld.service (value=9.5) [ UNSAFE ] - multipathd.service (value=9.5) [ UNSAFE ] - networkd-dispatcher.service (value=9.6) [ UNSAFE ] - open-vm-tools.service (value=9.5) [ UNSAFE ] - plymouth-start.service (value=9.5) [ UNSAFE ] - qemu-guest-agent.service (value=9.6) [ UNSAFE ] - rc-local.service (value=9.6) [ UNSAFE ] - rescue.service (value=9.5) [ UNSAFE ] - rsyslog.service (value=6.3) [ MEDIUM ] - serial-getty@ttyS0.service (value=9.6) [ UNSAFE ] - snapd.service (value=9.9) [ UNSAFE ] - ssh.service (value=9.6) [ UNSAFE ] - systemd-ask-password-console.service (value=9.4) [ UNSAFE ] - systemd-ask-password-plymouth.service (value=9.5) [ UNSAFE ] - systemd-ask-password-wall.service (value=9.4) [ UNSAFE ] - systemd-bsod.service (value=9.5) [ UNSAFE ] - systemd-fsckd.service (value=9.5) [ UNSAFE ] - systemd-initctl.service (value=9.4) [ UNSAFE ] - systemd-journald.service (value=4.3) [ PROTECTED ] - systemd-logind.service (value=2.8) [ PROTECTED ] - systemd-networkd.service (value=2.6) [ PROTECTED ] - systemd-resolved.service (value=2.2) [ PROTECTED ] - systemd-rfkill.service (value=9.4) [ UNSAFE ] - systemd-timesyncd.service (value=2.1) [ PROTECTED ] - systemd-udevd.service (value=7.2) [ MEDIUM ] - tpm-udev.service (value=9.6) [ UNSAFE ] - ubuntu-advantage.service (value=9.6) [ UNSAFE ] - unattended-upgrades.service (value=9.6) [ UNSAFE ] - user@0.service (value=9.8) [ UNSAFE ] - uuidd.service (value=5.8) [ MEDIUM ] - vgauth.service (value=9.5) [ UNSAFE ] [+] Kernel ------------------------------------ - Checking default runlevel [ runlevel 5 ] - Checking CPU support (NX/PAE) CPU support: PAE and/or NoeXecute supported [ FOUND ] - Checking kernel version and release [ DONE ] - Checking kernel type [ DONE ] - Checking loaded kernel modules [ DONE ] Found 77 active modules - Checking Linux kernel configuration file [ FOUND ] - Checking default I/O kernel scheduler [ NOT FOUND ] - Checking for available kernel update [ OK ] - Checking core dumps configuration - configuration in systemd conf files [ DEFAULT ] - configuration in /etc/profile [ DEFAULT ] - 'hard' configuration in /etc/security/limits.conf [ DEFAULT ] - 'soft' configuration in /etc/security/limits.conf [ DEFAULT ] - Checking setuid core dumps configuration [ PROTECTED ] - Check if reboot is needed [ NO ] [+] Memory and Processes ------------------------------------ - Checking /proc/meminfo [ FOUND ] - Searching for dead/zombie processes [ NOT FOUND ] - Searching for IO waiting processes [ NOT FOUND ] - Search prelink tooling [ NOT FOUND ] [+] Users, Groups and Authentication ------------------------------------ - Administrator accounts [ OK ] - Unique UIDs [ OK ] - Consistency of group files (grpck) [ OK ] - Unique group IDs [ OK ] - Unique group names [ OK ] - Password file consistency [ OK ] - Password hashing methods [ OK ] - Checking password hashing rounds [ DISABLED ] - Query system users (non daemons) [ DONE ] - NIS+ authentication support [ NOT ENABLED ] - NIS authentication support [ NOT ENABLED ] - Sudoers file(s) [ FOUND ] - Permissions for directory: /etc/sudoers.d [ OK ] - Permissions for: /etc/sudoers [ OK ] - Permissions for: /etc/sudoers.d/90-shb-automation [ OK ] - Permissions for: /etc/sudoers.d/README [ OK ] - Permissions for: /etc/sudoers.d/90-cloud-init-users [ OK ] - PAM password strength tools [ SUGGESTION ] - PAM configuration files (pam.conf) [ FOUND ] - PAM configuration files (pam.d) [ FOUND ] - PAM modules [ FOUND ] - LDAP module in PAM [ NOT FOUND ] - Accounts without expire date [ OK ] - Accounts without password [ OK ] - Locked accounts [ FOUND ] - Checking user password aging (minimum) [ DISABLED ] - User password aging (maximum) [ DISABLED ] - Checking expired passwords [ OK ] - Checking Linux single user mode authentication [ OK ] - Determining default umask - umask (/etc/profile) [ NOT FOUND ] - umask (/etc/login.defs) [ SUGGESTION ] - LDAP authentication support [ NOT ENABLED ] - Logging failed login attempts [ ENABLED ] [+] Kerberos ------------------------------------ - Check for Kerberos KDC and principals [ NOT FOUND ] [+] Shells ------------------------------------ - Checking shells from /etc/shells Result: found 9 shells (valid shells: 9). - Session timeout settings/tools [ NONE ] - Checking default umask values - Checking default umask in /etc/bash.bashrc [ NONE ] - Checking default umask in /etc/profile [ NONE ] [+] File systems ------------------------------------ - Checking mount points - Checking /home mount point [ SUGGESTION ] - Checking /tmp mount point [ SUGGESTION ] - Checking /var mount point [ SUGGESTION ] - Query swap partitions (fstab) [ NONE ] - Testing swap partitions [ OK ] - Testing /proc mount (hidepid) [ SUGGESTION ] - Checking for old files in /tmp [ OK ] - Checking /tmp sticky bit [ OK ] - Checking /var/tmp sticky bit [ OK ] - ACL support root file system [ ENABLED ] - Mount options of / [ OK ] - Mount options of /dev [ PARTIALLY HARDENED ] - Mount options of /dev/shm [ PARTIALLY HARDENED ] - Mount options of /run [ HARDENED ] - Total without nodev:9 noexec:11 nosuid:7 ro or noexec (W^X): 11 of total 27 - Disable kernel support of some filesystems [+] USB Devices ------------------------------------ - Checking usb-storage driver (modprobe config) [ NOT DISABLED ] - Checking USB devices authorization [ ENABLED ] - Checking USBGuard [ NOT FOUND ] [+] Storage ------------------------------------ - Checking firewire ohci driver (modprobe config) [ DISABLED ] [+] NFS ------------------------------------ - Check running NFS daemon [ NOT FOUND ] [+] Name services ------------------------------------ - Checking search domains [ FOUND ] - Checking /etc/resolv.conf options [ FOUND ] - Searching DNS domain name [ UNKNOWN ] - Checking /etc/hosts - Duplicate entries in hosts file [ NONE ] - Presence of configured hostname in /etc/hosts [ NOT FOUND ] - Hostname mapped to localhost [ NOT FOUND ] - Localhost mapping to IP address [ OK ] [+] Ports and packages ------------------------------------ - Searching package managers - Searching dpkg package manager [ FOUND ] - Querying package manager - Query unpurged packages [ NONE ] - Checking security repository in sources.list file or directory [ WARNING ] - Checking APT package database [ OK ] - Checking vulnerable packages [ WARNING ] [WARNING]: Test PKGS-7392 had a long execution: 20.536329 seconds - Checking upgradeable packages [ SKIPPED ] - Checking package audit tool [ INSTALLED ] Found: apt-get - Toolkit for automatic upgrades (unattended-upgrade) [ FOUND ] [+] Networking ------------------------------------ - Checking IPv6 configuration [ ENABLED ] Configuration method [ AUTO ] IPv6 only [ NO ] - Checking configured nameservers - Testing nameservers Nameserver: 127.0.0.53 [ OK ] - DNSSEC supported (systemd-resolved) [ UNKNOWN ] - Checking default gateway [ DONE ] - Getting listening ports (TCP/UDP) [ DONE ] - Checking promiscuous interfaces [ OK ] - Checking waiting connections [ OK ] - Checking status DHCP client [ NOT ACTIVE ] - Checking for ARP monitoring software [ NOT FOUND ] - Uncommon network protocols [ 0 ] [+] Printers and Spools ------------------------------------ - Checking cups daemon [ NOT FOUND ] - Checking lp daemon [ NOT RUNNING ] [+] Software: e-mail and messaging ------------------------------------ [+] Software: firewalls ------------------------------------ - Checking iptables kernel module [ FOUND ] - Checking iptables policies of chains [ FOUND ] - Chain INPUT (table: filter, target: DROP) [ DROP ] - Chain INPUT (table: security, target: ACCEPT) [ ACCEPT ] - Checking for empty ruleset [ OK ] - Checking for unused rules [ FOUND ] - Checking host based firewall [ ACTIVE ] [+] Software: webserver ------------------------------------ - Checking Apache [ NOT FOUND ] - Checking nginx [ NOT FOUND ] [+] SSH Support ------------------------------------ - Checking running SSH daemon [ FOUND ] - Searching SSH configuration [ FOUND ] - OpenSSH option: AllowTcpForwarding [ SUGGESTION ] - OpenSSH option: ClientAliveCountMax [ SUGGESTION ] - OpenSSH option: ClientAliveInterval [ OK ] - OpenSSH option: FingerprintHash [ OK ] - OpenSSH option: GatewayPorts [ OK ] - OpenSSH option: IgnoreRhosts [ OK ] - OpenSSH option: LoginGraceTime [ OK ] - OpenSSH option: LogLevel [ SUGGESTION ] - OpenSSH option: MaxAuthTries [ SUGGESTION ] - OpenSSH option: MaxSessions [ SUGGESTION ] - OpenSSH option: PermitRootLogin [ OK ] - OpenSSH option: PermitUserEnvironment [ OK ] - OpenSSH option: PermitTunnel [ OK ] - OpenSSH option: Port [ SUGGESTION ] - OpenSSH option: PrintLastLog [ OK ] - OpenSSH option: StrictModes [ OK ] - OpenSSH option: TCPKeepAlive [ SUGGESTION ] - OpenSSH option: UseDNS [ OK ] - OpenSSH option: X11Forwarding [ SUGGESTION ] - OpenSSH option: AllowAgentForwarding [ SUGGESTION ] - OpenSSH option: AllowUsers [ NOT FOUND ] - OpenSSH option: AllowGroups [ NOT FOUND ] [+] SNMP Support ------------------------------------ - Checking running SNMP daemon [ NOT FOUND ] [+] Databases ------------------------------------ No database engines found [+] LDAP Services ------------------------------------ - Checking OpenLDAP instance [ NOT FOUND ] [+] PHP ------------------------------------ - Checking PHP [ NOT FOUND ] [+] Squid Support ------------------------------------ - Checking running Squid daemon [ NOT FOUND ] [+] Logging and files ------------------------------------ - Checking for a running log daemon [ OK ] - Checking Syslog-NG status [ NOT FOUND ] - Checking systemd journal status [ FOUND ] - Checking Metalog status [ NOT FOUND ] - Checking RSyslog status [ FOUND ] - Checking RFC 3195 daemon status [ NOT FOUND ] - Checking minilogd instances [ NOT FOUND ] - Checking wazuh-agent daemon status [ NOT FOUND ] - Checking logrotate presence [ OK ] - Checking remote logging [ NOT ENABLED ] - Checking log directories (static list) [ DONE ] - Checking open log files [ DONE ] - Checking deleted files in use [ DONE ] [+] Insecure services ------------------------------------ - Installed inetd package [ NOT FOUND ] - Installed xinetd package [ OK ] - xinetd status [ NOT ACTIVE ] - Installed rsh client package [ OK ] - Installed rsh server package [ OK ] - Installed telnet client package [ OK ] - Installed telnet server package [ NOT FOUND ] - Checking NIS client installation [ OK ] - Checking NIS server installation [ OK ] - Checking TFTP client installation [ OK ] - Checking TFTP server installation [ OK ] [+] Banners and identification ------------------------------------ - /etc/issue [ FOUND ] - /etc/issue contents [ WEAK ] - /etc/issue.net [ FOUND ] - /etc/issue.net contents [ WEAK ] [+] Scheduled tasks ------------------------------------ - Checking crontab and cronjob files [ DONE ] - Checking atd status [ RUNNING ] - Checking at users [ DONE ] - Checking at jobs [ NONE ] [+] Accounting ------------------------------------ - Checking accounting information [ NOT FOUND ] - Checking sysstat accounting data [ DISABLED ] - Checking auditd [ NOT FOUND ] [+] Time and Synchronization ------------------------------------ - NTP daemon found: systemd (timesyncd) [ FOUND ] - Checking for a running NTP daemon or client [ OK ] - Last time synchronization [ 59s ] [+] Cryptography ------------------------------------ - Checking for expired SSL certificates [0/123] [ NONE ] - Found 0 encrypted and 0 unencrypted swap devices in use. [ OK ] - Kernel entropy is sufficient [ YES ] - HW RNG & rngd [ NO ] - SW prng [ NO ] - MOR variable not found [ WEAK ] [+] Virtualization ------------------------------------ [+] Containers ------------------------------------ [+] Security frameworks ------------------------------------ - Checking presence AppArmor [ FOUND ] - Checking AppArmor status [ ENABLED ] Found 29 unconfined processes - Checking presence SELinux [ NOT FOUND ] - Checking presence TOMOYO Linux [ NOT FOUND ] - Checking presence grsecurity [ NOT FOUND ] - Checking for implemented MAC framework [ OK ] [+] Software: file integrity ------------------------------------ - Checking file integrity tools - dm-integrity (status) [ DISABLED ] - dm-verity (status) [ DISABLED ] - Checking presence integrity tool [ NOT FOUND ] [+] Software: System tooling ------------------------------------ - Checking automation tooling - Automation tooling [ NOT FOUND ] - Checking for IDS/IPS tooling [ NONE ] [+] Software: Malware ------------------------------------ - Malware software components [ NOT FOUND ] [+] File Permissions ------------------------------------ - Starting file permissions check File: /boot/grub/grub.cfg [ OK ] File: /etc/at.deny [ SUGGESTION ] File: /etc/crontab [ SUGGESTION ] File: /etc/group [ OK ] File: /etc/group- [ OK ] File: /etc/hosts.allow [ OK ] File: /etc/hosts.deny [ OK ] File: /etc/issue [ OK ] File: /etc/issue.net [ OK ] File: /etc/passwd [ OK ] File: /etc/passwd- [ OK ] File: /etc/ssh/sshd_config [ SUGGESTION ] Directory: /root/.ssh [ OK ] Directory: /etc/cron.d [ SUGGESTION ] Directory: /etc/cron.daily [ SUGGESTION ] Directory: /etc/cron.hourly [ SUGGESTION ] Directory: /etc/cron.weekly [ SUGGESTION ] Directory: /etc/cron.monthly [ SUGGESTION ] [+] Home directories ------------------------------------ - Permissions of home directories [ OK ] - Ownership of home directories [ OK ] - Checking shell history files [ OK ] [+] Kernel Hardening ------------------------------------ - Comparing sysctl key pairs with scan profile - dev.tty.ldisc_autoload (exp: 0) [ DIFFERENT ] - fs.protected_fifos (exp: 2) [ DIFFERENT ] - fs.protected_hardlinks (exp: 1) [ OK ] - fs.protected_regular (exp: 2) [ OK ] - fs.protected_symlinks (exp: 1) [ OK ] - fs.suid_dumpable (exp: 0) [ DIFFERENT ] - kernel.core_uses_pid (exp: 1) [ DIFFERENT ] - kernel.ctrl-alt-del (exp: 0) [ OK ] - kernel.dmesg_restrict (exp: 1) [ OK ] - kernel.kptr_restrict (exp: 2) [ DIFFERENT ] - kernel.modules_disabled (exp: 1) [ DIFFERENT ] - kernel.perf_event_paranoid (exp: 2 3 4) [ OK ] - kernel.randomize_va_space (exp: 2) [ OK ] - kernel.sysrq (exp: 0) [ DIFFERENT ] - kernel.unprivileged_bpf_disabled (exp: 1) [ DIFFERENT ] - kernel.yama.ptrace_scope (exp: 1 2 3) [ OK ] - net.core.bpf_jit_harden (exp: 2) [ DIFFERENT ] - net.ipv4.conf.all.accept_redirects (exp: 0) [ OK ] - net.ipv4.conf.all.accept_source_route (exp: 0) [ OK ] - net.ipv4.conf.all.bootp_relay (exp: 0) [ OK ] - net.ipv4.conf.all.forwarding (exp: 0) [ OK ] - net.ipv4.conf.all.log_martians (exp: 1) [ DIFFERENT ] - net.ipv4.conf.all.mc_forwarding (exp: 0) [ OK ] - net.ipv4.conf.all.proxy_arp (exp: 0) [ OK ] - net.ipv4.conf.all.rp_filter (exp: 1) [ DIFFERENT ] - net.ipv4.conf.all.send_redirects (exp: 0) [ DIFFERENT ] - net.ipv4.conf.default.accept_redirects (exp: 0) [ OK ] - net.ipv4.conf.default.accept_source_route (exp: 0) [ DIFFERENT ] - net.ipv4.conf.default.log_martians (exp: 1) [ DIFFERENT ] - net.ipv4.icmp_echo_ignore_broadcasts (exp: 1) [ OK ] - net.ipv4.icmp_ignore_bogus_error_responses (exp: 1) [ OK ] - net.ipv4.tcp_syncookies (exp: 1) [ OK ] - net.ipv4.tcp_timestamps (exp: 0 1) [ OK ] - net.ipv6.conf.all.accept_redirects (exp: 0) [ OK ] - net.ipv6.conf.all.accept_source_route (exp: 0) [ OK ] - net.ipv6.conf.default.accept_redirects (exp: 0) [ OK ] - net.ipv6.conf.default.accept_source_route (exp: 0) [ OK ] [+] Hardening ------------------------------------ - Installed compiler(s) [ NOT FOUND ] - Installed malware scanner [ NOT FOUND ] - Non-native binary formats [ FOUND ] [+] Custom tests ------------------------------------ - Running custom tests...  [ NONE ] [+] Plugins (phase 2) ------------------------------------ ================================================================================ -[ Lynis 3.1.7 Results ]- Great, no warnings No suggestions ================================================================================ Lynis security scan details: Scan mode: Normal [▆] Forensics [ ] Integration [ ] Pentest [ ] Lynis modules: - Compliance status [?] - Security audit [V] - Vulnerability scan [V] Details: Hardening index : 61 [############ ] Tests performed : 257 Plugins enabled : 0 Software components: - Firewall [V] - Intrusion software [X] - Malware scanner [X] Files: - Test and debug information : /dev/null - Report data : /tmp/shb-audit/report.dat ================================================================================ Lynis 3.1.7 Auditing, system hardening, and compliance for UNIX-based systems (Linux, macOS, BSD, and others) 2007-2025, CISOfy - https://cisofy.com/lynis/ Enterprise support available (compliance, plugins, interface and tools) ================================================================================ [TIP]: Enhance Lynis audits by adding your settings to custom.prf (see /tmp/shb-audit/lynis/default.prf for all settings) ------------------------------------------------------------------------------ lynis: its full screen after the last step ------------------------------------------------------------------------------ [ Lynis 3.1.7 ] ################################################################################ Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the terms of the GNU General Public License. See the LICENSE file for details about using this software. 2007-2025, CISOfy - https://cisofy.com/lynis/ Enterprise support available (compliance, plugins, interface and tools) ################################################################################ [+] Initializing program ------------------------------------ - Detecting OS...  [ DONE ] - Checking profiles... [ DONE ] --------------------------------------------------- Program version: 3.1.7 Operating system: Linux Operating system name: Ubuntu Operating system version: 24.04 End-of-life: NO Kernel version: 6.8.0 Hardware platform: x86_64 Hostname: web-server --------------------------------------------------- Profiles: /tmp/shb-audit/lynis/default.prf Log file: /dev/null Report file: /tmp/shb-audit/report.dat Report version: 1.0 Plugin directory: ./plugins --------------------------------------------------- Auditor: [Not Specified] Language: en Test category: all Test group: all --------------------------------------------------- - Program update status...  [ NO UPDATE ] [+] System tools ------------------------------------ - Scanning available tools... - Checking system binaries... [+] Plugins (phase 1) ------------------------------------ Note: plugins have more extensive tests and may take several minutes to complete   - Plugins enabled [ NONE ] [+] Boot and services ------------------------------------ - Service Manager [ systemd ] - Checking UEFI boot [ DISABLED ] - Checking presence GRUB2 [ FOUND ] - Checking for password protection [ NONE ] - Check running services (systemctl) [ DONE ] Result: found 20 running services - Check enabled services at boot (systemctl) [ DONE ] Result: found 46 enabled services - Check startup files (permissions) [ OK ] - Running 'systemd-analyze security' Unit name (exposure value) and predicate -------------------------------- - acpid.service (value=9.6) [ UNSAFE ] - atd.service (value=9.6) [ UNSAFE ] - cron.service (value=9.6) [ UNSAFE ] - dbus.service (value=9.5) [ UNSAFE ] - dm-event.service (value=9.5) [ UNSAFE ] - dmesg.service (value=9.6) [ UNSAFE ] - emergency.service (value=9.5) [ UNSAFE ] - fail2ban.service (value=9.6) [ UNSAFE ] - getty@tty1.service (value=9.6) [ UNSAFE ] - iscsid.service (value=9.5) [ UNSAFE ] - lvm2-lvmpolld.service (value=9.5) [ UNSAFE ] - multipathd.service (value=9.5) [ UNSAFE ] - networkd-dispatcher.service (value=9.6) [ UNSAFE ] - open-vm-tools.service (value=9.5) [ UNSAFE ] - packagekit.service (value=9.6) [ UNSAFE ] - plymouth-start.service (value=9.5) [ UNSAFE ] - polkit.service (value=1.6) [ PROTECTED ] - qemu-guest-agent.service (value=9.6) [ UNSAFE ] - rc-local.service (value=9.6) [ UNSAFE ] - rescue.service (value=9.5) [ UNSAFE ] - rsyslog.service (value=6.3) [ MEDIUM ] - serial-getty@ttyS0.service (value=9.6) [ UNSAFE ] - snapd.service (value=9.9) [ UNSAFE ] - ssh.service (value=9.6) [ UNSAFE ] - systemd-ask-password-console.service (value=9.4) [ UNSAFE ] - systemd-ask-password-plymouth.service (value=9.5) [ UNSAFE ] - systemd-ask-password-wall.service (value=9.4) [ UNSAFE ] - systemd-bsod.service (value=9.5) [ UNSAFE ] - systemd-fsckd.service (value=9.5) [ UNSAFE ] - systemd-initctl.service (value=9.4) [ UNSAFE ] - systemd-journald.service (value=4.3) [ PROTECTED ] - systemd-logind.service (value=2.8) [ PROTECTED ] - systemd-networkd.service (value=2.6) [ PROTECTED ] - systemd-resolved.service (value=2.2) [ PROTECTED ] - systemd-rfkill.service (value=9.4) [ UNSAFE ] - systemd-timesyncd.service (value=2.1) [ PROTECTED ] - systemd-udevd.service (value=7.2) [ MEDIUM ] - tpm-udev.service (value=9.6) [ UNSAFE ] - ubuntu-advantage.service (value=9.6) [ UNSAFE ] - unattended-upgrades.service (value=9.6) [ UNSAFE ] - user@0.service (value=9.8) [ UNSAFE ] - uuidd.service (value=5.8) [ MEDIUM ] - vgauth.service (value=9.5) [ UNSAFE ] [+] Kernel ------------------------------------ - Checking default runlevel [ runlevel 5 ] - Checking CPU support (NX/PAE) CPU support: PAE and/or NoeXecute supported [ FOUND ] - Checking kernel version and release [ DONE ] - Checking kernel type [ DONE ] - Checking loaded kernel modules [ DONE ] Found 82 active modules - Checking Linux kernel configuration file [ FOUND ] - Checking default I/O kernel scheduler [ NOT FOUND ] - Checking for available kernel update [ OK ] - Checking core dumps configuration - configuration in systemd conf files [ DEFAULT ] - configuration in /etc/profile [ DEFAULT ] - 'hard' configuration in /etc/security/limits.conf [ DEFAULT ] - 'soft' configuration in /etc/security/limits.conf [ DEFAULT ] - Checking setuid core dumps configuration [ PROTECTED ] - Check if reboot is needed [ NO ] [+] Memory and Processes ------------------------------------ - Checking /proc/meminfo [ FOUND ] - Searching for dead/zombie processes [ NOT FOUND ] - Searching for IO waiting processes [ NOT FOUND ] - Search prelink tooling [ NOT FOUND ] [+] Users, Groups and Authentication ------------------------------------ - Administrator accounts [ OK ] - Unique UIDs [ OK ] - Consistency of group files (grpck) [ OK ] - Unique group IDs [ OK ] - Unique group names [ OK ] - Password file consistency [ OK ] - Password hashing methods [ OK ] - Checking password hashing rounds [ DISABLED ] - Query system users (non daemons) [ DONE ] - NIS+ authentication support [ NOT ENABLED ] - NIS authentication support [ NOT ENABLED ] - Sudoers file(s) [ FOUND ] - Permissions for directory: /etc/sudoers.d [ OK ] - Permissions for: /etc/sudoers [ OK ] - Permissions for: /etc/sudoers.d/90-shb-automation [ OK ] - Permissions for: /etc/sudoers.d/README [ OK ] - Permissions for: /etc/sudoers.d/90-cloud-init-users [ OK ] - PAM password strength tools [ SUGGESTION ] - PAM configuration files (pam.conf) [ FOUND ] - PAM configuration files (pam.d) [ FOUND ] - PAM modules [ FOUND ] - LDAP module in PAM [ NOT FOUND ] - Accounts without expire date [ OK ] - Accounts without password [ OK ] - Locked accounts [ FOUND ] - Checking user password aging (minimum) [ DISABLED ] - User password aging (maximum) [ DISABLED ] - Checking expired passwords [ OK ] - Checking Linux single user mode authentication [ OK ] - Determining default umask - umask (/etc/profile) [ NOT FOUND ] - umask (/etc/login.defs) [ SUGGESTION ] - LDAP authentication support [ NOT ENABLED ] - Logging failed login attempts [ ENABLED ] [+] Kerberos ------------------------------------ - Check for Kerberos KDC and principals [ NOT FOUND ] [+] Shells ------------------------------------ - Checking shells from /etc/shells Result: found 9 shells (valid shells: 9). - Session timeout settings/tools [ NONE ] - Checking default umask values - Checking default umask in /etc/bash.bashrc [ NONE ] - Checking default umask in /etc/profile [ NONE ] [+] File systems ------------------------------------ - Checking mount points - Checking /home mount point [ SUGGESTION ] - Checking /tmp mount point [ SUGGESTION ] - Checking /var mount point [ SUGGESTION ] - Query swap partitions (fstab) [ NONE ] - Testing swap partitions [ OK ] - Testing /proc mount (hidepid) [ SUGGESTION ] - Checking for old files in /tmp [ OK ] - Checking /tmp sticky bit [ OK ] - Checking /var/tmp sticky bit [ OK ] - ACL support root file system [ ENABLED ] - Mount options of / [ OK ] - Mount options of /dev [ PARTIALLY HARDENED ] - Mount options of /dev/shm [ PARTIALLY HARDENED ] - Mount options of /run [ HARDENED ] - Total without nodev:9 noexec:11 nosuid:7 ro or noexec (W^X): 11 of total 27 - Disable kernel support of some filesystems [+] USB Devices ------------------------------------ - Checking usb-storage driver (modprobe config) [ NOT DISABLED ] - Checking USB devices authorization [ ENABLED ] - Checking USBGuard [ NOT FOUND ] [+] Storage ------------------------------------ - Checking firewire ohci driver (modprobe config) [ DISABLED ] [+] NFS ------------------------------------ - Check running NFS daemon [ NOT FOUND ] [+] Name services ------------------------------------ - Checking search domains [ FOUND ] - Checking /etc/resolv.conf options [ FOUND ] - Searching DNS domain name [ UNKNOWN ] - Checking /etc/hosts - Duplicate entries in hosts file [ NONE ] - Presence of configured hostname in /etc/hosts [ NOT FOUND ] - Hostname mapped to localhost [ NOT FOUND ] - Localhost mapping to IP address [ OK ] [+] Ports and packages ------------------------------------ - Searching package managers - Searching dpkg package manager [ FOUND ] - Querying package manager - Query unpurged packages [ NONE ] - Checking security repository in sources.list file or directory [ WARNING ] - Checking APT package database [ OK ] - Checking vulnerable packages [ WARNING ] - Checking upgradeable packages [ SKIPPED ] - Checking package audit tool [ INSTALLED ] Found: apt-get - Toolkit for automatic upgrades (unattended-upgrade) [ FOUND ] [+] Networking ------------------------------------ - Checking IPv6 configuration [ ENABLED ] Configuration method [ AUTO ] IPv6 only [ NO ] - Checking configured nameservers - Testing nameservers Nameserver: 127.0.0.53 [ OK ] - DNSSEC supported (systemd-resolved) [ UNKNOWN ] - Checking default gateway [ DONE ] - Getting listening ports (TCP/UDP) [ DONE ] - Checking promiscuous interfaces [ OK ] - Checking waiting connections [ OK ] - Checking status DHCP client [ NOT ACTIVE ] - Checking for ARP monitoring software [ NOT FOUND ] - Uncommon network protocols [ 0 ] [+] Printers and Spools ------------------------------------ - Checking cups daemon [ NOT FOUND ] - Checking lp daemon [ NOT RUNNING ] [+] Software: e-mail and messaging ------------------------------------ [+] Software: firewalls ------------------------------------ - Checking iptables kernel module [ FOUND ] - Checking iptables policies of chains [ FOUND ] - Chain INPUT (table: filter, target: DROP) [ DROP ] - Chain INPUT (table: security, target: ACCEPT) [ ACCEPT ] - Checking for empty ruleset [ OK ] - Checking for unused rules [ FOUND ] - Checking host based firewall [ ACTIVE ] [+] Software: webserver ------------------------------------ - Checking Apache [ NOT FOUND ] - Checking nginx [ NOT FOUND ] [+] SSH Support ------------------------------------ - Checking running SSH daemon [ FOUND ] - Searching SSH configuration [ FOUND ] - OpenSSH option: AllowTcpForwarding [ SUGGESTION ] - OpenSSH option: ClientAliveCountMax [ SUGGESTION ] - OpenSSH option: ClientAliveInterval [ OK ] - OpenSSH option: FingerprintHash [ OK ] - OpenSSH option: GatewayPorts [ OK ] - OpenSSH option: IgnoreRhosts [ OK ] - OpenSSH option: LoginGraceTime [ OK ] - OpenSSH option: LogLevel [ SUGGESTION ] - OpenSSH option: MaxAuthTries [ SUGGESTION ] - OpenSSH option: MaxSessions [ SUGGESTION ] - OpenSSH option: PermitRootLogin [ OK ] - OpenSSH option: PermitUserEnvironment [ OK ] - OpenSSH option: PermitTunnel [ OK ] - OpenSSH option: Port [ SUGGESTION ] - OpenSSH option: PrintLastLog [ OK ] - OpenSSH option: StrictModes [ OK ] - OpenSSH option: TCPKeepAlive [ SUGGESTION ] - OpenSSH option: UseDNS [ OK ] - OpenSSH option: X11Forwarding [ SUGGESTION ] - OpenSSH option: AllowAgentForwarding [ SUGGESTION ] - OpenSSH option: AllowUsers [ NOT FOUND ] - OpenSSH option: AllowGroups [ NOT FOUND ] [+] SNMP Support ------------------------------------ - Checking running SNMP daemon [ NOT FOUND ] [+] Databases ------------------------------------ No database engines found [+] LDAP Services ------------------------------------ - Checking OpenLDAP instance [ NOT FOUND ] [+] PHP ------------------------------------ - Checking PHP [ NOT FOUND ] [+] Squid Support ------------------------------------ - Checking running Squid daemon [ NOT FOUND ] [+] Logging and files ------------------------------------ - Checking for a running log daemon [ OK ] - Checking Syslog-NG status [ NOT FOUND ] - Checking systemd journal status [ FOUND ] - Checking Metalog status [ NOT FOUND ] - Checking RSyslog status [ FOUND ] - Checking RFC 3195 daemon status [ NOT FOUND ] - Checking minilogd instances [ NOT FOUND ] - Checking wazuh-agent daemon status [ NOT FOUND ] - Checking logrotate presence [ OK ] - Checking remote logging [ NOT ENABLED ] - Checking log directories (static list) [ DONE ] - Checking open log files [ DONE ] - Checking deleted files in use [ DONE ] [+] Insecure services ------------------------------------ - Installed inetd package [ NOT FOUND ] - Installed xinetd package [ OK ] - xinetd status [ NOT ACTIVE ] - Installed rsh client package [ OK ] - Installed rsh server package [ OK ] - Installed telnet client package [ OK ] - Installed telnet server package [ NOT FOUND ] - Checking NIS client installation [ OK ] - Checking NIS server installation [ OK ] - Checking TFTP client installation [ OK ] - Checking TFTP server installation [ OK ] [+] Banners and identification ------------------------------------ - /etc/issue [ FOUND ] - /etc/issue contents [ WEAK ] - /etc/issue.net [ FOUND ] - /etc/issue.net contents [ WEAK ] [+] Scheduled tasks ------------------------------------ - Checking crontab and cronjob files [ DONE ] - Checking atd status [ RUNNING ] - Checking at users [ DONE ] - Checking at jobs [ NONE ] [+] Accounting ------------------------------------ - Checking accounting information [ NOT FOUND ] - Checking sysstat accounting data [ DISABLED ] - Checking auditd [ NOT FOUND ] [+] Time and Synchronization ------------------------------------ - NTP daemon found: systemd (timesyncd) [ FOUND ] - Checking for a running NTP daemon or client [ OK ] - Last time synchronization [ 217s ] [+] Cryptography ------------------------------------ - Checking for expired SSL certificates [0/123] [ NONE ] - Found 0 encrypted and 0 unencrypted swap devices in use. [ OK ] - Kernel entropy is sufficient [ YES ] - HW RNG & rngd [ NO ] - SW prng [ NO ] - MOR variable not found [ WEAK ] [+] Virtualization ------------------------------------ [+] Containers ------------------------------------ [+] Security frameworks ------------------------------------ - Checking presence AppArmor [ FOUND ] - Checking AppArmor status [ ENABLED ] Found 32 unconfined processes - Checking presence SELinux [ NOT FOUND ] - Checking presence TOMOYO Linux [ NOT FOUND ] - Checking presence grsecurity [ NOT FOUND ] - Checking for implemented MAC framework [ OK ] [+] Software: file integrity ------------------------------------ - Checking file integrity tools - dm-integrity (status) [ DISABLED ] - dm-verity (status) [ DISABLED ] - Checking presence integrity tool [ NOT FOUND ] [+] Software: System tooling ------------------------------------ - Checking automation tooling - Automation tooling [ NOT FOUND ] - Checking presence of Fail2ban [ FOUND ] 2026-11-18 22:06:41,284 fail2ban.configreader [62466]: WARNING 'allowipv6' not defined in 'Definition'. Using default one: 'auto' - Checking Fail2ban jails [ ENABLED ] - Checking for IDS/IPS tooling [ FOUND ] [+] Software: Malware ------------------------------------ - Malware software components [ NOT FOUND ] [+] File Permissions ------------------------------------ - Starting file permissions check File: /boot/grub/grub.cfg [ OK ] File: /etc/at.deny [ SUGGESTION ] File: /etc/crontab [ SUGGESTION ] File: /etc/group [ OK ] File: /etc/group- [ OK ] File: /etc/hosts.allow [ OK ] File: /etc/hosts.deny [ OK ] File: /etc/issue [ OK ] File: /etc/issue.net [ OK ] File: /etc/passwd [ OK ] File: /etc/passwd- [ OK ] File: /etc/ssh/sshd_config [ SUGGESTION ] Directory: /root/.ssh [ OK ] Directory: /etc/cron.d [ SUGGESTION ] Directory: /etc/cron.daily [ SUGGESTION ] Directory: /etc/cron.hourly [ SUGGESTION ] Directory: /etc/cron.weekly [ SUGGESTION ] Directory: /etc/cron.monthly [ SUGGESTION ] [+] Home directories ------------------------------------ - Permissions of home directories [ OK ] - Ownership of home directories [ OK ] - Checking shell history files [ OK ] [+] Kernel Hardening ------------------------------------ - Comparing sysctl key pairs with scan profile - dev.tty.ldisc_autoload (exp: 0) [ DIFFERENT ] - fs.protected_fifos (exp: 2) [ DIFFERENT ] - fs.protected_hardlinks (exp: 1) [ OK ] - fs.protected_regular (exp: 2) [ OK ] - fs.protected_symlinks (exp: 1) [ OK ] - fs.suid_dumpable (exp: 0) [ DIFFERENT ] - kernel.core_uses_pid (exp: 1) [ DIFFERENT ] - kernel.ctrl-alt-del (exp: 0) [ OK ] - kernel.dmesg_restrict (exp: 1) [ OK ] - kernel.kptr_restrict (exp: 2) [ DIFFERENT ] - kernel.modules_disabled (exp: 1) [ DIFFERENT ] - kernel.perf_event_paranoid (exp: 2 3 4) [ OK ] - kernel.randomize_va_space (exp: 2) [ OK ] - kernel.sysrq (exp: 0) [ DIFFERENT ] - kernel.unprivileged_bpf_disabled (exp: 1) [ DIFFERENT ] - kernel.yama.ptrace_scope (exp: 1 2 3) [ OK ] - net.core.bpf_jit_harden (exp: 2) [ DIFFERENT ] - net.ipv4.conf.all.accept_redirects (exp: 0) [ OK ] - net.ipv4.conf.all.accept_source_route (exp: 0) [ OK ] - net.ipv4.conf.all.bootp_relay (exp: 0) [ OK ] - net.ipv4.conf.all.forwarding (exp: 0) [ OK ] - net.ipv4.conf.all.log_martians (exp: 1) [ DIFFERENT ] - net.ipv4.conf.all.mc_forwarding (exp: 0) [ OK ] - net.ipv4.conf.all.proxy_arp (exp: 0) [ OK ] - net.ipv4.conf.all.rp_filter (exp: 1) [ DIFFERENT ] - net.ipv4.conf.all.send_redirects (exp: 0) [ DIFFERENT ] - net.ipv4.conf.default.accept_redirects (exp: 0) [ OK ] - net.ipv4.conf.default.accept_source_route (exp: 0) [ DIFFERENT ] - net.ipv4.conf.default.log_martians (exp: 1) [ DIFFERENT ] - net.ipv4.icmp_echo_ignore_broadcasts (exp: 1) [ OK ] - net.ipv4.icmp_ignore_bogus_error_responses (exp: 1) [ OK ] - net.ipv4.tcp_syncookies (exp: 1) [ OK ] - net.ipv4.tcp_timestamps (exp: 0 1) [ OK ] - net.ipv6.conf.all.accept_redirects (exp: 0) [ OK ] - net.ipv6.conf.all.accept_source_route (exp: 0) [ OK ] - net.ipv6.conf.default.accept_redirects (exp: 0) [ OK ] - net.ipv6.conf.default.accept_source_route (exp: 0) [ OK ] [+] Hardening ------------------------------------ - Installed compiler(s) [ NOT FOUND ] - Installed malware scanner [ NOT FOUND ] - Non-native binary formats [ FOUND ] [+] Custom tests ------------------------------------ - Running custom tests...  [ NONE ] [+] Plugins (phase 2) ------------------------------------ ================================================================================ -[ Lynis 3.1.7 Results ]- Great, no warnings No suggestions ================================================================================ Lynis security scan details: Scan mode: Normal [▆] Forensics [ ] Integration [ ] Pentest [ ] Lynis modules: - Compliance status [?] - Security audit [V] - Vulnerability scan [V] Details: Hardening index : 62 [############ ] Tests performed : 258 Plugins enabled : 0 Software components: - Firewall [V] - Intrusion software [V] - Malware scanner [X] Files: - Test and debug information : /dev/null - Report data : /tmp/shb-audit/report.dat ================================================================================ Lynis 3.1.7 Auditing, system hardening, and compliance for UNIX-based systems (Linux, macOS, BSD, and others) 2007-2025, CISOfy - https://cisofy.com/lynis/ Enterprise support available (compliance, plugins, interface and tools) ================================================================================ [TIP]: Enhance Lynis audits by adding your settings to custom.prf (see /tmp/shb-audit/lynis/default.prf for all settings) ------------------------------------------------------------------------------ nmap: its full screen before the first step ------------------------------------------------------------------------------ Starting Nmap 7.94SVN ( https://nmap.org ) at 2026-11-18 22:01 UTC Nmap scan report for 203.0.113.10 Host is up, received user-set (0.036s latency). Not shown: 999 filtered tcp ports (no-response) PORT STATE SERVICE REASON 22/tcp open ssh syn-ack Nmap done: 1 IP address (1 host up) scanned in 7.18 seconds ------------------------------------------------------------------------------ nmap: its full screen after the last step ------------------------------------------------------------------------------ Starting Nmap 7.94SVN ( https://nmap.org ) at 2026-11-18 22:06 UTC Nmap scan report for 203.0.113.10 Host is up, received user-set (0.036s latency). Not shown: 999 filtered tcp ports (no-response) PORT STATE SERVICE REASON 22/tcp open ssh syn-ack Nmap done: 1 IP address (1 host up) scanned in 5.02 seconds ------------------------------------------------------------------------------ The check's source (scripts/live/checks/fail2ban-ubuntu.mjs) As it ran. ------------------------------------------------------------------------------ /** * KB: Install fail2ban on Ubuntu 26.04 and 24.04 and protect SSH (ban, unban, whitelist your own address). Run per * release. Proof standard v2 (2026-11-18): on the rented server, with Lynis and nmap from a second server around the * steps (the bot computers stay network namespaces ON the server, so the runner's own address is never banned). * * The server is a fresh VM box with the UFW firewall from the ufw article already on (OpenSSH allowed), reached as the * sudo user `deploy`. The failed logins come from two OTHER computers on the server's network: network namespaces on * the VM, each joined to the server by its own virtual cable. The server's end of both cables is 203.0.113.10, so the * other computers type exactly what the article shows (`ssh admin@203.0.113.10`). "bot" is 198.51.100.2 (gets * banned); "office" is 192.0.2.2 (the reader's own address, whitelisted later). Their packets go through the server's * real kernel, nftables and ufw, and sshd logs them as remote logins, so fail2ban sees exactly what it sees on a VPS; * and the runner's own address is never banned. Every claim below is one the article makes. */ import { bareBox, reportBox } from '../lib.mjs' import { maskStrangerAddresses } from '../box.mjs' export const meta = { audits: ['lynis', 'nmap'], // The reader's check-your-server script (plan05 phase 3): proved by the runner on the stock server and after the steps. reader: [ { item: "fail2ban is running", cmd: "systemctl is-active fail2ban", expect: "^active$", step: "step-1-install" }, { item: "the sshd jail is on", cmd: "sudo fail2ban-client status sshd", expect: "Status for the jail: sshd", step: "step-3-defaults" }, ], } const RELEASE = process.env.LIVE_BOX_RELEASE || '24.04' const SERVER = '203.0.113.10' const BOT = '198.51.100.2' const OFFICE = '192.0.2.2' const sleep = (ms) => Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms) /** The ssh a reader's other computer runs (key-less, so the server says "Permission denied (publickey)"). */ const SSH_FLAGS = '-o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=5' const check = (ctx) => bareBox(ctx, async ({ sudoUser }) => { // a public server is found by bots within minutes; their addresses must not reach a run file or a page maskStrangerAddresses() const { run, L } = sudoUser() const other = (ns, cmd) => L(`sudo ip netns exec ${ns} ${cmd} 2>&1`) const tryLogin = (ns) => other(ns, `ssh ${SSH_FLAGS} admin@${SERVER} true`).split('\n').pop() // ── setup: the firewall from the ufw article, and the two other computers ───────────────── L('sudo ufw allow OpenSSH >/dev/null && sudo ufw --force enable >/dev/null') for (const [ns, addr] of [['bot', BOT], ['office', OFFICE]]) { L( [ `sudo ip netns add ${ns}`, `sudo ip link add v-${ns} type veth peer name eth0 netns ${ns}`, `sudo ip addr add ${SERVER} peer ${addr} dev v-${ns}`, `sudo ip link set v-${ns} up`, `sudo ip netns exec ${ns} ip addr add ${addr} peer ${SERVER} dev eth0`, `sudo ip netns exec ${ns} ip link set eth0 up`, `sudo ip netns exec ${ns} ip link set lo up`, ].join(' && '), ) } // the office address is used for the reachability test: a failed login from the bot would count as one of its five const reach = tryLogin('office') ctx.check('(setup) the other computer reaches the server’s SSH and is refused a login (no key)', /Permission denied \(publickey(,password)?\)/.test(reach), reach) // ── before you start ───────────────────────────────────────────────────────────────────── const ufw = run('sudo ufw status', { id: 'ufw-start' }) ctx.check('the starting server has ufw on with SSH allowed', /^Status: active$/m.test(ufw.out) && /OpenSSH\s+ALLOW/.test(ufw.out), ufw.out) // ── step 1: install ────────────────────────────────────────────────────────────────────── const upd = run('sudo apt update', { id: 'apt-update', timeout: 600000 }) ctx.check('apt update reads the package lists', upd.exit === 0 && /Reading package lists|can be upgraded|All packages are up to date/.test(upd.out), upd.out.slice(-400)) const inst = run('sudo apt install -y fail2ban', { id: 'apt-install', timeout: 900000 }) ctx.check('apt install -y fail2ban installs it', inst.exit === 0 && /Setting up fail2ban/.test(inst.out), inst.out.slice(-600)) if (RELEASE === '24.04') ctx.check('it pulls in python3-pyasyncore (the module Python 3.12 no longer ships)', /python3-pyasyncore/.test(inst.out), inst.out.slice(0, 600)) const st = run('sudo systemctl status fail2ban --no-pager', { id: 'service-status' }) ctx.check('the service is enabled and active (running) straight after install', /enabled;/.test(st.out) && /Active: active \(running\)/.test(st.out), st.out) const pol = run('apt-cache policy fail2ban', { id: 'policy' }) if (RELEASE === '24.04') ctx.check('the installed version is the fixed update 1.0.2-3ubuntu0.1, not the release’s 1.0.2-3', /Installed: 1\.0\.2-3ubuntu0\.1/.test(pol.out), pol.out) else ctx.check('apt-cache policy shows the installed version', /Installed: \d/.test(pol.out), pol.out) // ── step 2: what Ubuntu turns on ───────────────────────────────────────────────────────── const deb = run('cat /etc/fail2ban/jail.d/defaults-debian.conf', { id: 'defaults-debian' }) ctx.check('Ubuntu enables the sshd jail, reads the systemd journal and bans with nftables', /^\[sshd\]$/m.test(deb.out) && /^enabled = true$/m.test(deb.out) && /^backend = systemd$/m.test(deb.out) && /^banaction = nftables$/m.test(deb.out), deb.out) const jails = run('sudo fail2ban-client status', { id: 'client-status' }) ctx.check('fail2ban-client status lists one jail: sshd', /Number of jail:\s+1/.test(jails.out) && /Jail list:\s+sshd/.test(jails.out), jails.out) const conf = run(`sudo fail2ban-client get sshd maxretry && sudo fail2ban-client get sshd findtime && sudo fail2ban-client get sshd bantime`, { id: 'get-defaults' }) ctx.check('the defaults: 5 tries in 600 s (10 min) gets a 600 s (10 min) ban', /^5\n600\n600$/.test(conf.out), conf.out) // ── step 3: watch it ban ───────────────────────────────────────────────────────────────── const tries = [] // sshd 10 may drop a connection from an address that keeps failing, so count what fail2ban counted, not the tries for (let i = 0; i < 12; i++) { const t = tryLogin('bot') tries.push(t) if (/Connection refused/.test(t)) break sleep(1000) } ctx.check('the bot’s tries are refused at the login (or dropped by sshd) until the ban', /Permission denied/.test(tries[0]) && !tries.some((t) => /Welcome|\$ /.test(t)), tries.join('\n')) sleep(3000) const inv = run(`sudo journalctl -u ssh --no-pager | grep 'Invalid user' | tail -n 2`, { id: 'invalid-user' }) ctx.check('sshd logs each try as "Invalid user admin from 198.51.100.2"', new RegExp(`Invalid user admin from ${BOT.replace(/\./g, '\\.')} port \\d+`).test(inv.out), inv.out) const jail = run('sudo fail2ban-client status sshd', { id: 'jail-banned' }) ctx.check('after 5 failures the sshd jail has banned 198.51.100.2', new RegExp(`Banned IP list:[^\\n]*${BOT.replace(/\./g, '\\.')}`).test(jail.out), jail.out) const banlog = run(`sudo grep 'Ban ' /var/log/fail2ban.log`, { id: 'ban-log' }) ctx.check('/var/log/fail2ban.log: NOTICE [sshd] Ban 198.51.100.2', /NOTICE\s+\[sshd\] Ban 198\.51\.100\.2/.test(banlog.out), banlog.out) const refused = tryLogin('bot') ctx.capture(`ssh admin@${SERVER}`, refused, { id: 'banned-ssh' }) ctx.check('the banned computer now gets "Connection refused" (not a login prompt)', /ssh: connect to host 203\.0\.113\.10 port 22: Connection refused/.test(refused), refused) const nft = run('sudo nft list table inet f2b-table', { id: 'nft-table' }) ctx.check('the ban is an nftables set with a reject rule at priority filter - 1, before ufw’s rules', /elements = \{[^}]*198\.51\.100\.2/.test(nft.out) && /hook input priority filter - 1/.test(nft.out) && /reject with icmp port-unreachable/.test(nft.out), nft.out) const ufwStill = run('sudo ufw status', { id: 'ufw-during-ban' }) ctx.check('ufw still lists SSH as allowed: the ban is not a ufw rule', /OpenSSH\s+ALLOW/.test(ufwStill.out) && !/198\.51/.test(ufwStill.out), ufwStill.out) const mine = run('whoami', { id: 'still-me' }) ctx.check('your own login is not affected (only the failing address is banned)', /deploy$/.test(mine.out), mine.out) // ── step 4: unban ──────────────────────────────────────────────────────────────────────── const unban = run(`sudo fail2ban-client set sshd unbanip ${BOT}`, { id: 'unban' }) ctx.check('fail2ban-client set sshd unbanip prints 1 (one address unbanned)', unban.out.split('\n').pop() === '1', unban.out) const back = tryLogin('bot') ctx.capture(`ssh admin@${SERVER}`, back, { id: 'unbanned-ssh' }) ctx.check('the unbanned computer reaches sshd again at once', /Permission denied \(publickey(,password)?\)/.test(back), back) // ── step 5: your own settings in jail.local (never jail.conf) ──────────────────────────── const head = run(`grep -n 'YOU SHOULD NOT MODIFY' /etc/fail2ban/jail.conf`, { id: 'do-not-modify' }) ctx.check('jail.conf itself says YOU SHOULD NOT MODIFY THIS FILE', /YOU SHOULD NOT MODIFY THIS FILE/.test(head.out), head.out) L(`printf '%s\\n' '[DEFAULT]' 'ignoreip = 127.0.0.1/8 ::1 ${OFFICE}' 'bantime = 1h' | sudo tee /etc/fail2ban/jail.local >/dev/null`) const local = run('cat /etc/fail2ban/jail.local', { id: 'jail-local' }) ctx.check('(the jail.local file is exactly as the article shows it)', local.out === `[DEFAULT]\nignoreip = 127.0.0.1/8 ::1 ${OFFICE}\nbantime = 1h`, local.out) const reload = run('sudo fail2ban-client reload', { id: 'reload' }) ctx.check('fail2ban-client reload prints OK', /^OK$/m.test(reload.out), reload.out) const got = run('sudo fail2ban-client get sshd bantime && sudo fail2ban-client get sshd ignoreip', { id: 'get-local' }) ctx.check('the sshd jail now has a 3600 s ban and ignores 192.0.2.2', /^3600$/m.test(got.out) && /192\.0\.2\.2/.test(got.out), got.out) for (let i = 0; i < 6; i++) tryLogin('office') sleep(3000) const ign = run(`sudo grep 'Ignore ${OFFICE}' /var/log/fail2ban.log | tail -n 1`, { id: 'ignore-log' }) ctx.check('6 failed tries from the whitelisted address: fail2ban logs "Ignore 192.0.2.2 by ip"', /\[sshd\] Ignore 192\.0\.2\.2 by ip/.test(ign.out), ign.out) const after = run('sudo fail2ban-client status sshd', { id: 'jail-after-ignore' }) ctx.check('…and does not ban it', !/Banned IP list:[^\n]*192\.0\.2\.2/.test(after.out), after.out) const officeIn = tryLogin('office') ctx.check('(the whitelisted computer still reaches sshd)', /Permission denied \(publickey(,password)?\)/.test(officeIn), officeIn) const act = L('systemctl is-active fail2ban') ctx.check('(fail2ban is running at the end of the steps)', act === 'active', act, { reader: { cmd: 'systemctl is-active fail2ban', expect: '^active$' } }) const js = L('sudo fail2ban-client status sshd') ctx.check('(the sshd jail is on)', /Status for the jail: sshd/.test(js), js, { reader: { cmd: 'sudo fail2ban-client status sshd', expect: 'Status for the jail: sshd' }, }) ctx.stepsDone() // the article's steps end here; troubleshooting (24.04) and the undo follow reportBox( ctx, L, `A fresh Ubuntu ${RELEASE} server (a rented cloud server) with the UFW firewall on (SSH allowed), reached over SSH as a sudo user. The failed logins came from two other computers on its network, 198.51.100.2 and 192.0.2.2.`, ['fail2ban', 'python3', 'nftables', 'openssh-server'], ) // ── troubleshooting: the release package, "No module named 'asynchat'" ────────────────── // reproduce what an early 24.04 server has: the package from the release pocket (noble), before the fix. // 24.04 only: the bug and its fix are that release's. if (RELEASE === '24.04') { L('sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --allow-downgrades fail2ban=1.0.2-3 >/dev/null 2>&1; sudo systemctl restart fail2ban; sleep 3') const broken = run('sudo systemctl is-active fail2ban', { id: 'broken-active' }) ctx.check('with the release package 1.0.2-3 the service does not start', /^(failed|activating|inactive)$/m.test(broken.out), broken.out) const err = run(`sudo journalctl -u fail2ban --no-pager | grep asynchat | tail -n 1`, { id: 'asynchat' }) ctx.check('its log says: ERROR No module named \'asynchat\'', /ERROR\s+No module named 'asynchat'/.test(err.out), err.out) const pol2 = run('apt-cache policy fail2ban', { id: 'policy-broken' }) ctx.check('apt-cache policy shows 1.0.2-3 installed and the fixed 1.0.2-3ubuntu0.1 as the candidate', /Installed: 1\.0\.2-3\n/.test(pol2.out) && /Candidate: 1\.0\.2-3ubuntu0\.1/.test(pol2.out), pol2.out) const fix = run('sudo apt update && sudo apt install -y fail2ban', { id: 'fix-install', timeout: 900000 }) ctx.check('apt update + apt install fail2ban installs the fixed version', fix.exit === 0 && /Unpacking fail2ban \(1\.0\.2-3ubuntu0\.1\)/.test(fix.out), fix.out.slice(-600)) const ok = run('sudo systemctl is-active fail2ban', { id: 'fixed-active' }) ctx.check('fail2ban is active again, and jail.local was kept', ok.out.split('\n').pop() === 'active' && /3600/.test(L('sudo fail2ban-client get sshd bantime')), ok.out) } // ── undo ───────────────────────────────────────────────────────────────────────────────── const stop = run('sudo systemctl disable --now fail2ban', { id: 'disable' }) ctx.check('systemctl disable --now stops fail2ban and keeps it off after a reboot', stop.exit === 0 && /Removed/.test(stop.out), stop.out) const tables = run('sudo nft list tables', { id: 'nft-tables-after' }) ctx.check('stopping fail2ban removes its nftables table (no ban is left behind)', !/f2b-table/.test(tables.out), tables.out) }) export default check