mirror of
https://github.com/aljazceru/addons.git
synced 2026-02-23 13:54:26 +01:00
Fix route53, add google dns, fix documentation (#988)
* #987 fixed documentation link * fix route53, add google dns, fix documentation * Using "null", using share folder for google dns * Additional documentation added * Added argument array * Update CHANGELOG.md * Update config.json * Update README.md * Fix code style Co-authored-by: Pascal Vizeli <pascal.vizeli@syshack.ch>
This commit is contained in:
committed by
Pascal Vizeli
parent
9e3e9fdeff
commit
cec0c95d19
@@ -7,6 +7,12 @@ CERTFILE=$(bashio::config 'certfile')
|
||||
CHALLENGE=$(bashio::config 'challenge')
|
||||
DNS_PROVIDER=$(bashio::config 'dns.provider')
|
||||
|
||||
if [[ "$CHALLENGE" == "dns" ]]; then
|
||||
bashio::log.info "Selected DNS Provider: $(bashio::config 'dns.provider')"
|
||||
else
|
||||
bashio::log.info "Selected http verification"
|
||||
fi
|
||||
|
||||
CERT_DIR=/data/letsencrypt
|
||||
WORK_DIR=/data/workdir
|
||||
|
||||
@@ -15,6 +21,7 @@ mkdir -p "$CERT_DIR"
|
||||
mkdir -p "/ssl"
|
||||
chmod +x /run.sh
|
||||
touch /data/dnsapikey
|
||||
PROVIDER_ARGUMENTS=()
|
||||
|
||||
echo -e "dns_cloudflare_email = $(bashio::config 'dns.cloudflare_email')\n" \
|
||||
"dns_cloudflare_api_key = $(bashio::config 'dns.cloudflare_api_key')\n" \
|
||||
@@ -46,13 +53,29 @@ echo -e "dns_cloudflare_email = $(bashio::config 'dns.cloudflare_email')\n" \
|
||||
"dns_sakuracloud_api_secret = $(bashio::config 'dns.sakuracloud_api_secret')" > /data/dnsapikey
|
||||
chmod 600 /data/dnsapikey
|
||||
|
||||
# AWS workaround
|
||||
# AWS
|
||||
if bashio::config.exists 'dns.aws_access_key_id' && bashio::config.exists 'dns.aws_secret_access_key'; then
|
||||
AWS_ACCESS_KEY_ID="$(bashio::config 'dns.aws_access_key_id')"
|
||||
AWS_SECRET_ACCESS_KEY="$(bashio::config 'dns.aws_secret_access_key')"
|
||||
|
||||
export AWS_ACCESS_KEY_ID
|
||||
export AWS_SECRET_ACCESS_KEY
|
||||
PROVIDER_ARGUMENTS+=("--${DNS_PROVIDER}")
|
||||
#Google
|
||||
elif bashio::config.exists 'dns.google_creds'; then
|
||||
GOOGLE_CREDS="$(bashio::config 'dns.google_creds')"
|
||||
|
||||
export GOOGLE_CREDS
|
||||
if [ -f "/share/${GOOGLE_CREDS}" ]; then
|
||||
cp -f "/share/${GOOGLE_CREDS}" "/data/${GOOGLE_CREDS}"
|
||||
chmod 600 "/data/${GOOGLE_CREDS}"
|
||||
else
|
||||
bashio::log.info "Google Credentials File doesnt exists in folder share."
|
||||
fi
|
||||
PROVIDER_ARGUMENTS+=("--${DNS_PROVIDER}" "--${DNS_PROVIDER}-credentials" "/data/${GOOGLE_CREDS}")
|
||||
#All others
|
||||
else
|
||||
PROVIDER_ARGUMENTS+=("--${DNS_PROVIDER}" "--${DNS_PROVIDER}-credentials" /data/dnsapikey)
|
||||
fi
|
||||
|
||||
# Generate new certs
|
||||
@@ -64,7 +87,7 @@ if [ ! -d "$CERT_DIR/live" ]; then
|
||||
|
||||
echo "$DOMAINS" > /data/domains.gen
|
||||
if [ "$CHALLENGE" == "dns" ]; then
|
||||
certbot certonly --non-interactive --config-dir "$CERT_DIR" --work-dir "$WORK_DIR" "--$DNS_PROVIDER" "--${DNS_PROVIDER}-credentials" "/data/dnsapikey" --email "$EMAIL" --agree-tos --config-dir "$CERT_DIR" --work-dir "$WORK_DIR" --preferred-challenges "$CHALLENGE" "${DOMAIN_ARR[@]}"
|
||||
certbot certonly --non-interactive --config-dir "$CERT_DIR" --work-dir "$WORK_DIR" "${PROVIDER_ARGUMENTS[@]}" --email "$EMAIL" --agree-tos --config-dir "$CERT_DIR" --work-dir "$WORK_DIR" --preferred-challenges "$CHALLENGE" "${DOMAIN_ARR[@]}"
|
||||
else
|
||||
certbot certonly --non-interactive --standalone --email "$EMAIL" --agree-tos --config-dir "$CERT_DIR" --work-dir "$WORK_DIR" --preferred-challenges "$CHALLENGE" "${DOMAIN_ARR[@]}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user