Puppet Class: openvpn::params

Inherited by:
openvpn::install
Defined in:
manifests/params.pp

Overview

License

Copyright 2013 Raffael Schmid, <raffael@yux.ch>

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.



17
18
19
20
21
22
23
24
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'manifests/params.pp', line 17

class openvpn::params {

  case $::osfamily {
    'RedHat': {
      $etc_directory       = '/etc'
      $root_group          = 'root'
      $group               = 'nobody'
      $link_openssl_cnf    = true
      $pam_module_path     = '/usr/lib64/openvpn/plugin/lib/openvpn-auth-pam.so'
      $additional_packages = ['easy-rsa']
      $easyrsa_source      = '/usr/share/easy-rsa/2.0'
      $namespecific_rclink = false

      # Redhat/Centos >= 7.0
      if(versioncmp($::operatingsystemrelease, '7.0') >= 0) and $::operatingsystem != 'Amazon' {
        $systemd = true
      # Redhat/Centos < 7
      } else {
        $systemd = false
      }

      $ldap_auth_plugin_location = undef # no ldap plugin on redhat/centos
    }
    'Debian': { # Debian/Ubuntu
      $etc_directory       = '/etc'
      $root_group          = 'root'
      $group               = 'nogroup'
      $link_openssl_cnf    = true
      $pam_module_path     = '/usr/lib/openvpn/openvpn-auth-pam.so'
      $namespecific_rclink = false

      case $::operatingsystem {
        'Debian': {
          # Version > 8.0, jessie
          if(versioncmp($::operatingsystemrelease, '8.0') >= 0) {
            $additional_packages       = ['easy-rsa','openvpn-auth-ldap']
            $easyrsa_source            = '/usr/share/easy-rsa/'
            $ldap_auth_plugin_location = '/usr/lib/openvpn/openvpn-auth-ldap.so'
            $systemd                   = true

          # Version > 7.0, wheezy
          } elsif(versioncmp($::operatingsystemrelease, '7.0') >= 0) {
            $additional_packages       = ['openvpn-auth-ldap']
            $easyrsa_source            = '/usr/share/doc/openvpn/examples/easy-rsa/2.0'
            $ldap_auth_plugin_location = '/usr/lib/openvpn/openvpn-auth-ldap.so'
            $systemd                   = false
          } else {
            $additional_packages       = undef
            $easyrsa_source            = '/usr/share/doc/openvpn/examples/easy-rsa/2.0'
            $ldap_auth_plugin_location = undef
            $systemd                   = false
          }
        }
        'Ubuntu': {
          # Version > 15.04, vivid
          if(versioncmp($::operatingsystemrelease, '15.04') >= 0){
            $additional_packages       = ['easy-rsa','openvpn-auth-ldap']
            $easyrsa_source            = '/usr/share/easy-rsa/'
            $ldap_auth_plugin_location = '/usr/lib/openvpn/openvpn-auth-ldap.so'
            $systemd                   = true

          # Version > 13.10, saucy
          } elsif(versioncmp($::operatingsystemrelease, '13.10') >= 0) {
            $additional_packages       = ['easy-rsa','openvpn-auth-ldap']
            $easyrsa_source            = '/usr/share/easy-rsa/'
            $ldap_auth_plugin_location = '/usr/lib/openvpn/openvpn-auth-ldap.so'
            $systemd                   = false
          } else {
            $additional_packages       = undef
            $easyrsa_source            = '/usr/share/doc/openvpn/examples/easy-rsa/2.0'
            $ldap_auth_plugin_location = undef
            $systemd                   = false
          }
        }
        default: {
          fail("Unsupported OS/Distribution ${::osfamily}/${::operatingsystem}")
        }
      }
    }
    'Archlinux': {
      $etc_directory             = '/etc'
      $root_group                = 'root'
      $additional_packages       = ['easy-rsa']
      $easyrsa_source            = '/usr/share/easy-rsa/'
      $group                     = 'nobody'
      $ldap_auth_plugin_location = undef # unsupported
      $link_openssl_cnf          = true
      $systemd                   = true
      $namespecific_rclink       = false
    }
    'Linux': {
      case $::operatingsystem {
        'Amazon': {
          $etc_directory             = '/etc'
          $root_group                = 'root'
          $group                     = 'nobody'
          $additional_packages       = ['easy-rsa']
          $easyrsa_source            = '/usr/share/easy-rsa/2.0'
          $ldap_auth_plugin_location = undef
          $systemd                   = false
          $link_openssl_cnf          = true
          $pam_module_path           = '/usr/lib/openvpn/openvpn-auth-pam.so'
          $namespecific_rclink       = false
        }
        default: {
          fail("Unsupported OS/Distribution ${::osfamily}/${::operatingsystem}")
        }
      }
    }
    'FreeBSD': {
      $etc_directory       = '/usr/local/etc'
      $root_group          = 'wheel'
      $group               = 'nogroup'
      $link_openssl_cnf    = true
      $pam_module_path     = '/usr/local/lib/openvpn/openvpn-auth-pam.so'
      $additional_packages = ['easy-rsa']
      $easyrsa_source      = '/usr/local/share/easy-rsa'
      $namespecific_rclink = true
    }
    default: {
      fail("Not supported OS family ${::osfamily}")
    }
  }
}