aboutsummaryrefslogtreecommitdiffstats
path: root/painless-le.sh
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2016-12-24 07:46:19 +0100
committerThomas Lange <code@nerdmind.de>2016-12-24 07:46:19 +0100
commit1830626b92d860012a56641b7a6c6f525a4ebdd7 (patch)
tree559ff8c2673c783e635d245531003327112584cf /painless-le.sh
parent641a9eaf784dbc10e8aa62d2b82ae1342d6dfa84 (diff)
downloadpainlessle-1830626b92d860012a56641b7a6c6f525a4ebdd7.tar.gz
painlessle-1830626b92d860012a56641b7a6c6f525a4ebdd7.tar.xz
painlessle-1830626b92d860012a56641b7a6c6f525a4ebdd7.zip
Additional command-line options to customize the certificate target filenames were added.
Diffstat (limited to 'painless-le.sh')
-rwxr-xr-xpainless-le.sh22
1 files changed, 15 insertions, 7 deletions
diff --git a/painless-le.sh b/painless-le.sh
index 3a15cd5..b729017 100755
--- a/painless-le.sh
+++ b/painless-le.sh
@@ -8,19 +8,27 @@
# assumes that you have an existing RSA private key stored within your desired #
# install directory (with the filename which is defined in "${CONFIDENTIAL}"). #
# #
-# ARGUMENT [-i]: Full path to the install directory for the certificates. #
-# ARGUMENT [-h]: List of hostnames for the certificate: example.org[:...] #
+# OPTION [-i]: Full path to the install directory for the certificates. #
+# OPTION [-h]: List of hostnames for the certificate: example.org[:...] #
+# OPTION [-K]: Filename for the existing RSA private key relative to [-i] #
+# OPTION [-I]: Target filename for the intermediate cert relative to [-i] #
+# OPTION [-C]: Target filename for the certificate only file relative to [-i] #
+# OPTION [-F]: Target filename for the certificate full file relative to [-i] #
# #
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#
#===============================================================================
# Parsing command-line arguments with the getopts shell builtin
#===============================================================================
-while getopts :i:h: opt
+while getopts :i:h:K:I:C:F: opt
do
case $opt in
i) ARGUMENT_DIRECTORY="$OPTARG" ;;
h) ARGUMENT_HOSTNAMES="$OPTARG" ;;
+ K) ARGUMENT_CONFIDENTIAL="$OPTARG" ;;
+ I) ARGUMENT_INTERMEDIATE="$OPTARG" ;;
+ C) ARGUMENT_CERTIFICATE_ONLY="$OPTARG" ;;
+ F) ARGUMENT_CERTIFICATE_FULL="$OPTARG" ;;
esac
done
@@ -52,10 +60,10 @@ LETSENCRYPT_ENDPOINT="https://acme-v01.api.letsencrypt.org/directory"
#===============================================================================
OPENSSLCONF="/etc/ssl/openssl.cnf"
REQUESTFILE=`mktemp /tmp/painless-le.XXXXXXXXXX.csr`
- CONFIDENTIAL="${ARGUMENT_DIRECTORY%/}/confidential.pem"
- INTERMEDIATE="${ARGUMENT_DIRECTORY%/}/intermediate.pem"
-CERTIFICATE_ONLY="${ARGUMENT_DIRECTORY%/}/certificate_only.pem"
-CERTIFICATE_FULL="${ARGUMENT_DIRECTORY%/}/certificate_full.pem"
+ CONFIDENTIAL="${ARGUMENT_DIRECTORY%/}/${ARGUMENT_CONFIDENTIAL:-confidential.pem}"
+ INTERMEDIATE="${ARGUMENT_DIRECTORY%/}/${ARGUMENT_INTERMEDIATE:-intermediate.pem}"
+CERTIFICATE_ONLY="${ARGUMENT_DIRECTORY%/}/${ARGUMENT_CERTIFICATE_ONLY:-certificate_only.pem}"
+CERTIFICATE_FULL="${ARGUMENT_DIRECTORY%/}/${ARGUMENT_CERTIFICATE_FULL:-certificate_full.pem}"
#===============================================================================
# Delete Certificate-Signing-Request (CSR) file on exit