我在我的linux上使用ssh,我希望尽可能地保护它的安全,只允许通过ed25519椭圆曲线加密sigs来实现ssh。
我以为我的设置正确,禁用密码,没有PAM,等等。
它似乎正常工作,但是今天我注意到我没有指定一个authorised_keys文件,并且PubkeyAuthentication被注释掉了。
当密码auth设置为no时,这些内容是否隐式地设置为yes?
这个装置还好吗?
# $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj 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 6
#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 no
#PermitEmptyPasswords no
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no
# Set this to 'yes' to enable PAM authentication, account processing发布于 2019-12-09 18:53:42
我不确定,是否排除了所有的公钥算法,除了ed25519没有过分热心,它是一个很好的安全策略。安全堆栈交换当然可以告诉你更多关于这个问题的信息。
SSH默认值列在sshd_配置手册中,但最好在您的系统上读取该默认值:例如,Debian更改了一些上游默认值。PubkeyAuthentication's违约为是,而AuthorizedKeysFile's违约为~/.ssh/authorized_keys (美式拼写)。
假设您想要:禁用所有基于密码的身份验证,并且只使用ed25519公钥加密,同时考虑到上游默认设置,您只需要:
ChallengeResponseAuthentication no
#GSSAPIAuthentication no by default
#HostbasedAuthentication no by default
#KbdInteractiveAuthentication defaults to ChallengeResponseAuthentication
#KerberosAuthentication no by default
PasswordAuthentication no
#PubkeyAuthentication yes by default
PubkeyAcceptedKeyTypes ssh-ed25519
UsePAM yes禁用 PAM 作为一个整体禁用帐户和会话PAM模块的使用,这些模块为用户提供了一个更好的环境。无论如何,都不会使用auth PAM模块,因为密码和质询响应身份验证都是禁用的。
https://serverfault.com/questions/994894
复制相似问题