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 [email protected]
Ciphers [email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr
MACs [email protected],[email protected],[email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment