Version information
This version is compatible with:
- Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x
- Puppet >= 7.0.0 < 9.0.0
- , , , ,
Start using this module
Add this module to your Puppetfile:
mod 'simp-ds389', '0.7.0'
Learn more about managing modules with a PuppetfileDocumentation
Table of Contents
Description
This module manages the 389 Directory Server (389DS), an enterprise-class open source LDAP server for Linux. Options are provided to both create a default LDAP instance and to bootstrap it with SIMP's traditional LDAP hierarchy.
The module is named ds389
because Puppet modules cannot start with a digit.
This is a SIMP module
This module is a component of the System Integrity Management Platform
If you find any issues, please submit them via JIRA.
Please read our Contribution Guide.
This module should be used within the SIMP ecosystem and will be of limited independent use when included on its own.
Setup
Beginning with ds389
To set up a 389DS server, simply include ds389
. This will create a server with
no active instances and can be fully managed by hand.
Usage
Creating instances
389DS can host any number of LDAP instances but you need to ensure that all port numbers are unique! If port numbers overlap, then issues will arise when managing the services.
You must specify a base_dn
and a root_dn
for each instance, since these are
what define both the root of the directory (base_dn
) and the administrative
user of the directory (root_dn
). These can overlap between instances but
it is recommended that you keep them unique.
---
ds389::instances:
test:
base_dn: 'dc=test,dc=domain'
root_dn: 'cn=Test Admin'
listen_address: '0.0.0.0'
port: 380
test2:
base_dn: 'dc=some other,dc=space'
root_dn: 'cn=Directory Manager'
listen_address: '0.0.0.0'
port: 381
To access data on these instances, you need to direct your command to the appropriate port.
For example, to access the test
instance:
ldapsearch -x \
-y "/usr/share/puppet_ds389_config/test_ds_pw.txt" \
-D "cn=Directory Manager" \
-h `hostname -f` \
-p 380 \
-b "dc=test,dc=domain"
Deleting instances
LDAP instances are NOT automatically purged when they cease being managed by Puppet. This is a safety precaution, to protect users who may have set up instances using some other method, like the management console GUI. Automatic purging could result in the catastrophic loss of such valid yet unmanaged LDAP instances.
If you wish to remove an instance, you can either do it directly in Puppet:
ds389::instance { 'test2':
ensure => 'absent'
}
Or you can do it in Hiera:
---
ds389::instances:
test:
listen_address: '0.0.0.0'
port: 380
test2:
ensure: absent
Just remember that Puppet will attempt to remove this instance every time it
runs! This means that if you create an instance by hand with the name test2
then Puppet will remove it at the next run.
Reference
See REFERENCE.md for module API documentation.
For more details about 389DS, please see the vendor documentation.
Configuration item details can be found in the cn=config documentation.
Limitations
This is still a work in progress and breaking changes may occur until 1.0.0
Development
Please read our Contribution Guide.
Unit tests
Unit tests, written in rspec-puppet
can be run by calling:
bundle exec rake spec
Acceptance tests
To run the system tests, you need Vagrant installed. Then, run:
bundle exec rake beaker:suites
Some environment variables may be useful:
BEAKER_debug=true
BEAKER_provision=no
BEAKER_destroy=no
BEAKER_use_fixtures_dir_for_modules=yes
BEAKER_debug
: show the commands being run on the STU and their output.BEAKER_destroy=no
: prevent the machine destruction after the tests finish so you can inspect the state.BEAKER_provision=no
: prevent the machine from being recreated. This can save a lot of time while you're writing the tests.BEAKER_use_fixtures_dir_for_modules=yes
: cause all module dependencies to be loaded from thespec/fixtures/modules
directory, based on the contents of.fixtures.yml
. The contents of this directory are usually populated bybundle exec rake spec_prep
. This can be used to run acceptance tests to run on isolated networks.
Reference
Table of Contents
Classes
ds389
: Set up a local 389DS serverds389::install
: Set up a local 389DS server
Defined types
Public Defined types
ds389::instance
ds389::instance::attr::set
: Modifies the running directory server configuration and restarts the service when necessary. NOTE: When calling this defined type as you firds389::instance::dn::add
: Creates the passed DN using the provided paramters NOTE: When calling this defined type as you first set up an instance, you will need to pads389::instance::selinux::port
: Consolidate selinux_port enable/disable logicds389::instance::service
: Configure an instance service
Private Defined types
ds389::instance::tls
: Configure TLS for an instance
Data types
Ds389::ConfigItem
: Valid configuration itemDs389::ConfigItems
: Valid configuration items Hash
Classes
ds389
Set up a local 389DS server
Parameters
The following parameters are available in the ds389
class:
service_group
Data type: String[1]
The group DS389 is installed under.
Default value: 'dirsrv'
ldif_working_dir
Data type: Stdlib::Absolutepath
A directory used for temporary storage of ldifs during configuration.
Default value: "${config_dir}/ldifs"
instances
Data type: Hash
A hash of instances to be created when the server is installed.
Default value: {}
package_ensure
Data type: Simplib::PackageEnsure
What to do regarding package installation
Default value: simplib::lookup('simp_options::package_ensure', { 'default_value' => 'installed' })
config_dir
Data type: Stdlib::Absolutepath
Default value: '/usr/share/puppet_ds389_config'
ds389::install
Set up a local 389DS server
Parameters
The following parameters are available in the ds389::install
class:
package_list
Data type: Optional[Array[String[1]]]
A list of packages that will installed instead of the internally selected packages.
Default value: undef
setup_command
Data type: Stdlib::Unixpath
The path to the setup command on the system
Default value: '/sbin/setup-ds.pl'
dnf_module
Data type: Optional[String[1]]
Default value: undef
dnf_stream
Data type: Optional[String[1]]
Default value: undef
dnf_enable_only
Data type: Boolean
Default value: false
dnf_profile
Data type: Optional[String]
Default value: undef
remove_command
Data type: Stdlib::Unixpath
Default value: '/sbin/remove-ds.pl'
Defined types
ds389::instance
The ds389::instance class.
Parameters
The following parameters are available in the ds389::instance
defined type:
ensure
base_dn
root_dn
listen_address
port
secure_port
root_dn_password
machine_name
service_user
service_group
bootstrap_ldif_content
ds_setup_ini_content
general_config
password_policy
enable_tls
tls_params
ensure
Data type: Enum['present','absent']
Default value: 'present'
base_dn
Data type: Optional[String[2]]
Default value: undef
root_dn
Data type: Optional[Pattern['^[\S]+$']]
Default value: undef
listen_address
Data type: Simplib::IP
Default value: '127.0.0.1'
port
Data type: Simplib::Port
Default value: 389
secure_port
Data type: Simplib::Port
Default value: 636
root_dn_password
Data type: Optional[Pattern['^[\S]+$']]
Default value: undef
machine_name
Data type: String[1]
Default value: $facts['networking']['fqdn']
service_user
Data type: String[1]
Default value: 'dirsrv'
service_group
Data type: String[1]
Default value: 'dirsrv'
bootstrap_ldif_content
Data type: Optional[String[1]]
Default value: undef
ds_setup_ini_content
Data type: Optional[String[1]]
Default value: undef
general_config
Data type: Ds389::ConfigItem
Default value: simplib::dlookup('ds389::instance', 'general_config', {'default_value' => {} })
password_policy
Data type: Ds389::ConfigItem
Default value: simplib::dlookup('ds389::instance', 'password_policy', {'default_value' => {} })
enable_tls
Data type: Variant[Boolean, Enum['simp']]
Default value: simplib::lookup('simp_options::pki', { 'default_value' => false })
tls_params
Data type: Hash
Default value: simplib::dlookup('ds389::instance', 'tls_params', { 'default_value' => {} })
ds389::instance::attr::set
Modifies the running directory server configuration and restarts the service when necessary.
NOTE: When calling this defined type as you first set up an instance, you will need to pass in all parameters since the fact will not yet be fully populated.
Parameters
The following parameters are available in the ds389::instance::attr::set
defined type:
key
Data type: Optional[String[1]]
The configuration key to be set
- You can get a list of all configuration keys by running:
ldapsearch -H ldap://localhost:389 \ -y /usr/share/puppet_ds389_config/<instance_name>_ds_pw.txt \ -D "cn=Directory_Manager" -s base -b "cn=config"
- Mutually exclusive with
$attrs
$value
must be set when using this parameter.
Default value: undef
value
Data type: Optional[String[1]]
The value that should be set for $key
Default value: undef
attrs
Data type: Ds389::ConfigItems
Hash of attributes to be set.
- You can get a list of all configuration keys by running:
ldapsearch -H ldap://localhost:389 \ -y /usr/share/puppet_ds389_config/<instance_name>_ds_pw.txt \ -D "cn=Directory_Manager" -s base -b "cn=config"
- Mutually exclusive with
$key
Default value: {}
base_dn
Data type: String[2]
The base DN under which to search
Default value: 'cn=config'
instance_name
Data type: Simplib::Systemd::ServiceName
The Puppet resource name for the directory Service
resource
root_dn
Data type: Optional[String[2]]
A DN with administrative rights to the directory
- Will be determined automatically if not set
Default value: undef
root_pw_file
Data type: Optional[Stdlib::Absolutepath]
A file containing the password for use with $root_dn
- Defaults to
$ds389::config_dir/<usual pw file>
Default value: undef
host
Data type: Optional[Simplib::Host]
The host to which to connect
- Has no effect if LDAPI is enabled on the instance
- Will use 127.0.01 if not set
Default value: undef
port
Data type: Optional[Simplib::Port]
The port to which to connect
- Has no effect if LDAPI is enabled on the instance
- Will be determined automatically if not set
Default value: undef
force_ldapi
Data type: Boolean
Force the system to use the LDAPI interface
- Generally only useful during bootstrapping
Default value: false
restart_instance
Data type: Boolean
Whether or not to restart the directory server after applying this item
- This may be enabled automatically by
$attrs
Default value: false
ds389::instance::dn::add
Creates the passed DN using the provided paramters
NOTE: When calling this defined type as you first set up an instance, you will need to pass in all parameters since the fact will not yet be fully populated.
If passing a full LDIF - DO NOT WRAP LINES
Parameters
The following parameters are available in the ds389::instance::dn::add
defined type:
instance_name
dn
objectclass
attrs
content
root_dn
root_pw_file
host
port
force_ldapi
restart_instance
instance_name
Data type: Simplib::Systemd::ServiceName
The instance name as passed to ds389::instance
dn
Data type: Optional[Pattern['^\S+=.+']]
The DN to be created
Default value: undef
objectclass
Data type: Optional[Array[String[1],1]]
objectClasses to which the DN belongs
Default value: undef
attrs
Data type: Optional[Hash[String[1],String[1],1]]
Attributes that you wish to set at the time of creation
Default value: undef
content
Data type: Optional[String[3]]
The full content of the LDIF
- This may only contain one entry
- All other parameters will be ignored
- DO NOT add 'changetype: add'
Default value: undef
root_dn
Data type: Optional[String[2]]
A DN with administrative rights to the directory
- Will be determined automatically if not set
Default value: undef
root_pw_file
Data type: Optional[Stdlib::Absolutepath]
A file containing the password for use with $root_dn
- Defaults to
$ds389::config_dir/<usual pw file>
Default value: undef
host
Data type: Optional[Simplib::Host]
The host to which to connect
- Has no effect if LDAPI is enabled on the instance
- Will use 127.0.01 if not set
Default value: undef
port
Data type: Optional[Simplib::Port]
The port to which to connect
- Has no effect if LDAPI is enabled on the instance
- Will be determined automatically if not set
Default value: undef
force_ldapi
Data type: Boolean
Force the system to use the LDAPI interface
- Generally only useful during bootstrapping
Default value: false
restart_instance
Data type: Boolean
Whether or not to restart the directory server after applying this item
Default value: false
ds389::instance::selinux::port
Consolidate selinux_port enable/disable logic
Parameters
The following parameters are available in the ds389::instance::selinux::port
defined type:
default
Data type: Simplib::Port
instance
Data type: Optional[String[1]]
Default value: undef
enable
Data type: Boolean
Default value: true
ds389::instance::service
Configure an instance service
Parameters
The following parameters are available in the ds389::instance::service
defined type:
ensure
Data type: Enum['stopped','running']
Default value: simplib::dlookup('ds389::instance::service', 'ensure', $name, { 'default_value' => 'running'})
enable
Data type: Boolean
Default value: simplib::dlookup('ds389::instance::service', 'enable', $name, { 'default_value' => true})
hasrestart
Data type: Boolean
Default value: simplib::dlookup('ds389::instance::service', 'hasrestart', $name, { 'default_value' => true})
Data types
Ds389::ConfigItem
Valid configuration item
Alias of Hash[String[1], Variant[Boolean,Integer[0],Float[0],String[1],Array[String[1],1]]]
Ds389::ConfigItems
Valid configuration items Hash
Alias of Hash[Pattern['^cn=.+'], Ds389::ConfigItem]
- Fri Sep 13 2024 Steven Pritchard steve@sicura.us - 0.7.0
- [puppetsync] Update module dependencies to support simp-iptables 7.x
- Wed Jan 17 2024 Richard Gardner rick@sicura.us - 0.6.1
- Updated hiera.yaml facts to support puppet 8
- Mon Oct 23 2023 Steven Pritchard steve@sicura.us - 0.6.0
- [puppetsync] Add EL9 support
- Wed Oct 11 2023 Steven Pritchard steve@sicura.us - 0.5.0
- [puppetsync] Updates for Puppet 8
- These updates may include the following:
- Update Gemfile
- Add support for Puppet 8
- Drop support for Puppet 6
- Update module dependencies
- These updates may include the following:
- Wed Aug 23 2023 Steven Pritchard steve@sicura.us - 0.4.0
- Add AlmaLinux 8 support
- Mon Jun 12 2023 Chris Tessmer chris.tessmer@onyxpoint.com - 0.3.0
- Add RockyLinux 8 support
- Fri Jun 03 2022 Chris Tessmer chris.tessmer@onyxpoint.com - 0.2.0
- Update from camptocamp/systemd to puppet/systemd
- Wed Sep 22 2021 Trevor Vaughan tvaughan@onyxpoint.com - 0.1.2
- Ensure that the instances can load multiple CA certificates
- Tue Aug 03 2021 Trevor Vaughan tvaughan@onyxoint.com - 0.1.1
- Fixed
- Ensure that dirsrv.target is enabled so that all 389ds instances start at boot
- Set the journald LogLevelMax to warning for instances to reduce unnecessary log noise
- Tue Jun 15 2021 Trevor Vaughan tvaughan@onyxpoint.com - 0.1.0
- Initial release
Dependencies
- puppet/systemd (>= 4.0.2 < 8.0.0)
- simp/simplib (>= 4.9.0 < 5.0.0)
- puppetlabs/stdlib (>= 8.0.0 < 10.0.0)