From e50da193be297bc7a49c3be88a26586fa69bde51 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Sun, 2 Jan 2011 17:11:39 -0500 Subject: genericized x509 certificate generation -- now works for any service, not just https (invoke it like "make-x509-certreqs imap" for imap:// keys, etc) --- examples/make-https-certreqs | 95 ------------------------------------------- examples/make-x509-certreqs | 97 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 95 deletions(-) delete mode 100644 examples/make-https-certreqs create mode 100644 examples/make-x509-certreqs diff --git a/examples/make-https-certreqs b/examples/make-https-certreqs deleted file mode 100644 index 0512032..0000000 --- a/examples/make-https-certreqs +++ /dev/null @@ -1,95 +0,0 @@ -#!/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 < +# Date: 2010-12-20 20:54:55-0500 + +# On a system with keys for https (or some other X.509-using protocol) +# 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 <