debian:~# cat /etc/pam.d/openvpn
auth required pam_google_authenticator.so authtok_prompt=pin
#auth required pam_google_authenticator.so authtok_prompt=pin user=root secret=/etc/openvpn/google-auth/${USER}
...
# systemctl edit openvpn@openvpn1
[Service]
ProtectHome=no
# cat /etc/openvpn/openvpn1.conf
...
plugin /usr/lib/x86_64-linux-gnu/openvpn/plugins/openvpn-plugin-auth-pam.so "openvpn login USERNAME password PASSWORD pin OTP"
...
# apt-get install libpam-google-authenticator
student@debian:~$ google-authenticator
Your new secret key is: Q7LD2KDIYCU6DEL37JFLLFIQUY
Enter code from app (-1 to skip): 626315
Code confirmed
Your emergency scratch codes are:
99306402
91750171
46620301
47719792
57203818
# cp /etc/pam.d/other /etc/pam.d/openvpn
# pamtester openvpn student authenticate
Verification code:
Password:
pamtester: successfully authenticated