summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-03-02 18:40:37 +0000
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-03-02 18:40:37 +0000
commit5660589ce87e80f0a4bf58d19802a758329b8ff5 (patch)
tree57f7b7706b465781fe4ffb185b6668b76f94dbfe
parentf45102c3260b6e534f1c4b5158f765c3d1ae1647 (diff)
downloadpykolab-5660589ce87e80f0a4bf58d19802a758329b8ff5.tar.gz
Add a script that'll generate randomized user accounts in LDIF format, given a number
-rwxr-xr-xbin/gen-ldif30
1 files changed, 30 insertions, 0 deletions
diff --git a/bin/gen-ldif b/bin/gen-ldif
new file mode 100755
index 0000000..33442e8
--- /dev/null
+++ b/bin/gen-ldif
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+i=0
+while [ $i -lt 0$1 ]; do
+
+ givenname=`head -c 200 /dev/urandom | tr -dc A-Za-z | head -c5`
+ surname=`head -c 200 /dev/urandom | tr -dc A-Za-z | head -c10`
+
+ givenname="$(echo ${givenname:0:1} | tr '[:lower:]' '[:upper:]')$(echo ${givenname:1} | tr '[:upper:]' '[:lower:]')"
+ surname="$(echo ${surname:0:1} | tr '[:lower:]' '[:upper:]')$(echo ${surname:1} | tr '[:upper:]' '[:lower:]')"
+
+ uid="$(echo ${givenname:0:1}.${surname} | tr '[:upper:]' '[:lower:]')"
+
+ userpassword="VerySecret"
+
+ echo "dn: uid=$uid,ou=People,dc=kanarip,dc=com"
+ echo "uid: $uid"
+ echo "givenName: $givenname"
+ echo "objectClass: top"
+ echo "objectClass: person"
+ echo "objectClass: inetOrgPerson"
+ echo "objectClass: organizationalPerson"
+ echo "sn: $surname"
+ echo "cn: $givenname $surname"
+ echo "mail: $uid@kanarip.com"
+ echo "userPassword: {SSHA}zJ3oU5kqtS3MxnLWmKpnE7+eGVbmQKmj"
+ echo ""
+
+ let i++
+done