Documentation

OpenVPN Access Server

These instructions will enable you to add Duo two-factor authentication to an OpenVPN Access Server installation. If you wish to use Duo with the OpenVPN Community Open Source Software Project, refer to the OpenVPN instructions instead.

First Steps

To get started with your OpenVPN Access Server integration, you’ll need to:

  1. Sign up for a Duo account.
  2. Create a new OpenVPN Access Server integration to get an integration key, secret key, and API hostname. (See Getting Startedfor help.)
  3. Download the OpenVPN Access Server integration package from our duo_openvpn_as GitHub repository.

Connectivity Requirements

This integration communicates with Duo’s service on TCP port 443. Also, we do not recommend locking down your firewall to individual IP addresses, since these may change over time to maintain our service’s high availability.

Configure the Post-Auth Script

  1. Extract the OpenVPN Access Server integration package downloaded from Duo’s GitHub repository.
  2. Open the duo_openvpn_as.py script in a text editor and fill in your integration key, secret key, and API hostname where instructed:

    ...
    # ------------------------------------------------------------------
    # Fill in your integration credentials on the following three lines:
    IKEY = 'INTEGRATION_KEY'
    SKEY = 'SECRET_KEY'
    HOST = 'API_HOSTNAME'
    # ------------------------------------------------------------------
    ...
    
  3. Move the duo_openvpn_as.py script to the OpenVPN AS scripts folder - typically /usr/local/openvpn_as/scripts/ - and make sure it is executable.

    $ mv duo_openvpn_as.py /usr/local/openvpn_as/scripts/
    $ chmod a+x /usr/local/openvpn_as/scripts/duo_openvpn_as.py

Enable the Post-Auth Script

  1. Use OpenVPN Access Server’s command-line interface to set duo_openvpn_as.py as your post-auth script:

    $ /usr/local/openvpn_as/scripts/sacli -a admin_username \
    -k auth.module.post_auth_script --value_file=/usr/local/openvpn_as/scripts/duo_openvpn_as.py ConfigPut
  2. Restart the service to commit your configuration changes:

    $ /usr/local/openvpn_as/scripts/sacli -a admin_username Reset

    Where admin_username is the username of an administrator on your OpenVPN Access Server instance.

Test Your Setup

After you have enabled the Duo Post-Auth script, try to log in as a regular VPN user through the OpenVPN Access Server web interface. If you are using an account which has not previously been enrolled for Duo authentication, your login attempt will be denied with a self-enrollment URL. Visit the URL, enroll your phone, and then try logging in again.

Note:

You will only receive a self-enrollment URL if you log in to your OpenVPN Access Server instance with a web browser; this mechanism will not work with native clients (e.g. OpenVPN Connect). You can bulk enroll users if they won’t be logging in through the web interface.

Enroll

When you log in as a Duo-enrolled user, you will see a secondary prompt (either via a web browser or with a native client), with instructions to enter a Duo passcode (eg. “124356”) or an alternate factor identifier:

Auth Web

Choose from the following factors:

push Perform Duo Push authentication
You can use Duo Push if you’ve installed Duo Mobile and added your account to it
phone Perform phone callback
sms Send a new batch of SMS passcodes
Your authentication attempt will be denied. You can then authenticate with one of the newly-delivered passcodes.

You can also specify a number after the factor name if you have more than one device enrolled. So you can enter phone2 or push2 if you have two phones enrolled.