Menu

[r3313]: / trunk / etc / rc.d / ldap  Maximize  Restore  History

Download this file

44 lines (36 with data), 1.2 kB

#!/bin/sh
# Copyright (c) 2007-2008 Volker Theile (votdev@gmx.de)
# All rights reserved.

# PROVIDE: ldap
# REQUIRE: var
# BEFORE: NETWORK

#
# Configure LDAP modules
#

. /etc/rc.subr
. /etc/configxml.subr

# Defaults
ldap_config=${ldap_config:-"/var/etc/ldap.conf"}
ldap_secret=${ldap_secret:-"/var/etc/ldap.secret"}

# Create /var/etc/ldap.conf and /var/etc/ldap.secret
if configxml_isset //ldap/enable; then
	echo "Generating ldap.conf."
	/usr/local/bin/xml sel -t -m "//ldap" \
		-v "concat('host ',hostname)" -n \
		-v "concat('uri ldap://',hostname)" -n \
		-v "concat('base ',base)" -n \
		-v "concat('rootbinddn ',binddn)" -n \
		-v "concat('nss_base_passwd ',password_suffix,'?one')" -n \
		-v "concat('nss_base_group ',group_suffix,'?one')" -n \
		-v "concat('pam_password ',pam_password)" -n \
		-o "pam_ldap_attribute	uid" -n \
		-o "bind_policy soft" -n \
		-o "bind_timelimit 5" -n \
		-o "ldap_version 3" \
		${configxml_file} | /usr/local/bin/xml unesc > ${ldap_config}

	echo "Generating ldap.secret."
	/usr/local/bin/xml sel -t -m "//ldap" \
		-v "bindpw" \
		${configxml_file} | /usr/local/bin/xml unesc > ${ldap_secret}

	/bin/chmod 0600 ${ldap_secret}
fi
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.