pastebin - collaborative debugging tool
rovema.kpaste.net RSS

Difference between
modified post 3614ba43a3 by Anonymous on Sat 5th Aug 2023 12:20
original post eb12d by Anonymous on Sat 5th Aug 2023 12:15
Download diff
Show old version | new version | both versions

    
11
#!/bin/ksh93
22
33
#
44
# openldap test setup
55
#
66
77
set -o nounset
88
99
compound c=(
1010
	typeset -r tempdatadir="$PWD/tmpdata"
11+
	typeset -r ldap_url='ldap://10.49.20.131:8888'
1112
)
1213
1314
1415
1516
cat >'slapd.conf' <<EOF
1617
include         /etc/ldap/schema/corba.schema
1718
include         /etc/ldap/schema/core.schema
1819
include         /etc/ldap/schema/cosine.schema
1920
include         /etc/ldap/schema/duaconf.schema
2021
include         /etc/ldap/schema/dyngroup.schema
2122
include         /etc/ldap/schema/inetorgperson.schema
2223
include         /etc/ldap/schema/java.schema
2324
include         /etc/ldap/schema/misc.schema
2425
include         /etc/ldap/schema/nis.schema
2526
include         /etc/ldap/schema/openldap.schema
2627
include         /etc/ldap/schema/ppolicy.schema
2728
include         /etc/ldap/schema/collective.schema
2829
2930
modulepath /usr/lib/ldap
3031
moduleload back_bdb.so
3132
3233
pidfile     ${c.tempdatadir}/slapd.pid
3334
argsfile    ${c.tempdatadir}/slapd.args
3435
3536
database bdb
3637
3738
suffix "dc=global,dc=loc"
3839
rootdn "cn=ldapadmin,dc=global,dc=loc"
3940
rootpw mysecret
4041
directory ${c.tempdatadir}
4142
EOF
4243
4344
4445
cat >'user.ldif' <<EOF
4546
# User primary group
4647
dn: cn=rovusers,ou=groups,dc=global,dc=loc
4748
cn: rovusers
4849
objectClass: top
4950
objectClass: posixGroup
5051
gidNumber: 1616
5152
5253
# User account
5354
dn: uid=rmainz,ou=users,dc=global,dc=loc
5455
cn: Roland Mainz
5556
givenName: Roland
5657
sn: Mainz
5758
uid: rmainz
5859
uidNumber: 1616
5960
gidNumber: 1616
6061
homeDirectory: /home/rmainz
6162
mail: roland.mainz@nrubsig.org
6263
objectClass: top
6364
objectClass: posixAccount
6465
objectClass: shadowAccount
6566
objectClass: inetOrgPerson
6667
objectClass: organizationalPerson
6768
objectClass: person
6869
loginShell: /bin/bash
6970
userPassword: chickenMonster
7071
EOF
7172
7273
7374
#
7475
# main
7576
#
7677
7778
PATH+=':/sbin:/usr/sbin'
7879
7980
set -o xtrace
81+
set -o errexit
8082
8183
rm -Rf "${c.tempdatadir}"
8284
mkdir "${c.tempdatadir}"
83-
slapadd -f slapd.conf -l user.ldif
85+
slapadd -f slapd.conf -l user.ldif || true
8486
85-
slapd -d -1 -f slapd.conf -h ldap://10.49.20.131:8888 >'slapd.log' 2>&1 &
87+
slapd -d -1 -f slapd.conf -h "${c.ldap_url}" >'slapd.log' 2>&1 &
8688
(( c.slapd_pid=$! ))
8789
8890
# fixme: This should wait until slapd reaches poll/epoll
8991
sleep 2
9092
91-
ldapsearch -LLL -x -w mysecret -D "cn=ldapadmin,dc=global,dc=loc" -b "cn=rovusers,ou=groups,dc=global,dc=loc" '*' -H ldap://10.49.20.131:8888
93+
ldapsearch -LLL -x -w mysecret -D "cn=ldapadmin,dc=global,dc=loc" -b "cn=rovusers,ou=groups,dc=global,dc=loc" '*' -H "${c.ldap_url}"
92-
ldapsearch -LLL -x -w mysecret -D "cn=ldapadmin,dc=global,dc=loc" -b "uid=rmainz,ou=users,dc=global,dc=loc" '*' -H ldap://10.49.20.131:8888
94+
ldapsearch -LLL -x -w mysecret -D "cn=ldapadmin,dc=global,dc=loc" -b "uid=rmainz,ou=users,dc=global,dc=loc" '*' -H "${c.ldap_url}"
9395
9496
kill -s TERM ${c.slapd_pid}
9597
wait
9698
# EOF.
9799

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at