File tree Expand file tree Collapse file tree 3 files changed +41
-11
lines changed
custom-domain/dstack-ingress/scripts Expand file tree Collapse file tree 3 files changed +41
-11
lines changed Original file line number Diff line number Diff line change @@ -200,13 +200,17 @@ set_caa_record() {
200200 echo " Skipping CAA record setup"
201201 return
202202 fi
203+
203204 local ACCOUNT_URI
204- find /etc/letsencrypt/accounts -name regr.json
205- path=" /etc/letsencrypt/accounts/acme-v02.api.letsencrypt.org/directory/*/regr.json"
206- if [ " $CERTBOT_STAGING " == " true" ]; then
207- path=" ${path/ acme-v02/ acme-staging-v02} "
205+ local account_file
206+
207+ if ! account_file=$( get_letsencrypt_account_file) ; then
208+ echo " Warning: Cannot set CAA record - account file not found"
209+ echo " This is not critical - certificates can still be issued without CAA records"
210+ return
208211 fi
209- ACCOUNT_URI=$( jq -j ' .uri' $path )
212+
213+ ACCOUNT_URI=$( jq -j ' .uri' " $account_file " )
210214 echo " Adding CAA record for $domain , accounturi=$ACCOUNT_URI "
211215 dnsman.py set_caa \
212216 --domain " $domain " \
@@ -217,7 +221,6 @@ set_caa_record() {
217221 echo " Warning: Failed to set CAA record for $domain "
218222 echo " This is not critical - certificates can still be issued without CAA records"
219223 echo " Consider disabling CAA records by setting SET_CAA=false if this continues to fail"
220- # Don't exit - CAA records are optional for certificate generation
221224 fi
222225}
223226
Original file line number Diff line number Diff line change @@ -82,3 +82,29 @@ sanitize_proxy_timeout() {
8282 echo " "
8383 fi
8484}
85+
86+ get_letsencrypt_account_path () {
87+ local base_path=" /etc/letsencrypt/accounts"
88+ local api_endpoint=" acme-v02.api.letsencrypt.org"
89+
90+ if [[ " $CERTBOT_STAGING " == " true" ]]; then
91+ api_endpoint=" acme-staging-v02.api.letsencrypt.org"
92+ fi
93+
94+ echo " ${base_path} /${api_endpoint} /directory/*/regr.json"
95+ }
96+
97+ get_letsencrypt_account_file () {
98+ local account_pattern
99+ account_pattern=$( get_letsencrypt_account_path)
100+
101+ local account_files
102+ account_files=( $account_pattern )
103+
104+ if [[ ! -f " ${account_files[0]} " ]]; then
105+ echo " Error: Let's Encrypt account file not found at $account_pattern " >&2
106+ return 1
107+ fi
108+
109+ echo " ${account_files[0]} "
110+ }
Original file line number Diff line number Diff line change 22
33set -e
44
5- path=" /etc/letsencrypt/accounts/acme-v02.api.letsencrypt.org/directory/*/regr.json"
6- if [ " $CERTBOT_STAGING " == " true" ]; then
7- path=" ${path/ acme-v02/ acme-staging-v02} "
5+ source " /scripts/functions.sh"
6+
7+ if ! ACME_ACCOUNT_FILE=$( get_letsencrypt_account_file) ; then
8+ echo " Error: Cannot generate evidences without Let's Encrypt account file"
9+ exit 1
810fi
9- ACME_ACCOUNT_FILE=$( ls $path )
1011
1112mkdir -p /evidences
1213cd /evidences || exit
13- cp ${ACME_ACCOUNT_FILE} acme-account.json
14+ cp " ${ACME_ACCOUNT_FILE} " acme-account.json
1415
1516# Get all domains and copy their certificates
1617all_domains=$( get-all-domains.sh)
You can’t perform that action at this time.
0 commit comments