For the last days I have been struggling to add MFA on my existing OpenVPN Setup.
Existing setup works fine with LDAP and tested using any of the two most common modules:
My default setup uses the openvpn-auth-ldap.so module.
I am trying to add MFA support using OTP, so I installed libpam-oath and oathtool
After creating my secret by using
I created /etc/users.oath file as follwing:
and edit /etc/pam.d/openvpn usaing this single line
and added
openvpn-plugin-auth-pam.so plugin to my server.conf:
Testing OTP functionality:
getent also gets my LDAP user:
I can also succesfully authenticate with this user by SSH on my server, so I assume PAM + LDAP authentication is working fine.
Regarding OpenVPN config:
server.conf
client.conf
On my Windows client, by using static-challenge, I get an extra box where I enter my OTP
Connection fails:
sorry, for some reason, I cannot paste the log here, so I pasted here: https://pastebin.com/UdvJUErF
Existing setup works fine with LDAP and tested using any of the two most common modules:
Code:
openvpn-plugin-auth-pam.so openvpn-auth-ldap.so
I am trying to add MFA support using OTP, so I installed libpam-oath and oathtool
After creating my secret by using
Code:
openssl rand -hex 64 | sha1sum | cut -d' ' -f1
Code:
#type username pin secret-hash HOTP/T30/6 edumeres - 59640b7a353897bd63ea6d695016e313f17c4d0a
Code:
#OTP Authenticator auth requisite pam_oath.so usersfile=/etc/users.oath window=30 digits=6
openvpn-plugin-auth-pam.so plugin to my server.conf:
Code:
plugin /usr/lib/openvpn/openvpn-plugin-auth-pam.so "openvpn login USERNAME password PASSWORD pin OTP"
Code:
sudo pamster openvpn edumeres authenticate One-time password (OATH) for `edumeres': pamtester: successfully authenticated
Code:
getent passwd | grep edumeres edumeres:*:266736:266737:edumeres::
Regarding OpenVPN config:
server.conf
Code:
dev tun proto tcp-server port 1194 management 127.0.0.1 1443 topology subnet server 10.8.0.0 255.255.0.0 ifconfig-pool-persist pool-persist-tun dh keys/dh2048.pem ca ca.crt cert cert.crt key key.key keepalive 10 30 persist-key persist-tun compress migrate script-security 2 mute-replay-warnings verify-client-cert none username-as-common-name client-config-dir clients verb 5 #setenv verb 9 auth-gen-token 43200 plugin /usr/lib/openvpn/openvpn-auth-ldap.so /etc/openvpn/ldap.conf plugin /usr/lib/openvpn/openvpn-plugin-auth-pam.so "openvpn login USERNAME password PASSWORD pin OTP"
Code:
dev tun remote vpn.example.com 1194 tcp-client pull tls-client ca ca.crt verify-x509-name vpn.example.com name mute-replay-warnings route-method exe route-delay 2 auth-user-pass static-challenge "Enter your OTP" 1 script-security 2 verb 3
On my Windows client, by using static-challenge, I get an extra box where I enter my OTP
Connection fails:
sorry, for some reason, I cannot paste the log here, so I pasted here: https://pastebin.com/UdvJUErF
Comment