我将以下设置添加到基于码头的centos 7 /etc/ssh/sshd_config文件中:
Match User ansible
PermitEmptyPasswords yes
PasswordAuthentication no
PermitRootLogin without-password
PubkeyAuthentication no
HostbasedAuthentication yes我注意到sshd并没有遵守这些设置,至少它仍然要求一个密码。在我的设置中,我的ansible用户根本没有密码,但我仍然要求它在没有身份验证的情况下将其放入各种机器中。我知道ssh-copy-id不过,因为这是一个封闭的码头网络,我想绕过他们的密钥处理,只允许用户ansible传入。
我知道这是不安全的,但是这仅仅是一个用于开发的测试环境。
我应该添加什么额外的设置到我的sshd_config文件,以确保我从来没有麻烦的密码,或要求输入“是”接受指纹?
下面是我在码头里看到的情况:
[root@docker-ansible /]# ssh ansible@portal.docker.local
The authenticity of host 'portal.docker.local (172.31.0.2)' can't be established.
ECDSA key fingerprint is SHA256:klErLlMAooQXDpAVNAsGoQTt5r+GdjDX06Fgihstteo.
ECDSA key fingerprint is MD5:60:4e:1e:6a:05:12:45:e9:21:79:4b:22:0b:1b:a7:cd.
Are you sure you want to continue connecting (yes/no)? yes <-- I need to not be typing yes here.
Warning: Permanently added 'portal.docker.local,172.31.0.2' (ECDSA) to the list of known hosts.
Permission denied (gssapi-keyex,gssapi-with-mic,hostbased).当我再次尝试时,在输入“是”之后,仍然:
[root@docker-ansible /]# ssh ansible@portal.docker.local
Permission denied (gssapi-keyex,gssapi-with-mic,hostbased).更新:我刚刚尝试了@telcoM的想法,虽然这感觉很接近,但行不通。我的sshd_config文件的结尾是:
Match User ansible
PermitEmptyPasswords yes
AuthenticationMethods none 但现在我得到的错误是:
[ansible@docker-ansible ~]$ ssh -o StrictHostKeyChecking=no portal.docker.local
ansible@ocker-ansible's password:
:(所以似乎还想要密码..。
发布于 2019-09-30 09:23:02
主机密钥指纹和“您确定要继续连接吗?”提示是由SSH客户端生成的,而不是由远程sshd生成的。sshd服务器上的任何配置都不会改变这一点。您需要在本地个人~/.ssh/config或本地系统范围内的/etc/ssh/ssh_config中更改的设置是StrictHostKeyChecking。
accept-new,则新密钥将被接受,但在以前已知的主机上更改的密钥将不会被接受。no,则将接受新的和已更改的主机键。ask,这是当前的设置。yes是最严格的选项:使用此设置,SSH客户端将永远不会连接,除非它预先拥有本地可用的主机密钥(最大的安全性,最低的便利性)。现在让我们分析一下您的sshd_config片段:
Match User ansible
PermitEmptyPasswords yes
PasswordAuthentication no
PermitRootLogin without-password
PubkeyAuthentication no
HostbasedAuthentication yesPermitEmptyPasswords yes:不太适用,因为您已经设置了PasswordAuthentication no。这仍可能阻止sshd将无密码用户帐户视为与禁用帐户等效的帐户。PasswordAuthentication no:你永远不会被问到这个用户的密码(或者如果你这么做了,这将是一个假提示,只是为了浪费潜在入侵者的时间)PermitRootLogin without-password:这里没有效果,我们在一个Match User ansible块内,我们说的是作为用户ansible登录,而不是以root登录。PubkeyAuthentication no:~ansible/.ssh/authorized_keys没有效果。HostbasedAuthentication yes:这个可能不像你想的那样工作。的要求
为了让HostbasedAuthentication允许您登录,您来自的主机的主机键必须已经存在于远程/etc/ssh/ssh_known_hosts或~ansible/.ssh/known_hosts中,并且您的本地主机名必须在系统范围的/etc/ssh/shosts.equiv或/etc/hosts.equiv中列出,或者您的本地主机名和用户名必须在~ansible/.shosts或~ansible/.rhosts中列出。
因此,HostbasedAuthentication绝对不是你想象中的那种无准备的无密码设置。
要为ansible用户获得一个完全开放的、没有身份验证的设置,请尝试以下匹配块:
Match User ansible
PermitEmptyPasswords yes
AuthenticationMethods nonehttps://serverfault.com/questions/986126
复制相似问题