Skip to content

Commit 18f0bc5

Browse files
committed
Implement token substitution in ACLs
Idea from srvrco#267 Fixes typos in template domain.cfg
1 parent d971846 commit 18f0bc5

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

getssl

+14-3
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@
292292
# 2024-03-16 Use FTP_PORT when deleting ftp tokens. Delete tokens when using sftp, davfs, ftpes, ftps (#693,#839) (tlhackque)
293293
# 2024 03-16 Fix dns-01's CNAME processing. (#840) (tlhackque)
294294
# 2024-03-17 Automatically update the ACCOUNT_EMAIL (#827) (tlhackque)
295-
# 2024-08-18 Implement --new-account-key and --DEACTIVATE-account (tlhackque)
295+
# 2024-03-18 Implement --new-account-key and --DEACTIVATE-account (tlhackque)
296+
# 2024-03-18 Implement token substitution in ACLs (#267) (tlhackque)
296297
# ----------------------------------------------------------------------------------------
297298

298299
case :$SHELLOPTS: in
@@ -727,6 +728,10 @@ check_config() { # check the config files for all obvious errors
727728
else
728729
DOMAIN_ACL="${ACL[$dn]}"
729730
fi
731+
# shellcheck disable=SC2016
732+
DOMAIN_ACL="$(sed -e's/\${DOMAIN}\|\$DOMAIN/'"$DOMAIN"'/g' <<<"$DOMAIN_ACL")"
733+
# shellcheck disable=SC2016
734+
DOMAIN_ACL="$(sed -e's/\${SAN}\|\$SAN/'"$d"'/g' <<<"$DOMAIN_ACL")"
730735

731736
if [[ $VALIDATE_VIA_DNS != "true" ]]; then # using http-01 challenge
732737
if [[ -z "${DOMAIN_ACL}" ]]; then
@@ -1381,6 +1386,10 @@ for d in "${alldomains[@]}"; do
13811386
else
13821387
DOMAIN_ACL="${ACL[$dn]}"
13831388
fi
1389+
# shellcheck disable=SC2016
1390+
DOMAIN_ACL="$(sed -e's/\${DOMAIN}\|\$DOMAIN/'"$DOMAIN"'/g' <<<"$DOMAIN_ACL")"
1391+
# shellcheck disable=SC2016
1392+
DOMAIN_ACL="$(sed -e's/\${SAN}\|\$SAN/'"$d"'/g' <<<"$DOMAIN_ACL")"
13841393

13851394
# request a challenge token from ACME server
13861395
if [[ $API -eq 1 ]]; then
@@ -2759,11 +2768,13 @@ write_domain_template() { # write out a template file for a domain.
27592768
# You can also user WebDAV over HTTPS as transport mechanism. To do so, start with davs: followed by username,
27602769
# password, host, port (explicitly needed even if using default port 443) and path on the server.
27612770
# Multiple locations can be defined for a file by separating the locations with a semi-colon.
2771+
# The tokens '\$DOMAIN', '\${DOMAIN}', '\$SAN', and '\${SAN}' can be used to minimize the number of ACL
2772+
# entries when the challenge location follows a pattern (Often true with multiple vertual hosts). Also "USE_SINGLE_ACL":
27622773
#ACL=('/var/www/${DOMAIN}/web/.well-known/acme-challenge'
27632774
# 'ssh:server5:/var/www/${DOMAIN}/web/.well-known/acme-challenge'
27642775
# 'ssh:sshuserid@server5:/var/www/${DOMAIN}/web/.well-known/acme-challenge'
27652776
# 'ftp:ftpuserid:ftppassword:${DOMAIN}:/web/.well-known/acme-challenge'
2766-
# 'davs:davsuserid:davspassword:{DOMAIN}:443:/web/.well-known/acme-challenge'
2777+
# 'davs:davsuserid:davspassword:${DOMAIN}:443:/web/.well-known/acme-challenge'
27672778
# 'ftps:ftpuserid:ftppassword:${DOMAIN}:/web/.well-known/acme-challenge'
27682779
# 'ftpes:ftpuserid:ftppassword:${DOMAIN}:/web/.well-known/acme-challenge')
27692780
@@ -2878,7 +2889,7 @@ write_getssl_template() { # write out the main template file
28782889
# PUBLIC_DNS_SERVER="8.8.8.8"
28792890
28802891
# If getssl is unable to determine the authoritative nameserver for a domain
2881-
# it will as you to enter AUTH_DNS_SERVER. This is a server that
2892+
# it will ask you to enter AUTH_DNS_SERVER. This is a server that
28822893
# can answer queries for the zone - a master or a slave, not a recursive server.
28832894
# AUTH_DNS_SERVER="10.0.0.14"
28842895
_EOF_getssl_

0 commit comments

Comments
 (0)