More sshd hardening

This commit is contained in:
2023-02-27 04:21:58 +00:00
parent 2c9e5544d3
commit 344dd16cc4

View File

@ -11,7 +11,7 @@ Include /etc/ssh/sshd_config.d/*.conf
# / / -_) __/ |/|/ / _ \/ __/ '_// / _ \/ _ `/ # / / -_) __/ |/|/ / _ \/ __/ '_// / _ \/ _ `/
#/_/|_/\__/\__/|__,__/\___/_/ /_/\_\/_/_//_/\_, / #/_/|_/\__/\__/|__,__/\___/_/ /_/\_\/_/_//_/\_, /
# /___/ # /___/
#
Port 69 Port 69
#AddressFamily any #AddressFamily any
#ListenAddress 0.0.0.0 #ListenAddress 0.0.0.0
@ -22,7 +22,7 @@ Port 69
#/ /__/ // / _ \/ _ \/ -_) __(_-< > _/_ _/ / ,< / -_) // / / _ \/ _ `/ #/ /__/ // / _ \/ _ \/ -_) __(_-< > _/_ _/ / ,< / -_) // / / _ \/ _ `/
#\___/\_, / .__/_//_/\__/_/ /___/ |_____/ /_/|_|\__/\_, /_/_//_/\_, / #\___/\_, / .__/_//_/\__/_/ /___/ |_____/ /_/|_|\__/\_, /_/_//_/\_, /
# /___/_/ /___/ /___/ # /___/_/ /___/ /___/
#
Ciphers aes256-gcm@openssh.com,aes256-ctr Ciphers aes256-gcm@openssh.com,aes256-ctr
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp521 KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp521
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-512 MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-512
@ -37,7 +37,7 @@ Protocol 2
# / /__/ _ \/ _ `/ _ `/ / _ \/ _ `/ # / /__/ _ \/ _ `/ _ `/ / _ \/ _ `/
#/____/\___/\_, /\_, /_/_//_/\_, / #/____/\___/\_, /\_, /_/_//_/\_, /
# /___//___/ /___/ # /___//___/ /___/
#
#SyslogFacility AUTH #SyslogFacility AUTH
#LogLevel INFO #LogLevel INFO
@ -45,47 +45,39 @@ Protocol 2
# / _ |__ __/ /_/ / ___ ___ / /_(_)______ _/ /_(_)__ ___ # / _ |__ __/ /_/ / ___ ___ / /_(_)______ _/ /_(_)__ ___
# / __ / // / __/ _ \/ -_) _ \/ __/ / __/ _ `/ __/ / _ \/ _ \ # / __ / // / __/ _ \/ -_) _ \/ __/ / __/ _ `/ __/ / _ \/ _ \
#/_/ |_\_,_/\__/_//_/\__/_//_/\__/_/\__/\_,_/\__/_/\___/_//_/ #/_/ |_\_,_/\__/_//_/\__/_//_/\__/_/\__/\_,_/\__/_/\___/_//_/
#
AllowUsers coby AllowUsers coby
AllowGroups coby AllowGroups coby
#LoginGraceTime 2m #LoginGraceTime 2m
PermitRootLogin no PermitRootLogin no
#StrictModes yes #StrictModes yes
#MaxAuthTries 6 MaxAuthTries 3
#MaxSessions 10 MaxSessions 10
PubkeyAuthentication yes PubkeyAuthentication yes
# Expect .ssh/authorized_keys2 to be disregarded by default in future.
#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2
#AuthorizedPrincipalsFile none
#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no PasswordAuthentication no
PermitEmptyPasswords no PermitEmptyPasswords no
# Change to yes to enable challenge-response passwords (beware issues with #AuthorizedKeysFile .ssh/authorized_keys
# some PAM modules and threads) #AuthorizedPrincipalsFile none
#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody
#HostbasedAuthentication no
#IgnoreUserKnownHosts no
#IgnoreRhosts yes
ChallengeResponseAuthentication no ChallengeResponseAuthentication no
UsePam yes
# __ __ __ # __ __ __
# / //_/__ ____/ / ___ _______ ___ # / //_/__ ____/ / ___ _______ ___
# / ,< / -_) __/ _ \/ -_) __/ _ \(_-< # / ,< / -_) __/ _ \/ -_) __/ _ \(_-<
#/_/|_|\__/_/ /_.__/\__/_/ \___/___/ #/_/|_|\__/_/ /_.__/\__/_/ \___/___/
#
#KerberosAuthentication no KerberosAuthentication no
#KerberosOrLocalPasswd yes #KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes #KerberosTicketCleanup yes
#KerberosGetAFSToken no #KerberosGetAFSToken no
@ -94,30 +86,21 @@ ChallengeResponseAuthentication no
# / ___/ __/ __/ _ | / _ \/ _/ # / ___/ __/ __/ _ | / _ \/ _/
#/ (_ /\ \_\ \/ __ |/ ___// / #/ (_ /\ \_\ \/ __ |/ ___// /
#\___/___/___/_/ |_/_/ /___/ #\___/___/___/_/ |_/_/ /___/
#
#GSSAPIAuthentication no GSSAPIAuthentication no
#GSSAPICleanupCredentials yes #GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes #GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no #GSSAPIKeyExchange no
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
# ____ __ # ____ __
# / __/_ __/ /________ _ # / __/_ __/ /________ _
# / _/ \ \ / __/ __/ _ `/ # / _/ \ \ / __/ __/ _ `/
#/___//_\_\\__/_/ \_,_/ #/___//_\_\\__/_/ \_,_/
#
#AllowAgentForwarding yes AllowAgentForwarding no
#AllowTcpForwarding yes AllowTcpForwarding no
PermitTunnel no
GatewayPorts no GatewayPorts no
X11Forwarding no X11Forwarding no
#X11DisplayOffset 10 #X11DisplayOffset 10
@ -133,22 +116,8 @@ ClientAliveCountMax 3
#UseDNS no #UseDNS no
#PidFile /var/run/sshd.pid #PidFile /var/run/sshd.pid
#MaxStartups 10:30:100 #MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none #ChrootDirectory none
#VersionAddendum none #VersionAddendum none
# No default banner path
#Banner none #Banner none
# Allow client to pass locale environment variables
AcceptEnv LANG LC_* AcceptEnv LANG LC_*
# Override default of no subsystems
Subsystem sftp /usr/lib/openssh/sftp-server Subsystem sftp /usr/lib/openssh/sftp-server
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server