Version information
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
Add this module to your Puppetfile:
mod 'puppetfinland-openvpn', '3.3.1'
Learn more about managing modules with a PuppetfileDocumentation
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:
Dependencies
- puppetfinland/monit (>= 0.5.0)
- puppetfinland/packetfilter (>= 0.5.0)
- duritong/sysctl (>= 0.0.6)
- puppetfinland/os (>= 1.0.0)
- puppetfinland/systemd (>= 0.1.2)
- puppetfinland/puppetagent (>= 0.4.0)
- puppetlabs/stdlib (>= 4.0.0)
- puppetlabs/apt (>= 2.0.0)
Copyright 2017 Samuli Seppänen, 2016 Mikko Vilpponen, 2018 OpenVPN, Inc. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.