From 3cafd73a5467221e8ce61396bdb4f0caac8168eb Mon Sep 17 00:00:00 2001 From: Denis Knauf <^_^@denkn.at> Date: Thu, 29 Mar 2018 21:44:11 +0200 Subject: [PATCH] init --- .gitignore | 4 ++++ 00.root.ldif.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 10.acls.ldif | 12 ++++++++++++ 20.passwordhash.ldif | 6 ++++++ 90.user.ldif.sh | 25 +++++++++++++++++++++++++ README.md | 7 +++++++ 6 files changed, 97 insertions(+) create mode 100644 .gitignore create mode 100755 00.root.ldif.sh create mode 100644 10.acls.ldif create mode 100644 20.passwordhash.ldif create mode 100755 90.user.ldif.sh create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4b7903e --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*~ +.*.sw[op] + +basedn diff --git a/00.root.ldif.sh b/00.root.ldif.sh new file mode 100755 index 0000000..f0606c2 --- /dev/null +++ b/00.root.ldif.sh @@ -0,0 +1,43 @@ +#!/bin/sh -e + +basedn=$(cat basedn) +_x=${basedn%%,*} +dc=${_x#*=} +en=${_x%%=*} +if [ Xdc = "X$en" ] +then + en="" +else + en=`printf '\n%s' "$en: $dc"` +fi +pw=`pwgen 8 1` +echo "# Password for cn=root,$basedn: $pw" >&2 + +cat <&2 + echo "random password will be printed. Use ldappasswd for changing it" >&2 + exit 1 +fi + +pw=`pwgen 8 1` +echo "# Password: $pw" >&2 + +cat < basedn`). +For initialization, first shutdown slapd and delete `/var/lib/ldap/` (you will lost all your data!), +then use `./90.root.ldif | slapadd -b `cat basedn` -v`. +Now you can start slapd again. +Via `ldapadd -Y external` you can add any other ldif. +For adding user run `./90.user.ldif.sh | ldapadd -Y external`. +