Google-authenticator with openvpn – AUTH:收到控制消息:AUTH_FAILED

我试图在Ubuntu 16.04上为我的OpenVPN安装设置使用Google身份validation器的MFA。 现在OpenVPN的工作正常,直到我把谷歌身份validation器混合。

我的server.conf文件如下所示:

port 1194 proto udp dev tun ca ca.crt cert server.crt key server.key dh dh2048.pem server 10.0.0.0 255.255.255.0 ifconfig-pool-persist ipp.txt push "redirect-gateway def1 bypass-dhcp" client-to-client keepalive 10 120 tls-auth ta.key 0 key-direction 0 cipher AES-128-CBC auth SHA256 comp-lzo user nobody group nogroup persist-key persist-tun status openvpn-status.log log-append openvpn.log verb 3 plugin /usr/lib/openvpn/openvpn-plugin-auth-pam.so openvpn reneg-sec 0 

我的client.conf内容如下:

 client dev tun proto udp remote 10.1.0.2 1194 resolv-retry infinite nobind user nobody group nogroup persist-key persist-tun remote-cert-tls server comp-lzo verb 3 cipher AES-128-CBC auth SHA256 key-direction 1 script-security 2 up /etc/openvpn/update-resolv-conf down /etc/openvpn/update-resolv-conf auth-user-pass auth-nocache reneg-sec 0 

另外,在/etc/pam.d我已经克隆了common-accounts用下面几行创build一个openvpn文件:

 account requisite pam_deny.so account required pam_permit.so auth requisite pam_google_authenticator.so secret=/home/${USER}/.google_authenticator 

现在我已经为连接到VPN服务器的每个客户端创build了必要的用户configuration文件,比如说Ubuntu上的client1,client2和client3。 现在,考虑client1正试图连接到VPN服务器。 我在客户端系统上以client1身份login,并尝试连接到VPN服务器。

我得到以下,

 Enter Auth Username: ****** Enter Auth Password: ************* ( Password for local user profile? + OTP) 

在这之后,我得到了

 [server] Peer Connection Initiated with [AF_INET]10.1.0.2:1194 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1) AUTH: Received control message: AUTH_FAILED TCP/UDP: Closing socket SIGTERM[soft,auth-failure] received, process exiting 

现在我不知道为什么我得到AUTH失败的错误。 我已经看到在连接到VPN服务器的过程中可以input用户名/密码组合的许多不同方式。

  Method 1 - username ; password (local account password + OTP) Method 2 - username ; password (local account password) + separate prompt section which asks for Google authenticator OTP Method 3 - username ; OTP 

我从来没有提示单独的Google Authenticator提示单独询问我的OTP。 所以我尝试了方法1,并尝试方法2期待从未出现的Google身份validation器提示。

问题1:使用Google身份validation器login凭据的正确方法是什么? 我在这里错过了什么,这可能是为什么我不提示单独的OTP?

我观察到的另一件事是,

 sudo systemctl status openvpn@server 

给出了上述两种login方法的不同结果。

在尝试不同的密码+ OTP组合组合时,我收到了这些状态消息。

 openvpn(pam_google_authenticator)[15305]: Invalid verification code openvpn(pam_google_authenticator)[15305]: Did not receive verification code from user openvpn(pam_google_authenticator)[15305]: Failed to compute location of secret file 

问题2:有人可以向我解释这些状态消息在我的logininput方面的含义。

问题3:如何获得MFA并运行。

仅供参考我用libpam-google-authenticator。 我没有遵循保证使用makefile和为pam添加configuration参数的方法。

谢谢!

确保/home/user目录至less为+x这样可以读取主目录中的.google_authenticator文件。

另外尝试添加到/etc/pam.d/openvpn

 auth requisite pam_google_authenticator.so forward_pass auth required pam_unix.so use_first_pass