A page in your DokuWiki was added or changed. Here are the details:
Date : 2018/04/03 10:33
Browser : Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:59.0) Gecko/20100101
Firefox/59.0
IP-Address : 81.250.130.213
Hostname : LNeuilly-657-1-3-213.w81-250.abo.wanadoo.fr
Old Revision:
http://ltb-project.org/documentation/openldap-initscript?rev=1485426059
New Revision: http://ltb-project.org/documentation/openldap-initscript
Edit Summary:
User : coudot
@@ -1,26 +1,26 @@
- ====== OpenLDAP init script======
+ ====== OpenLDAP init script and CLI ======
===== Presentation =====
- The init script ''slapd'' provide start, stop and other commands for OpenLDAP
daemon. It requires:
+ The script ''slapd-cli'' provide start, stop and other commands for OpenLDAP
daemon. It requires:
* Logger, to forward messages to syslog
* Awk, for regular expression management
* BerkeleyDB, for recover and archive tools
* OpenLDAP, for save, index, ... tools
- Configuration of this script can be done in an external file, with the same
name as the init script in ''/etc/default''.
+ Configuration of this script can be done in an external file, with the same
name as the slapd-cli script in ''/usr/local/openldap/etc/openldap''.
A backup feature allows to save all data or configuration in an LDIF file,
compressed or not. The restore feature import the last backup in the directory.
- <note tip>This script is included in [[openldap-rpm|LTB OpenLDAP RPMS]]</note>
+ <note tip>This script is included in [[openldap-rpm|LTB OpenLDAP RPMS]] and
[[openldap-deb|LTB OpenLDAP DEBS]]</note>
- ===== Usage =====
+ ===== Usage of CLI =====
Run the script like that:
<code>
- # /etc/init.d/slapd action
+ # /usr/local/openldap/sbin/slapd-cli <action>
</code>
With action in:
* ''start'':
@@ -49,61 +49,38 @@
* ''backupconfig'': LDIF export of configuration or copy of slapd.conf
* ''restoreconfig'': Remove current configuration and restore last backup
* ''status'': Display running status and naming contexts
* ''debug'': Stop OpenLDAP and restart it in debug mode (level can be
configured), with output on the console
+ * ''checksync'': Try to find configured providers and check synchronization
status
- ===== Installation =====
+ ===== Installation of CLI =====
- Copy script in ''/etc/init.d'':
+ Copy script in ''/usr/local/openldap/sbin'':
<code>
- # mv slapd /etc/init.d
- # chmod +x /etc/init.d/slapd
+ # mv slapd-cli /usr/local/openldap/sbin
+ # chmod +x /usr/local/openldap/sbin/slapd
</code>
- Configure the service in init levels:
- <code>
- # ln -s /etc/init.d/slapd /etc/rc3.d/S90slapd
- # ln -s /etc/init.d/slapd /etc/rc4.d/S90slapd
- # ln -s /etc/init.d/slapd /etc/rc5.d/S90slapd
- # ln -s /etc/init.d/slapd /etc/rc0.d/K10slapd
- # ln -s /etc/init.d/slapd /etc/rc6.d/K10slapd
- </code>
+ Configuration file must be installed in ''/usr/local/openldap/etc/openldap'':
- For RedHat based systems:
<code>
- # chkconfig --add slapd
+ # mkdir -p /usr/local/openldap/etc/openldap
+ # mv slapd-cli.conf /usr/local/openldap/etc/openldap
+ # chmod 600 /usr/local/openldap/etc/openldap/slapd-cli.conf
</code>
- For Debian base systems:
- <code>
- # update-rc.d slapd defaults
- </code>
+ ===== Configuration of CLI =====
- Configuration file must be installed in ''/etc/default'':
-
- <code>
- # mkdir -p /etc/default
- # mv slapd.default /etc/default/slapd
- # chmod 600 /etc/default/slapd
- </code>
-
- You can run several OpenLDAP daemons on the same server, and use different
init scripts. For example to have a "slapd2" init script:
- <code>
- # ln -s /etc/init.d/slapd /etc/init.d/slapd2
- # cp /etc/default/slapd /etc/default/slapd2
- </code>
-
- ===== Configuration =====
-
- Use the external file in ''/etc/default'' rather than editing directly the
script.
+ Use the external file in ''/usr/local/openldap/etc/openldap'' rather than
editing directly the script.
* Following parameters are mandatory:
| //Parameter// | //Description// |
| ''IP'' | Listen address for standard LDAP requests. Meta character ''*''
can be used for all interfaces |
| ''PORT'' | Listen port for standard LDAP requests. Use ''SLAPD_SERVICES''
if you need several ports |
| ''SSLIP'' | Listen address for LDAPS requests. Meta character ''*'' can be
used for all interfaces |
- | ''SSLPORT'' | Listen port for LDAPS requests. Use ''SLAPD_SERVICES'' if you
need several ports |
+ | ''LDAPI_SOCKETDIR'' | Directory where LDAPI socket is created (will be
created if it does not exist) |
+ | ''LDAPI_SOCKETURL'' | LDAPI socket URL (URL encoded value) |
| - | |
| ''SLAPD_PATH'' | OpenLDAP main directory |
| ''DATA_PATH'' | Data directory. You can set ''auto'' to get directories
configured in ''slapd.conf'' |
| ''SLAPD_PID_FILE'' | The ''pidfile'' parameter of ''slapd.conf'' |
@@ -145,4 +122,81 @@
| ''BACKUP_COMPRESS_EXT'' | Extension of LDIF compressed file. No compression
is done if this is empty |
| ''BACKUP_COMPRESS_BIN'' | Binary used to compress LDIF file |
| ''BACKUP_UNCOMPRESS_BIN'' | Binary used to uncompress LDIF file |
| ''DEBUG_LEVEL'' | OpenLDAP log level to use in debug mode. Default is 256
(stats) |
+
+ ===== initd script =====
+
+ The ''slapd-cli'' command is used in an initd script.
+
+ Installation:
+ <code>
+ # cp slapd.init /etc/init.d/slapd
+ # chmod +x /etc/init.d/slapd
+ </code>
+
+ For RedHat based systems:
+ <code>
+ # chkconfig --add slapd
+ </code>
+
+ For Debian based systems:
+ <code>
+ # update-rc.d slapd defaults
+ </code>
+
+ ===== systemd script =====
+
+ The ''slapd-cli'' command is used in an systemd script.
+
+ Installation:
+ <code>
+ # cp slapd.service /etc/systemd/system/
+ # systemctl --system daemon-reload
+ # systemctl enable slapd.service
+ </code>
+
+ ===== Run several OpenLDAP instances =====
+
+
+ You can run several OpenLDAP daemons on the same server.
+
+ ==== initd script ====
+
+ * Copy initd script:
+ <code>
+ # cp /etc/init.d/slapd /etc/init.d/slapd2
+ </code>
+ * Change ''CLI_BIN'' value:
+ <file>
+ CLI_BIN="/usr/local/openldap/sbin/slapd2-cli"
+ </file>
+ * Link ''slapd-cli'' command:
+ <code>
+ # ln -s /usr/local/openldap/sbin/slapd-cli /usr/local/openldap/sbin/slapd2-cli
+ </code>
+ * Copy and edit ''slapd-cli'' configuration to change at least the ports
and PID file:
+ <code>
+ # cp /usr/local/openldap/etc/openldap/slapd-cli.conf
/usr/local/openldap/etc/openldap/slapd2-cli.conf
+ </code>
+
+ ==== systemd script ====
+
+ * Copy systemd script:
+ <code>
+ # cp /etc/systemd/system/slapd.service /etc/systemd/system/slapd2.service
+ </code>
+ * Change ''PIDFile'', ''ExecStart'', ''ExecRestart'', ''ExecStop'' values:
+ <file>
+ PIDFile=/usr/local/openldap/var/run/slapd2.pid
+ ExecStart=/usr/local/openldap/sbin/slapd2-cli start
+ ExecRestart=/usr/local/openldap/sbin/slapd2-cli restart
+ ExecStop=/usr/local/openldap/sbin/slapd2-cli stop
+ </file>
+ * Link ''slapd-cli'' command:
+ <code>
+ # ln -s /usr/local/openldap/sbin/slapd-cli /usr/local/openldap/sbin/slapd2-cli
+ </code>
+ * Copy and edit ''slapd-cli'' configuration to change at least the ports
and PID file:
+ <code>
+ # cp /usr/local/openldap/etc/openldap/slapd-cli.conf
/usr/local/openldap/etc/openldap/slapd2-cli.conf
+ </code>
--
This mail was generated by DokuWiki at
http://ltb-project.org/
_______________________________________________
ltb-changes mailing list
[email protected]
https://lists.ltb-project.org/cgi-bin/mailman/listinfo/ltb-changes