From a702f88870399d275ab2ac1bf255732f53e68b5c Mon Sep 17 00:00:00 2001 From: Daniel Winzen Date: Thu, 24 Aug 2023 22:16:44 +0200 Subject: [PATCH] Move custom ssh config to sub direcotry --- etc/ssh/sshd_config | 110 ------------------------------ etc/ssh/sshd_config.d/custom.conf | 22 ++++++ 2 files changed, 22 insertions(+), 110 deletions(-) delete mode 100644 etc/ssh/sshd_config create mode 100644 etc/ssh/sshd_config.d/custom.conf diff --git a/etc/ssh/sshd_config b/etc/ssh/sshd_config deleted file mode 100644 index 407c7dd..0000000 --- a/etc/ssh/sshd_config +++ /dev/null @@ -1,110 +0,0 @@ -# $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $ - -# This is the sshd server system-wide configuration file. See -# sshd_config(5) for more information. - -# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin - -# The strategy used for options in the default sshd_config shipped with -# OpenSSH is to specify options with their default value where -# possible, but leave them commented. Uncommented options override the -# default value. - -Port 22 -#AddressFamily any -ListenAddress 0.0.0.0 -ListenAddress :: - -#HostKey /etc/ssh/ssh_host_rsa_key -#HostKey /etc/ssh/ssh_host_ecdsa_key -HostKey /etc/ssh/ssh_host_ed25519_key - -# Ciphers and keying -#RekeyLimit default none - -# Logging -#SyslogFacility AUTH -#LogLevel INFO - -# Authentication: - -#LoginGraceTime 2m -PermitRootLogin prohibit-password -#StrictModes yes -MaxAuthTries 3 -#MaxSessions 10 - -#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 yes -#PermitEmptyPasswords no - -# Change to yes to enable challenge-response passwords (beware issues with -# some PAM modules and threads) -ChallengeResponseAuthentication 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 - -DisableForwarding yes -#PermitTTY yes -PrintMotd no -#PrintLastLog yes -#TCPKeepAlive yes -#UseLogin no -#PermitUserEnvironment no -#Compression delayed -#ClientAliveInterval 0 -#ClientAliveCountMax 3 -UseDNS no -#PidFile /var/run/sshd.pid -#MaxStartups 10:30:100 -#ChrootDirectory none -#VersionAddendum none - -# no default banner path -Banner none -DebianBanner no - -# Allow client to pass locale environment variables -AcceptEnv LANG LC_* - -# override default of no subsystems -#Subsystem sftp /usr/lib/openssh/sftp-server -Subsystem sftp internal-sftp - -# Hardened set of key exchange, cipher, and MAC algorithms, as per . -KexAlgorithms sntrup761x25519-sha512@openssh.com,curve25519-sha256,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-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512 - -Match User root - AuthenticationMethods publickey - -Match Group www-data - ChrootDirectory %h diff --git a/etc/ssh/sshd_config.d/custom.conf b/etc/ssh/sshd_config.d/custom.conf new file mode 100644 index 0000000..67cd150 --- /dev/null +++ b/etc/ssh/sshd_config.d/custom.conf @@ -0,0 +1,22 @@ +Port 22 +ListenAddress 0.0.0.0 +ListenAddress :: +HostKey /etc/ssh/ssh_host_ed25519_key +PermitRootLogin prohibit-password +MaxAuthTries 3 +DisableForwarding yes +PrintMotd no +UseDNS no +Banner none +DebianBanner no +Subsystem sftp internal-sftp +# Hardened set of key exchange, cipher, and MAC algorithms, as per . +KexAlgorithms sntrup761x25519-sha512@openssh.com,curve25519-sha256,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-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512 + +Match User root + AuthenticationMethods publickey + +Match Group www-data + ChrootDirectory %h