|
233 | 233 | end |
234 | 234 | end |
235 | 235 |
|
| 236 | + case facts[:os]['family'] |
| 237 | + when 'Debian' |
| 238 | + # ldap auth needs the ldap package and that is only defined for a few OSes (including debian) |
| 239 | + context 'debian' do |
| 240 | + context 'creating a server with ldap authentication enabled' do |
| 241 | + let(:params) do |
| 242 | + { |
| 243 | + 'country' => 'CO', |
| 244 | + 'province' => 'ST', |
| 245 | + 'city' => 'Some City', |
| 246 | + 'organization' => 'example.org', |
| 247 | + |
| 248 | + 'ldap_enabled' => true, |
| 249 | + 'ldap_binddn' => 'dn=foo,ou=foo,ou=com', |
| 250 | + 'ldap_bindpass' => 'ldappass123', |
| 251 | + 'ldap_tls_enable' => true, |
| 252 | + 'ldap_tls_ca_cert_file' => '/etc/ldap/ca.pem', |
| 253 | + 'ldap_tls_ca_cert_dir' => '/etc/ldap/certs' |
| 254 | + } |
| 255 | + end |
| 256 | + |
| 257 | + it { is_expected.to contain_file('/etc/openvpn/test_server/auth/ldap.conf').with_content(%r{^\s+TLSEnable\s+yes$}) } |
| 258 | + it { is_expected.to contain_file('/etc/openvpn/test_server/auth/ldap.conf').with_content(%r{^\s+TLSCACertFile\s+/etc/ldap/ca.pem$}) } |
| 259 | + it { is_expected.to contain_file('/etc/openvpn/test_server/auth/ldap.conf').with_content(%r{^\s+TLSCACertDir\s+/etc/ldap/certs$}) } |
| 260 | + it { is_expected.to contain_file('/etc/openvpn/test_server/auth/ldap.conf').without_content(%r{^\s+TLSCertFile.*$}) } |
| 261 | + it { is_expected.to contain_file('/etc/openvpn/test_server/auth/ldap.conf').without_content(%r{^\s+TLSKeyFile.*$}) } |
| 262 | + end |
| 263 | + |
| 264 | + context 'creating a server with ldap authentication enabled and using ldap client certificates' do |
| 265 | + let(:params) do |
| 266 | + { |
| 267 | + 'country' => 'CO', |
| 268 | + 'province' => 'ST', |
| 269 | + 'city' => 'Some City', |
| 270 | + 'organization' => 'example.org', |
| 271 | + |
| 272 | + 'ldap_enabled' => true, |
| 273 | + 'ldap_binddn' => 'dn=foo,ou=foo,ou=com', |
| 274 | + 'ldap_bindpass' => 'ldappass123', |
| 275 | + 'ldap_tls_enable' => true, |
| 276 | + 'ldap_tls_ca_cert_file' => '/etc/ldap/ca.pem', |
| 277 | + 'ldap_tls_ca_cert_dir' => '/etc/ldap/certs', |
| 278 | + 'ldap_tls_client_cert_file' => '/etc/ldap/client-cert.pem', |
| 279 | + 'ldap_tls_client_key_file' => '/etc/ldap/client-key.pem' |
| 280 | + } |
| 281 | + end |
| 282 | + |
| 283 | + it { is_expected.to contain_file('/etc/openvpn/test_server/auth/ldap.conf').with_content(%r{^\s+TLSEnable\s+yes$}) } |
| 284 | + it { is_expected.to contain_file('/etc/openvpn/test_server/auth/ldap.conf').with_content(%r{^\s+TLSCACertFile\s+/etc/ldap/ca.pem$}) } |
| 285 | + it { is_expected.to contain_file('/etc/openvpn/test_server/auth/ldap.conf').with_content(%r{^\s+TLSCACertDir\s+/etc/ldap/certs$}) } |
| 286 | + it { is_expected.to contain_file('/etc/openvpn/test_server/auth/ldap.conf').with_content(%r{^\s+TLSCertFile\s+/etc/ldap/client-cert.pem$}) } |
| 287 | + it { is_expected.to contain_file('/etc/openvpn/test_server/auth/ldap.conf').with_content(%r{^\s+TLSKeyFile\s+/etc/ldap/client-key.pem$}) } |
| 288 | + end |
| 289 | + end |
| 290 | + end |
| 291 | + |
236 | 292 | context 'creating a server setting all parameters' do |
237 | 293 | let(:params) do |
238 | 294 | { |
|
0 commit comments