Forge Home

openvpn

Setup openvpn

8,110 downloads

5,733 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 3.3.1 (latest)
  • 3.2.2
  • 3.2.1
  • 3.2.0
  • 3.1.4
  • 3.1.3
  • 3.1.2
released Jun 26th 2018
This version is compatible with:
  • Puppet Enterprise 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >= 4.8.0 < 6.0.0
  • , , , , windows

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'puppetfinland-openvpn', '3.3.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add puppetfinland-openvpn
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install puppetfinland-openvpn --version 3.3.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

puppetfinland/openvpn — version 3.3.1 Jun 26th 2018

openvpn

A module for managing OpenVPN daemons. The module supports template-based servers and clients, as well as those based on a static configuration file with inlined certificates. The former is recommended, because use of static configuration files does not scale well.

The module can optionally reuse existing Puppet certificates for OpenVPN.

Module usage

A Hiera example where a dynamic server with (hopefully) sane default configuration is setup:

classes:
    - openvpn

openvpn::dynamic_servers:
    office:
        vpn_network: '10.160.0.0'
        vpn_netmask: '255.255.255.0'
        use_puppetcerts: false
        tunif: 'tun10'
    push:
        - 'route 10.260.0.0 255.255.255.0'
        - 'dhcp-option DNS 10.260.0.1'
        - 'dhcp-option DOMAIN internal.company.com'

Here we setup a client to connect automatically to the above "office" server, and occasionally to an external VPN service provider using a static configuration file and to a customer VPN using password authentication and a dynamically created configuration file:

classes:
    - openvpn

openvpn::enable_service: true

openvpn::dynamic_clients:
    office:
        remote_ip: 'office-vpn-server'
        tunif: 'tun10'
        use_puppetcerts: false
        enable_service: true
    customer:
        remote_ip: 'vpn.customer.com'
        tunif: 'tun12'
        use_puppetcerts: false
        username: 'contractor'
        password: 'verysecret'
        enable_service: false

openvpn::inline_clients:
    vpn_provider:
        tunif: 'tun11'
        enable_service: false

The $enable_service parameter of the main class enables the OpenVPN system service, except on systemd distros, where the parameter makes no difference. The system service will then launch all individual OpenVPN connections which have $enable_service set to true. In the example right above the "office" connection is started automatically on boot, but the "vpn_provider" connection is not.

If you use an external CA, you need to place the CA cert as well as the client/server certificate and key to the Puppet fileserver. By default the module looks for the certificates in these locations:

"puppet:///files/openvpn-${title}-${::fqdn}.key"
"puppet:///files/openvpn-${title}-${::fqdn}.crt"
"puppet:///files/openvpn-${title}-ca.crt"

Even if you decide to reuse Puppet certificates and keys, you need to generate two additional files per OpenVPN network and place them to the Puppet fileserver:

"puppet:///files/openvpn-${title}-ta.key" (TLS auth key)
"puppet:///files/openvpn-${title}-dh.pem" (Diffie-Helmann parameters)

You can override the "puppet:///files" part using the $files_baseurl parameter, for example if you want to store the files in a module or on a different global fileshare.

To create the TLS auth key do

cd /etc/puppetlabs/code/files
openvpn --genkey --secret openvpn-${title}-ta.key

To create the Diffie-Hellman parameters do

git clone https://github.com/OpenVPN/easy-rsa
cd easy-rsa/easyrsa3
./easyrsa init-pki
./easyrsa gen-dh
cp dh.pem /etc/puppetlabs/code/files/openvpn-${title}-dh.pem

For more details please refer to the class and define documentation: