aboutsummaryrefslogtreecommitdiff
path: root/rcynic
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2010-05-28 15:19:54 +0000
committerRob Austein <sra@hactrn.net>2010-05-28 15:19:54 +0000
commitc0394b44808f71888f175411a8334af02ee6555c (patch)
tree051f1eab8ca23c9a0ad50f36c87c37dc8c5461e3 /rcynic
parentc6bfdbcead647daee8b06b74b929aa1fe05891db (diff)
Script to generate indirect trust anchor files.
svn path=/rcynic/make-ita.sh; revision=3265
Diffstat (limited to 'rcynic')
-rw-r--r--rcynic/make-ita.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/rcynic/make-ita.sh b/rcynic/make-ita.sh
new file mode 100644
index 00000000..45e5b712
--- /dev/null
+++ b/rcynic/make-ita.sh
@@ -0,0 +1,42 @@
+#!/bin/sh -
+# $Id$
+#
+# Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+# Generate an indirect trust anchor given the rsync URI for a
+# self-signed RFC 3779 certificate.
+#
+# Usage: make-ita.sh uri [local_copy_of_certificate]
+#
+# The optional second parameter is the name of a local copy of the
+# certificate to be checked against the copy retrieved from the URI;
+# if present, this should be a local X.509 file in DER format.
+
+case "$1" in rsync://*) :;; *) echo 1>&2 "\"$1\" is not a rsync URI"; exit 1;; esac
+
+tmpfile="make-ita.tmp.$$"
+trap "rm -f $tmpfile" 0 1 2 15
+
+rsync "$1" "$tmpfile" || exit
+
+if test -n "$2"
+then
+ diff -q "$tmpfile" "$2" || exit
+fi
+
+echo "$1"
+openssl x509 -inform DER -in "$tmpfile" -pubkey -noout |
+openssl rsa -outform DER -pubin 2>/dev/null |
+openssl enc -base64