cdw*_*son 7 mac ssh configuration mac-osx
我在 Yosemite 上运行 Mac OS X Server.app,并且我为使用默认设置的用户启用了 SSH /etc/sshd_config
(默认情况下启用公钥和密码身份验证)。 但是,我需要限制git
本地用户只能通过 SSH 访问公钥。
完全公开,Server.app 启用了一些额外的 Kerberos 和 GSSAPI 选项(虽然我不是 100% 确定这些如何影响我下面的问题):
# Kerberos options
KerberosAuthentication yes
KerberosOrLocalPasswd yes
KerberosTicketCleanup yes
# GSSAPI options
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
GSSAPIStrictAcceptorCheck yes
GSSAPIKeyExchange no
Run Code Online (Sandbox Code Playgroud)
/etc/sshd_config
说如下:
# To disable tunneled clear text passwords both PasswordAuthentication and
# ChallengeResponseAuthentication must be set to "no".
Run Code Online (Sandbox Code Playgroud)
但是,ChallengeResponseAuthentication
match 语句中不允许使用,所以我尝试仅禁用密码身份验证:
Match User git
PasswordAuthentication no
Run Code Online (Sandbox Code Playgroud)
这不起作用——我仍然能够使用用户名/密码登录 git@my.server :(
但是,添加KbdInteractiveAuthentication no
似乎可以正常工作:
Match User git
PasswordAuthentication no
KbdInteractiveAuthentication no
Run Code Online (Sandbox Code Playgroud)
现在我Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
尝试在没有公钥的情况下登录。这似乎表明除了 publickey 之外还有其他方法可以允许git
用户登录(即gssapi-keyex
和gssapi-with-mic
)
似乎更好的方法是简单地将身份验证方法限制为publickey
:
Match User git
AuthenticationMethods publickey
Run Code Online (Sandbox Code Playgroud)
这给出了响应`Permission denied (publickey)。
问题:
ChallengeResponseAuthentication
和 和有
KbdInteractiveAuthentication
什么区别?为什么
KbdInteractiveAuthentication
在 match 语句中允许但不允许
ChallengeResponseAuthentication
?AuthenticationMethods publickey
方法有任何缺点/安全问题吗?gssapi-keyex
/gssapi-with-mic
以及它们与启用的 GSSAPI/Kerberos 选项的关系,则奖励)有之间的差异的一个很好的总结ChallengeResponseAuthentication
,并KbdInteractiveAuthentication
在
http://blog.tankywoo.com/linux/2013/09/14/ssh-passwordauthentication-vs-challengeresponseauthentication.html -总之是经常询问-最终只是要求密码(但坚持以交互方式提供)。
KbdInteractiveAuthentication
并且ChallengeResponseAuthentication
是不同的东西。只是ChallengeResponseAuthentication
在简单的情况下最终可能会提示输入密码。
ChallengeResponseAuthentication
是全局设置,不能在Match
子句中指定-sshd_config
有关详细信息,请参阅手册页。
AuthenticationMethods publickey
为git
用户明确指定应该可以正常工作,并且比禁用您不想要的更好(因为列表可能会更改)。
gssapi
如果您在Kerberos
环境(例如 Active Directory 域)中工作,这些选项就会发挥作用。
归档时间: |
|
查看次数: |
2592 次 |
最近记录: |