Defined Type: openvpn::client_specific_config

Defined in:
manifests/client_specific_config.pp

Overview

This feature is explained here: openvpn.net/index.php/open-source/documentation/howto.html#policy All the parameters are explained in the openvpn documentation openvpn.net/index.php/open-source/documentation/howto.html#policy

Examples:

openvpn::client_specific_config {
  'vpn_client':
    server       => 'contractors',
    iroute       => ['10.0.1.0 255.255.255.0'],
    ifconfig     => '10.10.10.1 10.10.10.2',
    dhcp_options => ['DNS 8.8.8.8']
 }

Parameters:

  • server (String[1])

    Name of the corresponding openvpn endpoint

  • iroute (Array[String[1]]) (defaults to: [])

    Array of iroute combinations.

  • iroute_ipv6 (Array[String[1]]) (defaults to: [])

    Array of IPv6 iroute combinations.

  • route (Array[String[1]]) (defaults to: [])

    Array of route combinations pushed to client.

  • ifconfig (Optional[String[1]]) (defaults to: undef)

    IP configuration to push to the client.

  • ifconfig_ipv6 (Optional[String[1]]) (defaults to: undef)

    IPv6 configuration to push to the client.

  • dhcp_options (Array[String[1]]) (defaults to: [])

    DHCP options to push to the client.

  • redirect_gateway (Boolean) (defaults to: false)

    Redirect all traffic to gateway

  • ensure (Enum['present', 'absent']) (defaults to: present)

    Sets the client specific configuration file status (present or absent)

  • manage_client_configs (Boolean) (defaults to: true)

    Manage dependencies on Openvpn::Client ressources



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'manifests/client_specific_config.pp', line 25

define openvpn::client_specific_config (
  String[1] $server,
  Enum['present', 'absent'] $ensure  = present,
  Array[String[1]] $iroute           = [],
  Array[String[1]] $iroute_ipv6      = [],
  Array[String[1]] $route            = [],
  Optional[String[1]] $ifconfig      = undef,
  Optional[String[1]] $ifconfig_ipv6 = undef,
  Array[String[1]]  $dhcp_options    = [],
  Boolean $redirect_gateway          = false,
  Boolean $manage_client_configs     = true,
) {
  if $manage_client_configs {
    Openvpn::Server[$server]
    -> Openvpn::Client[$name]
    -> Openvpn::Client_specific_config[$name]
  } else {
    Openvpn::Server[$server]
    -> Openvpn::Client_specific_config[$name]
  }

  file { "${openvpn::server_directory}/${server}/client-configs/${name}":
    ensure  => $ensure,
    content => template('openvpn/client_specific_config.erb'),
  }
}