summaryrefslogtreecommitdiff
path: root/mailcert.sh
diff options
context:
space:
mode:
Diffstat (limited to 'mailcert.sh')
-rwxr-xr-xmailcert.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/mailcert.sh b/mailcert.sh
index 6002a1e..33a8467 100755
--- a/mailcert.sh
+++ b/mailcert.sh
@@ -54,4 +54,18 @@ echo USEREMAIL is assumed to be: "$USEREMAIL"
echo Press Ctrl-C if any of this looks incorrect.
sleep 5
+[[ $(openssl x509 -in omgca/ca/omgca.crt -noout -subject) =~ .+CN=(.+) ]]
+CACN="${BASH_REMATCH[1]}"
+if [[ "$CACN" =~ (.+)/emailAddress.+ ]]; then
+ CACN=${BASH_REMATCH[1]}
+fi
+
# FIXME: implement /usr/lib/sendmail input, including attachment syntax
+# /usr/lib/sendmail -t << EOF
+cat << EOF
+To: "$USEREMAIL"
+From: "$E"
+Subject: Certificate from "$CACN"
+MIME-Version: 1.0
+Content-Type:
+