Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
160b2e95
Unverified
Commit
160b2e95
authored
Feb 04, 2024
by
neil
Committed by
GitHub
Feb 04, 2024
Browse files
Merge pull request #4986 from acmesh-official/dev
sync
parents
afacdfcb
7ec692cd
Changes
7
Hide whitespace changes
Inline
Side-by-side
.github/workflows/DNS.yml
View file @
160b2e95
...
@@ -332,7 +332,7 @@ jobs:
...
@@ -332,7 +332,7 @@ jobs:
with
:
with
:
envs
:
'
TEST_DNS
TestingDomain
TEST_DNS_NO_WILDCARD
TEST_DNS_NO_SUBDOMAIN
TEST_DNS_SLEEP
CASE
TEST_LOCAL
DEBUG
http_proxy
https_proxy
TokenName1
TokenName2
TokenName3
TokenName4
TokenName5
${{
secrets.TokenName1}}
${{
secrets.TokenName2}}
${{
secrets.TokenName3}}
${{
secrets.TokenName4}}
${{
secrets.TokenName5}}'
envs
:
'
TEST_DNS
TestingDomain
TEST_DNS_NO_WILDCARD
TEST_DNS_NO_SUBDOMAIN
TEST_DNS_SLEEP
CASE
TEST_LOCAL
DEBUG
http_proxy
https_proxy
TokenName1
TokenName2
TokenName3
TokenName4
TokenName5
${{
secrets.TokenName1}}
${{
secrets.TokenName2}}
${{
secrets.TokenName3}}
${{
secrets.TokenName4}}
${{
secrets.TokenName5}}'
prepare
:
|
prepare
:
|
pkg_add curl socat
/usr/sbin/
pkg_add curl socat
usesh
:
true
usesh
:
true
copyback
:
false
copyback
:
false
run
:
|
run
:
|
...
@@ -493,8 +493,6 @@ jobs:
...
@@ -493,8 +493,6 @@ jobs:
copyback
:
false
copyback
:
false
prepare
:
pkg install socat
prepare
:
pkg install socat
run
:
|
run
:
|
pkg set-mediator -v -I default@1.1 openssl
export PATH=/usr/gnu/bin:$PATH
if [ "${{ secrets.TokenName1}}" ] ; then
if [ "${{ secrets.TokenName1}}" ] ; then
export ${{ secrets.TokenName1}}="${{ secrets.TokenValue1}}"
export ${{ secrets.TokenName1}}="${{ secrets.TokenValue1}}"
fi
fi
...
...
.github/workflows/NetBSD.yml
View file @
160b2e95
...
@@ -20,7 +20,6 @@ concurrency:
...
@@ -20,7 +20,6 @@ concurrency:
jobs
:
jobs
:
NetBSD
:
NetBSD
:
strategy
:
strategy
:
...
@@ -44,6 +43,7 @@ jobs:
...
@@ -44,6 +43,7 @@ jobs:
CA
:
${{ matrix.CA }}
CA
:
${{ matrix.CA }}
CA_EMAIL
:
${{ matrix.CA_EMAIL }}
CA_EMAIL
:
${{ matrix.CA_EMAIL }}
TEST_PREFERRED_CHAIN
:
${{ matrix.TEST_PREFERRED_CHAIN }}
TEST_PREFERRED_CHAIN
:
${{ matrix.TEST_PREFERRED_CHAIN }}
ACME_USE_WGET
:
${{ matrix.ACME_USE_WGET }}
steps
:
steps
:
-
uses
:
actions/checkout@v4
-
uses
:
actions/checkout@v4
-
uses
:
vmactions/cf-tunnel@v0
-
uses
:
vmactions/cf-tunnel@v0
...
@@ -57,7 +57,7 @@ jobs:
...
@@ -57,7 +57,7 @@ jobs:
run
:
cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git && cp -r acme.sh acmetest/
run
:
cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git && cp -r acme.sh acmetest/
-
uses
:
vmactions/netbsd-vm@v1
-
uses
:
vmactions/netbsd-vm@v1
with
:
with
:
envs
:
'
TEST_LOCAL
TestingDomain
TEST_ACME_Server
CA_ECDSA
CA
CA_EMAIL
TEST_PREFERRED_CHAIN'
envs
:
'
TEST_LOCAL
TestingDomain
TEST_ACME_Server
CA_ECDSA
CA
CA_EMAIL
TEST_PREFERRED_CHAIN
ACME_USE_WGET
'
nat
:
|
nat
:
|
"8080": "80"
"8080": "80"
prepare
:
|
prepare
:
|
...
...
acme.sh
View file @
160b2e95
...
@@ -2499,10 +2499,10 @@ _startserver() {
...
@@ -2499,10 +2499,10 @@ _startserver() {
_debug Le_Listen_V6
"
$Le_Listen_V6
"
_debug Le_Listen_V6
"
$Le_Listen_V6
"
_NC
=
"socat"
_NC
=
"socat"
if
[
"
$Le_Listen_V4
"
]
;
then
if
[
"
$Le_Listen_V6
"
]
;
then
_NC
=
"
$_NC
-4"
elif
[
"
$Le_Listen_V6
"
]
;
then
_NC
=
"
$_NC
-6"
_NC
=
"
$_NC
-6"
else
_NC
=
"
$_NC
-4"
fi
fi
if
[
"
$DEBUG
"
]
&&
[
"
$DEBUG
"
-gt
"1"
]
;
then
if
[
"
$DEBUG
"
]
&&
[
"
$DEBUG
"
-gt
"1"
]
;
then
...
@@ -4515,7 +4515,7 @@ issue() {
...
@@ -4515,7 +4515,7 @@ issue() {
vlist
=
"
$Le_Vlist
"
vlist
=
"
$Le_Vlist
"
_cleardomainconf
"Le_Vlist"
_cleardomainconf
"Le_Vlist"
_
info
"Getting domain auth token for each domain"
_
debug
"Getting domain auth token for each domain"
sep
=
'#'
sep
=
'#'
dvsep
=
','
dvsep
=
','
if
[
-z
"
$vlist
"
]
;
then
if
[
-z
"
$vlist
"
]
;
then
...
@@ -4571,12 +4571,22 @@ issue() {
...
@@ -4571,12 +4571,22 @@ issue() {
if
[
"
$_notAfter
"
]
;
then
if
[
"
$_notAfter
"
]
;
then
_newOrderObj
=
"
$_newOrderObj
,
\"
notAfter
\"
:
\"
$_notAfter
\"
"
_newOrderObj
=
"
$_newOrderObj
,
\"
notAfter
\"
:
\"
$_notAfter
\"
"
fi
fi
_debug
"STEP 1, Ordering a Certificate"
if
!
_send_signed_request
"
$ACME_NEW_ORDER
"
"
$_newOrderObj
}"
;
then
if
!
_send_signed_request
"
$ACME_NEW_ORDER
"
"
$_newOrderObj
}"
;
then
_err
"Create new order error."
_err
"Create new order error."
_clearup
_clearup
_on_issue_err
"
$_post_hook
"
_on_issue_err
"
$_post_hook
"
return
1
return
1
fi
fi
if
_contains
"
$response
"
"invalid"
;
then
if
echo
"
$response
"
| _normalizeJson |
grep
'"status":"invalid"'
>
/dev/null 2>&1
;
then
_err
"Create new order with invalid status."
_err
"
$response
"
_clearup
_on_issue_err
"
$_post_hook
"
return
1
fi
fi
Le_LinkOrder
=
"
$(
echo
"
$responseHeaders
"
|
grep
-i
'^Location.*$'
| _tail_n 1 |
tr
-d
"
\r\n
"
|
cut
-d
":"
-f
2-
)
"
Le_LinkOrder
=
"
$(
echo
"
$responseHeaders
"
|
grep
-i
'^Location.*$'
| _tail_n 1 |
tr
-d
"
\r\n
"
|
cut
-d
":"
-f
2-
)
"
_debug Le_LinkOrder
"
$Le_LinkOrder
"
_debug Le_LinkOrder
"
$Le_LinkOrder
"
...
@@ -4601,6 +4611,7 @@ issue() {
...
@@ -4601,6 +4611,7 @@ issue() {
return
1
return
1
fi
fi
_debug
"STEP 2, Get the authorizations of each domain"
#domain and authz map
#domain and authz map
_authorizations_map
=
""
_authorizations_map
=
""
for
_authz_url
in
$(
echo
"
$_authorizations_seg
"
|
tr
','
' '
)
;
do
for
_authz_url
in
$(
echo
"
$_authorizations_seg
"
|
tr
','
' '
)
;
do
...
@@ -4609,6 +4620,7 @@ issue() {
...
@@ -4609,6 +4620,7 @@ issue() {
_err
"get to authz error."
_err
"get to authz error."
_err
"_authorizations_seg"
"
$_authorizations_seg
"
_err
"_authorizations_seg"
"
$_authorizations_seg
"
_err
"_authz_url"
"
$_authz_url
"
_err
"_authz_url"
"
$_authz_url
"
_err
"
$response
"
_clearup
_clearup
_on_issue_err
"
$_post_hook
"
_on_issue_err
"
$_post_hook
"
return
1
return
1
...
@@ -4616,6 +4628,14 @@ issue() {
...
@@ -4616,6 +4628,14 @@ issue() {
response
=
"
$(
echo
"
$response
"
| _normalizeJson
)
"
response
=
"
$(
echo
"
$response
"
| _normalizeJson
)
"
_debug2 response
"
$response
"
_debug2 response
"
$response
"
if
echo
"
$response
"
|
grep
'"status":"invalid"'
>
/dev/null 2>&1
;
then
_err
"get authz objec with invalid status, please try again later."
_err
"_authorizations_seg"
"
$_authorizations_seg
"
_err
"
$response
"
_clearup
_on_issue_err
"
$_post_hook
"
return
1
fi
_d
=
"
$(
echo
"
$response
"
| _egrep_o
'"value" *: *"[^"]*"'
|
cut
-d
:
-f
2- |
tr
-d
' "'
)
"
_d
=
"
$(
echo
"
$response
"
| _egrep_o
'"value" *: *"[^"]*"'
|
cut
-d
:
-f
2- |
tr
-d
' "'
)
"
if
_contains
"
$response
"
"
\"
wildcard
\"
*: *true"
;
then
if
_contains
"
$response
"
"
\"
wildcard
\"
*: *true"
;
then
_d
=
"*.
$_d
"
_d
=
"*.
$_d
"
...
...
deploy/routeros.sh
View file @
160b2e95
...
@@ -137,7 +137,7 @@ routeros_deploy() {
...
@@ -137,7 +137,7 @@ routeros_deploy() {
return
$_err_code
return
$_err_code
fi
fi
DEPLOY_SCRIPT_CMD
=
"/system script add name=
\"
LE
Cert
Deploy
-
$_cdomain
\"
owner=
$ROUTER_OS_USERNAME
\
DEPLOY_SCRIPT_CMD
=
"/system script add name=
\"
LECertDeploy
-
$_cdomain
\"
owner=
$ROUTER_OS_USERNAME
\
comment=
\"
generated by routeros deploy script in acme.sh
\"
\
comment=
\"
generated by routeros deploy script in acme.sh
\"
\
source=
\"
/certificate remove [ find name=
$_cdomain
.cer_0 ];
\
source=
\"
/certificate remove [ find name=
$_cdomain
.cer_0 ];
\
\n
/certificate remove [ find name=
$_cdomain
.cer_1 ];
\
\n
/certificate remove [ find name=
$_cdomain
.cer_1 ];
\
...
@@ -158,11 +158,11 @@ source=\"/certificate remove [ find name=$_cdomain.cer_0 ];\
...
@@ -158,11 +158,11 @@ source=\"/certificate remove [ find name=$_cdomain.cer_0 ];\
return
$_err_code
return
$_err_code
fi
fi
if
!
_ssh_remote_cmd
"/system script run
\"
LE
Cert
Deploy
-
$_cdomain
\"
"
;
then
if
!
_ssh_remote_cmd
"/system script run
\"
LECertDeploy
-
$_cdomain
\"
"
;
then
return
$_err_code
return
$_err_code
fi
fi
if
!
_ssh_remote_cmd
"/system script remove
\"
LE
Cert
Deploy
-
$_cdomain
\"
"
;
then
if
!
_ssh_remote_cmd
"/system script remove
\"
LECertDeploy
-
$_cdomain
\"
"
;
then
return
$_err_code
return
$_err_code
fi
fi
...
...
deploy/synology_dsm.sh
View file @
160b2e95
...
@@ -223,7 +223,7 @@ synology_dsm_deploy() {
...
@@ -223,7 +223,7 @@ synology_dsm_deploy() {
#################### Private functions below ##################################
#################### Private functions below ##################################
_logout
()
{
_logout
()
{
# Logout to not occupy a permanent session, e.g. in DSM's "Connected Users" widget
# Logout
CERT user only
to not occupy a permanent session, e.g. in DSM's "Connected Users" widget
(based on previous variables)
response
=
$(
_get
"
$_base_url
/webapi/
entry.cgi
?api=SYNO.API.Auth&version=
$api_version
&method=logout"
)
response
=
$(
_get
"
$_base_url
/webapi/
$api_path
?api=SYNO.API.Auth&version=
$api_version
&method=logout
&_sid=
$sid
"
)
_debug3 response
"
$response
"
_debug3 response
"
$response
"
}
}
dnsapi/dns_do.sh
deleted
100755 → 0
View file @
afacdfcb
#!/usr/bin/env sh
# DNS API for Domain-Offensive / Resellerinterface / Domainrobot
# Report bugs at https://github.com/seidler2547/acme.sh/issues
# set these environment variables to match your customer ID and password:
# DO_PID="KD-1234567"
# DO_PW="cdfkjl3n2"
DO_URL
=
"https://soap.resellerinterface.de/"
######## Public functions #####################
#Usage: dns_myapi_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
dns_do_add
()
{
fulldomain
=
$1
txtvalue
=
$2
if
_dns_do_authenticate
;
then
_info
"Adding TXT record to
${
_domain
}
as
${
fulldomain
}
"
_dns_do_soap createRR origin
"
${
_domain
}
"
name
"
${
fulldomain
}
"
type
TXT data
"
${
txtvalue
}
"
ttl 300
if
_contains
"
${
response
}
"
'>success<'
;
then
return
0
fi
_err
"Could not create resource record, check logs"
fi
return
1
}
#fulldomain
dns_do_rm
()
{
fulldomain
=
$1
if
_dns_do_authenticate
;
then
if
_dns_do_list_rrs
;
then
_dns_do_had_error
=
0
for
_rrid
in
${
_rr_list
}
;
do
_info
"Deleting resource record
$_rrid
for
$_domain
"
_dns_do_soap deleteRR origin
"
${
_domain
}
"
rrid
"
${
_rrid
}
"
if
!
_contains
"
${
response
}
"
'>success<'
;
then
_dns_do_had_error
=
1
_err
"Could not delete resource record for
${
_domain
}
, id
${
_rrid
}
"
fi
done
return
$_dns_do_had_error
fi
fi
return
1
}
#################### Private functions below ##################################
_dns_do_authenticate
()
{
_info
"Authenticating as
${
DO_PID
}
"
_dns_do_soap authPartner partner
"
${
DO_PID
}
"
password
"
${
DO_PW
}
"
if
_contains
"
${
response
}
"
'>success<'
;
then
_get_root
"
$fulldomain
"
_debug
"_domain
$_domain
"
return
0
else
_err
"Authentication failed, are DO_PID and DO_PW set correctly?"
fi
return
1
}
_dns_do_list_rrs
()
{
_dns_do_soap getRRList origin
"
${
_domain
}
"
if
!
_contains
"
${
response
}
"
'SOAP-ENC:Array'
;
then
_err
"getRRList origin
${
_domain
}
failed"
return
1
fi
_rr_list
=
"
$(
echo
"
${
response
}
"
|
tr
-d
"
\n\r\t
"
|
sed
-e
's/<item xsi:type="ns2:Map">/\n/g'
|
grep
">
$(
_regexcape
"
$fulldomain
"
)
</value>"
|
sed
-e
's/<\/item>/\n/g'
|
grep
'>id</key><value'
|
_egrep_o
'>[0-9]{1,16}<'
|
tr
-d
'><'
)
"
[
"
${
_rr_list
}
"
]
}
_dns_do_soap
()
{
func
=
"
$1
"
shift
# put the parameters to xml
body
=
"<tns:
${
func
}
xmlns:tns=
\"
${
DO_URL
}
\"
>"
while
[
"
$1
"
]
;
do
_k
=
"
$1
"
shift
_v
=
"
$1
"
shift
body
=
"
$body
<
$_k
>
$_v
</
$_k
>"
done
body
=
"
$body
</tns:
${
func
}
>"
_debug2
"SOAP request
${
body
}
"
# build SOAP XML
_xml
=
'<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>'
"
$body
"
'</env:Body>
</env:Envelope>'
# set SOAP headers
export
_H1
=
"SOAPAction:
${
DO_URL
}
#
${
func
}
"
if
!
response
=
"
$(
_post
"
${
_xml
}
"
"
${
DO_URL
}
"
)
"
;
then
_err
"Error <
$1
>"
return
1
fi
_debug2
"SOAP response
$response
"
# retrieve cookie header
_H2
=
"
$(
_egrep_o
'Cookie: [^;]+'
<
"
$HTTP_HEADER
"
| _head_n 1
)
"
export
_H2
return
0
}
_get_root
()
{
domain
=
$1
i
=
1
_dns_do_soap getDomainList
_all_domains
=
"
$(
echo
"
${
response
}
"
|
tr
-d
"
\n\r\t
"
|
_egrep_o
'domain</key><value[^>]+>[^<]+'
|
sed
-e
's/^domain<\/key><value[^>]*>//g'
)
"
while
true
;
do
h
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
$i
-100
)
if
[
-z
"
$h
"
]
;
then
return
1
fi
if
_contains
"
${
_all_domains
}
"
"^
$(
_regexcape
"
$h
"
)
\$
"
;
then
_domain
=
"
$h
"
return
0
fi
i
=
$(
_math
$i
+ 1
)
done
_debug
"
$domain
not found"
return
1
}
_regexcape
()
{
echo
"
$1
"
|
sed
-e
's/\([]\.$*^[]\)/\\\1/g'
}
dnsapi/dns_gandi_livedns.sh
View file @
160b2e95
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
#
#
######## Public functions #####################
######## Public functions #####################
GANDI_LIVEDNS_API
=
"https://
dns.
api.gandi.net/
api/v5
"
GANDI_LIVEDNS_API
=
"https://api.gandi.net/
v5/livedns
"
#Usage: dns_gandi_livedns_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
#Usage: dns_gandi_livedns_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
dns_gandi_livedns_add
()
{
dns_gandi_livedns_add
()
{
...
@@ -78,7 +78,7 @@ dns_gandi_livedns_rm() {
...
@@ -78,7 +78,7 @@ dns_gandi_livedns_rm() {
_gandi_livedns_rest PUT
\
_gandi_livedns_rest PUT
\
"domains/
$_domain
/records/
$_sub_domain
/TXT"
\
"domains/
$_domain
/records/
$_sub_domain
/TXT"
\
"{
\"
rrset_ttl
\"
: 300,
\"
rrset_values
\"
:
$_new_rrset_values
}"
&&
"{
\"
rrset_ttl
\"
: 300,
\"
rrset_values
\"
:
$_new_rrset_values
}"
&&
_contains
"
$response
"
'{"message":
"DNS Record Created"}'
&&
_contains
"
$response
"
'{"message":"DNS Record Created"}'
&&
_info
"Removing record
$(
__green
"success"
)
"
_info
"Removing record
$(
__green
"success"
)
"
}
}
...
@@ -134,7 +134,7 @@ _dns_gandi_append_record() {
...
@@ -134,7 +134,7 @@ _dns_gandi_append_record() {
_debug new_rrset_values
"
$_rrset_values
"
_debug new_rrset_values
"
$_rrset_values
"
_gandi_livedns_rest PUT
"domains/
$_domain
/records/
$sub_domain
/TXT"
\
_gandi_livedns_rest PUT
"domains/
$_domain
/records/
$sub_domain
/TXT"
\
"{
\"
rrset_ttl
\"
: 300,
\"
rrset_values
\"
:
$_rrset_values
}"
&&
"{
\"
rrset_ttl
\"
: 300,
\"
rrset_values
\"
:
$_rrset_values
}"
&&
_contains
"
$response
"
'{"message":
"DNS Record Created"}'
&&
_contains
"
$response
"
'{"message":"DNS Record Created"}'
&&
_info
"Adding record
$(
__green
"success"
)
"
_info
"Adding record
$(
__green
"success"
)
"
}
}
...
@@ -144,11 +144,11 @@ _dns_gandi_existing_rrset_values() {
...
@@ -144,11 +144,11 @@ _dns_gandi_existing_rrset_values() {
if
!
_gandi_livedns_rest GET
"domains/
$domain
/records/
$sub_domain
"
;
then
if
!
_gandi_livedns_rest GET
"domains/
$domain
/records/
$sub_domain
"
;
then
return
1
return
1
fi
fi
if
!
_contains
"
$response
"
'"rrset_type":
"TXT"'
;
then
if
!
_contains
"
$response
"
'"rrset_type":"TXT"'
;
then
_debug
"Does not have a _acme-challenge TXT record yet."
_debug
"Does not have a _acme-challenge TXT record yet."
return
1
return
1
fi
fi
if
_contains
"
$response
"
'"rrset_values":
\[\]'
;
then
if
_contains
"
$response
"
'"rrset_values":\[\]'
;
then
_debug
"Empty rrset_values for TXT record, no previous TXT record."
_debug
"Empty rrset_values for TXT record, no previous TXT record."
return
1
return
1
fi
fi
...
@@ -169,7 +169,7 @@ _gandi_livedns_rest() {
...
@@ -169,7 +169,7 @@ _gandi_livedns_rest() {
if
[
-n
"
$GANDI_LIVEDNS_TOKEN
"
]
;
then
if
[
-n
"
$GANDI_LIVEDNS_TOKEN
"
]
;
then
export
_H2
=
"Authorization: Bearer
$GANDI_LIVEDNS_TOKEN
"
export
_H2
=
"Authorization: Bearer
$GANDI_LIVEDNS_TOKEN
"
else
else
export
_H2
=
"
X-
Api
-K
ey
:
$GANDI_LIVEDNS_KEY
"
export
_H2
=
"
Authorization:
Api
k
ey
$GANDI_LIVEDNS_KEY
"
fi
fi
if
[
"
$m
"
=
"GET"
]
;
then
if
[
"
$m
"
=
"GET"
]
;
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment