ServerHandbook live check: run log ------------------------------------------------------------------------------ Article https://serverhandbook.com/kb/ssh-key-login-ubuntu Check scripts/live/checks/ssh-key-login-ubuntu.mjs (sha256 4968dbaf40b56f93db488e8d4246a57832555f1ba5fb25a8a4d891c8a667561f) Ran at 2026-11-15T13:51:16Z (244 s) Result PASS, all 24 claims held Tested on System Ubuntu 24.04.5 LTS Kernel 6.8.0-147-generic Package openssh-server 1:9.6p1-3ubuntu13.20 Package cloud-init 26.1-0ubuntu1~24.04.1 Setup A fresh Ubuntu 24.04 server from a provider that set a password (cloud-init turned SSH password login on), with the sudo user deploy. Your computer: Ubuntu 24.04.5 LTS, openssh-client 1:9.6p1-3ubuntu13.20. 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 (0) Packages upgraded (0) Packages removed (0) Services enabled at boot (0) Services disabled (0) Listening sockets opened (0) Listening sockets closed (0) Files added in /etc (1) /etc/ssh/sshd_config.d/00-keys-only.conf Files changed in /etc (0) Files removed from /etc (0) Disk used on / (includes logs written during the run): +15.3 MB ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Audit: Lynis 3.1.7, the whole server, before the first step and after the last ------------------------------------------------------------------------------ Hardening index 62 -> 62 (Lynis's own score for this server; not a certification) Warnings 2 -> 2 Suggestions 41 -> 41 Resolved by the steps (0) New after the steps (0) ------------------------------------------------------------------------------ Claims (24), each with what the run saw ------------------------------------------------------------------------------ 1. ok a bare Ubuntu 24.04 server box (web-server) starts 2. ok a fresh server from a provider that set a password has password login ON | To run a command as administrator (user "root"), use "sudo ". | See "man sudo_root" for details. | | passwordauthentication yes 3. ok 50-cloud-init.conf says yes and 60-cloudimg-settings.conf says no; sshd_config has only a commented line | /etc/ssh/sshd_config.d/60-cloudimg-settings.conf:PasswordAuthentication no | /etc/ssh/sshd_config.d/50-cloud-init.conf:PasswordAuthentication yes 4. ok sshd_config includes sshd_config.d/*.conf before its own settings | 12:Include /etc/ssh/sshd_config.d/*.conf (first setting on line 12) 5. ok SSH is socket-activated: ssh.socket and ssh.service both active | active | active 6. ok a fresh "your computer" machine (Ubuntu 24.04, openssh-client only) starts 7. ok (tested on) your computer reports its OS and OpenSSH client version | PRETTY_NAME="Ubuntu 24.04.5 LTS" | PKG openssh-client 1:9.6p1-3ubuntu13.20 8. ok ssh-keygen writes id_ed25519 and id_ed25519.pub | Generating public/private ed25519 key pair. | Enter file in which to save the key (/home/you/.ssh/id_ed25519): | Created directory '/home/you/.ssh'. | Enter passphrase (empty for no passphrase): | Enter same passphrase again: | Your identification has been saved in /home/you/.ssh/id_ed25519 | Your public key has been saved in /home/you/.ssh/id_ed25519.pub | The key fingerprint is: | SHA256:40pok/GYHXLQawlnU0HKHUmI/kabhQKQ53TQ4l4UxLo you@laptop | The key's randomart image is: | +--[ED25519 256]--+ | |.o.=oo +*o | | |. = *o.+.. | | | = Bo B.. | | | + +=o+. | | | . oo+*+S | | | E %=o . | | | B.+ . | | | . o . | | | . | | +----[SHA256]-----+ 9. ok the private key is -rw------- (600) and the public key -rw-r--r-- (644) | total 8 | -rw------- 1 you you 444 Nov 15 13:54 id_ed25519 | -rw-r--r-- 1 you you 92 Nov 15 13:54 id_ed25519.pub 10. ok ssh-copy-id reports "Number of key(s) added: 1" | /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/you/.ssh/id_ed25519.pub" | The authenticity of host '203.0.113.10 ([172.17.0.1]:2297)' can't be established. | ED25519 key fingerprint is SHA256:gfKdZX5E/AVvChGv4MYRn2fy6odCAEvq5DD1R1xj35s. | This key is not known by any other names. | Are you sure you want to continue connecting (yes/no/[fingerprint])? yes | /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed | /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys | deploy@203.0.113.10's password: | | Number of key(s) added: 1 | | Now try logging into the machine, with: "ssh 'deploy@203.0.113.10'" | and check to make sure that only the key(s) you wanted were added. 11. ok ssh now asks for the key passphrase, then opens a shell as deploy on web-server | Enter passphrase for key '/home/you/.ssh/id_ed25519': | Welcome to Ubuntu 24.04.5 LTS (GNU/Linux 6.8.0-147-generic x86_64) | | * Documentation: https://help.ubuntu.com | * Management: https://landscape.canonical.com | * Support: https://ubuntu.com/pro | | System information as of Sun Nov 15 13:54:02 UTC 2026 | | System load: 0.65 | Usage of /: 7.9% of 23.17GB | Memory usage: 10% | Swap usage: 0% | Processes: 128 | Users logged in: 0 | IPv4 address for enp0s2: 203.0.113.10 | IPv6 address for enp0s2: 2001:db8::10 | | | Expanded Security Maintenance for Applications is not enabled. | | 53 updates can be applied immediately. | 42 of these updates are standard security updates. | To see these additional updates run: apt list --upgradable | | Enable ESM Apps to receive additional future security updates. | See https://ubuntu.com/esm or run: sudo pro status | | New release '26.04.1 LTS' available. | Run 'do-release-upgrade' to upgrade to it. | | | Last login: Sun Nov 15 13:54:10 2026 from 203.0.113.1 | deploy@web-server:~$ exit | logout | Connection to 172.17.0.1 closed. 12. ok setting PasswordAuthentication no in sshd_config leaves it ON: 50-cloud-init.conf is read first | passwordauthentication yes 13. ok the drop-in is written | PasswordAuthentication no 14. ok sshd -t finds no error (prints nothing, exit 0) | 0 15. ok before the reload, the running sshd still accepts a password | deploy@203.0.113.10's password: 16. ok systemctl reload ssh succeeds on the socket-activated service 17. ok sshd -T now says passwordauthentication no | passwordauthentication no 18. ok a password login is refused: "Permission denied (publickey)." | deploy@172.17.0.1: Permission denied (publickey). 19. ok the key still logs in | Enter passphrase for key '/home/you/.ssh/id_ed25519': | passwordauthentication no 20. ok the server reboots | 13 21. ok after a reboot, password login is still refused | deploy@172.17.0.1: Permission denied (publickey). 22. ok the drop-in is in place | PasswordAuthentication no 23. ok undo: removing the drop-in and reloading turns password login back on | passwordauthentication yes 24. ok (tested on) the box reports its OS, kernel and the version of 2 package(s) | PRETTY_NAME="Ubuntu 24.04.5 LTS" | VIRT=none | KERNEL=6.8.0-147-generic | PKG cloud-init 26.1-0ubuntu1~24.04.1 | PKG openssh-server 1:9.6p1-3ubuntu13.20 ------------------------------------------------------------------------------ Commands and what they printed (19) ------------------------------------------------------------------------------ $ sudo sshd -T | grep -i "^passwordauthentication" To run a command as administrator (user "root"), use "sudo ". See "man sudo_root" for details. passwordauthentication yes $ sudo grep -ri "^passwordauthentication" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/ /etc/ssh/sshd_config.d/60-cloudimg-settings.conf:PasswordAuthentication no /etc/ssh/sshd_config.d/50-cloud-init.conf:PasswordAuthentication yes $ grep -n "^Include" /etc/ssh/sshd_config 12:Include /etc/ssh/sshd_config.d/*.conf $ systemctl is-active ssh.socket ssh.service active active $ ssh-keygen -t ed25519 Generating public/private ed25519 key pair. Enter file in which to save the key (/home/you/.ssh/id_ed25519): Created directory '/home/you/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/you/.ssh/id_ed25519 Your public key has been saved in /home/you/.ssh/id_ed25519.pub The key fingerprint is: SHA256:40pok/GYHXLQawlnU0HKHUmI/kabhQKQ53TQ4l4UxLo you@laptop The key's randomart image is: +--[ED25519 256]--+ |.o.=oo +*o | |. = *o.+.. | | = Bo B.. | | + +=o+. | | . oo+*+S | | E %=o . | | B.+ . | | . o . | | . | +----[SHA256]-----+ $ ls -l ~/.ssh/ total 8 -rw------- 1 you you 444 Nov 15 13:54 id_ed25519 -rw-r--r-- 1 you you 92 Nov 15 13:54 id_ed25519.pub $ ssh-copy-id deploy@203.0.113.10 /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/you/.ssh/id_ed25519.pub" The authenticity of host '203.0.113.10 ([172.17.0.1]:2297)' can't be established. ED25519 key fingerprint is SHA256:gfKdZX5E/AVvChGv4MYRn2fy6odCAEvq5DD1R1xj35s. This key is not known by any other names. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys deploy@203.0.113.10's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'deploy@203.0.113.10'" and check to make sure that only the key(s) you wanted were added. $ ssh deploy@203.0.113.10 Enter passphrase for key '/home/you/.ssh/id_ed25519': Welcome to Ubuntu 24.04.5 LTS (GNU/Linux 6.8.0-147-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/pro System information as of Sun Nov 15 13:54:02 UTC 2026 System load: 0.65 Usage of /: 7.9% of 23.17GB Memory usage: 10% Swap usage: 0% Processes: 128 Users logged in: 0 IPv4 address for enp0s2: 203.0.113.10 IPv6 address for enp0s2: 2001:db8::10 Expanded Security Maintenance for Applications is not enabled. 53 updates can be applied immediately. 42 of these updates are standard security updates. To see these additional updates run: apt list --upgradable Enable ESM Apps to receive additional future security updates. See https://ubuntu.com/esm or run: sudo pro status New release '26.04.1 LTS' available. Run 'do-release-upgrade' to upgrade to it. Last login: Sun Nov 15 13:54:10 2026 from 203.0.113.1 deploy@web-server:~$ exit logout Connection to 172.17.0.1 closed. $ sudo sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config && sudo systemctl reload ssh $ sudo sshd -T | grep -i "^passwordauthentication" passwordauthentication yes $ echo "PasswordAuthentication no" | sudo tee /etc/ssh/sshd_config.d/00-keys-only.conf PasswordAuthentication no $ sudo sshd -t $ (probe, not shown) password login before the reload deploy@203.0.113.10's password: $ sudo systemctl reload ssh $ sudo sshd -T | grep -i "^passwordauthentication" passwordauthentication no $ ssh -o PubkeyAuthentication=no deploy@203.0.113.10 deploy@172.17.0.1: Permission denied (publickey). $ ssh deploy@203.0.113.10 "sudo sshd -T | grep -i ^passwordauthentication" Enter passphrase for key '/home/you/.ssh/id_ed25519': passwordauthentication no $ ssh -o PubkeyAuthentication=no deploy@203.0.113.10 deploy@172.17.0.1: Permission denied (publickey). $ sudo rm /etc/ssh/sshd_config.d/00-keys-only.conf && sudo systemctl reload ssh && sudo sshd -T | grep -i "^passwordauthentication" passwordauthentication yes ------------------------------------------------------------------------------ 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...  [ UNKNOWN ] [+] 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 45 enabled services - Check startup files (permissions) [ OK ] - Running 'systemd-analyze security' Unit name (exposure value) and predicate -------------------------------- - ModemManager.service (value=6.3) [ MEDIUM ] - 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 ] - polkit.service (value=1.6) [ PROTECTED ] - 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-timedated.service (value=2.2) [ PROTECTED ] - systemd-timesyncd.service (value=2.1) [ PROTECTED ] - systemd-udevd.service (value=7.1) [ MEDIUM ] - tpm-udev.service (value=9.6) [ UNSAFE ] - ubuntu-advantage.service (value=9.6) [ UNSAFE ] - udisks2.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 52 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 [ WARNING ] - Permissions for: /etc/sudoers [ OK ] - Permissions for: /etc/sudoers.d/90-shb-automation [ OK ] - Permissions for: /etc/sudoers.d/README [ 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 [ SUGGESTION ] - Accounts without password [ OK ] - Locked accounts [ OK ] - 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 / [ NON DEFAULT ] - Mount options of /boot [ DEFAULT ] - Mount options of /dev [ PARTIALLY HARDENED ] - Mount options of /dev/shm [ PARTIALLY HARDENED ] - Mount options of /run [ HARDENED ] - Total without nodev:6 noexec:8 nosuid:4 ro or noexec (W^X): 8 of total 23 - Disable kernel support of some filesystems [+] USB Devices ------------------------------------ - Checking usb-storage driver (modprobe config) [ NOT DISABLED ] - Checking USB devices authorization [ DISABLED ] - 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 [ 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.d directory [ OK ] - Checking APT package database [ OK ] - Checking vulnerable packages [ WARNING ] [WARNING]: Test PKGS-7392 had a long execution: 106.147170 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 ] - Getting listening ports (TCP/UDP) [ DONE ] - Checking promiscuous interfaces [ 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: ACCEPT) [ ACCEPT ] - Chain INPUT (table: security, target: ACCEPT) [ ACCEPT ] - Checking for empty ruleset [ WARNING ] - Checking for unused rules [ OK ] - 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 ] [+] 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 [ 15s ] [+] Cryptography ------------------------------------ - Checking for expired SSL certificates [0/127] [ 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/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) [ DIFFERENT ] - 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) [ DIFFERENT ] - 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) [ DIFFERENT ] - net.ipv6.conf.all.accept_source_route (exp: 0) [ OK ] - net.ipv6.conf.default.accept_redirects (exp: 0) [ DIFFERENT ] - 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 : 253 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...  [ UNKNOWN ] [+] 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 45 enabled services - Check startup files (permissions) [ OK ] - Running 'systemd-analyze security' Unit name (exposure value) and predicate -------------------------------- - ModemManager.service (value=6.3) [ MEDIUM ] - 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 ] - polkit.service (value=1.6) [ PROTECTED ] - 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-timedated.service (value=2.2) [ PROTECTED ] - systemd-timesyncd.service (value=2.1) [ PROTECTED ] - systemd-udevd.service (value=7.1) [ MEDIUM ] - tpm-udev.service (value=9.6) [ UNSAFE ] - ubuntu-advantage.service (value=9.6) [ UNSAFE ] - udisks2.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 54 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 [ WARNING ] - Permissions for: /etc/sudoers [ OK ] - Permissions for: /etc/sudoers.d/90-shb-automation [ OK ] - Permissions for: /etc/sudoers.d/README [ 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 [ SUGGESTION ] - Accounts without password [ OK ] - Locked accounts [ OK ] - 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 / [ NON DEFAULT ] - Mount options of /boot [ DEFAULT ] - Mount options of /dev [ PARTIALLY HARDENED ] - Mount options of /dev/shm [ PARTIALLY HARDENED ] - Mount options of /run [ HARDENED ] - Total without nodev:6 noexec:8 nosuid:4 ro or noexec (W^X): 8 of total 23 - Disable kernel support of some filesystems [+] USB Devices ------------------------------------ - Checking usb-storage driver (modprobe config) [ NOT DISABLED ] - Checking USB devices authorization [ DISABLED ] - 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 [ 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.d directory [ OK ] - 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 ] - Getting listening ports (TCP/UDP) [ DONE ] - Checking promiscuous interfaces [ 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: ACCEPT) [ ACCEPT ] - Chain INPUT (table: security, target: ACCEPT) [ ACCEPT ] - Checking for empty ruleset [ WARNING ] - Checking for unused rules [ OK ] - 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 ] [+] 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 [ 5s ] [+] Cryptography ------------------------------------ - Checking for expired SSL certificates [0/127] [ 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/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) [ DIFFERENT ] - 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) [ DIFFERENT ] - 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) [ DIFFERENT ] - net.ipv6.conf.all.accept_source_route (exp: 0) [ OK ] - net.ipv6.conf.default.accept_redirects (exp: 0) [ DIFFERENT ] - 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 : 253 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) ------------------------------------------------------------------------------ The check's source (scripts/live/checks/ssh-key-login-ubuntu.mjs) As it ran. ------------------------------------------------------------------------------ /** * KB: Set up SSH key login on Ubuntu 26.04 and 24.04 and turn off password login. Run once per release * (`npm run live -- ssh-key-login-ubuntu --releases=26.04,24.04`); was ssh-key-login-ubuntu-24-04.mjs (git history). * Proof standard v2 (plan05 phase 1 pilot): the runner records the server before the first step and at * ctx.stepsDone(), and runs Lynis at both points (meta.audits). * * Two machines, as a reader has them: "your computer" (box/client.mjs, user `you`) makes the key and copies it; the * server (VM box, as a provider hands it over WITH a root password, so cloud-init has turned password login on) gets * password login switched off. The sudo user `deploy` has a password, as the "create a sudo user" article leaves it. * Every claim below is one the article makes. */ import { asRoot, rebootBox } from '../box.mjs' import { bareBox, reportBox, withClient } from '../lib.mjs' export const meta = { audits: ['lynis'] } const RELEASE = process.env.LIVE_BOX_RELEASE || '24.04' const SERVER = 'deploy@203.0.113.10' // throwaway test values for a box deleted after the run; shown as [password] in the published log const DEPLOY_PASSWORD = '[password]' // secret-scan: ok — throwaway test value, box deleted after the run const KEY_PHRASE = '[password]' const ROOT_PASSWORD = '[password]' // secret-scan: ok — throwaway test value, box deleted after the run const DROPIN = '/etc/ssh/sshd_config.d/00-keys-only.conf' const check = (ctx) => bareBox( ctx, async ({ sudoUser }) => { const { run, L } = sudoUser() const deployPw = ctx.secret(DEPLOY_PASSWORD) asRoot(`echo 'deploy:${deployPw}' | chpasswd`) const phrase = ctx.secret(KEY_PHRASE) // ── the starting point the article describes ───────────────────────────────────────────── const before = run('sudo sshd -T | grep -i "^passwordauthentication"', { id: 'pw-before' }) ctx.check('a fresh server from a provider that set a password has password login ON', /^passwordauthentication yes$/m.test(before.out), before.out) const who = run('sudo grep -ri "^passwordauthentication" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/', { id: 'which-file' }) ctx.check( '50-cloud-init.conf says yes and 60-cloudimg-settings.conf says no; sshd_config has only a commented line', /50-cloud-init\.conf:PasswordAuthentication yes/.test(who.out) && /60-cloudimg-settings\.conf:PasswordAuthentication no/.test(who.out) && !/sshd_config:PasswordAuthentication/.test(who.out), who.out, ) const inc = run('grep -n "^Include" /etc/ssh/sshd_config') // the line moved: 12 on 24.04, 24 on 26.04 (seen 2026-11-15); what matters is that it comes before any setting const firstSetting = Number(L(`grep -nvE '^[[:space:]]*(#|$)' /etc/ssh/sshd_config | head -1 | cut -d: -f1`)) const incLine = Number((/^(\d+):Include \/etc\/ssh\/sshd_config\.d\/\*\.conf$/m.exec(inc.out) ?? [])[1]) ctx.check('sshd_config includes sshd_config.d/*.conf before its own settings', incLine > 0 && incLine === firstSetting, `${inc.out} (first setting on line ${firstSetting})`) const sock = run('systemctl is-active ssh.socket ssh.service', { id: 'socket' }) ctx.check('SSH is socket-activated: ssh.socket and ssh.service both active', sock.out.split('\n').filter((l) => l.trim() === 'active').length === 2, sock.out) await withClient(ctx, async (pc) => { // ── step 1: make a key on your computer ─────────────────────────────────────────────── const kg = pc.ask( 'ssh-keygen -t ed25519', [ ['Enter file in which to save the key', ''], ['Enter passphrase', phrase], ['Enter same passphrase again', phrase], ], ) ctx.check('ssh-keygen writes id_ed25519 and id_ed25519.pub', kg.exit === 0 && /id_ed25519\.pub/.test(kg.out), kg.out) const perms = pc.run('ls -l ~/.ssh/') ctx.check('the private key is -rw------- (600) and the public key -rw-r--r-- (644)', /-rw------- .* id_ed25519\n/.test(perms.out + '\n') && /-rw-r--r-- .* id_ed25519\.pub/.test(perms.out), perms.out) // ── step 2: copy the public key to the server ───────────────────────────────────────── const cp = pc.ask(`ssh-copy-id ${SERVER}`, [ ['continue connecting', 'yes'], ['password:', deployPw], ]) ctx.check('ssh-copy-id reports "Number of key(s) added: 1"', /Number of key\(s\) added: 1/.test(cp.out), cp.out) // ── step 3: log in with the key (asks for the KEY's passphrase, not the server password) ── const li = pc.ask(`ssh ${SERVER}`, [ ['Enter passphrase for key', phrase], ['deploy@web-server:~\\$', 'exit'], ]) ctx.check('ssh now asks for the key passphrase, then opens a shell as deploy on web-server', /Enter passphrase for key/.test(li.out) && /deploy@web-server/.test(li.out) && !/deploy@203\.0\.113\.10's password/.test(li.out), li.out) // ── why editing sshd_config (what most guides say) does nothing here ───────────────── L(`sudo cp /etc/ssh/sshd_config /root/sshd_config.orig`) run(`sudo sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config && sudo systemctl reload ssh`, { id: 'wrong-edit' }) const wrong = run('sudo sshd -T | grep -i "^passwordauthentication"', { id: 'pw-after-wrong-edit' }) ctx.check('setting PasswordAuthentication no in sshd_config leaves it ON: 50-cloud-init.conf is read first', /^passwordauthentication yes$/m.test(wrong.out), wrong.out) L('sudo cp /root/sshd_config.orig /etc/ssh/sshd_config && sudo rm /root/sshd_config.orig && sudo systemctl reload ssh') // ── step 4: a drop-in that sorts first ──────────────────────────────────────────────── const w = run(`echo "PasswordAuthentication no" | sudo tee ${DROPIN}`) ctx.check('the drop-in is written', w.exit === 0 && /PasswordAuthentication no/.test(w.out), w.out) const t = run('sudo sshd -t') ctx.check('sshd -t finds no error (prints nothing, exit 0)', t.exit === 0 && t.out === '', `${t.exit} ${t.out}`) const pre = pc.ask(`ssh -o PubkeyAuthentication=no ${SERVER} true`, [['password:', deployPw]], { show: '(probe, not shown) password login before the reload' }) ctx.check('before the reload, the running sshd still accepts a password', pre.exit === 0, pre.out) const rl = run('sudo systemctl reload ssh') ctx.check('systemctl reload ssh succeeds on the socket-activated service', rl.exit === 0, rl.out) const after = run('sudo sshd -T | grep -i "^passwordauthentication"', { id: 'pw-after' }) ctx.check('sshd -T now says passwordauthentication no', /^passwordauthentication no$/m.test(after.out), after.out, { reader: { cmd: 'sudo sshd -T | grep -i "^passwordauthentication"', expect: '^passwordauthentication no$' }, }) // ── step 5: prove it, from a NEW session ───────────────────────────────────────────── const pw = pc.run(`ssh -o PubkeyAuthentication=no ${SERVER}`, { id: 'denied' }) ctx.check('a password login is refused: "Permission denied (publickey)."', pw.exit === 255 && /Permission denied \(publickey\)/.test(pw.out), pw.out) const ok = pc.ask(`ssh ${SERVER} "sudo sshd -T | grep -i ^passwordauthentication"`, [['Enter passphrase for key', phrase]], { id: 'key-still-works' }) ctx.check('the key still logs in', ok.exit === 0 && /passwordauthentication no/.test(ok.out), ok.out) // ── it survives a reboot (cloud-init does not rewrite it) ───────────────────────────── const secs = rebootBox() ctx.check('the server reboots', typeof secs === 'number', String(secs)) const pw2 = pc.run(`ssh -o PubkeyAuthentication=no ${SERVER}`, { id: 'denied-after-reboot' }) ctx.check('after a reboot, password login is still refused', pw2.exit === 255 && /Permission denied \(publickey\)/.test(pw2.out), pw2.out) const drop = L(`sudo cat ${DROPIN}`) ctx.check('the drop-in is in place', /^PasswordAuthentication no$/m.test(drop), drop, { reader: { cmd: `sudo cat ${DROPIN}`, expect: '^PasswordAuthentication no$' }, }) ctx.stepsDone() // ── undo ────────────────────────────────────────────────────────────────────────────── const u = run(`sudo rm ${DROPIN} && sudo systemctl reload ssh && sudo sshd -T | grep -i "^passwordauthentication"`, { id: 'undo' }) ctx.check('undo: removing the drop-in and reloading turns password login back on', /^passwordauthentication yes$/m.test(u.out), u.out) reportBox(ctx, L, `A fresh Ubuntu ${RELEASE} server from a provider that set a password (cloud-init turned SSH password login on), with the sudo user deploy. Your computer: ${pc.os}, openssh-client ${pc.openssh}.`, ['openssh-server', 'cloud-init']) }) }, { rootPassword: ROOT_PASSWORD }, ) export default check