keys.archive: New program to capture and sign an archive.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 26 Dec 2011 00:03:53 +0000 (00:03 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 26 Dec 2011 00:08:44 +0000 (00:08 +0000)
Doesn't include the key nubs.

Makefile.am
keys.archive [new file with mode: 0755]

index 3566e3a..ba7fdff 100644 (file)
@@ -93,6 +93,7 @@ keyfunc.sh: keyfunc.sh.in Makefile
                mv keyfunc.sh.new keyfunc.sh
 
 ## Commands.
+dist_pkglib_SCRIPTS    += keys.archive
 dist_pkglib_SCRIPTS    += keys.conceal
 dist_pkglib_SCRIPTS    += keys.keeper-cards
 dist_pkglib_SCRIPTS    += keys.new-keeper
diff --git a/keys.archive b/keys.archive
new file mode 100755 (executable)
index 0000000..3ac414e
--- /dev/null
@@ -0,0 +1,57 @@
+#! /bin/sh
+###
+### Output a publishable archive of the key repository
+###
+### (c) 2011 Mark Wooding
+###
+
+###----- Licensing notice ---------------------------------------------------
+###
+### This file is part of the distorted.org.uk key management suite.
+###
+### distorted-keys is free software; you can redistribute it and/or modify
+### it under the terms of the GNU General Public License as published by
+### the Free Software Foundation; either version 2 of the License, or
+### (at your option) any later version.
+###
+### distorted-keys is distributed in the hope that it will be useful,
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+### GNU General Public License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with distorted-keys; if not, write to the Free Software Foundation,
+### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+set -e
+case "${KEYSLIB+t}" in t) ;; *) echo >&2 "$0: KEYSLIB unset"; exit 1 ;; esac
+. "$KEYSLIB"/keyfunc.sh
+
+defhelp <<HELP
+LABEL KEY
+Write a publishable archive of the key-management state.
+
+The archive is written to LABEL.tar.gz; a signature is written to
+LABEL.KEY.sig.
+
+The archive doesn't contain any unecrypted secrets.  You'll probably need
+a keeper set to get anything useful.
+HELP
+
+case $# in 2) ;; *) usage_err ;; esac
+label=$1 key=$2
+checkword "archive label" "$label"
+
+mktmp
+prepare "$key" archive
+( cd $tmp
+  mkdir $label
+  ln -s $ETC $label/config
+  mkdir $label/data
+  ln -s $KEYS/* $label/data/
+  rm -f $label/data/nub
+  tar cf - $label/config/* $label/data/*/* ) | gzip -9c >$label.tar.gz.new
+c_sign $kdir $knub <$label.tar.gz.new >$label.sig.new
+for i in sig tar.gz; do mv $label.$i.new $label.$i; done
+
+###----- That's all, folks --------------------------------------------------