Using sequencer configuration handling and making it more foolproof
This commit is contained in:
@@ -14,9 +14,9 @@ CERTBOT_WEBROOT="/var/www/letsencrypt"
|
|||||||
# Email address for important account notifications
|
# Email address for important account notifications
|
||||||
CERTBOT_MAIL="postmaster@mydomain.eu"
|
CERTBOT_MAIL="postmaster@mydomain.eu"
|
||||||
|
|
||||||
# List you domains here.
|
# Uncomment and list your domains here.
|
||||||
# The first will be the subject CN and all other will be listed as Subject Alternative Names.
|
# The first will be the subject CN and all other will be listed as Subject Alternative Names.
|
||||||
CERTBOT_DOMAINS=(\
|
#CERTBOT_DOMAINS=(\
|
||||||
mydomain.eu \
|
# mydomain.eu \
|
||||||
www.mydomain.eu \
|
# www.mydomain.eu \
|
||||||
)
|
# )
|
||||||
|
@@ -8,18 +8,15 @@ toolName=certbot
|
|||||||
# Get script working directory
|
# Get script working directory
|
||||||
# (when called from a different directory)
|
# (when called from a different directory)
|
||||||
WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
|
WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
|
||||||
CONFIG_FILE="$WDIR/${toolName}.cfg"
|
CONFIG=0
|
||||||
CONFIG_FILE_DEFAULT="${CONFIG_FILE}.example"
|
CONFIG_FILE_NAME="${toolName}.cfg"
|
||||||
|
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE}.example"
|
||||||
|
|
||||||
step_config() {
|
step_config() {
|
||||||
if [ ! -s "$CONFIG_FILE" ] && [ ! -s "$CONFIG_FILE_DEFAULT" ] ; then
|
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
|
||||||
echoerr " [E] No configuration \"$CONFIG_FILE_DEFAULT\" or \"$CONFIG_FILE\" found"
|
local confReturn=$?
|
||||||
exit 1;
|
if [ $confReturn -eq 0 ] ; then
|
||||||
fi
|
CONFIG=1
|
||||||
if [ -s "$CONFIG_FILE" ] ; then
|
|
||||||
. "$CONFIG_FILE"
|
|
||||||
else
|
|
||||||
echoerr " [E] No user configuration \"$CONFIG_FILE\" found. (See template $CONFIG_FILE_DEFAULT)"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,13 +71,13 @@ step_1() {
|
|||||||
step_2_info() { echo "Create or update letsencrypt certificate"; }
|
step_2_info() { echo "Create or update letsencrypt certificate"; }
|
||||||
step_2_alias() { ALIAS="update"; }
|
step_2_alias() { ALIAS="update"; }
|
||||||
step_2() {
|
step_2() {
|
||||||
endCheckEmpty CERTBOT_DOMAINS "Invalid domain list"
|
endCheckEmpty CERTBOT_DOMAINS "No domain list found. Check configuration"
|
||||||
endCheckEmpty CERTBOT_WEBROOT "Invalid web root"
|
endCheckEmpty CERTBOT_WEBROOT "Invalid web root. Check configuration"
|
||||||
endCheckEmpty CERTBOT_MAIL "Invalid mail address"
|
endCheckEmpty CERTBOT_MAIL "Invalid mail address. Check configuration"
|
||||||
|
|
||||||
exe certbot certonly --webroot -w "$CERTBOT_WEBROOT" --rsa-key-size 4096 --expand --agree-tos \
|
exe certbot certonly --webroot -w "$CERTBOT_WEBROOT" --rsa-key-size 4096 --expand --agree-tos \
|
||||||
-m "$CERTBOT_MAIL" ${CERTBOT_DOMAINS[@]/#/-d }
|
-m "$CERTBOT_MAIL" ${CERTBOT_DOMAINS[@]/#/-d }
|
||||||
}
|
}
|
||||||
|
|
||||||
VERSION_SEQREV=8
|
VERSION_SEQREV=11
|
||||||
. /usr/local/bin/sequencer.sh
|
. /usr/local/bin/sequencer.sh
|
||||||
|
Reference in New Issue
Block a user