FreeNAS Code
This project has moved to github - see https://github.com/freenas
Brought to you by:
cochard,
mattolander
#!/bin/sh # Copyright (c) 2007-2009 Volker Theile (votdev@gmx.de) # All rights reserved. # PROVIDE: ldap # REQUIRE: var # BEFORE: NETWORK # # Configure LDAP modules # . /etc/rc.subr . /etc/configxml.subr name="ldap" load_rc_config "${name}" # Defaults ldap_config=${ldap_config:-"/var/etc/ldap.conf"} ldap_secret=${ldap_secret:-"/var/etc/ldap.secret"} # Clear existing file /bin/cat /dev/null > ${ldap_config} /bin/cat /dev/null > ${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 \ -i "count(anonymousbind) = 0" \ -v "concat('binddn ',binddn)" -n \ -v "concat('bindpw ',bindpw)" -n \ -b \ -v "concat('rootbinddn ',rootbinddn)" -n \ -i "string-length(password_suffix) > 0" -v "concat('nss_base_passwd ',password_suffix,',',base,'?one')" -n -b \ -i "string-length(group_suffix) > 0" -v "concat('nss_base_group ',group_suffix,',',base,'?one')" -n -b \ -v "concat('pam_password ',pam_password)" -n \ -m "auxparam" -v "." -n -b \ ${configxml_file} | /usr/local/bin/xml unesc > ${ldap_config} echo "Generating ldap.secret." /usr/local/bin/xml sel -t -m "//ldap" \ -v "rootbindpw" \ ${configxml_file} | /usr/local/bin/xml unesc > ${ldap_secret} /bin/chmod 0600 ${ldap_secret} fi