google / google/google-authenticator-libpam
Libpam with OpenVPN on Ubuntu 18.04
- Dominant language
- C
- Stars
- 2k
- Forks
- 305
- PR merge metrics
- No merged PRs in 30d
Description
Ubuntu Version: 18.04
OpenVPN Version: 2.4.4
google-authenticator-libpam Version: Ubuntu pacakge version 20170702-1 (Which appears to be created from git hash 00065df)
I'm trying to set up 2fa with OpenVPN using google authenticator. In the OpenVPN server config I have the following line:
`plugin /usr/lib/x86_64-linux-gnu/openvpn/plugins/openvpn-plugin-auth-pam.so openvpn`
Then in /etc/pam.d/openvpn I have:
`auth required /lib/x86_64-linux-gnu/security/pam_google_authenticator.so`
When I try logging into the openvpn server I see the following error in /var/auth.log:
`openvpn(pam_google_authenticator)[20005]: Failed to read "/home/david/.google_authenticator" for "david"`
Doing a ls -l on /home/david/.google_authenticator:
`-r-------- 1 david users 129 May 22 19:19 /home/david/.google_authenticator`
From doing a strace on the openvpn process, I see:
`setfsuid(1002) = 0`
`setfsuid(1002) = 1002`
`openat(AT_FDCWD, "/home/david/.google_authenticator", O_RDONLY) = -1 EACCES (Permission denied)`
Ok so for some reason due to permissions, it can't access the file even though user id 1002 corresponds to the user david.
Also I have google authenticator pam module set up with ssh. When I try connecting through SSH, it works just fine. Here's the strace from sshd:
`[pid 20034] setfsuid(1002) = 0`
`[pid 20034] setfsuid(1002) = 1002`
`[pid 20034] openat(AT_FDCWD, "/home/david/.google_authenticator", O_RDONLY) = 4`
I have no idea why the openat system call fails from the openvpn process.
Contributor guide
Assessment
This issue has not been assessed yet.