pastebin - collaborative debugging tool
rovema.kpaste.net RSS


openldap posixAccount test1
Posted by Anonymous on Sat 5th Aug 2023 12:20
raw | new post
modification of post by Anonymous (view diff)

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