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
|
||||
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.
|
||||
CERTBOT_DOMAINS=(\
|
||||
mydomain.eu \
|
||||
www.mydomain.eu \
|
||||
)
|
||||
#CERTBOT_DOMAINS=(\
|
||||
# mydomain.eu \
|
||||
# www.mydomain.eu \
|
||||
# )
|
||||
|
@@ -8,18 +8,15 @@ toolName=certbot
|
||||
# Get script working directory
|
||||
# (when called from a different directory)
|
||||
WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
|
||||
CONFIG_FILE="$WDIR/${toolName}.cfg"
|
||||
CONFIG_FILE_DEFAULT="${CONFIG_FILE}.example"
|
||||
CONFIG=0
|
||||
CONFIG_FILE_NAME="${toolName}.cfg"
|
||||
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE}.example"
|
||||
|
||||
step_config() {
|
||||
if [ ! -s "$CONFIG_FILE" ] && [ ! -s "$CONFIG_FILE_DEFAULT" ] ; then
|
||||
echoerr " [E] No configuration \"$CONFIG_FILE_DEFAULT\" or \"$CONFIG_FILE\" found"
|
||||
exit 1;
|
||||
fi
|
||||
if [ -s "$CONFIG_FILE" ] ; then
|
||||
. "$CONFIG_FILE"
|
||||
else
|
||||
echoerr " [E] No user configuration \"$CONFIG_FILE\" found. (See template $CONFIG_FILE_DEFAULT)"
|
||||
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
|
||||
local confReturn=$?
|
||||
if [ $confReturn -eq 0 ] ; then
|
||||
CONFIG=1
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -74,13 +71,13 @@ step_1() {
|
||||
step_2_info() { echo "Create or update letsencrypt certificate"; }
|
||||
step_2_alias() { ALIAS="update"; }
|
||||
step_2() {
|
||||
endCheckEmpty CERTBOT_DOMAINS "Invalid domain list"
|
||||
endCheckEmpty CERTBOT_WEBROOT "Invalid web root"
|
||||
endCheckEmpty CERTBOT_MAIL "Invalid mail address"
|
||||
endCheckEmpty CERTBOT_DOMAINS "No domain list found. Check configuration"
|
||||
endCheckEmpty CERTBOT_WEBROOT "Invalid web root. Check configuration"
|
||||
endCheckEmpty CERTBOT_MAIL "Invalid mail address. Check configuration"
|
||||
|
||||
exe certbot certonly --webroot -w "$CERTBOT_WEBROOT" --rsa-key-size 4096 --expand --agree-tos \
|
||||
-m "$CERTBOT_MAIL" ${CERTBOT_DOMAINS[@]/#/-d }
|
||||
}
|
||||
|
||||
VERSION_SEQREV=8
|
||||
VERSION_SEQREV=11
|
||||
. /usr/local/bin/sequencer.sh
|
||||
|
Reference in New Issue
Block a user