sshd 匹配身份验证用户使用的 pubkey 类型(匹配 PubkeyAcceptedAlgorithms)

问题描述 投票:0回答:1

我想检测用户正在使用什么类型的 ssh 公钥,并在

sshd_config
中对其执行匹配语句。
目标是在使用安全密钥 (https://man.openbsd.org/ssh-keygen#FIDO_AUTHENTICATOR) 或其他类型的公钥时防止使用 pam。

我在 https://man.openbsd.org/sshd_config#Match 中看到了 Match 属性

PubkeyAcceptedAlgorithms
。但当我使用它时:

Match PubkeyAcceptedAlgorithms [email protected],[email protected]

当我尝试重新启动 sshd 时出现此错误:

Apr 10 12:59:42 ssh sshd[67517]: Unsupported Match attribute PubkeyAcceptedAlgorithms
Apr 10 12:59:42 ssh sshd[67517]: /etc/ssh/sshd_config line 136: Bad Match condition

你有办法做我想做的事吗?谢谢!

linux ssh openssh sshd
1个回答
0
投票

根据手册Match指令:

可用的条件为 UserGroupHostLocalAddressLocalPortRDomainAddress

这是第一个条件的标准,然后您可以使用

PubkeyAcceptedAlgorithms
。块中列出的所有条件之间存在逻辑
AND

Match User root
  PasswordAuthentication no
  PubkeyAcceptedAlgorithms [email protected],[email protected]
© www.soinside.com 2019 - 2024. All rights reserved.