我有这个漂亮的小 yubikey,我想在验证 ssh 会话时添加额外的安全层。在服务器端,我已经禁用了密码验证,并且只允许在登录时使用 ssh 密钥。
问题是,在为 yubikey auth 配置 sshd 和 PAM 之后,sshd 仍然只需要一个 ssh 密钥,我从来没有被要求提供 yubikey 的响应。
我如何同时需要ssh 密钥和yubikey?
(ubuntu 14.04 - trusty)
/etc/pam.d/common-auth
:
auth required pam_yubico.so mode=client try_first_pass id=<id> key=<secret>
auth [success=1 default=ignore] pam_unix.so nullok_secure try_first_pass
# here's the fallback if no module succeeds
auth requisite pam_deny.so
# prime the stack with a positive return value if there isn't one already;
# this avoids us returning an error just because nothing sets a success code
# since the modules above will each just jump around
auth required pam_permit.so
# and here are more per-package modules (the "Additional" block)
auth optional pam_cap.so
# end of pam-auth-update config
/etc/ssh/sshd_config
:
...
PasswordAuthentication no
ChallengeResponseAuthentication yes
UsePAM yes