|
20 | 20 | # @param pam DEPRECATED: Boolean, Enable/Disable. |
21 | 21 | # @param authuserpass Set if username and password required |
22 | 22 | # @param tls_auth Activates tls-auth to Add an additional layer of HMAC authentication on top of the TLS control channel to protect against DoS attacks. This has to be set to the same value as on the Server |
| 23 | +# @param tls_crypt Encrypt and authenticate all control channel packets with the key from keyfile. (See --tls-auth for more background.) |
23 | 24 | # @param x509_name Common name of openvpn server to make an x509-name verification |
24 | 25 | # @param setenv Set a custom environmental variable name=value to pass to script. |
25 | 26 | # @param setenv_safe Set a custom environmental variable OPENVPN_name=value to pass to script. This directive is designed to be pushed by the server to clients, and the prepending of "OPENVPN_" to the environmental variable is a safety precaution to prevent a LD_PRELOAD style attack from a malicious or compromised server. |
|
45 | 46 | # |
46 | 47 | define openvpn::client ( |
47 | 48 | String $server, |
48 | | - Enum['comp-lzo', ''] $compression = 'comp-lzo', |
| 49 | + String $compression = 'comp-lzo', |
49 | 50 | Enum['tap', 'tun'] $dev = 'tun', |
50 | 51 | Integer $mute = 20, |
51 | 52 | Boolean $mute_replay_warnings = true, |
|
67 | 68 | String $up = '', |
68 | 69 | String $down = '', |
69 | 70 | Boolean $tls_auth = false, |
| 71 | + Boolean $tls_crypt = false, |
70 | 72 | Optional[String] $x509_name = undef, |
71 | 73 | Optional[Integer] $sndbuf = undef, |
72 | 74 | Optional[Integer] $rcvbuf = undef, |
|
89 | 91 |
|
90 | 92 | $extca_enabled = pick(getparam(Openvpn::Server[$server], 'extca_enabled'), $server_extca_enabled) |
91 | 93 | if $extca_enabled { fail('cannot currently create client configs when corresponding openvpn::server is extca_enabled') } |
| 94 | + if $tls_auth and $tls_crypt { fail('tls_auth and tls_crypt are mutually exclusive') } |
92 | 95 |
|
93 | 96 | $ca_name = pick($shared_ca, $server) |
94 | 97 | Openvpn::Ca[$ca_name] |
|
164 | 167 | require => Exec["generate certificate for ${name} in context of ${ca_name}"], |
165 | 168 | } |
166 | 169 |
|
167 | | - if $tls_auth { |
| 170 | + if $tls_auth or $tls_crypt { |
168 | 171 | file { "${etc_directory}/openvpn/${server}/download-configs/${name}/keys/${name}/ta.key": |
169 | 172 | ensure => link, |
170 | 173 | target => "${etc_directory}/openvpn/${server}/easy-rsa/keys/ta.key", |
|
319 | 322 | order => '13', |
320 | 323 | } |
321 | 324 | } |
| 325 | + elsif $tls_crypt { |
| 326 | + concat::fragment { "/etc/openvpn/${server}/download-configs/${name}.ovpn/tls_crypt_open_tag": |
| 327 | + target => "${etc_directory}/openvpn/${server}/download-configs/${name}.ovpn", |
| 328 | + content => "<tls-crypt>\n", |
| 329 | + order => '11', |
| 330 | + } |
| 331 | + |
| 332 | + concat::fragment { "${etc_directory}/openvpn/${server}/download-configs/${name}.ovpn/tls_crypt": |
| 333 | + target => "${etc_directory}/openvpn/${server}/download-configs/${name}.ovpn", |
| 334 | + source => "${etc_directory}/openvpn/${server}/download-configs/${name}/keys/${name}/ta.key", |
| 335 | + order => '12', |
| 336 | + } |
| 337 | + |
| 338 | + concat::fragment { "${etc_directory}/openvpn/${server}/download-configs/${name}.ovpn/tls_crypt_close_tag": |
| 339 | + target => "${etc_directory}/openvpn/${server}/download-configs/${name}.ovpn", |
| 340 | + content => "</tls-crypt>\n", |
| 341 | + order => '13', |
| 342 | + } |
| 343 | + } |
322 | 344 | } |
0 commit comments