Commit 1f08fda7 authored by Lukas Schauer's avatar Lukas Schauer

look for domains.txt under BASEDIR

parent 77df80b5
...@@ -12,7 +12,8 @@ RENEW_DAYS="14" ...@@ -12,7 +12,8 @@ RENEW_DAYS="14"
KEYSIZE="4096" KEYSIZE="4096"
WELLKNOWN=".acme-challenges" WELLKNOWN=".acme-challenges"
PRIVATE_KEY_RENEW=no PRIVATE_KEY_RENEW=no
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BASEDIR="${SCRIPTDIR}"
OPENSSL_CNF="$(openssl version -d | cut -d'"' -f2)/openssl.cnf" OPENSSL_CNF="$(openssl version -d | cut -d'"' -f2)/openssl.cnf"
# If exists load config from same directory as this script # If exists load config from same directory as this script
...@@ -216,7 +217,11 @@ if [[ "${register}" = "1" ]]; then ...@@ -216,7 +217,11 @@ if [[ "${register}" = "1" ]]; then
signed_request "${CA}/acme/new-reg" '{"resource": "new-reg", "agreement": "'"$LICENSE"'"}' > /dev/null signed_request "${CA}/acme/new-reg" '{"resource": "new-reg", "agreement": "'"$LICENSE"'"}' > /dev/null
fi fi
if [[ ! -e "domains.txt" ]]; then if [[ -e "${BASEDIR}/domains.txt" ]]; then
DOMAINS_TXT="${BASEDIR}/domains.txt"
elif [[ -e "${SCRIPTDIR}/domains.txt" ]]; then
DOMAINS_TXT="${SCRIPTDIR}/domains.txt"
else
echo "You have to create a domains.txt file listing the domains you want certificates for. Have a look at domains.txt.example." echo "You have to create a domains.txt file listing the domains you want certificates for. Have a look at domains.txt.example."
exit 1 exit 1
fi fi
...@@ -225,8 +230,8 @@ if [[ ! -e "${WELLKNOWN}" ]]; then ...@@ -225,8 +230,8 @@ if [[ ! -e "${WELLKNOWN}" ]]; then
mkdir -p "${WELLKNOWN}" mkdir -p "${WELLKNOWN}"
fi fi
# Generate certificates for all domains found in domain.txt. Check if existing certificate are about to expire # Generate certificates for all domains found in domains.txt. Check if existing certificate are about to expire
<domains.txt sed 's/^\s*//g;s/\s*$//g' | grep -v '^#' | grep -v '^$' | while read -r line; do <"${DOMAINS_TXT}" sed 's/^\s*//g;s/\s*$//g' | grep -v '^#' | grep -v '^$' | while read -r line; do
domain="$(echo "${line}" | cut -d' ' -f1)" domain="$(echo "${line}" | cut -d' ' -f1)"
cert="${BASEDIR}/certs/${domain}/cert.pem" cert="${BASEDIR}/certs/${domain}/cert.pem"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment