Take Note:
novaflash wrote
I am going to lock this topic. It is terribly outdated and pointless.
Because every single tutorial in the universe is based off the Community Edition I decided I would post a guide on how to setup your OpenVPN
ACCESS SERVER securely to your LDAP server, and as an extra bit of security, also hook it up to Google Authenticator and login with a one time password.
Just a note, the docs for Access Server are terribly scarce..Like they do not even exist. You cannot even find documentation on the "plugin" line that is below..I had to find all this stuff through other people who were also banging their heads.
I am going to assume that most of you already know how G.Authenticator works, and I won't overexplain the little details.
Requirements:
This is for CentOS, and Ubuntu. Did not test on other distros.
The system itself must be connected to and using an LDAP. (You must be able to SSH and login as an LDAP user who does not exist locally)..That part you must figure out on your own. Hint: SSSD
Note: If you don't want to go with LDAP and you wish to simply have local passwords, just continue anyway, everything should be the same, minus the LDAP.
- Your date/time must be correct (If not, your codes will be invalid, and logins will fail)
ntpdate <server>
- Install OpenVPN Access Server:
rpm -Uvh http://swupdate.openvpn.org/as/openvpn-as-1.8.5-CentOS6.x86_64.rpm
Install some compiling tools to compile google authenticator:
Centos:
yum -y install pam-devel
Ubuntu:
apt-get install libpam0g-dev
wget https://google-authenticator.googlecode.com/files/libpam-google-authenticator-1.0-source.tar.bz2
bunzip2 libpam-google-authenticator-1.0-source.tar.bz2
tar xvf libpam-google-authenticator-1.0-source.tar
cd libpam-google-authenticator-1.0/
make && make install
Login with your LDAP user and type
google-authenticator
Press yes for all the prompts. You will be given some scratch codes and a link to scan with your phone.
Note: The scratch codes will work ONE TIME. So if you lose your phone or something, you will be able to login with the scratch codes once and they are no longer valid. So don't make the mistake of assuming they aren't working if you've already used it.
Now GoogleAuthenticator is working, and OpenVPN is running..Let's make OpenVPN use google auth now..
- Download the missing openvpn pam file:
wget http://safesrv.net/public/openvpn-auth-pam.zip
- Unzip the file to
/usr/lib/openvpn/
- you should have a file in there called openvpn-auth-pam.so
- Add the plugin to the AS.CONF file:
vi /usr/local/openvpn_as/etc/as.conf
Add this to the very bottom:
plugin /usr/lib/openvpn/openvpn-auth-pam.so /etc/pam.d/openvpnas
# Where is the documentation for this for Access Server edition? Your documentation has no trace of the word plugin with access server. You really need to document this in the access server docs, not only community edition.
Tell OpenVPN's PAM file to use Google Authenticator:
vi /etc/pam.d/openvpnas
Find & comment out these lines:
#auth include system-auth
#account include system-auth
#password include system-auth
#session include system-auth
FOR UBUNTU:
It's very similar, comment all the lines starting with an '@' (They should all have a similar last field, such as common-auth, if I remember correctly)
Then add these lines:
auth requisite pam_google_authenticator.so forward_pass
account required pam_permit.so
Restart OpenVPN to reload configs:
service openvpnas restart
Test by logging into the VPN through the Admin console or as you would normally with the client:
Example:
LDAP username: joebob55
LDAP password: pazzwurdlol
Google Authenticator code: 444999
You would login with these credentials:
Username: joebob55
Password: pazzwurdlol444999
Every 30 seconds the google code changes, giving you a one time password.
hope it helps, enjoy your secure access servers