Skip to content

Commit d97033a

Browse files
committed
Set script paths and update documentation and tests
Script paths are automatically prepended `REFERENCE.md` updated using `puppet strings generate --format markdown`. This adds some documentation for other missing items.
1 parent 80a0520 commit d97033a

File tree

4 files changed

+243
-85
lines changed

4 files changed

+243
-85
lines changed

REFERENCE.md

Lines changed: 120 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,14 @@ Determins if a tls key is generated
339339

340340
Default value: `false`
341341

342+
##### `tls_static_key`
343+
344+
Data type: `Boolean`
345+
346+
Determins if a tls key is generated
347+
348+
Default value: `false`
349+
342350
##### `crl_days`
343351

344352
Data type: `Integer`
@@ -375,7 +383,7 @@ Name of the corresponding openvpn endpoint
375383

376384
##### `compression`
377385

378-
Data type: `Enum['comp-lzo', '']`
386+
Data type: `String`
379387

380388
Which compression algorithim to use
381389

@@ -517,6 +525,14 @@ Activates tls-auth to Add an additional layer of HMAC authentication on top of t
517525

518526
Default value: `false`
519527

528+
##### `tls_crypt`
529+
530+
Data type: `Boolean`
531+
532+
Encrypt and authenticate all control channel packets with the key from keyfile. (See --tls-auth for more background.)
533+
534+
Default value: `false`
535+
520536
##### `x509_name`
521537

522538
Data type: `Optional[String]`
@@ -662,45 +678,53 @@ The following parameters are available in the `openvpn::client_specific_config`
662678

663679
##### `server`
664680

665-
Data type: `String`
681+
Data type: `String[1]`
666682

667683
Name of the corresponding openvpn endpoint
668684

669685
##### `iroute`
670686

671-
Data type: `Array[String]`
687+
Data type: `Array[String[1]]`
672688

673689
Array of iroute combinations.
674690

675691
Default value: []
676692

677693
##### `iroute_ipv6`
678694

679-
Data type: `Array[String]`
695+
Data type: `Array[String[1]]`
680696

681697
Array of IPv6 iroute combinations.
682698

683699
Default value: []
684700

685701
##### `route`
686702

687-
Data type: `Array[String]`
703+
Data type: `Array[String[1]]`
688704

689705
Array of route combinations pushed to client.
690706

691707
Default value: []
692708

693709
##### `ifconfig`
694710

695-
Data type: `Variant[Boolean, String]`
711+
Data type: `Optional[String[1]]`
696712

697713
IP configuration to push to the client.
698714

699-
Default value: `false`
715+
Default value: `undef`
716+
717+
##### `ifconfig_ipv6`
718+
719+
Data type: `Optional[String[1]]`
720+
721+
IPv6 configuration to push to the client.
722+
723+
Default value: `undef`
700724

701725
##### `dhcp_options`
702726

703-
Data type: `Array[String]`
727+
Data type: `Array[String[1]]`
704728

705729
DHCP options to push to the client.
706730

@@ -716,12 +740,20 @@ Default value: `false`
716740

717741
##### `ensure`
718742

719-
Data type: `Enum[present, absent]`
743+
Data type: `Enum['present', 'absent']`
720744

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

723747
Default value: present
724748

749+
##### `manage_client_configs`
750+
751+
Data type: `Boolean`
752+
753+
Manage dependencies on Openvpn::Client ressources
754+
755+
Default value: `true`
756+
725757
### openvpn::deploy::client
726758

727759
Collect the exported configs for an Host and ensure a running Openvpn Service
@@ -982,6 +1014,30 @@ Logfile for this openvpn server
9821014

9831015
Default value: `false`
9841016

1017+
##### `manage_logfile_directory`
1018+
1019+
Data type: `Boolean`
1020+
1021+
Manage the directory that the logfile is located in
1022+
1023+
Default value: `false`
1024+
1025+
##### `logdirectory_user`
1026+
1027+
Data type: `String[1]`
1028+
1029+
The owner user of the logfile directory
1030+
1031+
Default value: 'nobody'
1032+
1033+
##### `logdirectory_group`
1034+
1035+
Data type: `String[1]`
1036+
1037+
The owner group of the logfile directory
1038+
1039+
Default value: 'nobody'
1040+
9851041
##### `port`
9861042

9871043
Data type: `String`
@@ -1000,7 +1056,7 @@ Default value: `undef`
10001056

10011057
##### `proto`
10021058

1003-
Data type: `Enum['tcp', 'udp']`
1059+
Data type: `Enum['tcp', 'tcp4', 'tcp6', 'udp', 'udp4', 'udp6']`
10041060

10051061
What IP protocol is being used.
10061062

@@ -1160,19 +1216,35 @@ Default value: 7505
11601216

11611217
##### `up`
11621218

1163-
Data type: `String`
1219+
Data type: `Optional[String[1]]`
11641220

1165-
Script which we want to run when openvpn server starts
1221+
Script which we want to run when openvpn server starts. If the path to the scirpt does not contain a slash, it will be assumed to be in `openvpn/${name}/scripts` directory.
11661222

1167-
Default value: ''
1223+
Default value: `undef`
11681224

11691225
##### `down`
11701226

1171-
Data type: `String`
1227+
Data type: `Optional[String[1]]`
11721228

1173-
Script which we want to run when openvpn server stops
1229+
Script which we want to run when openvpn server stops. If the path to the scirpt does not contain a slash, it will be assumed to be in `openvpn/${name}/scripts` directory.
11741230

1175-
Default value: ''
1231+
Default value: `undef`
1232+
1233+
##### `client_connect`
1234+
1235+
Data type: `Optional[String[1]]`
1236+
1237+
Script which we want to run when a client connects. If the path to the scirpt does not contain a slash, it will be assumed to be in `openvpn/${name}/scripts` directory.
1238+
1239+
Default value: `undef`
1240+
1241+
##### `client_disconnect`
1242+
1243+
Data type: `Optional[String[1]]`
1244+
1245+
Script which we want to run when a client disconnects. If the path to the scirpt does not contain a slash, it will be assumed to be in `openvpn/${name}/scripts` directory.
1246+
1247+
Default value: `undef`
11761248

11771249
##### `username_as_common_name`
11781250

@@ -1296,19 +1368,19 @@ Default value: ''
12961368

12971369
##### `ldap_tls_client_cert_file`
12981370

1299-
Data type: `String`
1371+
Data type: `Optional[Stdlib::Absolutepath]`
13001372

13011373
LDAP TLS authentication: path to the tls client certificate
13021374

1303-
Default value: ''
1375+
Default value: `undef`
13041376

13051377
##### `ldap_tls_client_key_file`
13061378

1307-
Data type: `String`
1379+
Data type: `Optional[Stdlib::Absolutepath]`
13081380

13091381
LDAP TLS authentication: path to the tls client key
13101382

1311-
Default value: ''
1383+
Default value: `undef`
13121384

13131385
##### `verb`
13141386

@@ -1398,6 +1470,14 @@ Activates tls-auth to Add an additional layer of HMAC authentication on top of t
13981470

13991471
Default value: `false`
14001472

1473+
##### `tls_crypt`
1474+
1475+
Data type: `Boolean`
1476+
1477+
Encrypt and authenticate all control channel packets with the key from keyfile. (See --tls-auth for more background.)
1478+
1479+
Default value: `false`
1480+
14011481
##### `tls_server`
14021482

14031483
Data type: `Boolean`
@@ -1582,6 +1662,26 @@ A pre-shared static key.
15821662

15831663
Default value: `undef`
15841664

1665+
##### `scripts`
1666+
1667+
Data type: `Hash[String, Hash]`
1668+
1669+
Hash of scripts to copy with this instance.
1670+
For example, to put a script in `/etc/openvpn/test-site/scripts/add-tap-to-bridge.sh` and use it as an `up` script
1671+
``` puppet
1672+
openvpn::server { 'test-site':
1673+
....
1674+
up => 'add-tap-to-bridge.sh',
1675+
scripts => {
1676+
"add-tap-to-bridge.sh" => {
1677+
source => 'puppet:///path/to/add-tap-to-bridge.sh',
1678+
},
1679+
},
1680+
}
1681+
```
1682+
1683+
Default value: {}
1684+
15851685
##### `custom_options`
15861686

15871687
Data type: `Hash`

manifests/server.pp

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@
4141
# @param management Enable management interface
4242
# @param management_ip IP address where the management interface will listen
4343
# @param management_port Port where the management interface will listen
44-
# @param up Script which we want to run when openvpn server starts
45-
# @param down Script which we want to run when openvpn server stops
44+
# @param up Script which we want to run when openvpn server starts. If the path to the scirpt does not contain a slash, it will be assumed to be in `openvpn/${name}/scripts` directory.
45+
# @param down Script which we want to run when openvpn server stops. If the path to the scirpt does not contain a slash, it will be assumed to be in `openvpn/${name}/scripts` directory.
46+
# @param client_connect Script which we want to run when a client connects. If the path to the scirpt does not contain a slash, it will be assumed to be in `openvpn/${name}/scripts` directory.
47+
# @param client_disconnect Script which we want to run when a client disconnects. If the path to the scirpt does not contain a slash, it will be assumed to be in `openvpn/${name}/scripts` directory.
4648
# @param username_as_common_name If true then set username-as-common-name
4749
# @param client_cert_not_required If true then set client-cert-not-required
4850
# @param ldap_enabled If ldap is enabled, do stuff
@@ -96,6 +98,19 @@
9698
# @param nobind Whether or not to bind to a specific port number.#
9799
# @param secret A pre-shared static key.
98100
# @param scripts Hash of scripts to copy with this instance.
101+
# For example, to put a script in `/etc/openvpn/test-site/scripts/add-tap-to-bridge.sh` and use it as an `up` script
102+
# ``` puppet
103+
# openvpn::server { 'test-site':
104+
# ....
105+
# up => 'add-tap-to-bridge.sh',
106+
# scripts => {
107+
# "add-tap-to-bridge.sh" => {
108+
# source => 'puppet:///path/to/add-tap-to-bridge.sh',
109+
# },
110+
# },
111+
# }
112+
# ```
113+
#
99114
# @param custom_options Hash of additional options to append to the configuration file.
100115
#
101116
# @example install
@@ -107,6 +122,7 @@
107122
# email => '[email protected]',
108123
# server => '10.200.200.0 255.255.255.0',
109124
# }
125+
#
110126
# @example a server in client mode
111127
# file {
112128
# '/etc/openvpn/zurich/keys/ca.crt':
@@ -165,8 +181,10 @@
165181
Boolean $management = false,
166182
String $management_ip = 'localhost',
167183
Variant[Stdlib::Port::Unprivileged,Enum['unix']] $management_port = 7505,
168-
String $up = '',
169-
String $down = '',
184+
Optional[String[1]] $up = undef,
185+
Optional[String[1]] $down = undef,
186+
Optional[String[1]] $client_connect = undef,
187+
Optional[String[1]] $client_disconnect = undef,
170188
Boolean $username_as_common_name = false,
171189
Boolean $client_cert_not_required = false,
172190
Boolean $ldap_enabled = false,
@@ -419,6 +437,10 @@
419437

420438
# template use $_easyrsa_version
421439
$_easyrsa_version = $openvpn::easyrsa_version
440+
441+
# Template might need script directory
442+
$_script_dir = "${etc_directory}/openvpn/${name}/scripts"
443+
422444
file { "${etc_directory}/openvpn/${name}.conf":
423445
owner => root,
424446
group => 0,
@@ -441,7 +463,7 @@
441463
}
442464

443465
$scripts.each |String $scriptname, Hash $properties| {
444-
file { "${etc_directory}/openvpn/${name}/scripts/${scriptname}":
466+
file { "${_script_dir}/${scriptname}":
445467
* => $properties,
446468
}
447469
}

0 commit comments

Comments
 (0)