SSH Hardening Audit
Inspect sshd configuration for common risky settings without changing anything.
$ webtoolist --script failed-login-report
Summarise recent failed SSH logins by source address.
sshloginssecuritylogsDependencies: journalctl, awk, sort
#!/usr/bin/env bash
set -euo pipefail
since="${SINCE:-24 hours ago}"
echo "Failed SSH logins since: $since"
journalctl -u ssh -u sshd --since "$since" --no-pager 2>/dev/null \
| awk '/Failed password for/ {for (i=1;i<=NF;i++) if ($i=="from") print $(i+1)}' \
| sort | uniq -c | sort -rn | head -n 20
echo
echo "Accepted logins in the same window:"
journalctl -u ssh -u sshd --since "$since" --no-pager 2>/dev/null \
| awk '/Accepted (password|publickey) for/ {print $1, $2, $3, $9, $11}' \
| tail -n 20
sudo ./failed-login-report
SINCE='7 days ago' sudo ./failed-login-report
ssh; on RHEL-family systems it is sshd.Related scripts
Inspect sshd configuration for common risky settings without changing anything.
Find world-writable files and directories, excluding known-safe locations.
Run one command on a list of SSH hosts, sequentially, with clear output.
List systemd units that are failed or restarting, with recent log lines.