[cpp-sp] branch master updated: Shell version of secret key maintainer.

Scott Cantor cantor.2 at osu.edu
Mon Mar 19 21:26:53 EDT 2018


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository cpp-sp.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=2166ce8265cadbd6caaf610d936061d518659ea9

The following commit(s) were added to refs/heads/master by this push:
       new  2166ce8   Shell version of secret key maintainer.
2166ce8 is described below

commit 2166ce8265cadbd6caaf610d936061d518659ea9
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Mar 19 21:26:46 2018 -0400

    Shell version of secret key maintainer.
---
 configs/seckeygen.sh | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/configs/seckeygen.sh b/configs/seckeygen.sh
new file mode 100755
index 0000000..cb8df4d
--- /dev/null
+++ b/configs/seckeygen.sh
@@ -0,0 +1,56 @@
+#! /bin/sh
+
+while getopts h:u:g:o:f:b: c
+     do
+         case $c in
+           u)         USER=$OPTARG;;
+           g)         GROUP=$OPTARG;;
+           o)         OUT=$OPTARG;;
+           b)         BITS=$OPTARG;;
+           f)         FILENAME=$OPTARG;;
+           h)         HISTORY=$OPTARG;;
+		   \?)        echo "seckeygen [-o output directory (default .)] [-f filename (default sealer.keys)] [-h key history (default 14)] [-b key size in bits (default 128)] [-u owning username] [-g owning groupname]"
+                      exit 1;;
+         esac
+     done
+     
+if [ -z "$OUT" ] ; then
+    OUT=.
+fi
+
+if [ -z "$FILENAME" ]; then
+	FILENAME="sealer.keys"
+fi
+
+if [ -z "$HISTORY" ] ; then
+    HISTORY=14
+fi
+
+if [ -z "$BITS" ] ; then
+    BITS=128
+fi
+
+BYTES=`expr $BITS / 8`
+
+rm -f $OUT/${FILENAME}.tmp
+touch $OUT/${FILENAME}.tmp
+chmod 600 $OUT/${FILENAME}.tmp
+
+KEYVER=1
+if [ -f $OUT/${FILENAME} -a $HISTORY -gt 0 ] ; then
+    tail -n `expr $HISTORY - 1` $OUT/${FILENAME} > $OUT/${FILENAME}.tmp
+    KEYVER=`tail -n 1 $OUT/${FILENAME}.tmp | awk -F: '{print $1}'`
+    KEYVER=`expr $KEYVER + 1`
+fi
+KEYVAL=`openssl rand -base64 $BYTES 2> /dev/null`
+echo "${KEYVER}:${KEYVAL}" >> $OUT/${FILENAME}.tmp
+
+mv $OUT/${FILENAME}.tmp $OUT/${FILENAME}
+
+if  [ -s $OUT/${FILENAME} -a -n "$USER" ] ; then
+    chown $USER $OUT/${FILENAME}
+fi
+
+if  [ -s $OUT/${FILENAME} -a -n "$GROUP" ] ; then
+    chgrp $GROUP $OUT/${FILENAME}
+fi

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list