mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-04-22 08:18:27 +02:00
make default PRIVATE_KEY and WELLKNOWN relative to BASEDIR, even if BASEDIR is overridden in config.sh; basic checks on BASEDIR
This commit is contained in:
@@ -19,14 +19,14 @@
|
|||||||
# Path to license agreement (default: https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf)
|
# Path to license agreement (default: https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf)
|
||||||
#LICENSE="https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf"
|
#LICENSE="https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf"
|
||||||
|
|
||||||
# Output directory for challenge-tokens to be served by webserver or deployed in HOOK (default: $SCRIPTDIR/.acme-challenges)
|
|
||||||
#WELLKNOWN="${SCRIPTDIR}/.acme-challenges"
|
|
||||||
|
|
||||||
# Base directory for account key, generated certificates and list of domains (default: $SCRIPTDIR -- uses config directory if undefined)
|
# Base directory for account key, generated certificates and list of domains (default: $SCRIPTDIR -- uses config directory if undefined)
|
||||||
#BASEDIR=$SCRIPTDIR
|
#BASEDIR=$SCRIPTDIR
|
||||||
|
|
||||||
# Location of private account key
|
# Output directory for challenge-tokens to be served by webserver or deployed in HOOK (default: $BASEDIR/.acme-challenges)
|
||||||
#PRIVATE_KEY=${BASEDIR}/private_key.pem
|
#WELLKNOWN="${BASEDIR}/.acme-challenges"
|
||||||
|
|
||||||
|
# Location of private account key (default: $BASEDIR/private_key.pem)
|
||||||
|
#PRIVATE_KEY="${BASEDIR}/private_key.pem"
|
||||||
|
|
||||||
# Default keysize for private keys (default: 4096)
|
# Default keysize for private keys (default: 4096)
|
||||||
#KEYSIZE="4096"
|
#KEYSIZE="4096"
|
||||||
|
|||||||
@@ -16,14 +16,26 @@ CA="https://acme-v01.api.letsencrypt.org/directory"
|
|||||||
LICENSE="https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf"
|
LICENSE="https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf"
|
||||||
HOOK=
|
HOOK=
|
||||||
RENEW_DAYS="14"
|
RENEW_DAYS="14"
|
||||||
PRIVATE_KEY=${BASEDIR}/private_key.pem
|
PRIVATE_KEY=
|
||||||
KEYSIZE="4096"
|
KEYSIZE="4096"
|
||||||
WELLKNOWN="${SCRIPTDIR}/.acme-challenges"
|
WELLKNOWN=
|
||||||
PRIVATE_KEY_RENEW="no"
|
PRIVATE_KEY_RENEW="no"
|
||||||
OPENSSL_CNF="$(openssl version -d | cut -d'"' -f2)/openssl.cnf"
|
OPENSSL_CNF="$(openssl version -d | cut -d'"' -f2)/openssl.cnf"
|
||||||
ROOTCERT="lets-encrypt-x1-cross-signed.pem"
|
ROOTCERT="lets-encrypt-x1-cross-signed.pem"
|
||||||
CONTACT_EMAIL=
|
CONTACT_EMAIL=
|
||||||
|
|
||||||
|
set_defaults() {
|
||||||
|
# Default config variables depending on BASEDIR
|
||||||
|
if [[ -z "${PRIVATE_KEY}" ]]; then
|
||||||
|
PRIVATE_KEY="${BASEDIR}/private_key.pem"
|
||||||
|
fi
|
||||||
|
if [[ -z "${WELLKNOWN}" ]]; then
|
||||||
|
WELLKNOWN="${BASEDIR}/.acme-challenges"
|
||||||
|
fi
|
||||||
|
|
||||||
|
LOCKFILE="${BASEDIR}/lock"
|
||||||
|
}
|
||||||
|
|
||||||
init_system() {
|
init_system() {
|
||||||
# Check for config in various locations
|
# Check for config in various locations
|
||||||
if [[ -z "${CONFIG:-}" ]]; then
|
if [[ -z "${CONFIG:-}" ]]; then
|
||||||
@@ -52,9 +64,14 @@ init_system() {
|
|||||||
# Remove slash from end of BASEDIR. Mostly for cleaner outputs, doesn't change functionality.
|
# Remove slash from end of BASEDIR. Mostly for cleaner outputs, doesn't change functionality.
|
||||||
BASEDIR="${BASEDIR%%/}"
|
BASEDIR="${BASEDIR%%/}"
|
||||||
|
|
||||||
# Lockfile handling (prevents concurrent access)
|
# Check BASEDIR and set default variables
|
||||||
LOCKFILE="${BASEDIR}/lock"
|
if [[ ! -d "${BASEDIR}" ]]; then
|
||||||
|
echo "ERROR: BASEDIR does not exist: ${BASEDIR}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
set_defaults
|
||||||
|
|
||||||
|
# Lockfile handling (prevents concurrent access)
|
||||||
set -o noclobber
|
set -o noclobber
|
||||||
if ! { date > "${LOCKFILE}"; } 2>/dev/null; then
|
if ! { date > "${LOCKFILE}"; } 2>/dev/null; then
|
||||||
echo " + ERROR: Lock file '${LOCKFILE}' present, aborting." >&2
|
echo " + ERROR: Lock file '${LOCKFILE}' present, aborting." >&2
|
||||||
|
|||||||
Reference in New Issue
Block a user