OpenSSH (sshd)
CentOS 7.4.1708 における sshd (OpenSSH 7.4p1) のデフォルト設定を確認した。
なお、CentOS 6.9 における OpenSSH は 5.3p1 になる。
設定値の確認
デフォルト値
sshd -T -f /dev/null
設定ファイルが未指定の場合の純粋なデフォルト値。
設定ファイルによるデフォルト値
sshd -T
CentOS 7 における /etc/ssh/sshd_config のデフォルトの設定値。
OpenSSH 7.4 のデフォルト値の比較表
| 項目名 | デフォルト値 | 設定ファイルデフォルト値 |
|---|---|---|
port |
22 |
22 |
addressfamily |
any |
any |
listenaddress |
[::]:22 |
[::]:22 |
listenaddress |
0.0.0.0:22 |
0.0.0.0:22 |
usepam |
no |
yes |
logingracetime |
120 |
120 |
x11displayoffset |
10 |
10 |
x11maxdisplays |
1000 |
1000 |
maxauthtries |
6 |
6 |
maxsessions |
10 |
10 |
clientaliveinterval |
0 |
0 |
clientalivecountmax |
3 |
3 |
streamlocalbindmask |
0177 |
0177 |
permitrootlogin |
yes |
yes |
ignorerhosts |
yes |
yes |
ignoreuserknownhosts |
no |
no |
hostbasedauthentication |
no |
no |
hostbasedusesnamefrompacketonly |
no |
no |
pubkeyauthentication |
yes |
yes |
kerberosauthentication |
no |
no |
kerberosorlocalpasswd |
yes |
yes |
kerberosticketcleanup |
yes |
yes |
gssapiauthentication |
no |
yes |
gssapicleanupcredentials |
yes |
no |
gssapikeyexchange |
no |
no |
gssapistrictacceptorcheck |
yes |
yes |
gssapistorecredentialsonrekey |
no |
no |
gssapikexalgorithms |
gss-gex-sha1-,gss-group1-sha1-,gss-group14-sha1- |
gss-gex-sha1-,gss-group1-sha1-,gss-group14-sha1- |
passwordauthentication |
yes |
yes |
kbdinteractiveauthentication |
yes |
no |
challengeresponseauthentication |
yes |
no |
printmotd |
yes |
yes |
printlastlog |
yes |
yes |
x11forwarding |
no |
yes |
x11uselocalhost |
yes |
yes |
permittty |
yes |
yes |
permituserrc |
yes |
yes |
strictmodes |
yes |
yes |
tcpkeepalive |
yes |
yes |
permitemptypasswords |
no |
no |
permituserenvironment |
no |
no |
compression |
yes |
yes |
gatewayports |
no |
no |
showpatchlevel |
no |
no |
usedns |
yes |
yes |
allowtcpforwarding |
yes |
yes |
allowagentforwarding |
yes |
yes |
disableforwarding |
no |
no |
allowstreamlocalforwarding |
yes |
yes |
streamlocalbindunlink |
no |
no |
useprivilegeseparation |
sandbox |
sandbox |
kerberosusekuserok |
yes |
yes |
gssapienablek5users |
no |
no |
exposeauthenticationmethods |
never |
never |
fingerprinthash |
SHA256 |
SHA256 |
pidfile |
/var/run/sshd.pid |
/var/run/sshd.pid |
xauthlocation |
/usr/bin/xauth |
/usr/bin/xauth |
ciphers |
chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc,cast128-cbc,3des-cbc |
chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc,cast128-cbc,3des-cbc |
macs |
umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 |
umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 |
banner |
none |
none |
forcecommand |
none |
none |
chrootdirectory |
none |
none |
trustedusercakeys |
none |
none |
revokedkeys |
none |
none |
authorizedprincipalsfile |
none |
none |
versionaddendum |
none |
none |
authorizedkeyscommand |
none |
none |
authorizedkeyscommanduser |
none |
none |
authorizedprincipalscommand |
none |
none |
authorizedprincipalscommanduser |
none |
none |
hostkeyagent |
none |
none |
kexalgorithms |
curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 |
curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 |
hostbasedacceptedkeytypes |
ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss |
ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss |
hostkeyalgorithms |
ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss |
ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss |
pubkeyacceptedkeytypes |
ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss |
ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss |
loglevel |
INFO |
INFO |
syslogfacility |
AUTH |
AUTHPRIV |
authorizedkeysfile |
.ssh/authorized_keys .ssh/authorized_keys2 |
.ssh/authorized_keys |
hostkey |
/etc/ssh/ssh_host_rsa_key |
/etc/ssh/ssh_host_rsa_key |
hostkey |
/etc/ssh/ssh_host_dsa_key |
|
hostkey |
/etc/ssh/ssh_host_ecdsa_key |
/etc/ssh/ssh_host_ecdsa_key |
hostkey |
/etc/ssh/ssh_host_ed25519_key |
/etc/ssh/ssh_host_ed25519_key |
acceptenv |
|
LANG |
acceptenv |
|
LC_CTYPE |
acceptenv |
|
LC_NUMERIC |
acceptenv |
|
LC_TIME |
acceptenv |
|
LC_COLLATE |
acceptenv |
|
LC_MONETARY |
acceptenv |
|
LC_MESSAGES |
acceptenv |
|
LC_PAPER |
acceptenv |
|
LC_NAME |
acceptenv |
|
LC_ADDRESS |
acceptenv |
|
LC_TELEPHONE |
acceptenv |
|
LC_MEASUREMENT |
acceptenv |
|
LC_IDENTIFICATION |
acceptenv |
|
LC_ALL |
acceptenv |
|
LANGUAGE |
acceptenv |
|
XMODIFIERS |
authenticationmethods |
any |
any |
subsystem |
|
sftp /usr/libexec/openssh/sftp-server |
maxstartups |
10:30:100 |
10:30:100 |
permittunnel |
no |
no |
ipqos |
lowdelay throughput |
lowdelay throughput |
rekeylimit |
0 0 |
0 0 |
permitopen |
any |
any |
デフォルト値と設定ファイルの相違
UsePAM
PAM インターフェイスによる認証を許可するかどうかを指定する。
yes の場合、すべての認証形式に対して ChallengeResponseAuthentication を使用した PAM 認証と PAM アカウントおよびセッションモジュールの処理が許可される。 1
その際 PasswordAuthentication か ChallengeResponseAuthentication のどちらかを許可する必要があり 2 、また sshd を root 以外の一般ユーザで走らせることはできない。 3
デフォルト値では no だが、設定ファイルでは yes が指定されている。
設定ファイルのコメントで WARNING: 'UsePAM no' is not supported in Red Hat Enterprise Linux and may cause several problems. との記載がある。
GSSAPIAuthentication
GSSAPIに基づくユーザー認証が許可されるかどうかを指定する。4
デフォルト値では no だが、設定ファイルでは yes が指定されている。
接続が遅くなるため no にすることが2005年頃から言及されている。5
GSSAPICleanupCredentials
ログアウト時にユーザーの資格情報キャッシュを自動的に破棄するかどうかを指定する。6
デフォルト値では yes だが、設定ファイルでは no が指定されている。
KbdInteractiveAuthentication
デフォルト値では yes だが、設定ファイルでは no が指定されている。
ChallengeResponseAuthentication
デフォルト値では yes だが、設定ファイルでは no が指定されている。
X11Forwarding
デフォルト値では no だが、設定ファイルでは yes が指定されている。
SyslogFacility
デフォルト値では AUTH だが、設定ファイルでは AUTHPRIV が指定されている。
AuthorizedKeysFile
デフォルト値では .ssh/authorized_keys .ssh/authorized_keys2 だが、設定ファイルでは .ssh/authorized_keys2 が除去されている。
HostKey
デフォルト値では ssh_host_rsa_key ssh_host_dsa_key ssh_host_ecdsa_key ssh_host_ed25519_key が指定されているが、設定ファイルではその内 ssh_host_dsa_key が除去されている。
AcceptEnv
デフォルト値で指定はないが、設定ファイルでは LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION LC_ALL LANGUAGE XMODIFIERS が指定されている。
Subsystem
デフォルト値で指定はないが、設定ファイルでは sftp /usr/libexec/openssh/sftp-server が指定されている。
OpenSSH 7.4 で変更された項目
Compression
compression のデフォルト値が yes に変更
OpenSSH 7.4 で廃止された項目
Protocol
SSH v.1 のサポートが取り除かれ、Protocol 設定ディレクティブは廃止された。7
UseLogin
UserLogin 設定ディレクティブは廃止された。8
rhostsrsaauthentication rsaauthentication serverkeybits ?
OpenSSH 7.4 で追加された項目
DisableForwarding
X11、エージェント、TCP、トンネル、Unix ドメインのソケット転送を無効にする DisableForwarding 設定ディレクティブが追加された。9
-
"Pluggable Authentication Module (PAM) インターフェイスによる認証を許可します。これが"yes"に設定されている場合、すべての認証形式に対してChallengeResponseAuthenticationを使用した PAM 認証と、PAM アカウントおよびセッションモジュールの処理が許可されます。" - sshd_config(5) - OpenSSH 日本語マニュアルページ ↩
-
"ふつう PAM のチャレンジ・レスポンス認証はパスワード認証と等価な役割を提供しているので、PasswordAuthenticationあるいはChallengeResponseAuthentication.のどちらかを許可する必要があります。" - sshd_config(5) - OpenSSH 日本語マニュアルページ ↩
-
"UsePAMを許可した場合、sshd を root 以外の一般ユーザで走らせることはできません。" - sshd_config(5) - OpenSSH 日本語マニュアルページ ↩
-
"Specifies whether to automatically destroy the user's credentials cache on logout." - sshd_config(5) - OpenBSD manual pages ↩
-
"The delay was due to the absence of a DNS server for the _kerberos. lookup (because my ISP was dead). I set GSSAPIAuthentication to "no" and the delay disappeared." - Re: Sudden change in ssh behavior. ↩
-
"Specifies whether to automatically destroy the user's credentials cache on logout." - sshd_config(5) - OpenBSD manual pages ↩
-
"This release removes server support for the SSH v.1 protocol." - OpenSSH 7.4 Release Notes ↩
-
"Remove the UseLogin configuration directive and support for having /bin/login manage login sessions." - OpenSSH 7.4 Release Notes ↩
-
"Add a sshd_config DisableForwarding option that disables X11, agent, TCP, tunnel and Unix domain socket forwarding, as well as anything else we might implement in the future." - OpenSSH 7.4 Release Notes ↩