2024-07-01 15:36:36 -04:00
|
|
|
# Encryption hardening
|
2023-10-10 15:20:29 -04:00
|
|
|
HostKey /etc/ssh/ssh_host_ed25519_key
|
|
|
|
HostKeyAlgorithms ssh-ed25519
|
2024-07-01 15:36:36 -04:00
|
|
|
KexAlgorithms sntrup761x25519-sha512@openssh.com
|
2023-10-10 15:20:29 -04:00
|
|
|
PubkeyAcceptedKeyTypes ssh-ed25519
|
|
|
|
Ciphers aes256-gcm@openssh.com
|
|
|
|
MACs -*
|
2024-07-01 15:36:36 -04:00
|
|
|
|
2024-07-01 15:57:20 -04:00
|
|
|
# Security hardening
|
2024-07-01 17:03:54 -04:00
|
|
|
AuthenticationMethods publickey
|
2024-07-01 15:57:20 -04:00
|
|
|
AuthorizedKeysFile .ssh/authorized_keys
|
2024-07-01 16:42:21 -04:00
|
|
|
Compression no
|
|
|
|
DisableForwarding yes
|
2024-07-01 15:57:20 -04:00
|
|
|
LoginGraceTime 15s
|
|
|
|
MaxAuthTries 1
|
2024-07-01 17:03:54 -04:00
|
|
|
PermitUserEnvironment no
|
2024-07-01 16:42:21 -04:00
|
|
|
PermitUserRC no
|
2024-07-01 15:57:20 -04:00
|
|
|
StrictModes yes
|
2024-07-01 16:42:21 -04:00
|
|
|
UseDNS no
|
|
|
|
|
|
|
|
# Use KeepAlive over SSH instead of with TCP to prevent spoofing
|
|
|
|
TCPKeepAlive no
|
|
|
|
ClientAliveInterval 15
|
|
|
|
ClientAliveCountMax 4
|
2024-07-01 15:57:20 -04:00
|
|
|
|
|
|
|
## Use PAM for session checks here but authentication is disabled below
|
2024-07-01 16:42:21 -04:00
|
|
|
## Also, this prevents running sshd as non-root
|
2024-07-01 15:57:20 -04:00
|
|
|
UsePAM yes
|
|
|
|
|
2024-07-01 15:36:36 -04:00
|
|
|
# Disabling unused authentication methods
|
2024-07-01 15:57:20 -04:00
|
|
|
ChallengeResponseAuthentication no
|
2024-07-01 16:42:21 -04:00
|
|
|
GSSAPIAuthentication no
|
|
|
|
HostbasedAuthentication no
|
2024-02-13 18:05:52 -05:00
|
|
|
PasswordAuthentication no
|
2023-10-10 15:20:29 -04:00
|
|
|
PermitRootLogin no
|
2024-07-01 16:42:21 -04:00
|
|
|
PermitEmptyPasswords no
|
2024-07-01 15:57:20 -04:00
|
|
|
KbdInteractiveAuthentication no
|
2023-10-10 15:20:29 -04:00
|
|
|
KerberosAuthentication no
|
2024-07-01 15:36:36 -04:00
|
|
|
|
|
|
|
# Displaying info
|
|
|
|
Banner /etc/issue.net
|
|
|
|
PrintLastLog yes
|
|
|
|
PrintMotd yes
|