Skip to content

Commit 3fb6e3f

Browse files
committed
Update cpanel and gandi dns plugin handling.
Minor adjustments to init logic.
1 parent e2d02de commit 3fb6e3f

File tree

6 files changed

+23
-19
lines changed

6 files changed

+23
-19
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
336336

337337
## Versions
338338

339+
* **06.10.22:** - Update cpanel and gandi dns plugin handling. Minor adjustments to init logic.
339340
* **05.10.22:** - Use certbot file hooks instead of command line hooks
340341
* **04.10.22:** - Add godaddy and porkbun dns plugins.
341342
* **03.10.22:** - Add default_server back to default site conf's https listen.

readme-vars.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ app_setup_nginx_reverse_proxy_block: ""
156156

157157
# changelog
158158
changelogs:
159+
- { date: "06.10.22:", desc: "Update cpanel and gandi dns plugin handling. Minor adjustments to init logic." }
159160
- { date: "05.10.22:", desc: "Use certbot file hooks instead of command line hooks" }
160161
- { date: "04.10.22:", desc: "Add godaddy and porkbun dns plugins." }
161162
- { date: "03.10.22:", desc: "Add default_server back to default site conf's https listen." }

root/defaults/dns-conf/cpanel.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Instructions: https://github.com/badjware/certbot-dns-cpanel#credentials
22
# Replace with your values
33
# include the scheme and the port number (usually 2083 for https)
4-
certbot_dns_cpanel:cpanel_url = https://cpanel.example.com:2083
5-
certbot_dns_cpanel:cpanel_username = username
6-
certbot_dns_cpanel:cpanel_password = 1234567890abcdef
4+
dns_cpanel_url = https://cpanel.example.com:2083
5+
dns_cpanel_username = username
6+
dns_cpanel_password = 1234567890abcdef

root/defaults/dns-conf/gandi.ini

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
# Instructions: https://github.com/obynio/certbot-plugin-gandi#usage
22
# Replace with your value
3-
certbot_plugin_gandi:dns_api_key=APIKEY
3+
# live dns v5 api key
4+
dns_gandi_api_key=APIKEY
5+
6+
# optional organization id, remove it if not used
7+
#dns_gandi_sharing_id=SHARINGID
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Instructions: https://github.com/Infomaniak/certbot-dns-infomaniak#via-ini-file
1+
# Instructions: https://github.com/Infomaniak/certbot-dns-infomaniak#via-ini-file
22
# Replace with your values
33
dns_infomaniak_token = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ chown -R abc:abc /config/dns-conf
3434

3535
# update plugin names in dns conf inis
3636
sed -i 's|^certbot_dns_aliyun:||g' /config/dns-conf/aliyun.ini
37+
sed -i 's|^certbot_dns_cpanel:|dns_|g' /config/dns-conf/cpanel.ini
3738
sed -i 's|^certbot_dns_domeneshop:||g' /config/dns-conf/domeneshop.ini
3839
sed -i 's|^certbot_dns_inwx:||g' /config/dns-conf/inwx.ini
3940
sed -i 's|^certbot_dns_transip:||g' /config/dns-conf/transip.ini
41+
sed -i 's|^certbot_plugin_gandi:dns_|dns_gandi_|g' /config/dns-conf/gandi.ini
4042

4143
# copy default renewal hooks
4244
chmod -R +x /defaults/etc/letsencrypt/renewal-hooks
@@ -134,16 +136,13 @@ if [ "$VALIDATION" = "dns" ]; then
134136
if [ "$DNSPLUGIN" = "route53" ]; then
135137
if [ -n "$PROPAGATION" ]; then PROPAGATIONPARAM="--dns-${DNSPLUGIN}-propagation-seconds ${PROPAGATION}"; fi
136138
PREFCHAL="--dns-${DNSPLUGIN} ${PROPAGATIONPARAM}"
137-
elif [[ "$DNSPLUGIN" =~ ^(cpanel)$ ]]; then
138-
if [ -n "$PROPAGATION" ]; then PROPAGATIONPARAM="--certbot-dns-${DNSPLUGIN}:${DNSPLUGIN}-propagation-seconds ${PROPAGATION}"; fi
139-
PREFCHAL="-a certbot-dns-${DNSPLUGIN}:${DNSPLUGIN} --certbot-dns-${DNSPLUGIN}:${DNSPLUGIN}-credentials /config/dns-conf/${DNSPLUGIN}.ini ${PROPAGATIONPARAM}"
140-
elif [[ "$DNSPLUGIN" =~ ^(gandi)$ ]]; then
141-
if [ -n "$PROPAGATION" ]; then echo "Gandi dns plugin does not support setting propagation time"; fi
142-
PREFCHAL="-a certbot-plugin-${DNSPLUGIN}:dns --certbot-plugin-${DNSPLUGIN}:dns-credentials /config/dns-conf/${DNSPLUGIN}.ini"
139+
elif [[ "$DNSPLUGIN" =~ ^(azure|gandi)$ ]]; then
140+
if [ -n "$PROPAGATION" ]; then echo "${DNSPLUGIN} dns plugin does not support setting propagation time"; fi
141+
PREFCHAL="-a dns-${DNSPLUGIN} --dns-${DNSPLUGIN}-credentials /config/dns-conf/${DNSPLUGIN}.ini"
143142
elif [[ "$DNSPLUGIN" =~ ^(google)$ ]]; then
144143
if [ -n "$PROPAGATION" ]; then PROPAGATIONPARAM="--dns-${DNSPLUGIN}-propagation-seconds ${PROPAGATION}"; fi
145144
PREFCHAL="--dns-${DNSPLUGIN} --dns-${DNSPLUGIN}-credentials /config/dns-conf/${DNSPLUGIN}.json ${PROPAGATIONPARAM}"
146-
elif [[ "$DNSPLUGIN" =~ ^(aliyun|desec|dnspod|do|domeneshop|dynu|godaddy|he|hetzner|infomaniak|inwx|ionos|loopia|netcup|njalla|porkbun|transip|vultr)$ ]]; then
145+
elif [[ "$DNSPLUGIN" =~ ^(aliyun|cpanel|desec|dnspod|do|domeneshop|dynu|godaddy|he|hetzner|infomaniak|inwx|ionos|loopia|netcup|njalla|porkbun|transip|vultr)$ ]]; then
147146
if [ -n "$PROPAGATION" ]; then PROPAGATIONPARAM="--dns-${DNSPLUGIN}-propagation-seconds ${PROPAGATION}"; fi
148147
PREFCHAL="-a dns-${DNSPLUGIN} --dns-${DNSPLUGIN}-credentials /config/dns-conf/${DNSPLUGIN}.ini ${PROPAGATIONPARAM}"
149148
elif [[ "$DNSPLUGIN" =~ ^(standalone)$ ]]; then
@@ -152,19 +151,16 @@ if [ "$VALIDATION" = "dns" ]; then
152151
elif [[ "$DNSPLUGIN" =~ ^(directadmin)$ ]]; then
153152
if [ -n "$PROPAGATION" ]; then PROPAGATIONPARAM="--${DNSPLUGIN}-propagation-seconds ${PROPAGATION}"; fi
154153
PREFCHAL="-a ${DNSPLUGIN} --${DNSPLUGIN}-credentials /config/dns-conf/${DNSPLUGIN}.ini ${PROPAGATIONPARAM}"
155-
elif [[ "$DNSPLUGIN" =~ ^(azure)$ ]]; then
156-
if [ -n "$PROPAGATION" ]; then echo "Azure dns plugin does not support setting propagation time"; fi
157-
PREFCHAL="-a dns-${DNSPLUGIN} --dns-${DNSPLUGIN}-credentials /config/dns-conf/${DNSPLUGIN}.ini"
158154
else
159155
if [ -n "$PROPAGATION" ]; then PROPAGATIONPARAM="--dns-${DNSPLUGIN}-propagation-seconds ${PROPAGATION}"; fi
160156
PREFCHAL="--dns-${DNSPLUGIN} --dns-${DNSPLUGIN}-credentials /config/dns-conf/${DNSPLUGIN}.ini ${PROPAGATIONPARAM}"
161157
fi
162158
echo "${VALIDATION} validation via ${DNSPLUGIN} plugin is selected"
163159
elif [ "$VALIDATION" = "tls-sni" ]; then
164-
PREFCHAL="--non-interactive --standalone --preferred-challenges http"
160+
PREFCHAL="--standalone --preferred-challenges http"
165161
echo "*****tls-sni validation has been deprecated, attempting http validation instead"
166162
elif [ "$VALIDATION" = "duckdns" ]; then
167-
PREFCHAL="--non-interactive --manual --preferred-challenges dns --manual-auth-hook /app/duckdns-txt"
163+
PREFCHAL="--manual --preferred-challenges dns --manual-auth-hook /app/duckdns-txt"
168164
chmod +x /app/duckdns-txt
169165
echo "duckdns validation is selected"
170166
if [ "$SUBDOMAINS" = "wildcard" ]; then
@@ -175,7 +171,7 @@ elif [ "$VALIDATION" = "duckdns" ]; then
175171
export URL_REAL="-d ${URL}"
176172
fi
177173
else
178-
PREFCHAL="--non-interactive --standalone --preferred-challenges http"
174+
PREFCHAL="--standalone --preferred-challenges http"
179175
echo "http validation is selected"
180176
fi
181177

@@ -234,7 +230,9 @@ fi
234230
if [ -f "/config/keys/letsencrypt/chain.pem" ] && { [ "${CERTPROVIDER}" == "letsencrypt" ] || [ "${CERTPROVIDER}" == "" ]; } && [ "${STAGING}" != "true" ] && ! openssl x509 -in /config/keys/letsencrypt/chain.pem -noout -issuer | grep -q "ISRG Root X"; then
235231
echo "The cert seems to be using the old LE root cert, which is no longer valid. Deleting and revoking."
236232
REV_ACMESERVER="https://acme-v02.api.letsencrypt.org/directory"
237-
certbot revoke --non-interactive --cert-path /config/etc/letsencrypt/live/"$ORIGDOMAIN"/fullchain.pem --server $REV_ACMESERVER
233+
if [[ -f /config/etc/letsencrypt/live/"$ORIGDOMAIN"/fullchain.pem ]]; then
234+
certbot revoke --non-interactive --cert-path /config/etc/letsencrypt/live/"$ORIGDOMAIN"/fullchain.pem --server $REV_ACMESERVER
235+
fi
238236
rm -rf /config/etc/letsencrypt/{archive,live,renewal}
239237
fi
240238

0 commit comments

Comments
 (0)