我已经安装了FreeRADIUS,PAM和Google Authtenicator。 FreeRADIUS调用PAM,然后PAM调用Google pam_google_authenticator.so库。 这一切都成功。
但是,这不是真正的双因素validation,因为所有需要的是来自Google App的OTP。 要获得两个2FA,我想使用本地Linux密码。 由于这是通过RADIUS,我不能提示这两个密码,并需要将它们合并为一个。 根据Google Auth README和我发现的各种博客,我应该在PAM中这样做:
auth requisite pam_google_authenticator.so forward_pass auth required pam_unix.so use_first_pass
然后我可以在相同的提示下input密码和OTP,例如MyPass123456
但它从来没有工作。 通过debugging,我可以看到,pam_unix.so检查并接受来自用户的密码,但仍然失败。 如果我删除第二行,或者将“auth”改为“account”(我发现了一个build议),auth就起作用,但是本地密码被忽略。
我在我的PAMconfiguration中丢失了什么?
谷歌的谷歌search引导我https://bugs.launchpad.net/percona-server/+bug/1274821其中描述了类似的问题。 正如那里所logging的,这工作:
auth requisite pam_google_authenticator.so forward_pass auth required pam_unix.so use_first_pass account required pam_unix.so audit account required pam_permit.so
虽然为什么这个作品对我来说仍然是一个谜,因为MySQL的问题是关于使用PAM作为非根,并且我有FreeRADIUS安装程序以root身份运行。
如果您将“auth”更改为“account”,则pam_unix不再用于身份validation。
你是什么意思
pam_unix.so会检查并接受来自用户的密码,但是无论如何都会失败
你的这个服务的pamconfiguration是怎样的? 由于“必需”意味着堆栈被处理直到结束,也许它在 pam_unix 之后中断。
你也可以考虑使用另外两个因素auth后端,它自己处理这两个因素… https://www.howtoforge.com/two-factor-authentication-with-otp-using-privacyidea-and-freeradius-上的CentOS
试试这个configuration:
auth requisite pam_google_authenticator.so forward_pass auth足够pam_unix.so use_first_pass
但是很难说,没有在你的pamconfiguration文件中看到所有的auth
条目。
你可以给你的整个PAMconfiguration文件? 如果在pam_unix.so之后使用pam_deny.so,则必须将您的configuration更改为:
auth [success=1 default=ignore] pam_unix.so use_first_pass
它指定如果模块返回成功则必须跳过下一行。
整个authconfiguration:
auth requisite pam_google_authenticator.so forward_pass auth [success=1 default=ignore] pam_unix.so use_first_pass auth requisite pam_deny.so auth required pam_permit.so
首先,pam_google_authenticator模块提取TOTP并进行validation。
其次,pam_unix模块validation密码,如果成功则跳过第三行。