pastebin - collaborative debugging tool
rovema.kpaste.net RSS


openldap posixAccount test1
Posted by Anonymous on Sat 5th Aug 2023 12:15
raw | new post
view followups (newest first): openldap posixAccount test1 by Anonymous

  1. #!/bin/ksh93
  2.  
  3. #
  4. # openldap test setup
  5. #
  6.  
  7. set -o nounset
  8.  
  9. compound c=(
  10.         typeset -r tempdatadir="$PWD/tmpdata"
  11. )
  12.  
  13.  
  14.  
  15. cat >'slapd.conf' <<EOF
  16. include         /etc/ldap/schema/corba.schema
  17. include         /etc/ldap/schema/core.schema
  18. include         /etc/ldap/schema/cosine.schema
  19. include         /etc/ldap/schema/duaconf.schema
  20. include         /etc/ldap/schema/dyngroup.schema
  21. include         /etc/ldap/schema/inetorgperson.schema
  22. include         /etc/ldap/schema/java.schema
  23. include         /etc/ldap/schema/misc.schema
  24. include         /etc/ldap/schema/nis.schema
  25. include         /etc/ldap/schema/openldap.schema
  26. include         /etc/ldap/schema/ppolicy.schema
  27. include         /etc/ldap/schema/collective.schema
  28.  
  29. modulepath /usr/lib/ldap
  30. moduleload back_bdb.so
  31.  
  32. pidfile     ${c.tempdatadir}/slapd.pid
  33. argsfile    ${c.tempdatadir}/slapd.args
  34.  
  35. database bdb
  36.  
  37. suffix "dc=global,dc=loc"
  38. rootdn "cn=ldapadmin,dc=global,dc=loc"
  39. rootpw mysecret
  40. directory ${c.tempdatadir}
  41. EOF
  42.  
  43.  
  44. cat >'user.ldif' <<EOF
  45. # User primary group
  46. dn: cn=rovusers,ou=groups,dc=global,dc=loc
  47. cn: rovusers
  48. objectClass: top
  49. objectClass: posixGroup
  50. gidNumber: 1616
  51.  
  52. # User account
  53. dn: uid=rmainz,ou=users,dc=global,dc=loc
  54. cn: Roland Mainz
  55. givenName: Roland
  56. sn: Mainz
  57. uid: rmainz
  58. uidNumber: 1616
  59. gidNumber: 1616
  60. homeDirectory: /home/rmainz
  61. mail: roland.mainz@nrubsig.org
  62. objectClass: top
  63. objectClass: posixAccount
  64. objectClass: shadowAccount
  65. objectClass: inetOrgPerson
  66. objectClass: organizationalPerson
  67. objectClass: person
  68. loginShell: /bin/bash
  69. userPassword: chickenMonster
  70. EOF
  71.  
  72.  
  73. #
  74. # main
  75. #
  76.  
  77. PATH+=':/sbin:/usr/sbin'
  78.  
  79. set -o xtrace
  80.  
  81. rm -Rf "${c.tempdatadir}"
  82. mkdir "${c.tempdatadir}"
  83. slapadd -f slapd.conf -l user.ldif
  84.  
  85. slapd -d -1 -f slapd.conf -h ldap://10.49.20.131:8888 >'slapd.log' 2>&1 &
  86. (( c.slapd_pid=$! ))
  87.  
  88. # fixme: This should wait until slapd reaches poll/epoll
  89. sleep 2
  90.  
  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
  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
  93.  
  94. kill -s TERM ${c.slapd_pid}
  95. wait
  96. # EOF.

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