Last active
May 20, 2020 06:24
-
-
Save cseelye/94fa74f49545063bf8f3cb3ab5781c8f to your computer and use it in GitHub Desktop.
Secure SSHD config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# To use this on your own server, change the port and username to what you wish to use and deploy the public key for that user onto your SSH server. | |
# Make sure to leave at least one SSH session open while you test this! | |
# | |
# Run on a custom port | |
Port 54321 | |
# Restrict user access to the minimum | |
PermitRootLogin no | |
AllowUsers username | |
# Disable less secure protocols | |
Protocol 2 | |
IgnoreRhosts yes | |
RhostsRSAAuthentication no | |
HostbasedAuthentication no | |
KexAlgorithms [email protected],diffie-hellman-group-exchange-sha256 | |
Ciphers [email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr | |
MACs [email protected],[email protected],[email protected],[email protected],hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,[email protected] | |
# Kick out idle clients | |
ClientAliveInterval 300 | |
ClientAliveCountMax 0 | |
LoginGraceTime 10 | |
MaxAuthTries 1 | |
MaxStartups 3 | |
TCPKeepAlive yes | |
# Restrict user settings | |
PermitUserEnvironment no | |
PermitUserRC no | |
# Only allow clients with pubkey | |
PermitEmptyPasswords no | |
PasswordAuthentication no | |
ChallengeResponseAuthentication no | |
GSSAPIAuthentication no | |
PubkeyAuthentication yes | |
# Turn off unneeded features | |
AllowTcpForwarding no | |
AllowStreamLocalForwarding no | |
X11Forwarding no | |
AllowAgentForwarding no | |
#UseRoaming no | |
UsePrivilegeSeparation sandbox | |
StrictModes yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment