Skip to content

Commit fe50d15

Browse files
committed
Implement token substitution in ACLs
Idea from srvrco#267 Fixes typos in template domain.cfg
1 parent 0d68989 commit fe50d15

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

getssl

+14-4
Original file line numberDiff line numberDiff line change
@@ -292,8 +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-03-18 Refresh the TXT record if a CNAME is found (JoergBruce #828) (2.49)
296-
# 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)
297297
# ----------------------------------------------------------------------------------------
298298

299299
case :$SHELLOPTS: in
@@ -728,6 +728,10 @@ check_config() { # check the config files for all obvious errors
728728
else
729729
DOMAIN_ACL="${ACL[$dn]}"
730730
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")"
731735

732736
if [[ $VALIDATE_VIA_DNS != "true" ]]; then # using http-01 challenge
733737
if [[ -z "${DOMAIN_ACL}" ]]; then
@@ -1382,6 +1386,10 @@ for d in "${alldomains[@]}"; do
13821386
else
13831387
DOMAIN_ACL="${ACL[$dn]}"
13841388
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")"
13851393

13861394
# request a challenge token from ACME server
13871395
if [[ $API -eq 1 ]]; then
@@ -2763,11 +2771,13 @@ write_domain_template() { # write out a template file for a domain.
27632771
# You can also user WebDAV over HTTPS as transport mechanism. To do so, start with davs: followed by username,
27642772
# password, host, port (explicitly needed even if using default port 443) and path on the server.
27652773
# Multiple locations can be defined for a file by separating the locations with a semi-colon.
2774+
# The tokens '\$DOMAIN', '\${DOMAIN}', '\$SAN', and '\${SAN}' can be used to minimize the number of ACL
2775+
# entries when the challenge location follows a pattern (Often true with multiple vertual hosts). Also "USE_SINGLE_ACL":
27662776
#ACL=('/var/www/${DOMAIN}/web/.well-known/acme-challenge'
27672777
# 'ssh:server5:/var/www/${DOMAIN}/web/.well-known/acme-challenge'
27682778
# 'ssh:sshuserid@server5:/var/www/${DOMAIN}/web/.well-known/acme-challenge'
27692779
# 'ftp:ftpuserid:ftppassword:${DOMAIN}:/web/.well-known/acme-challenge'
2770-
# 'davs:davsuserid:davspassword:{DOMAIN}:443:/web/.well-known/acme-challenge'
2780+
# 'davs:davsuserid:davspassword:${DOMAIN}:443:/web/.well-known/acme-challenge'
27712781
# 'ftps:ftpuserid:ftppassword:${DOMAIN}:/web/.well-known/acme-challenge'
27722782
# 'ftpes:ftpuserid:ftppassword:${DOMAIN}:/web/.well-known/acme-challenge')
27732783
@@ -2882,7 +2892,7 @@ write_getssl_template() { # write out the main template file
28822892
# PUBLIC_DNS_SERVER="8.8.8.8"
28832893
28842894
# If getssl is unable to determine the authoritative nameserver for a domain
2885-
# it will as you to enter AUTH_DNS_SERVER. This is a server that
2895+
# it will ask you to enter AUTH_DNS_SERVER. This is a server that
28862896
# can answer queries for the zone - a master or a slave, not a recursive server.
28872897
# AUTH_DNS_SERVER="10.0.0.14"
28882898
_EOF_getssl_

0 commit comments

Comments
 (0)