From: Ralf Jung Date: Sun, 6 Dec 2015 16:14:41 +0000 (+0100) Subject: add script to generate CSR's with subjectAltName X-Git-Url: https://git.ralfj.de/lets-encrypt-tiny.git/commitdiff_plain/c5f541d513fe37747443aa23176611175f0cd440?ds=inline;hp=6d31fb31978c91bc9a6d754dce57a1529f97c4dc add script to generate CSR's with subjectAltName --- diff --git a/gencsr.sh b/gencsr.sh new file mode 100755 index 0000000..a419359 --- /dev/null +++ b/gencsr.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -e +## ./gencsr.sh KEY.key DOMAIN1 DOMAIN2: Generate (to stdout) a CSR for this key, for all the domains listed later + +KEY="$1" +shift + +test -f "$KEY" || (echo "Usage: $0 KEY.key DOMAIN1 DOMAIN2"; exit 1) + +openssl req -new -sha256 -key "$1" -subj "/" -reqexts SAN \ + -config <(cat /etc/ssl/openssl.cnf \ + <(echo "[SAN]"; echo -n "subjectAltName="; unset COMMA; \ + for domain in "$@"; do test -n "$COMMA" && echo -n ","; echo -n "DNS:$domain"; COMMA=1; done; echo) \ + )