Skip to content

Commit ae50d7d

Browse files
authored
Merge pull request #65 from wwwehr/npw/certbot-staging
support certbot staging mode
2 parents 033b124 + e7f6839 commit ae50d7d

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

custom-domain/dstack-ingress/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ configs:
180180
- `PROXY_READ_TIMEOUT`: Optional value for nginx `proxy_read_timeout` (numeric with optional `s|m|h` suffix, e.g. `30s`) in single-domain mode
181181
- `PROXY_SEND_TIMEOUT`: Optional value for nginx `proxy_send_timeout` (numeric with optional `s|m|h` suffix, e.g. `30s`) in single-domain mode
182182
- `PROXY_CONNECT_TIMEOUT`: Optional value for nginx `proxy_connect_timeout` (numeric with optional `s|m|h` suffix, e.g. `10s`) in single-domain mode
183+
- `CERTBOT_STAGING`: Optional; set this value to the string `true` to set the `--staging` server option on the [`certbot` cli](https://eff-certbot.readthedocs.io/en/stable/using.html#certbot-command-line-options)
183184

184185
**Backward Compatibility:**
185186

custom-domain/dstack-ingress/scripts/certman.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ def _build_certbot_command(self, action: str, domain: str, email: str) -> List[s
288288
if action == "certonly":
289289
base_cmd.extend(["--agree-tos", "--no-eff-email",
290290
"--email", email, "-d", domain])
291+
if os.environ.get("CERTBOT_STAGING", "false") == "true":
292+
base_cmd.extend(["--staging"])
291293

292294
base_cmd.extend(["--dns-cloudflare-propagation-seconds=120"])
293295

custom-domain/dstack-ingress/scripts/entrypoint.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,12 @@ set_caa_record() {
201201
return
202202
fi
203203
local ACCOUNT_URI
204-
ACCOUNT_URI=$(jq -j '.uri' /etc/letsencrypt/accounts/acme-v02.api.letsencrypt.org/directory/*/regr.json)
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}"
208+
fi
209+
ACCOUNT_URI=$(jq -j '.uri' $path)
205210
echo "Adding CAA record for $domain, accounturi=$ACCOUNT_URI"
206211
dnsman.py set_caa \
207212
--domain "$domain" \

custom-domain/dstack-ingress/scripts/generate-evidences.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
set -e
44

5-
ACME_ACCOUNT_FILE=$(ls /etc/letsencrypt/accounts/acme-v02.api.letsencrypt.org/directory/*/regr.json)
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}"
8+
fi
9+
ACME_ACCOUNT_FILE=$(ls $path)
610

711
mkdir -p /evidences
812
cd /evidences || exit

0 commit comments

Comments
 (0)