Skip to content

Commit

Permalink
Merge pull request #342 from voxpupuli/fix-freebsd-directory
Browse files Browse the repository at this point in the history
  • Loading branch information
smortex authored Oct 24, 2021
2 parents 3fc9d20 + 27a0de4 commit 9ecdd03
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 16 deletions.
3 changes: 3 additions & 0 deletions data/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ openldap::server::group: "ldap"
openldap::server::owner: "ldap"
openldap::server::service: "slapd"
openldap::server::escape_ldapi_ifs: false
openldap::server::ldapi_ifs:
- "/"
openldap::server::default_directory: "/var/lib/ldap"
3 changes: 3 additions & 0 deletions data/os/FreeBSD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ openldap::server::confdir: "/usr/local/etc/openldap/slapd.d"
openldap::server::conffile: "/usr/local/etc/openldap/slapd.conf"
openldap::server::package: "openldap24-server"
openldap::server::escape_ldapi_ifs: true
openldap::server::ldapi_ifs:
- "/var/run/openldap/ldapi"
openldap::server::default_directory: "/var/db/openldap-data"
3 changes: 2 additions & 1 deletion manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
String[1] $owner,
String[1] $group,
Boolean $escape_ldapi_ifs,
Array[String[1]] $ldapi_ifs,
Stdlib::Absolutepath $default_directory,
Optional[Boolean] $enable_chown = undef,
Optional[Boolean] $service_hasstatus = undef,
Boolean $enable = true,
Expand All @@ -17,7 +19,6 @@
Hash $databases = {},
Array[String[1]] $ldap_ifs = ['/'],
Array[String[1]] $ldaps_ifs = [],
Array[String[1]] $ldapi_ifs = ['/'],
Optional[String] $slapd_params = undef,
Optional[Stdlib::Port] $ldap_port = undef,
Optional[Stdlib::IP::Address] $ldap_address = undef,
Expand Down
18 changes: 15 additions & 3 deletions manifests/server/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
}
$slapd_ldap_urls = "${slapd_ldap_ifs} ${slapd_ldapi_ifs} ${slapd_ldaps_ifs}"

file { $openldap::server::confdir:
ensure => directory,
owner => $openldap::server::owner,
group => $openldap::server::group,
mode => '0750',
force => true,
}

case $facts['os']['family'] {
'Debian': {
shellvar { 'slapd':
Expand Down Expand Up @@ -114,9 +122,13 @@
# On FreeBSD we need to bootstrap slapd.d
$ldif = file('openldap/cn-config.ldif')
exec { 'bootstrap cn=config':
path => '/usr/local/sbin',
command => "echo '${ldif}' | slapadd -n 0 -F ${openldap::server::confdir}",
creates => "${openldap::server::confdir}/cn=config.ldif",
path => '/usr/local/sbin',
command => "echo '${ldif}' | slapadd -n 0 -F ${openldap::server::confdir}",
creates => "${openldap::server::confdir}/cn=config.ldif",
provider => 'shell',
user => $openldap::server::owner,
group => $openldap::server::group,
require => File[$openldap::server::confdir],
}
}
'Suse': {
Expand Down
5 changes: 1 addition & 4 deletions manifests/server/database.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@
'config' => undef,
'relay' => undef,
'ldap' => undef,
default => $directory ? {
undef => '/var/lib/ldap',
default => $directory,
},
default => $directory.lest || { $openldap::server::default_directory },
}

Class['openldap::server::service']
Expand Down
8 changes: 0 additions & 8 deletions manifests/server/slapdconf.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
class openldap::server::slapdconf {
include openldap::server

file { $openldap::server::confdir:
ensure => directory,
owner => $openldap::server::owner,
group => $openldap::server::group,
mode => '0750',
force => true,
}

if $openldap::server::ssl_cert {
if $openldap::server::ssl_key {
openldap::server::globalconf { 'TLSCertificate':
Expand Down

0 comments on commit 9ecdd03

Please sign in to comment.