From 935cfc0979691cba6d68299186568832a7d8f8fc Mon Sep 17 00:00:00 2001 From: fram3d Date: Mon, 22 Jan 2024 18:56:17 +0100 Subject: [PATCH] fix slapd acl generation scripts --- docs/slapd/.gitignore | 2 ++ docs/slapd/generateacl.sh | 4 +--- docs/slapd/generatecreds.sh | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 docs/slapd/.gitignore diff --git a/docs/slapd/.gitignore b/docs/slapd/.gitignore new file mode 100644 index 0000000..91f7864 --- /dev/null +++ b/docs/slapd/.gitignore @@ -0,0 +1,2 @@ +acladd.ldif +*gpg diff --git a/docs/slapd/generateacl.sh b/docs/slapd/generateacl.sh index fee3005..647e1d6 100755 --- a/docs/slapd/generateacl.sh +++ b/docs/slapd/generateacl.sh @@ -3,7 +3,5 @@ READUSERS="" for i in $(cat servicesaccounts.txt); do READUSERS="$READUSERS by dn=\"$i\" read" ; done -sed 's/READUSERS/$READUSERS/g' acladd-template.ldif > acladd.ldif - -for i in $(cat list) ; do printf "%s\n" $(echo -n $i | cut -d"," -f 1 | cut -d"=" -f2 ; genpass) | gpg -e -r fram3d@dmz.rs -r sienna@dmz.rs --output $(echo -n $i | cut -d"," -f 1 | cut -d"=" -f2).gpg ; done +sed 's/READUSERS/'"$READUSERS"'/g' acladd-template.ldif > acladd.ldif diff --git a/docs/slapd/generatecreds.sh b/docs/slapd/generatecreds.sh index f505bd2..c68b85c 100755 --- a/docs/slapd/generatecreds.sh +++ b/docs/slapd/generatecreds.sh @@ -1,6 +1,8 @@ #!/bin/bash -GENPASS=$( echo $(shuf ../../scripts/shared/english.txt | head) | sed "s/ //g") +function genpass(){ +echo $(shuf ../../scripts/shared/english.txt | head) | sed "s/ //g" +} -for i in $(cat servicesaccounts.txt) ; do printf "%s\n" $(echo -n $i | cut -d"," -f 1 | cut -d"=" -f2 ; $(GENPASS)) | gpg -e -r fram3d@dmz.rs -r sienna@dmz.rs --output $(echo -n $i | cut -d"," -f 1 | cut -d"=" -f2).gpg ; done +for i in $(cat servicesaccounts.txt) ; do printf "%s\n" $(echo -n $i | cut -d"," -f 1 | cut -d"=" -f2 ; genpass) | gpg -e -r fram3d@dmz.rs -r sienna@dmz.rs --output creds/$(echo -n $i | cut -d"," -f 1 | cut -d"=" -f2).gpg ; done