Last active
October 24, 2023 11:48
-
-
Save flydo/6edc29ab6a70be60dee80506b8ad1472 to your computer and use it in GitHub Desktop.
acme.sh 证书创建与部署
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# 手动安装证书到容器中的 /data/ssl | |
# https://github.com/acmesh-official/acme.sh/wiki/Run-acme.sh-in-docker | |
set -eu | |
BASE_EXEC="docker exec acme.sh" | |
DOMAIN="${1}" | |
# 默认为 dns_cf | |
DNS=${DNS:-dns_cf} | |
# 交换域名 | |
CHALLENGE=${CA:-} | |
if [[ -n "$CHALLENGE" ]]; then | |
# _acme-challenge. | |
CHALLENGE="--challenge-alias $CHALLENGE" | |
fi | |
# 签发 | |
# shellcheck disable=SC2086 | |
$BASE_EXEC acme.sh --issue -d "$DOMAIN" --dns "$DNS" $CHALLENGE -d "*.$DOMAIN" --keylength ec-256 --ecc --force | |
# 部署 | |
$BASE_EXEC acme.sh --install-cert --ecc -d "$DOMAIN" --key-file /data/ssl/"$DOMAIN".key --fullchain-file /data/ssl/"$DOMAIN".fullchain.cer | |
# ./issue_deploy.sh domain.com | |
# DNS=dns_ali ./issue_deploy.sh domain.com | |
# CA=x.com DNS=dns_ali ./issue_deploy.sh domain.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment