From 13f1cad6f9d3e5bcf853d918617c9fcef9f96320 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Mon, 20 Dec 2010 22:04:15 -0500 Subject: added example script to auto-generate X.509 certificate requests with the PGPExtension embedded in them from https monkeysphere-host keys. --- examples/make-https-certreqs | 95 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 examples/make-https-certreqs diff --git a/examples/make-https-certreqs b/examples/make-https-certreqs new file mode 100644 index 0000000..0512032 --- /dev/null +++ b/examples/make-https-certreqs @@ -0,0 +1,95 @@ +#!/bin/bash + +# Author: Daniel Kahn Gillmor +# Date: 2010-12-20 20:54:55-0500 + +# On a system with keys for https already imported into +# monkeysphere-host, this script generates X.509 certificate requests +# for each key, with appropriate subjectAltNames and the PGPExtension +# embedded. + +# The generated requests get dumped to stdout. redirect to a file or +# copy/paste if you want to save them/send them someplace. + +# This script uses bashisms + +# It currently needs OpenSSL binaries to work properly + +# It assumes that the monkeysphere-host keyring is in +# /var/lib/monkeysphere/host (which it is on debian) + +# This should probably eventually be incorporated into +# monkeysphere-host directly. + +get_openssl_config() { + # first param is seconds since the epoch: + X509_PGP_EXTENSION="$(TZ=UTC date -d "@$1" '+%Y%m%d%H%M%SZ')" + # next parameter is SAN names, separated by newlines: + SUBJECTALTNAME=$(printf "%s" "$2" | sed 's/^/DNS:/' | tr '\n' ',' | \ + sed -e 's/,*$//' -e 's/^,*//') + + printf "sAN: %s\n" "$SUBJECTALTNAME" >&2 + + cat <