SSH ist der wichtigste Zugangspunkt und das haeufigste Angriffsziel. Eine korrekte Absicherung ist der erste Schritt.
Schluessel¶
ssh-keygen -t ed25519 -C ‘admin@server’ ssh-copy-id user@server
sshd-Konfiguration¶
PasswordAuthentication no PermitRootLogin no AllowUsers admin deploy Port 2222 MaxAuthTries 3 KexAlgorithms curve25519-sha256 Ciphers [email protected],[email protected]
Fail2ban¶
sudo apt install fail2ban
/etc/fail2ban/jail.local¶
[sshd] enabled = true maxretry = 3 bantime = 3600
Weiteres¶
- 2FA — Google Authenticator PAM
- Port Knocking — knockd
- Firewall — SSH nur von vertrauenswuerdigen IPs
- SSH CA anstelle von Schluesselverteilung
SSH-Hardening ist Pflicht¶
Minimum: Schluessel, Passwoerter deaktivieren, Root deaktivieren, fail2ban.