2023-01-27 00:19:52 -08:00
|
|
|
# TODO - Figure out difference between /private/etc/ssh and /etc/ssh on macOS
|
|
|
|
|
|
|
|
Include /etc/ssh/sshd_config.d/*.conf
|
|
|
|
|
|
|
|
Port {{ .host.ssh.port }}
|
|
|
|
AddressFamily inet
|
|
|
|
#ListenAddress 0.0.0.0
|
|
|
|
#ListenAddress ::
|
|
|
|
|
|
|
|
### Host keys
|
|
|
|
#HostKey /etc/ssh/ssh_host_rsa_key
|
|
|
|
#HostKey /etc/ssh/ssh_host_ecdsa_key
|
|
|
|
#HostKey /etc/ssh/ssh_host_ed25519_key
|
|
|
|
|
|
|
|
### Ciphers and keyring
|
|
|
|
#RekeyLimit default none
|
|
|
|
|
|
|
|
### Logging
|
|
|
|
#SyslogFacility AUTH
|
|
|
|
#LogLevel INFO
|
|
|
|
|
|
|
|
### Authentication
|
|
|
|
LoginGraceTime 60
|
|
|
|
{{ if ne .host.distro.family "windows" }}
|
|
|
|
PermitRootLogin no
|
|
|
|
{{ else }}
|
|
|
|
DenyGroups Administrators
|
|
|
|
{{ end }}
|
|
|
|
AllowUsers {{ .host.ssh.allowUsers }}
|
|
|
|
#StrictModes yes
|
|
|
|
MaxAuthTries 3
|
|
|
|
#MaxSessions 10
|
|
|
|
|
|
|
|
AuthenticationMethods publickey
|
|
|
|
|
|
|
|
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
|
|
|
|
# but this is overridden so installations will only check .ssh/authorized_keys
|
|
|
|
AuthorizedKeysFile .ssh/authorized_keys
|
|
|
|
|
|
|
|
#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
|
|
|
|
PermitEmptyPasswords no
|
|
|
|
|
|
|
|
# Change to no to disable s/key passwords
|
|
|
|
ChallengeResponseAuthentication no
|
|
|
|
|
|
|
|
{{ if ne .host.distro.family "windows" }}
|
|
|
|
# Kerberos options
|
|
|
|
#KerberosAuthentication no
|
|
|
|
#KerberosOrLocalPasswd yes
|
|
|
|
#KerberosTicketCleanup yes
|
|
|
|
#KerberosGetAFSToken no
|
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
# GSSAPI options
|
|
|
|
GSSAPIAuthentication no
|
|
|
|
#GSSAPICleanupCredentials yes
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
{{ if ne .host.distro.family "windows" }}
|
|
|
|
#AllowAgentForwarding yes
|
|
|
|
AllowTcpForwarding {{ .host.ssh.allowTCPForwarding }}
|
|
|
|
|
|
|
|
#GatewayPorts no
|
|
|
|
X11Forwarding no
|
|
|
|
#X11DisplayOffset 10
|
|
|
|
#X11UseLocalhost yes
|
|
|
|
#PermitTTY yes
|
|
|
|
#PrintMotd yes
|
|
|
|
#PrintLastLog yes
|
|
|
|
#TCPKeepAlive yes
|
|
|
|
#PermitUserEnvironment no
|
|
|
|
#Compression delayed
|
|
|
|
ClientAliveInterval 60
|
|
|
|
ClientAliveCountMax 3
|
|
|
|
UseDNS no
|
|
|
|
# Experiment with this
|
|
|
|
#PidFile /var/run/sshd.pid
|
|
|
|
#MaxStartups 10:30:100
|
|
|
|
#PermitTunnel no
|
|
|
|
#ChrootDirectory none
|
|
|
|
#VersionAddendum none
|
|
|
|
|
|
|
|
# pass locale information
|
2023-08-06 22:19:59 -07:00
|
|
|
AcceptEnv LANG LC_* FIG_*
|
|
|
|
AllowStreamLocalForwarding yes
|
2023-01-27 00:19:52 -08:00
|
|
|
|
|
|
|
# no default banner path
|
|
|
|
Banner /etc/ssh/banner
|
|
|
|
|
|
|
|
# override default of no subsystems
|
|
|
|
# TODO - Figure out how to detect the sftp path to place here. i.e. replicate the following Ansible logic
|
|
|
|
# using Go templating:
|
|
|
|
# - name: Find the path of the sftp-server executable
|
|
|
|
# find:
|
|
|
|
# paths: /usr
|
|
|
|
# file_type: file
|
|
|
|
# patterns: '*sftp-server'
|
|
|
|
# recurse: true
|
|
|
|
# register: sftp_executable
|
|
|
|
#Subsystem sftp {/{ sftp_executable.files[0].path | default('internal-sftp') }/}
|
|
|
|
|
|
|
|
# Example of overriding settings on a per-user basis
|
|
|
|
#Match User anoncvs
|
|
|
|
# X11Forwarding no
|
|
|
|
# AllowTcpForwarding no
|
|
|
|
# PermitTTY no
|
|
|
|
# ForceCommand cvs server
|
|
|
|
{{ end }}
|