mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-12-26 05:22:10 +08:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c86631b40c | ||
|
|
8ef5daa807 | ||
|
|
fa47ea4196 | ||
|
|
683592fa86 | ||
|
|
477a04760c | ||
|
|
b4a62bfa30 | ||
|
|
10eec7d48c |
32
README.md
32
README.md
@@ -1,6 +1,6 @@
|
||||
# An ACME Shell script: acme.sh [](https://travis-ci.org/Neilpang/acme.sh)
|
||||
|
||||
<img src="https://opencollective.com/acmesh/tiers/backers/badge.svg?label=backer&color=brightgreen" /> [](https://gitter.im/acme-sh/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
<a href="https://opencollective.com/acmesh" alt="Financial Contributors on Open Collective"><img src="https://opencollective.com/acmesh/all/badge.svg?label=financial+contributors" /></a> [](https://gitter.im/acme-sh/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
- An ACME protocol client written purely in Shell (Unix shell) language.
|
||||
- Full ACME protocol implementation.
|
||||
- Support ACME v1 and ACME v2
|
||||
@@ -451,6 +451,36 @@ TODO:
|
||||
2. ACME protocol: https://github.com/ietf-wg-acme/acme
|
||||
|
||||
|
||||
## Contributors
|
||||
|
||||
### Code Contributors
|
||||
|
||||
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
|
||||
<a href="https://github.com/Neilpang/acme.sh/graphs/contributors"><img src="https://opencollective.com/acmesh/contributors.svg?width=890&button=false" /></a>
|
||||
|
||||
### Financial Contributors
|
||||
|
||||
Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/acmesh/contribute)]
|
||||
|
||||
#### Individuals
|
||||
|
||||
<a href="https://opencollective.com/acmesh"><img src="https://opencollective.com/acmesh/individuals.svg?width=890"></a>
|
||||
|
||||
#### Organizations
|
||||
|
||||
Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/acmesh/contribute)]
|
||||
|
||||
<a href="https://opencollective.com/acmesh/organization/0/website"><img src="https://opencollective.com/acmesh/organization/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/acmesh/organization/1/website"><img src="https://opencollective.com/acmesh/organization/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/acmesh/organization/2/website"><img src="https://opencollective.com/acmesh/organization/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/acmesh/organization/3/website"><img src="https://opencollective.com/acmesh/organization/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/acmesh/organization/4/website"><img src="https://opencollective.com/acmesh/organization/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/acmesh/organization/5/website"><img src="https://opencollective.com/acmesh/organization/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/acmesh/organization/6/website"><img src="https://opencollective.com/acmesh/organization/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/acmesh/organization/7/website"><img src="https://opencollective.com/acmesh/organization/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/acmesh/organization/8/website"><img src="https://opencollective.com/acmesh/organization/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/acmesh/organization/9/website"><img src="https://opencollective.com/acmesh/organization/9/avatar.svg"></a>
|
||||
|
||||
# 19. License & Others
|
||||
|
||||
License is GPLv3
|
||||
|
||||
64
acme.sh
64
acme.sh
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
VER=2.8.3
|
||||
VER=2.8.4
|
||||
|
||||
PROJECT_NAME="acme.sh"
|
||||
|
||||
@@ -90,6 +90,9 @@ DEBUG_LEVEL_3=3
|
||||
DEBUG_LEVEL_DEFAULT=$DEBUG_LEVEL_1
|
||||
DEBUG_LEVEL_NONE=0
|
||||
|
||||
DOH_CLOUDFLARE=1
|
||||
DOH_GOOGLE=2
|
||||
|
||||
HIDDEN_VALUE="[hidden](please add '--output-insecure' to see this value)"
|
||||
|
||||
SYSLOG_ERROR="user.error"
|
||||
@@ -811,6 +814,11 @@ _json_encode() {
|
||||
echo "$_j_str" | _hex_dump | _lower_case | sed 's/0a/5c 6e/g' | tr -d ' ' | _h2b | tr -d "\r\n"
|
||||
}
|
||||
|
||||
#convert '\/' to '\'
|
||||
_json_decode() {
|
||||
sed 's#\\/#/#g'
|
||||
}
|
||||
|
||||
#options file
|
||||
_sed_i() {
|
||||
options="$1"
|
||||
@@ -2392,7 +2400,7 @@ _initAPI() {
|
||||
_debug "_init api for server: $_api_server"
|
||||
|
||||
if [ -z "$ACME_NEW_ACCOUNT" ]; then
|
||||
response=$(_get "$_api_server")
|
||||
response=$(_get "$_api_server" | _json_decode)
|
||||
if [ "$?" != "0" ]; then
|
||||
_debug2 "response" "$response"
|
||||
_err "Can not init api."
|
||||
@@ -3636,7 +3644,7 @@ __trigger_validation() {
|
||||
}
|
||||
|
||||
#endpoint domain type
|
||||
_ns_lookup() {
|
||||
_ns_lookup_impl() {
|
||||
_ns_ep="$1"
|
||||
_ns_domain="$2"
|
||||
_ns_type="$3"
|
||||
@@ -3660,7 +3668,7 @@ _ns_lookup_cf() {
|
||||
_cf_ld="$1"
|
||||
_cf_ld_type="$2"
|
||||
_cf_ep="https://cloudflare-dns.com/dns-query"
|
||||
_ns_lookup "$_cf_ep" "$_cf_ld" "$_cf_ld_type"
|
||||
_ns_lookup_impl "$_cf_ep" "$_cf_ld" "$_cf_ld_type"
|
||||
}
|
||||
|
||||
#domain, type
|
||||
@@ -3673,6 +3681,44 @@ _ns_purge_cf() {
|
||||
_debug2 response "$response"
|
||||
}
|
||||
|
||||
#checks if cf server is available
|
||||
_ns_is_available_cf() {
|
||||
if _get "https://cloudflare-dns.com"; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
#domain, type
|
||||
_ns_lookup_google() {
|
||||
_cf_ld="$1"
|
||||
_cf_ld_type="$2"
|
||||
_cf_ep="https://dns.google/resolve"
|
||||
_ns_lookup_impl "$_cf_ep" "$_cf_ld" "$_cf_ld_type"
|
||||
}
|
||||
|
||||
#domain, type
|
||||
_ns_lookup() {
|
||||
if [ -z "$DOH_USE" ]; then
|
||||
_debug "Detect dns server first."
|
||||
if _ns_is_available_cf; then
|
||||
_debug "Use cloudflare doh server"
|
||||
export DOH_USE=$DOH_CLOUDFLARE
|
||||
else
|
||||
_debug "Use google doh server"
|
||||
export DOH_USE=$DOH_GOOGLE
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$DOH_USE" = "$DOH_CLOUDFLARE" ] || [ -z "$DOH_USE" ]; then
|
||||
_ns_lookup_cf "$@"
|
||||
else
|
||||
_ns_lookup_google "$@"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
#txtdomain, alias, txt
|
||||
__check_txt() {
|
||||
_c_txtdomain="$1"
|
||||
@@ -3681,7 +3727,7 @@ __check_txt() {
|
||||
_debug "_c_txtdomain" "$_c_txtdomain"
|
||||
_debug "_c_aliasdomain" "$_c_aliasdomain"
|
||||
_debug "_c_txt" "$_c_txt"
|
||||
_answers="$(_ns_lookup_cf "$_c_aliasdomain" TXT)"
|
||||
_answers="$(_ns_lookup "$_c_aliasdomain" TXT)"
|
||||
_contains "$_answers" "$_c_txt"
|
||||
|
||||
}
|
||||
@@ -3690,7 +3736,13 @@ __check_txt() {
|
||||
__purge_txt() {
|
||||
_p_txtdomain="$1"
|
||||
_debug _p_txtdomain "$_p_txtdomain"
|
||||
_ns_purge_cf "$_p_txtdomain" "TXT"
|
||||
if [ "$DOH_USE" = "$DOH_CLOUDFLARE" ] || [ -z "$DOH_USE" ]; then
|
||||
_ns_purge_cf "$_p_txtdomain" "TXT"
|
||||
else
|
||||
_debug "no purge api for google dns api, just sleep 5 secs"
|
||||
_sleep 5
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
#wait and check each dns entries
|
||||
|
||||
Reference in New Issue
Block a user