Friday, 31 July 2015

Setting up open vpn client on Ubuntu with two factor authentication Support

Background

In this post we will see how to setup open vpn on ubuntu and then configure it to use Duo Two factor Authentication.

Installing openvpn

Installing openvpn is fairly simple. Just execute following command in command line

  •  sudo apt-get install openvpn
 This should install openvpn client in you Linux machine. You can verify the installation by checking the version.
  • openvpn --version

Connecting to VPN


 You can then connect to your vpn by executing command - 
  • sudo openvpn --config /path/to/config.ovpn
Next obvious question  -  What is this config.ovpn file? and where do I get it?

This is the file you would typically get from your vpn service provider. You can simply log on to your vpn with browser and download it from there. Note this file contains inline private keys and must be kept confidential.It will also have your vpn configuration like vpn address, ports , protocols etc.

Connecting to VPN with two factor Authentication like Duo

If two factor authentication is enabled on your server then your authentication will fail. 




You need to do some extra setup before you can start handling two factor authentications.

Configuring open VPN client
  1. Make sure you have following like in your OpenVPN client configuration file 
    • auth-user-pass    
  2. Next you should append you openvpn connect command with following - 
    • --auth-retry interact
And you should be all set for your vpn connection. You can run the command -

  • sudo openvpn --config /path/to/config.ovpn --auth-retry interact
You should not get a prompt to enter your dual auth password.




Simply enter your dual auth password and you should be good.

Related Links


t> UA-39527780-1 back to top