Skip to content

Add support for expand #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ The following environment variables can be used to customize the Certbot contain
| Variable | Description | Default Value |
|------------------------|---------------------------------------------------------------------|---------------|
| `CERTBOT_DOMAINS` | Comma-separated list of domains for which to obtain the certificate | - |
| `CERTBOT_EXPAND` | Expand existing certificate to add Subject Alternative Name domains | - |
| `CERTBOT_EMAIL` | Email address for Let's Encrypt notifications | - |
| `CERTBOT_KEY_TYPE` | Type of private key to generate | `ecdsa` |
| `CERTBOT_SERVER` | The ACME server URL | `https://acme-v02.api.letsencrypt.org/directory` |
Expand Down
2 changes: 1 addition & 1 deletion src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ RUN apk update && \
ENTRYPOINT ["/entrypoint.sh"]

HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD [ -f "/etc/letsencrypt/live/$(echo "$CERTBOT_DOMAINS" | cut -d',' -f1)/fullchain.pem" ]
CMD [ -f "/etc/letsencrypt/live/$(echo "$CERTBOT_DOMAINS" | cut -d',' -f1)/fullchain.pem" ]
8 changes: 8 additions & 0 deletions src/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ run_certbot() {
debug_flag=""
[ "$DEBUG" = "true" ] && debug_flag="-v"

# Check if we need to expand
if [ "$CERTBOT_EXPAND" == "true" ]; then
expand="--expand"
else
expand=""
fi

$certbot_cmd $debug_flag certonly \
--dns-cloudflare \
--dns-cloudflare-credentials "$CLOUDFLARE_CREDENTIALS_FILE" \
Expand All @@ -113,6 +120,7 @@ run_certbot() {
--key-type "$CERTBOT_KEY_TYPE" \
--email "$CERTBOT_EMAIL" \
--server "$CERTBOT_SERVER" \
$expand \
--agree-tos \
--non-interactive \
--strict-permissions
Expand Down