Skip to content

Instantly share code, notes, and snippets.

@tribou
Last active February 26, 2019 18:55
Show Gist options
  • Select an option

  • Save tribou/fcda8e6066776c9eaa47 to your computer and use it in GitHub Desktop.

Select an option

Save tribou/fcda8e6066776c9eaa47 to your computer and use it in GitHub Desktop.
sshd_config hardening
# Insert these at the beginning of an existing sshd_config file
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,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
Protocol 2
HostKey /etc/ssh/ssh_host_ed25519_key
HostKey /etc/ssh/ssh_host_rsa_key
PasswordAuthentication no
ChallengeResponseAuthentication no
PubkeyAuthentication yes
# Optional group restriction:
# AllowGroups groupname
# If using Tor hidden services:
# ListenAddress 127.0.0.1:22
#
# Also add this to /etc/tor/torrc
# HiddenServiceDir /var/lib/tor/hidden_service/ssh
# HiddenServicePort 22 127.0.0.1:22
# Generate server keys:
# cd /etc/ssh
# rm ssh_host_*key*
# ssh-keygen -t ed25519 -f ssh_host_ed25519_key < /dev/null
# ssh-keygen -t rsa -b 4096 -f ssh_host_rsa_key < /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment