如何强制/引导用户在没有 MFA 的情况下登录时使用“google-authenticator”?

如何强制/引导用户在没有 MFA 的情况下登录时使用“google-authenticator”?

环境:Amazon Linux 2(centos 7 自定义)


我最近将 Google Authenticator 插入 sshd,我希望每个用户都使用它。


当前状态

用户可以使用我最初提供的私钥在没有 MFA 的情况下登录,但一旦设置了 MFA,他们就必须使用它。

/etc/pam.d/sshd

#%PAM-1.0
auth       required     pam_google_authenticator.so nullok secret=${HOME}/.ssh/google_authenticator
auth       required     pam_permit.so

/etc/ssh/sshd_config

UsePAM yes
PasswordAuthentication no
ChallengeResponseAuthentication yes
AuthenticationMethods publickey,keyboard-interactive:pam

我的目标

我想系统地强制/引导每个没有 MFA 登录的用户进行设置。我怎样才能系统地做到这一点?

相关内容