summaryrefslogtreecommitdiffstats
path: root/zmqauth/zmq_auth_gen/zmq_gen.sh
diff options
context:
space:
mode:
Diffstat (limited to 'zmqauth/zmq_auth_gen/zmq_gen.sh')
-rw-r--r--zmqauth/zmq_auth_gen/zmq_gen.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/zmqauth/zmq_auth_gen/zmq_gen.sh b/zmqauth/zmq_auth_gen/zmq_gen.sh
new file mode 100644
index 0000000..8b67280
--- /dev/null
+++ b/zmqauth/zmq_auth_gen/zmq_gen.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+#rm /root/output/*
+while read line
+do
+ NAME=$(echo $line | cut -d' ' -f1 | sed 's,.*/,,')
+ DIR=$(echo $line | cut -d' ' -f1)
+ MASTERDIR=$(echo $line | cut -d' ' -f2)
+ echo "DEBUG: $LINE NAME=$NAME DIR=$DIR"
+ if [ ! -e /root/output/$DIR/zmq_auth/${NAME}.key ];then
+ /root/create_certificate.py $NAME --directory /root/output/$DIR/zmq_auth/ || exit $?
+ else
+ echo "DEBUG: ZMQ files for $NAME already exists"
+ fi
+ if [ ! -z "$MASTERDIR" -a "$MASTERDIR" != "$DIR" ];then
+ MASTERNAME=$(echo $MASTERDIR | sed 's,.*/,,')
+ cp /root/output/$MASTERDIR/zmq_auth/$MASTERNAME.key /root/output/$DIR/zmq_auth/master.key || exit $?
+ cp /root/output/$DIR/zmq_auth/$NAME.key /root/output/$MASTERDIR/zmq_auth/ || exit $?
+ chown $(cat /root/id) /root/output/$MASTERDIR/zmq_auth/* || exit $?
+ fi
+ # All files are generated by root, chown them to the user using the docker
+ chown $(cat /root/id) /root/output/$DIR/zmq_auth/* || exit $?
+done < /root/zmq_genlist