aboutsummaryrefslogtreecommitdiffstats
path: root/letsencrypt
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2015-12-08 19:50:09 +0100
committerGuilhem Moulin <guilhem@fripost.org>2015-12-08 21:08:19 +0100
commitf23e4e0d0cf48153dbc5134cf1bf1bb7189c3005 (patch)
tree004f1228cfd1992c82827f7674b4e1ee644148eb /letsencrypt
parent450eff3c5ff16321d0675c1e2c22f5f85aaf6524 (diff)
Various fixes.
Diffstat (limited to 'letsencrypt')
-rwxr-xr-xletsencrypt14
1 files changed, 8 insertions, 6 deletions
diff --git a/letsencrypt b/letsencrypt
index 50406f7..5c10ea1 100755
--- a/letsencrypt
+++ b/letsencrypt
@@ -16,7 +16,7 @@ declare COMMAND ACCOUNTKEY
declare -l GENKEY
declare RUNAS QUIET= DEBUG=
-declare SRVCERT= CHAIN= CSR SRVKEY
+declare SRVCRT= CHAIN= CSR SRVKEY
declare -l HASH=
declare SUBJECT=/
declare SAN=
@@ -96,7 +96,7 @@ while [ $# -gt 0 ]; do
--quiet|-q) QUIET=1;;
--debug) DEBUG=1;;
- --output=*) SRVCERT="${1#*=}";;
+ --output=*) SRVCRT="${1#*=}";;
--chain) CHAIN=1;;
--csr=*) CSR="${1#*=}";;
--key=*) SRVKEY="${1#*=}";;
@@ -160,7 +160,7 @@ if [ "$COMMAND" = 'revoke-cert' ]; then
exit 1
fi
elif [ "$COMMAND" = 'new-cert' ]; then
- if [ ! "${SRVCERT:-}" ]; then
+ if [ ! "${SRVCRT:-}" ]; then
echo "Error: Missing --output" >&2
exit 1
fi
@@ -270,10 +270,12 @@ if [ "$COMMAND" = 'new-cert' ]; then
# TODO
# Verify: dump and compare public keys
# Valid cert, signed by the right CA
-
- # Copy "$x509" to "$SRVCERT", possibly chained
# https://crt.sh/?q=cse-fresti.cse.chalmers.se&iCAID=7395
- cp "$x509" "$SRVCERT"
+
+ # if it doesn't exist, create the file with mode 0644 minus the process's umask(2)
+ [ -e "$SRVCRT" ] || touch "$SRVCRT"
+ cat "$x509" >"$SRVCRT"
+ [ ! "$DEBUG" ] || openssl x509 -noout -text <"$SRVCRT"
for (( i=0; i<${#NOTIFY[@]}; i++ )); do
${NOTIFY[$i]}