Fix LDAP support for openSUSE

Closes-Bug: #1227651
Change-Id: I1c55fbb2f65f882a0ae2bcf4767c0a3e0f0f47e7
This commit is contained in:
Ralf Haferkamp 2013-09-12 14:24:47 +02:00
parent 9c3b0cc4e4
commit 704106a1bd
2 changed files with 33 additions and 4 deletions

View File

@ -0,0 +1,19 @@
dn: cn=config
objectClass: olcGlobal
cn: config
olcArgsFile: /var/run/slapd/slapd.args
olcAuthzRegexp: {0}gidNumber=0\+uidNumber=0,cn=peercred,cn=external,cn=auth dn
:cn=config
olcPidFile: /var/run/slapd/slapd.pid
olcSizeLimit: 10000
dn: cn=schema,cn=config
objectClass: olcSchemaConfig
cn: schema
include: file:///etc/openldap/schema/core.ldif
dn: olcDatabase={1}hdb,cn=config
objectClass: olcHdbConfig
olcDbDirectory: /var/lib/ldap
olcSuffix: dc=openstack,dc=org

View File

@ -8,6 +8,7 @@
XTRACE=$(set +o | grep xtrace) XTRACE=$(set +o | grep xtrace)
set +o xtrace set +o xtrace
LDAP_SERVICE_NAME=slapd
# Functions # Functions
# --------- # ---------
@ -24,10 +25,19 @@ function install_ldap() {
LDAP_ROOTPW_COMMAND=replace LDAP_ROOTPW_COMMAND=replace
sudo DEBIAN_FRONTEND=noninteractive apt-get install slapd ldap-utils sudo DEBIAN_FRONTEND=noninteractive apt-get install slapd ldap-utils
#automatically starts LDAP on ubuntu so no need to call start_ldap #automatically starts LDAP on ubuntu so no need to call start_ldap
elif is_fedora || is_suse; then elif is_fedora; then
LDAP_OLCDB_NUMBER=2 LDAP_OLCDB_NUMBER=2
LDAP_ROOTPW_COMMAND=add LDAP_ROOTPW_COMMAND=add
start_ldap start_ldap
elif is_suse; then
LDAP_OLCDB_NUMBER=1
LDAP_ROOTPW_COMMAND=add
LDAP_SERVICE_NAME=ldap
# SUSE has slappasswd in /usr/sbin/
PATH=$PATH:/usr/sbin/
sudo slapadd -F /etc/openldap/slapd.d/ -bcn=config -l $FILES/ldap/base-config.ldif
sudo sed -i '/^OPENLDAP_START_LDAPI=/s/"no"/"yes"/g' /etc/sysconfig/openldap
start_ldap
fi fi
printf "generate password file" printf "generate password file"
@ -42,7 +52,7 @@ function install_ldap() {
sudo ldapmodify -Y EXTERNAL -H ldapi:/// -f $TMP_MGR_DIFF_FILE sudo ldapmodify -Y EXTERNAL -H ldapi:/// -f $TMP_MGR_DIFF_FILE
# On fedora we need to manually add cosine and inetorgperson schemas # On fedora we need to manually add cosine and inetorgperson schemas
if is_fedora; then if is_fedora || is_suse; then
sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/cosine.ldif sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/cosine.ldif
sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/inetorgperson.ldif sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/inetorgperson.ldif
fi fi
@ -64,13 +74,13 @@ function install_ldap() {
# start_ldap() - Start LDAP # start_ldap() - Start LDAP
function start_ldap() { function start_ldap() {
sudo service slapd restart sudo service $LDAP_SERVICE_NAME restart
} }
# stop_ldap() - Stop LDAP # stop_ldap() - Stop LDAP
function stop_ldap() { function stop_ldap() {
sudo service slapd stop sudo service $LDAP_SERVICE_NAME stop
} }
# clear_ldap_state() - Clear LDAP State # clear_ldap_state() - Clear LDAP State