Skip to content
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

[pull] master from acmesh-official:master #15

Merged
merged 57 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
bd3a2b1
Prevent leaving blank lines in config file after cleared keys.
scruel Feb 27, 2024
b1d0191
UBNT removed keytool from UnifiOS, modify to use openssl PKCS12. Also…
3VAbdAVE May 13, 2024
fd461fe
Fix missing XML Escaping in Password String
Weishaupt May 16, 2024
b821836
update dns_doapi
henrikalves May 27, 2024
617f4ac
Update dns_openprovider.sh for OpenProvider
WinSCaP Jun 22, 2024
5789e80
Fixed a bug where the zone_id was corrupted for domains containing th…
IIIPr0t0typ3III Jul 5, 2024
a2bc79d
Fixed a bug where trying to add entries where the fulldomain contains…
Jul 7, 2024
ab86e05
Changed A-Z and a-z to [:upper:] and [:lower:] from last commit to co…
Jul 7, 2024
0a64567
Merge branch 'acmesh-official:dev' into dev
IIIPr0t0typ3III Jul 22, 2024
dd582c0
Changed the direct call of `tr` to cast to lower case to the function
Jul 23, 2024
3e36f05
Update dockerhub.yml
tomo2403 Jul 27, 2024
b6f7710
Update bark.sh
tomo2403 Jul 27, 2024
cb5eae8
Update dns_ispconfig.sh
mickaelmonsieur Jul 31, 2024
de90216
Replaced keytool with openssl pkcs12. Added backup of original certif…
3VAbdAVE Aug 1, 2024
57da04b
Updated Unifi deploy hook to use openssl's pkcs12 instead of Java Key…
3VAbdAVE Aug 12, 2024
3bb5943
Merge branch 'dev' of https://github.com/3VAbdAVE/acme.sh into dev
3VAbdAVE Aug 12, 2024
a8d8fef
Merge branch 'acmesh-official:dev' into dev
3VAbdAVE Aug 12, 2024
adfafe5
reverted bad merge
3VAbdAVE Aug 12, 2024
ca62263
removed old comment
3VAbdAVE Aug 12, 2024
de99d6d
fixed shfmt
3VAbdAVE Aug 15, 2024
f1b6016
Merge branch 'acmesh-official:dev' into dev
3VAbdAVE Aug 15, 2024
d8637b2
fixes #3359
3VAbdAVE Aug 15, 2024
a94653b
Merge branch 'dev' of https://github.com/3VAbdAVE/acme.sh into dev
3VAbdAVE Aug 15, 2024
5275daa
Merge pull request #5231 from mickaelmonsieur/master
Neilpang Sep 15, 2024
e0214a2
Merge pull request #5218 from IIIPr0t0typ3III/dev
Neilpang Sep 15, 2024
beb31ab
Merge pull request #5246 from 3VAbdAVE/dev
Neilpang Sep 15, 2024
dc341ef
Merge pull request #5149 from Weishaupt/patch-1
Neilpang Sep 15, 2024
8635d89
Merge pull request #5029 from scruel/patch-2
Neilpang Sep 15, 2024
2d28259
fix format
Sep 15, 2024
f86ee84
fix format
Sep 15, 2024
522c953
Update dockerhub.yml
tomo2403 Sep 15, 2024
ea94477
Merge pull request #5229 from tomo2403/master
Neilpang Sep 15, 2024
22d260f
fix dns_nsupdate when NSUPDATE_OPT is empty, refs #5224
fraenki Sep 16, 2024
9ecd840
resolve shellcheck offenses
fraenki Sep 17, 2024
167aba6
Merge pull request #5285 from markt-de/fix_nsupdate
Neilpang Sep 17, 2024
d057a9b
update version
Sep 18, 2024
fc7f861
Merge pull request #5290 from acmesh-official/dev
Neilpang Sep 18, 2024
fca6e9b
refactor: Alibaba Cloud API
PMExtra Sep 19, 2024
610bb2b
refactor(ali): set API endpoint for each action
PMExtra Sep 19, 2024
ea2330b
refactor(ali): move the loading script into ali_cdn_deploy
PMExtra Sep 20, 2024
2ea37e6
refactor(ali): check the result of prepare_ali_credentials
PMExtra Sep 20, 2024
114eb62
Merge pull request #5294 from PMExtra/refactor/ali_api
Neilpang Sep 20, 2024
df6aa99
fix Timeweb Cloud DNS API pagination
nikolaypronchev Sep 20, 2024
45ea2f8
explicitly reset *_return variables
nikolaypronchev Sep 20, 2024
ad44c87
Merge pull request #5296 from nikolaypronchev/master
Neilpang Sep 21, 2024
997bd33
fix https://github.com/acmesh-official/acme.sh/issues/5293
Sep 21, 2024
8cb684e
fix https://github.com/acmesh-official/acme.sh/issues/5067
Sep 21, 2024
2044d63
Merge pull request #5183 from WinSCaP/patch-1
Neilpang Sep 21, 2024
e036eea
Merge pull request #5158 from henrikalves/dode
Neilpang Sep 21, 2024
89342bc
add ali_dcdn deploy hook
PMExtra Sep 23, 2024
c20b016
upgrade version
Sep 23, 2024
76719d1
fix: fix ali_dcdn function naming typo
ShirasawaSama Sep 24, 2024
7ebe97b
Merge pull request #1 from ShirasawaSama/patch-1
PMExtra Sep 25, 2024
2570329
Add OpenContainer Image Format Annotations as Labels to Docker Image
mpgirro Sep 25, 2024
a972901
Merge pull request #5305 from mpgirro/oci-image-source
Neilpang Sep 27, 2024
df93fb7
Merge pull request #5297 from PMExtra/feature/ali_dcdn
Neilpang Sep 29, 2024
eaf1100
Merge pull request #5310 from acmesh-official/dev
Neilpang Sep 29, 2024
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
15 changes: 13 additions & 2 deletions .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
DOCKER_IMAGE: neilpang/acme.sh

jobs:
CheckToken:
Expand Down Expand Up @@ -44,15 +46,18 @@ jobs:
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Extract Docker metadata
id: meta
uses: docker/[email protected]
with:
images: ${DOCKER_IMAGE}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: login to docker hub
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: build and push the image
run: |
DOCKER_IMAGE=neilpang/acme.sh

if [[ $GITHUB_REF == refs/tags/* ]]; then
DOCKER_IMAGE_TAG=${GITHUB_REF#refs/tags/}
fi
Expand All @@ -66,8 +71,14 @@ jobs:
fi
fi

DOCKER_LABELS=()
while read -r label; do
DOCKER_LABELS+=(--label "${label}")
done <<<"${DOCKER_METADATA_OUTPUT_LABELS}"

docker buildx build \
--tag ${DOCKER_IMAGE}:${DOCKER_IMAGE_TAG} \
"${DOCKER_LABELS[@]}" \
--output "type=image,push=true" \
--build-arg AUTO_UPGRADE=${AUTO_UPGRADE} \
--platform linux/arm64/v8,linux/amd64,linux/arm/v6,linux/arm/v7,linux/386,linux/ppc64le,linux/s390x .
22 changes: 20 additions & 2 deletions acme.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

VER=3.0.8
VER=3.1.0

PROJECT_NAME="acme.sh"

Expand Down Expand Up @@ -672,8 +672,10 @@ _hex_dump() {
#0 1 2 3 4 5 6 7 8 9 - _ . ~
#30 31 32 33 34 35 36 37 38 39 2d 5f 2e 7e

#_url_encode [upper-hex] the encoded hex will be upper-case if the argument upper-hex is followed
#stdin stdout
_url_encode() {
_upper_hex=$1
_hex_str=$(_hex_dump)
_debug3 "_url_encode"
_debug3 "_hex_str" "$_hex_str"
Expand Down Expand Up @@ -883,6 +885,9 @@ _url_encode() {
;;
#other hex
*)
if [ "$_upper_hex" = "upper-hex" ]; then
_hex_code=$(printf "%s" "$_hex_code" | _upper_case)
fi
printf '%%%s' "$_hex_code"
;;
esac
Expand Down Expand Up @@ -2361,7 +2366,7 @@ _clear_conf() {
_sdkey="$2"
if [ "$_c_c_f" ]; then
_conf_data="$(cat "$_c_c_f")"
echo "$_conf_data" | sed "s/^$_sdkey *=.*$//" >"$_c_c_f"
echo "$_conf_data" | sed "/^$_sdkey *=.*$/d" >"$_c_c_f"
else
_err "Config file is empty, cannot clear"
fi
Expand Down Expand Up @@ -5111,6 +5116,19 @@ $_authorizations_map"
_on_issue_err "$_post_hook" "$vlist"
return 1
fi
_retryafter=$(echo "$responseHeaders" | grep -i "^Retry-After *: *[0-9]\+ *" | cut -d : -f 2 | tr -d ' ' | tr -d '\r')
_sleep_overload_retry_sec=$_retryafter
if [ "$_sleep_overload_retry_sec" ]; then
if [ $_sleep_overload_retry_sec -le 600 ]; then
_sleep $_sleep_overload_retry_sec
else
_info "The retryafter=$_retryafter value is too large (> 600), will not retry anymore."
_clearupwebbroot "$_currentRoot" "$removelevel" "$token"
_clearup
_on_issue_err "$_post_hook" "$vlist"
return 1
fi
fi
done

done
Expand Down
107 changes: 19 additions & 88 deletions deploy/ali_cdn.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
#!/usr/bin/env sh
# shellcheck disable=SC2034,SC2154

# Script to create certificate to Alibaba Cloud CDN
#
# Docs: https://github.com/acmesh-official/acme.sh/wiki/deployhooks#33-deploy-your-certificate-to-cdn-or-dcdn-of-alibaba-cloud-aliyun
#
# This deployment required following variables
# export Ali_Key="ALIACCESSKEY"
# export Ali_Secret="ALISECRETKEY"
# The credentials are shared with all the Alibaba Cloud deploy hooks and dnsapi
#
# To specify the CDN domain that is different from the certificate CN, usually used for multi-domain or wildcard certificates
# export DEPLOY_ALI_CDN_DOMAIN="cdn.example.com"
# If you have more than one domain, just
# If you have multiple CDN domains using the same certificate, just
# export DEPLOY_ALI_CDN_DOMAIN="cdn1.example.com cdn2.example.com"
#
# The credentials are shared with all domains, also shared with dns_ali api
# For DCDN, see ali_dcdn deploy hook

Ali_API="https://cdn.aliyuncs.com/"
Ali_CDN_API="https://cdn.aliyuncs.com/"

ali_cdn_deploy() {
_cdomain="$1"
Expand All @@ -26,18 +32,16 @@ ali_cdn_deploy() {
_debug _cca "$_cca"
_debug _cfullchain "$_cfullchain"

Ali_Key="${Ali_Key:-$(_readaccountconf_mutable Ali_Key)}"
Ali_Secret="${Ali_Secret:-$(_readaccountconf_mutable Ali_Secret)}"
if [ -z "$Ali_Key" ] || [ -z "$Ali_Secret" ]; then
Ali_Key=""
Ali_Secret=""
_err "You don't specify aliyun api key and secret yet."
# Load dnsapi/dns_ali.sh to reduce the duplicated codes
# https://github.com/acmesh-official/acme.sh/pull/5205#issuecomment-2357867276
dnsapi_ali="$(_findHook "$_cdomain" "$_SUB_FOLDER_DNSAPI" dns_ali)"
# shellcheck source=/dev/null
if ! . "$dnsapi_ali"; then
_err "Error loading file $dnsapi_ali. Please check your API file and try again."
return 1
fi

#save the api key and secret to the account conf file.
_saveaccountconf_mutable Ali_Key "$Ali_Key"
_saveaccountconf_mutable Ali_Secret "$Ali_Secret"
_prepare_ali_credentials || return 1

_getdeployconf DEPLOY_ALI_CDN_DOMAIN
if [ "$DEPLOY_ALI_CDN_DOMAIN" ]; then
Expand All @@ -47,8 +51,8 @@ ali_cdn_deploy() {
fi

# read cert and key files and urlencode both
_cert=$(_url_encode_upper <"$_cfullchain")
_key=$(_url_encode_upper <"$_ckey")
_cert=$(_url_encode upper-hex <"$_cfullchain")
_key=$(_url_encode upper-hex <"$_ckey")

_debug2 _cert "$_cert"
_debug2 _key "$_key"
Expand All @@ -64,82 +68,9 @@ ali_cdn_deploy() {
return 0
}

#################### Private functions below ##################################

# act ign mtd
_ali_rest() {
act="$1"
ign="$2"
mtd="$3"

signature=$(printf "%s" "$mtd&%2F&$(_ali_urlencode "$query")" | _hmac "sha1" "$(printf "%s" "$Ali_Secret&" | _hex_dump | tr -d " ")" | _base64)
signature=$(_ali_urlencode "$signature")
url="$Ali_API?$query&Signature=$signature"

if [ "$mtd" = "GET" ]; then
response="$(_get "$url")"
else
# post payload is not supported yet because of signature
response="$(_post "" "$url")"
fi

_ret="$?"
_debug2 response "$response"
if [ "$_ret" != "0" ]; then
_err "Error <$act>"
return 1
fi

if [ -z "$ign" ]; then
message="$(echo "$response" | _egrep_o "\"Message\":\"[^\"]*\"" | cut -d : -f 2 | tr -d \")"
if [ "$message" ]; then
_err "$message"
return 1
fi
fi
}

_ali_urlencode() {
_str="$1"
_str_len=${#_str}
_u_i=1
while [ "$_u_i" -le "$_str_len" ]; do
_str_c="$(printf "%s" "$_str" | cut -c "$_u_i")"
case $_str_c in [a-zA-Z0-9.~_-])
printf "%s" "$_str_c"
;;
*)
printf "%%%02X" "'$_str_c"
;;
esac
_u_i="$(_math "$_u_i" + 1)"
done
}

_ali_nonce() {
#_head_n 1 </dev/urandom | _digest "sha256" hex | cut -c 1-31
#Not so good...
date +"%s%N" | sed 's/%N//g'
}

_timestamp() {
date -u +"%Y-%m-%dT%H%%3A%M%%3A%SZ"
}

# stdin stdout
_url_encode_upper() {
encoded=$(_url_encode)

for match in $(echo "$encoded" | _egrep_o '%..' | sort -u); do
upper=$(echo "$match" | _upper_case)
encoded=$(echo "$encoded" | sed "s/$match/$upper/g")
done

echo "$encoded"
}

# domain pub pri
_set_cdn_domain_ssl_certificate_query() {
endpoint=$Ali_CDN_API
query=''
query=$query'AccessKeyId='$Ali_Key
query=$query'&Action=SetCdnDomainSSLCertificate'
Expand Down
88 changes: 88 additions & 0 deletions deploy/ali_dcdn.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/usr/bin/env sh
# shellcheck disable=SC2034,SC2154

# Script to create certificate to Alibaba Cloud DCDN
#
# Docs: https://github.com/acmesh-official/acme.sh/wiki/deployhooks#33-deploy-your-certificate-to-cdn-or-dcdn-of-alibaba-cloud-aliyun
#
# This deployment required following variables
# export Ali_Key="ALIACCESSKEY"
# export Ali_Secret="ALISECRETKEY"
# The credentials are shared with all the Alibaba Cloud deploy hooks and dnsapi
#
# To specify the DCDN domain that is different from the certificate CN, usually used for multi-domain or wildcard certificates
# export DEPLOY_ALI_DCDN_DOMAIN="dcdn.example.com"
# If you have multiple CDN domains using the same certificate, just
# export DEPLOY_ALI_DCDN_DOMAIN="dcdn1.example.com dcdn2.example.com"
#
# For regular CDN, see ali_cdn deploy hook

Ali_DCDN_API="https://dcdn.aliyuncs.com/"

ali_dcdn_deploy() {
_cdomain="$1"
_ckey="$2"
_ccert="$3"
_cca="$4"
_cfullchain="$5"

_debug _cdomain "$_cdomain"
_debug _ckey "$_ckey"
_debug _ccert "$_ccert"
_debug _cca "$_cca"
_debug _cfullchain "$_cfullchain"

# Load dnsapi/dns_ali.sh to reduce the duplicated codes
# https://github.com/acmesh-official/acme.sh/pull/5205#issuecomment-2357867276
dnsapi_ali="$(_findHook "$_cdomain" "$_SUB_FOLDER_DNSAPI" dns_ali)"
# shellcheck source=/dev/null
if ! . "$dnsapi_ali"; then
_err "Error loading file $dnsapi_ali. Please check your API file and try again."
return 1
fi

_prepare_ali_credentials || return 1

_getdeployconf DEPLOY_ALI_DCDN_DOMAIN
if [ "$DEPLOY_ALI_DCDN_DOMAIN" ]; then
_savedeployconf DEPLOY_ALI_DCDN_DOMAIN "$DEPLOY_ALI_DCDN_DOMAIN"
else
DEPLOY_ALI_DCDN_DOMAIN="$_cdomain"
fi

# read cert and key files and urlencode both
_cert=$(_url_encode upper-hex <"$_cfullchain")
_key=$(_url_encode upper-hex <"$_ckey")

_debug2 _cert "$_cert"
_debug2 _key "$_key"

## update domain ssl config
for domain in $DEPLOY_ALI_DCDN_DOMAIN; do
_set_dcdn_domain_ssl_certificate_query "$domain" "$_cert" "$_key"
if _ali_rest "Set DCDN domain SSL certificate for $domain" "" POST; then
_info "Domain $domain certificate has been deployed successfully"
fi
done

return 0
}

# domain pub pri
_set_dcdn_domain_ssl_certificate_query() {
endpoint=$Ali_DCDN_API
query=''
query=$query'AccessKeyId='$Ali_Key
query=$query'&Action=SetDcdnDomainSSLCertificate'
query=$query'&CertType=upload'
query=$query'&DomainName='$1
query=$query'&Format=json'
query=$query'&SSLPri='$3
query=$query'&SSLProtocol=on'
query=$query'&SSLPub='$2
query=$query'&SignatureMethod=HMAC-SHA1'
query=$query"&SignatureNonce=$(_ali_nonce)"
query=$query'&SignatureVersion=1.0'
query=$query'&Timestamp='$(_timestamp)
query=$query'&Version=2018-01-15'
}
6 changes: 3 additions & 3 deletions deploy/synology_dsm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ synology_dsm_deploy() {

# Default values for scheme, hostname and port
# Defaulting to localhost and http, because it's localhost…
[ -n "$SYNO_SCHEME" ] || SYNO_SCHEME="http"
[ -n "$SYNO_HOSTNAME" ] || SYNO_HOSTNAME="localhost"
[ -n "$SYNO_PORT" ] || SYNO_PORT="5000"
[ -n "$SYNO_SCHEME" ] || SYNO_SCHEME=http
[ -n "$SYNO_HOSTNAME" ] || SYNO_HOSTNAME=localhost
[ -n "$SYNO_PORT" ] || SYNO_PORT=5000
_savedeployconf SYNO_SCHEME "$SYNO_SCHEME"
_savedeployconf SYNO_HOSTNAME "$SYNO_HOSTNAME"
_savedeployconf SYNO_PORT "$SYNO_PORT"
Expand Down
Loading
Loading