shell-things/etc/ssh/sshd_config

108 lines
3.8 KiB
Plaintext
Raw Normal View History

2015-08-30 15:54:21 +02:00
# OpenSSH /etc/ssh/sshd_config. I am removing commented lines for this to
# be more clear and if they are missed some day, just download
# upstream config file or take it from any distribution.
2015-09-06 07:12:41 +02:00
# Partially based on https://wiki.mozilla.org/Security/Guidelines/OpenSSH
# where some comments are took. Some options look like I don't want to
# change them to get updates when defaults change.
# No environment variable is accepted for security reasons, e.g.
# shellshock worked with remotely accepted environment variables.
#AcceptEnv LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION
2015-08-30 15:54:21 +02:00
2015-09-06 07:12:41 +02:00
# IPv4 & IPv6
AddressFamily any
2015-09-06 07:12:41 +02:00
# Password based logins are disabled - only public key based logins are
# allowed.
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
# File to send to client before authentication.
Banner /etc/issue.net
2015-09-06 07:12:41 +02:00
# Disable s/key passwords.
ChallengeResponseAuthentication no
# If the client doesn't reply in three "pings", connection is dead.
# Defaults to 3 anyway, but I add it here for clearity and
# in case it decides to change in the future.
ClientAliveCountMax 3
# "ping" the client every minute.
ClientAliveInterval 60
# HostKeys for protocol version 2.
2014-12-27 10:09:00 +01:00
HostKey /etc/ssh/ssh_host_ed25519_key
2015-08-30 15:54:21 +02:00
HostKey /etc/ssh/ssh_host_rsa_key
2014-12-27 10:09:00 +01:00
## IF THE HOST KEYS ARE MISSING, RUN THE FOLLOWING AS ROOT:
# ssh-keygen -t ed25519 -N "" -f /etc/ssh/ssh_host_ed25519_key
2015-08-30 15:54:21 +02:00
# ssh-keygen -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key
2014-12-27 10:09:00 +01:00
2015-09-06 07:42:29 +02:00
# Listen on the following TCP ports, default 22.
# /etc/ssh/sshd_config ...: ports must be specified before ListenAddress.
Port 22
2015-09-06 07:12:41 +02:00
# Listen on all IPv4 & IPv6 addresses.
ListenAddress 0.0.0.0
ListenAddress ::
# In cse you wish to use external SFTP subsystem, uncomment one of the
# following or wonder where the subsystem is.
# I think it's the easiest when I don't uncomment anything as I don't use
# SFTP so often...
## Arch
#Subsystem sftp /usr/lib/ssh/sftp-server
## Debian
#Subsystem sftp /usr/lib/openssh/sftp-server
## Fedora (21)
#Subsystem sftp /usr/libexec/openssh/sftp-server
## Gentoo (/usr/lib is a symlink)
#Subsystem sftp /usr/lib/misc/sftp-server
2015-09-06 07:12:41 +02:00
# VERBOSE logging, logs user's key fingerprint on login. Needed to have a
# clear audit track of which key was using to log in.
2014-12-27 10:09:00 +01:00
LogLevel VERBOSE
2015-09-06 07:12:41 +02:00
# Disable tunneled clear text passwords!
PasswordAuthentication no
# Auditing reasons, difficult to track which process belongs to which root
# user.
2015-08-30 15:54:21 +02:00
PermitRootLogin No
2014-12-27 10:09:00 +01:00
2015-09-06 07:12:41 +02:00
# Print /etc/motd (or /etc/profile or equivalent) on login. It's already
# done by PAM, so no need for duplicate MOTDs.
PrintMotd no
2014-12-27 10:09:00 +01:00
2015-09-06 07:12:41 +02:00
# Avoid enabling insecure protocol 1.
Protocol 2
2015-09-06 07:12:41 +02:00
## Enable SFTP. As the subsystem location varies, uncomment the one for the
## OS you use.
## Arch
#Subsystem sftp /usr/lib/ssh/sftp-server
## Debian
#Subsystem sftp /usr/lib/openssh/sftp-server
2014-12-27 10:09:00 +01:00
# 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
2015-09-06 07:12:41 +02:00
# Use kernel sandbox mechanisms where possible in unprivilegied processes.
# Systrace on OpenBSD, Seccomp on Linux, seatbelt on MacOSX/Darwin,
# rlimit elsewhere.
UsePrivilegeSeparation sandbox