Skip to content
This repository was archived by the owner on Jan 6, 2021. It is now read-only.

Commit 71b51c1

Browse files
authored
Merge pull request #383 from that1matt/master
Google Cloud DNS needs a .json for authentication
2 parents 0338178 + e97cf80 commit 71b51c1

4 files changed

Lines changed: 19 additions & 9 deletions

File tree

readme-vars.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ cap_add_param_vars:
5151
# optional container parameters
5252
opt_param_usage_include_env: true
5353
opt_param_env_vars:
54-
- { env_var: "DNSPLUGIN", env_value: "cloudflare", desc: "Required if `VALIDATION` is set to `dns`. Options are `cloudflare`, `cloudxns`, `digitalocean`, `dnsimple`, `dnsmadeeasy`, `google`, `inwx`, `linode`, `luadns`, `nsone`, `ovh`, `rfc2136`, `route53` and `transip`. Also need to enter the credentials into the corresponding ini file under `/config/dns-conf`." }
54+
- { env_var: "DNSPLUGIN", env_value: "cloudflare", desc: "Required if `VALIDATION` is set to `dns`. Options are `cloudflare`, `cloudxns`, `digitalocean`, `dnsimple`, `dnsmadeeasy`, `google`, `inwx`, `linode`, `luadns`, `nsone`, `ovh`, `rfc2136`, `route53` and `transip`. Also need to enter the credentials into the corresponding ini (or json for some plugins) file under `/config/dns-conf`." }
5555
- { env_var: "DUCKDNSTOKEN", env_value: "<token>", desc: "Required if `VALIDATION` is set to `duckdns`. Retrieve your token from https://www.duckdns.org" }
5656
- { env_var: "EMAIL", env_value: "<e-mail>", desc: "Optional e-mail address used for cert expiration notifications." }
5757
- { env_var: "DHLEVEL", env_value: "2048", desc: "Dhparams bit value (default=2048, can be set to `1024` or `4096`)." }
@@ -81,7 +81,7 @@ app_setup_block: |
8181
* Before running this container, make sure that the url and subdomains are properly forwarded to this container's host, and that port 443 (and/or 80) is not being used by another service on the host (NAS gui, another webserver, etc.).
8282
* For `http` validation, port 80 on the internet side of the router should be forwarded to this container's port 80
8383
* For `tls-sni` validation, port 443 on the internet side of the router should be forwarded to this container's port 443
84-
* For `dns` validation, make sure to enter your credentials into the corresponding ini file under `/config/dns-conf`
84+
* For `dns` validation, make sure to enter your credentials into the corresponding ini (or json for some plugins) file under `/config/dns-conf`
8585
* Cloudflare provides free accounts for managing dns and is very easy to use with this image. Make sure that it is set up for "dns only" instead of "dns + proxy"
8686
* Google dns plugin is meant to be used with "Google Cloud DNS", a paid enterprise product, and not for "Google Domains DNS"
8787
* For `duckdns` validation, either leave the `SUBDOMAINS` variable empty or set it to `wildcard`, and set the `DUCKDNSTOKEN` variable with your duckdns token. Due to a limitation of duckdns, the resulting cert will only cover either main subdomain (ie. `yoursubdomain.duckdns.org`), or sub-subdomains (ie. `*.yoursubdomain.duckdns.org`), but will not both at the same time. You can use our [duckdns image](https://hub.docker.com/r/linuxserver/duckdns/) to update your IP on duckdns.org.
@@ -126,6 +126,7 @@ app_setup_nginx_reverse_proxy_block: ""
126126

127127
# changelog
128128
changelogs:
129+
- { date: "11.12.19:", desc: "Fix Google Cloud DNS to use .json file for authentication." }
129130
- { date: "20.11.19:", desc: "Fix cryptography version mismatch due to pip issue." }
130131
- { date: "17.11.19:", desc: "Add php7-pdo_odbc." }
131132
- { date: "17.11.19:", desc: "Add transip dns validation plugin." }

root/defaults/dns-conf/google.ini

Lines changed: 0 additions & 6 deletions
This file was deleted.

root/defaults/dns-conf/google.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"instructions": "https://github.com/certbot/certbot/blob/master/certbot-dns-google/certbot_dns_google/__init__.py",
3+
"_comment": "Replace with your values",
4+
"type": "service_account",
5+
"rest": "..."
6+
}

root/etc/cont-init.d/50-config

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ fi
174174
if [ "$VALIDATION" = "dns" ]; then
175175
if [ "$DNSPLUGIN" = "route53" ]; then
176176
PREFCHAL="--dns-${DNSPLUGIN} --manual-public-ip-logging-ok"
177+
elif [[ "$DNSPLUGIN" =~ ^(google)$ ]]; then
178+
PREFCHAL="--dns-${DNSPLUGIN} --dns-${DNSPLUGIN}-credentials /config/dns-conf/${DNSPLUGIN}.json --manual-public-ip-logging-ok --dns-${DNSPLUGIN}-propagation-seconds 120"
177179
elif [[ "$DNSPLUGIN" =~ ^(inwx|transip)$ ]]; then
178180
PREFCHAL="-a certbot-dns-${DNSPLUGIN}:dns-${DNSPLUGIN} --certbot-dns-${DNSPLUGIN}:dns-${DNSPLUGIN}-credentials /config/dns-conf/${DNSPLUGIN}.ini --manual-public-ip-logging-ok"
179181
else
@@ -224,6 +226,13 @@ fi
224226
# saving new variables
225227
echo -e "ORIGURL=\"$URL\" ORIGSUBDOMAINS=\"$SUBDOMAINS\" ORIGONLY_SUBDOMAINS=\"$ONLY_SUBDOMAINS\" ORIGEXTRA_DOMAINS=\"$EXTRA_DOMAINS\" ORIGDHLEVEL=\"$DHLEVEL\" ORIGVALIDATION=\"$VALIDATION\" ORIGDNSPLUGIN=\"$DNSPLUGIN\" ORIGSTAGING=\"$STAGING\" ORIGDUCKDNSTOKEN=\"$DUCKDNSTOKEN\"" > /config/donoteditthisfile.conf
226228

229+
# alter extension for error message
230+
if [ "$DNSPLUGIN" = "google" ]; then
231+
FILENAME="$DNSPLUGIN.json"
232+
else
233+
FILENAME="$DNSPLUGIN.ini"
234+
fi
235+
227236
# generating certs if necessary
228237
if [ ! -f "/config/keys/letsencrypt/fullchain.pem" ]; then
229238
echo "Generating new certificate"
@@ -233,7 +242,7 @@ if [ ! -f "/config/keys/letsencrypt/fullchain.pem" ]; then
233242
cd /config/keys/letsencrypt || exit
234243
else
235244
if [ "$VALIDATION" = "dns" ]; then
236-
echo "ERROR: Cert does not exist! Please see the validation error above. Make sure you entered correct credentials into the /config/dns-conf/${DNSPLUGIN}.ini file."
245+
echo "ERROR: Cert does not exist! Please see the validation error above. Make sure you entered correct credentials into the /config/dns-conf/${FILENAME} file."
237246
elif [ "$VALIDATION" = "duckdns" ]; then
238247
echo "ERROR: Cert does not exist! Please see the validation error above. Make sure your DUCKDNSTOKEN is correct."
239248
else

0 commit comments

Comments
 (0)