SSH là cửa chính của server, nên hãy khoá cho chặt.
Cấu hình sshd_config
# /etc/ssh/sshd_config.d/99-hardening.conf
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
MaxAuthTries 3
AllowUsers deploy
Kiểm tra cú pháp rồi reload:
sudo sshd -t && sudo systemctl reload ssh
Fail2ban
sudo apt install fail2ban
sudo systemctl enable --now fail2ban
⚠️ Luôn giữ một phiên SSH đang mở khi thử cấu hình mới để tránh tự khoá mình.