VPS & Server audit fixes
SSH & Access: fixing all 11 checks
The SSH and access audit reads sshd_config, the sudoers files and every account home to establish who can open a session on this box and how much privilege they hold once they are in.
Three conditions skip a check here: /etc/ssh/sshd_config being unreadable, which takes out six of the config checks at once, /etc/login.defs being unreadable, which takes out Password Ageing, and no root, which stops the sudoers scan behind Passwordless Sudo Rules. SSH Authorized Keys never skips, it quietly narrows to the account homes the audit user can read and appends "readable homes only" to the result, so a low key count under an unprivileged run is not the whole picture.
Transcribed from the vps-security-ssh-access audit script. For what the audit covers rather than how to fix it, see the SSH & Access checklist.
Find your finding
Listed in the order the audit runs them. Take the check name from the third field of the result line and open its page.
SSH Root Login
SoonChecks the effective sshd PermitRootLogin setting for direct root access over SSH
HighNo root4 resultsSSH Password Auth
SoonChecks whether sshd still accepts password authentication instead of keys only
MediumNo root3 resultsSSH Port
SoonChecks whether sshd listens on the default port 22, which attracts constant brute-force noise
LowNo root3 resultsSSH Idle Timeout
SoonChecks the ClientAliveInterval and ClientAliveCountMax pair that drops idle SSH sessions
LowNo root3 resultsSSH Authorized Keys
SoonChecks every account home for authorized_keys files, counting keys and flagging group- or world-writable ones
HighNeeds root3 resultsExtra Root Accounts
SoonChecks for accounts other than root holding UID 0, using getent so LDAP-backed accounts are covered
HighNo root2 resultsSudo Group Members
SoonChecks who belongs to the sudo, wheel and admin groups, including primary-group membership
MediumNo root2 resultsPasswordless Sudo Rules
SoonChecks sudoers for NOPASSWD rules, separating blanket ALL grants from command-scoped ones
MediumNeeds root4 resultsSSH Login Restrictions
SoonEmpty passwords, retry ceiling and the SSH account allow-list
HighNo root4 resultsSSH Crypto Algorithms
SoonKey exchange, cipher and MAC algorithms offered by sshd
MediumNo root4 resultsPassword Ageing
SoonPassword expiry policy in /etc/login.defs
LowNo root3 results
How the SSH & Access audit reads your server
Every check in this audit runs after the same preamble, and several of its results only make sense once you know what that preamble could and could not see.
How sshd settings are read. The script does not run sshd -T. It parses /etc/ssh/sshd_config and, if the file contains an Include directive, the included files first (the same first-match-wins order sshd uses). sshval <keyword> returns the first value found, case-insensitive. Every message carries the qualifier "(read from sshd_config - Include drop-ins are followed, Match blocks are not evaluated)". Consequences:
- A setting inside a
Match User/Group/Addressblock is ignored. Usesshd -T -C user=bob,host=x,addr=1.2.3.4to see effective values. - Ubuntu's
/etc/ssh/sshd_config.d/50-cloud-init.conf(PasswordAuthentication yes) is an Include and is followed, so it correctly overrides the main file. - Defaults assumed when nothing is set:
PermitRootLogin prohibit-password,PasswordAuthentication yes,Port 22,ClientAliveInterval 0,ClientAliveCountMax 3,PermitEmptyPasswords no,MaxAuthTries 6.
A SKIP is never a pass
A skipped check verified nothing at all. The most common cause is privilege: 2 of the 11 checks in this audit need root for a complete result. Before every run, each script works out which of four privilege modes it is in.
| Mode | How it is reached | What it means for your results |
|---|---|---|
root | The audit runs as UID 0. | Every privileged branch runs directly. No check skips for lack of permission. |
nopass | sudo -n true succeeds, so the account has passwordless sudo. | Privileged commands run through sudo -n. |
pass | A sudo password was supplied in the CtrlOps audit settings and accepted. | Privileged commands run through sudo -S. |
none | None of the above worked. | CAN_ROOT=0. Every privileged branch returns SKIP with a "Need root" message rather than guessing. |
If many checks skip with a “need root” message, run the audit as root, grant the audit account sudo (with or without NOPASSWD), or supply the sudo password in the CtrlOps audit settings.
SSH & Access questions
Run all 11 SSH & Access checks, in one click
CtrlOps runs this audit over your existing SSH connection - no agents, no scripts to manage. $7/user/month after a 1 month free trial - no credit card required.
✓ Start instantly·✓ No credit card·✓ No sneaky autorenewals