Skip to content

Commit abad6f9

Browse files
committed
(profile::core:openvpnas) add test filter
1 parent 00b15ea commit abad6f9

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

site/profile/manifests/core/openvpnas.pp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111
# Hash of VPN groups to create with their properties.
1212
# Example: { 'vpn-it' => { 'superuser' => true }, 'vpn-default' => { 'superuser' => false } }
1313
#
14+
# @param ldap_add_req
15+
# LDAP additional requirement filter for OpenVPN AS (auth.ldap.0.add_req).
16+
# Defaults to requiring membership in the 'vpn' group; can be overridden per-node in Hiera.
17+
#
1418
class profile::core::openvpnas (
1519
String[1] $version,
1620
Optional[String[1]] $bind_pw = undef,
1721
Hash[String, Hash] $vpn_groups = {},
22+
String[1] $ldap_add_req = 'memberOf=cn=vpn,cn=groups,cn=accounts,dc=lsst,dc=cloud',
1823
) {
1924
include profile::core::letsencrypt
2025
$fqdn = $facts['networking']['fqdn']
@@ -65,7 +70,7 @@
6570
}
6671
openvpnas::config::key { 'auth.ldap.0.add_req':
6772
key => 'auth.ldap.0.add_req',
68-
value => 'memberOf=cn=vpn,cn=groups,cn=accounts,dc=lsst,dc=cloud',
73+
value => $ldap_add_req,
6974
}
7075
openvpnas::config::key { 'auth.ldap.0.uname_attr':
7176
key => 'auth.ldap.0.uname_attr',

spec/classes/core/openvpnas_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,24 @@
203203
)
204204
end
205205
end
206+
207+
context 'with custom ldap_add_req' do
208+
let(:params) do
209+
{
210+
version: '3.0.2_87c70987',
211+
ldap_add_req: 'memberOf=cn=vpn-backup,cn=groups,cn=accounts,dc=lsst,dc=cloud'
212+
}
213+
end
214+
215+
it { is_expected.to compile.with_all_deps }
216+
217+
it do
218+
is_expected.to contain_openvpnas__config__key('auth.ldap.0.add_req').with(
219+
key: 'auth.ldap.0.add_req',
220+
value: 'memberOf=cn=vpn-backup,cn=groups,cn=accounts,dc=lsst,dc=cloud'
221+
)
222+
end
223+
end
206224
end
207225
end
208226
end

0 commit comments

Comments
 (0)