summaryrefslogtreecommitdiffstats
path: root/zmqauth/zmq_auth_gen/zmq_gen.sh
diff options
context:
space:
mode:
authorkhilman <khilman@users.noreply.github.com>2018-07-23 09:32:40 -0500
committerGitHub <noreply@github.com>2018-07-23 09:32:40 -0500
commitef276f04512f1808ae7e9fbb2e3b904855486462 (patch)
tree28b055619917fbc254a59586bc6e47d84cf0bf2f /zmqauth/zmq_auth_gen/zmq_gen.sh
parent45f76344b4278f1ecf9956f3a81bfe11cd525c43 (diff)
parentd42030d39800b930634dba1efafcf43959c40205 (diff)
Merge pull request #33 from montjoie/zmq_auth
Zmq auth
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