Skip to content

Instantly share code, notes, and snippets.

@niclaslindstedt
Last active November 8, 2022 07:34
Show Gist options
  • Save niclaslindstedt/fd6e2249cebbe6c9c1d091d3fc417590 to your computer and use it in GitHub Desktop.
Save niclaslindstedt/fd6e2249cebbe6c9c1d091d3fc417590 to your computer and use it in GitHub Desktop.
SSH Server Hardening
# Add this in /etc/ssh/sshd_config.d/00-hardening.conf
# Then type sudo service sshd reload
Protocol 2
Port 2222
PermitRootLogin no
MaxAuthTries 3
LoginGraceTime 20
PasswordAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
KerberosAuthentication no
GSSAPIAuthentication no
X11Forwarding no
PermitUserEnvironment no
AllowAgentForwarding no
AllowTcpForwarding no
PermitTunnel no
DebianBanner no
AllowUsers *@192.168.0.0/16
HostKey /etc/ssh/ssh_host_ed25519_key
HostKey /etc/ssh/ssh_host_rsa_key
KexAlgorithms curve25519-sha256@libssh.org
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment