Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
b6508ccc
Unverified
Commit
b6508ccc
authored
Aug 17, 2020
by
neil
Committed by
GitHub
Aug 17, 2020
Browse files
Merge pull request #3108 from acmesh-official/ga
support Github Actions
parents
d5d38b33
d9e7cf65
Changes
29
Expand all
Hide whitespace changes
Inline
Side-by-side
.github/workflows/ci.yml
0 → 100644
View file @
b6508ccc
name
:
CI
on
:
[
push
,
pull_request
]
jobs
:
formatCheck
:
runs-on
:
ubuntu-latest
steps
:
-
uses
:
actions/checkout@v2
-
name
:
Install Shellcheck
run
:
sudo apt-get install -y shellcheck
-
name
:
DoShellcheck
run
:
shellcheck -V && shellcheck -e SC2181 **/*.sh && echo "shellcheck OK"
-
name
:
Install shfmt
run
:
curl -sSL https://github.com/mvdan/sh/releases/download/v3.1.2/shfmt_v3.1.2_linux_amd64 -o ~/shfmt && chmod +x ~/shfmt
-
name
:
shfmt
run
:
~/shfmt -l -w -i 2 . ; git diff --exit-code && echo "shfmt OK"
acme.sh
View file @
b6508ccc
This diff is collapsed.
Click to expand it.
deploy/exim4.sh
View file @
b6508ccc
...
...
@@ -69,8 +69,8 @@ exim4_deploy() {
cp
"
$_exim4_conf
"
"
$_backup_conf
"
_info
"Modify exim4 conf:
$_exim4_conf
"
if
_setopt
"
$_exim4_conf
"
"tls_certificate"
"="
"
$_real_fullchain
"
\
&&
_setopt
"
$_exim4_conf
"
"tls_privatekey"
"="
"
$_real_key
"
;
then
if
_setopt
"
$_exim4_conf
"
"tls_certificate"
"="
"
$_real_fullchain
"
&&
_setopt
"
$_exim4_conf
"
"tls_privatekey"
"="
"
$_real_key
"
;
then
_info
"Set config success!"
else
_err
"Config exim4 server error, please report bug to us."
...
...
deploy/ssh.sh
View file @
b6508ccc
...
...
@@ -195,8 +195,8 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d
fi
if
[
-n
"
$Le_Deploy_ssh_cafile
"
]
;
then
_pipe
=
">"
if
[
"
$Le_Deploy_ssh_cafile
"
=
"
$Le_Deploy_ssh_keyfile
"
]
\
||
[
"
$Le_Deploy_ssh_cafile
"
=
"
$Le_Deploy_ssh_certfile
"
]
;
then
if
[
"
$Le_Deploy_ssh_cafile
"
=
"
$Le_Deploy_ssh_keyfile
"
]
||
[
"
$Le_Deploy_ssh_cafile
"
=
"
$Le_Deploy_ssh_certfile
"
]
;
then
# if filename is same as previous file then append.
_pipe
=
">>"
elif
[
"
$Le_Deploy_ssh_backup
"
=
"yes"
]
;
then
...
...
@@ -222,9 +222,9 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d
fi
if
[
-n
"
$Le_Deploy_ssh_fullchain
"
]
;
then
_pipe
=
">"
if
[
"
$Le_Deploy_ssh_fullchain
"
=
"
$Le_Deploy_ssh_keyfile
"
]
\
||
[
"
$Le_Deploy_ssh_fullchain
"
=
"
$Le_Deploy_ssh_certfile
"
]
\
||
[
"
$Le_Deploy_ssh_fullchain
"
=
"
$Le_Deploy_ssh_cafile
"
]
;
then
if
[
"
$Le_Deploy_ssh_fullchain
"
=
"
$Le_Deploy_ssh_keyfile
"
]
||
[
"
$Le_Deploy_ssh_fullchain
"
=
"
$Le_Deploy_ssh_certfile
"
]
||
[
"
$Le_Deploy_ssh_fullchain
"
=
"
$Le_Deploy_ssh_cafile
"
]
;
then
# if filename is same as previous file then append.
_pipe
=
">>"
elif
[
"
$Le_Deploy_ssh_backup
"
=
"yes"
]
;
then
...
...
deploy/vsftpd.sh
View file @
b6508ccc
...
...
@@ -65,9 +65,9 @@ vsftpd_deploy() {
cp
"
$_vsftpd_conf
"
"
$_backup_conf
"
_info
"Modify vsftpd conf:
$_vsftpd_conf
"
if
_setopt
"
$_vsftpd_conf
"
"rsa_cert_file"
"="
"
$_real_fullchain
"
\
&&
_setopt
"
$_vsftpd_conf
"
"rsa_private_key_file"
"="
"
$_real_key
"
\
&&
_setopt
"
$_vsftpd_conf
"
"ssl_enable"
"="
"YES"
;
then
if
_setopt
"
$_vsftpd_conf
"
"rsa_cert_file"
"="
"
$_real_fullchain
"
&&
_setopt
"
$_vsftpd_conf
"
"rsa_private_key_file"
"="
"
$_real_key
"
&&
_setopt
"
$_vsftpd_conf
"
"ssl_enable"
"="
"YES"
;
then
_info
"Set config success!"
else
_err
"Config vsftpd server error, please report bug to us."
...
...
dnsapi/dns_arvan.sh
View file @
b6508ccc
...
...
@@ -5,7 +5,7 @@
ARVAN_API_URL
=
"https://napi.arvancloud.com/cdn/4.0/domains"
#Author: Ehsan Aliakbar
#Report Bugs here: https://github.com/Neilpang/acme.sh
#Report Bugs here: https://github.com/Neilpang/acme.sh
#
######## Public functions #####################
...
...
dnsapi/dns_aws.sh
View file @
b6508ccc
...
...
@@ -222,21 +222,21 @@ _use_instance_role() {
_use_metadata
()
{
_aws_creds
=
"
$(
_get
"
$1
"
""
1
\
|
_normalizeJson
\
|
tr
'{,}'
'\n'
\
|
while
read
-r
_line
;
do
_get
"
$1
"
""
1
|
_normalizeJson
|
tr
'{,}'
'\n'
|
while
read
-r
_line
;
do
_key
=
"
$(
echo
"
${
_line
%%
:
*
}
"
|
tr
-d
'"'
)
"
_value
=
"
${
_line
#*
:
}
"
_debug3
"_key"
"
$_key
"
_secure_debug3
"_value"
"
$_value
"
case
"
$_key
"
in
AccessKeyId
)
echo
"AWS_ACCESS_KEY_ID=
$_value
"
;;
SecretAccessKey
)
echo
"AWS_SECRET_ACCESS_KEY=
$_value
"
;;
Token
)
echo
"AWS_SESSION_TOKEN=
$_value
"
;;
AccessKeyId
)
echo
"AWS_ACCESS_KEY_ID=
$_value
"
;;
SecretAccessKey
)
echo
"AWS_SECRET_ACCESS_KEY=
$_value
"
;;
Token
)
echo
"AWS_SESSION_TOKEN=
$_value
"
;;
esac
done
\
|
paste
-sd
' '
-
done
|
paste
-sd
' '
-
)
"
_secure_debug
"_aws_creds"
"
$_aws_creds
"
...
...
dnsapi/dns_azure.sh
View file @
b6508ccc
...
...
@@ -220,7 +220,7 @@ _azure_rest() {
export
_H2
=
"accept: application/json"
export
_H3
=
"Content-Type: application/json"
# clear headers from previous request to avoid getting wrong http code on timeouts
:>
"
$HTTP_HEADER
"
:
>
"
$HTTP_HEADER
"
_debug
"
$ep
"
if
[
"
$m
"
!=
"GET"
]
;
then
_secure_debug2
"data
$data
"
...
...
dnsapi/dns_conoha.sh
View file @
b6508ccc
...
...
@@ -115,9 +115,9 @@ dns_conoha_rm() {
return
1
fi
record_id
=
$(
printf
"%s"
"
$response
"
| _egrep_o
'{[^}]*}'
\
|
grep
'"type":"TXT"'
|
grep
"
\"
data
\"
:
\"
$txtvalue
\"
"
| _egrep_o
"
\"
id
\"
:
\"
[^
\"
]*
\"
"
\
|
_head_n 1 |
cut
-d
:
-f
2 |
tr
-d
\"
)
record_id
=
$(
printf
"%s"
"
$response
"
| _egrep_o
'{[^}]*}'
|
grep
'"type":"TXT"'
|
grep
"
\"
data
\"
:
\"
$txtvalue
\"
"
| _egrep_o
"
\"
id
\"
:
\"
[^
\"
]*
\"
"
|
_head_n 1 |
cut
-d
:
-f
2 |
tr
-d
\"
)
if
[
-z
"
$record_id
"
]
;
then
_err
"Can not get record id to remove."
return
1
...
...
dnsapi/dns_cyon.sh
View file @
b6508ccc
...
...
@@ -18,23 +18,23 @@
########
dns_cyon_add
()
{
_cyon_load_credentials
\
&&
_cyon_load_parameters
"
$@
"
\
&&
_cyon_print_header
"add"
\
&&
_cyon_login
\
&&
_cyon_change_domain_env
\
&&
_cyon_add_txt
\
&&
_cyon_logout
_cyon_load_credentials
&&
_cyon_load_parameters
"
$@
"
&&
_cyon_print_header
"add"
&&
_cyon_login
&&
_cyon_change_domain_env
&&
_cyon_add_txt
&&
_cyon_logout
}
dns_cyon_rm
()
{
_cyon_load_credentials
\
&&
_cyon_load_parameters
"
$@
"
\
&&
_cyon_print_header
"delete"
\
&&
_cyon_login
\
&&
_cyon_change_domain_env
\
&&
_cyon_delete_txt
\
&&
_cyon_logout
_cyon_load_credentials
&&
_cyon_load_parameters
"
$@
"
&&
_cyon_print_header
"delete"
&&
_cyon_login
&&
_cyon_change_domain_env
&&
_cyon_delete_txt
&&
_cyon_logout
}
#########################
...
...
dnsapi/dns_da.sh
View file @
b6508ccc
...
...
@@ -115,23 +115,23 @@ _da_api() {
_debug response
"
$response
"
case
"
${
cmd
}
"
in
CMD_API_DNS_CONTROL
)
# Parse the result in general
# error=0&text=Records Deleted&details=
# error=1&text=Cannot View Dns Record&details=No domain provided
err_field
=
"
$(
_getfield
"
$response
"
1
'&'
)
"
txt_field
=
"
$(
_getfield
"
$response
"
2
'&'
)
"
details_field
=
"
$(
_getfield
"
$response
"
3
'&'
)
"
error
=
"
$(
_getfield
"
$err_field
"
2
'='
)
"
text
=
"
$(
_getfield
"
$txt_field
"
2
'='
)
"
details
=
"
$(
_getfield
"
$details_field
"
2
'='
)
"
_debug
"error:
${
error
}
, text:
${
text
}
, details:
${
details
}
"
if
[
"
$error
"
!=
"0"
]
;
then
_err
"error
$response
"
return
1
fi
;;
CMD_API_SHOW_DOMAINS
)
;;
CMD_API_DNS_CONTROL
)
# Parse the result in general
# error=0&text=Records Deleted&details=
# error=1&text=Cannot View Dns Record&details=No domain provided
err_field
=
"
$(
_getfield
"
$response
"
1
'&'
)
"
txt_field
=
"
$(
_getfield
"
$response
"
2
'&'
)
"
details_field
=
"
$(
_getfield
"
$response
"
3
'&'
)
"
error
=
"
$(
_getfield
"
$err_field
"
2
'='
)
"
text
=
"
$(
_getfield
"
$txt_field
"
2
'='
)
"
details
=
"
$(
_getfield
"
$details_field
"
2
'='
)
"
_debug
"error:
${
error
}
, text:
${
text
}
, details:
${
details
}
"
if
[
"
$error
"
!=
"0"
]
;
then
_err
"error
$response
"
return
1
fi
;;
CMD_API_SHOW_DOMAINS
)
;;
esac
return
0
}
...
...
dnsapi/dns_do.sh
View file @
b6508ccc
...
...
@@ -67,14 +67,14 @@ _dns_do_list_rrs() {
_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
=
"
$(
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
}
"
]
}
...
...
@@ -120,10 +120,10 @@ _get_root() {
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'
)
"
_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
)
...
...
dnsapi/dns_easydns.sh
View file @
b6508ccc
...
...
@@ -3,7 +3,7 @@
#######################################################
#
# easyDNS REST API for acme.sh by Neilpang based on dns_cf.sh
#
#
# API Documentation: https://sandbox.rest.easydns.net:3001/
#
# Author: wurzelpanzer [wurzelpanzer@maximolider.net]
...
...
dnsapi/dns_freedns.sh
View file @
b6508ccc
...
...
@@ -303,10 +303,10 @@ _freedns_domain_id() {
return
1
fi
domain_id
=
"
$(
echo
"
$htmlpage
"
|
tr
-d
"
\t\r\n\v\f
"
|
sed
's/<tr>/@<tr>/g'
|
tr
'@'
'\n'
\
|
grep
"<td>
$search_domain
</td>
\|
<td>
$search_domain
(.*)</td>"
\
|
sed
-n
's/.*\(edit\.php?edit_domain_id=[0-9a-zA-Z]*\).*/\1/p'
\
|
cut
-d
=
-f
2
)
"
domain_id
=
"
$(
echo
"
$htmlpage
"
|
tr
-d
"
\t\r\n\v\f
"
|
sed
's/<tr>/@<tr>/g'
|
tr
'@'
'\n'
|
grep
"<td>
$search_domain
</td>
\|
<td>
$search_domain
(.*)</td>"
|
sed
-n
's/.*\(edit\.php?edit_domain_id=[0-9a-zA-Z]*\).*/\1/p'
|
cut
-d
=
-f
2
)
"
# The above beauty extracts domain ID from the html page...
# strip out all blank space and new lines. Then insert newlines
# before each table row <tr>
...
...
@@ -349,11 +349,11 @@ _freedns_data_id() {
return
1
fi
data_id
=
"
$(
echo
"
$htmlpage
"
|
tr
-d
"
\t\r\n\v\f
"
|
sed
's/<tr>/@<tr>/g'
|
tr
'@'
'\n'
\
|
grep
"<td[a-zA-Z=#]*>
$record_type
</td>"
\
|
grep
"<ahref.*>
$search_domain
</a>"
\
|
sed
-n
's/.*\(edit\.php?data_id=[0-9a-zA-Z]*\).*/\1/p'
\
|
cut
-d
=
-f
2
)
"
data_id
=
"
$(
echo
"
$htmlpage
"
|
tr
-d
"
\t\r\n\v\f
"
|
sed
's/<tr>/@<tr>/g'
|
tr
'@'
'\n'
|
grep
"<td[a-zA-Z=#]*>
$record_type
</td>"
|
grep
"<ahref.*>
$search_domain
</a>"
|
sed
-n
's/.*\(edit\.php?data_id=[0-9a-zA-Z]*\).*/\1/p'
|
cut
-d
=
-f
2
)
"
# The above beauty extracts data ID from the html page...
# strip out all blank space and new lines. Then insert newlines
# before each table row <tr>
...
...
dnsapi/dns_gandi_livedns.sh
View file @
b6508ccc
...
...
@@ -69,9 +69,9 @@ dns_gandi_livedns_rm() {
_gandi_livedns_rest PUT
\
"domains/
$_domain
/records/
$_sub_domain
/TXT"
\
"{
\"
rrset_ttl
\"
: 300,
\"
rrset_values
\"
:
$_new_rrset_values
}"
\
&&
_contains
"
$response
"
'{"message": "DNS Record Created"}'
\
&&
_info
"Removing record
$(
__green
"success"
)
"
"{
\"
rrset_ttl
\"
: 300,
\"
rrset_values
\"
:
$_new_rrset_values
}"
&&
_contains
"
$response
"
'{"message": "DNS Record Created"}'
&&
_info
"Removing record
$(
__green
"success"
)
"
}
#################### Private functions below ##################################
...
...
@@ -125,9 +125,9 @@ _dns_gandi_append_record() {
fi
_debug new_rrset_values
"
$_rrset_values
"
_gandi_livedns_rest PUT
"domains/
$_domain
/records/
$sub_domain
/TXT"
\
"{
\"
rrset_ttl
\"
: 300,
\"
rrset_values
\"
:
$_rrset_values
}"
\
&&
_contains
"
$response
"
'{"message": "DNS Record Created"}'
\
&&
_info
"Adding record
$(
__green
"success"
)
"
"{
\"
rrset_ttl
\"
: 300,
\"
rrset_values
\"
:
$_rrset_values
}"
&&
_contains
"
$response
"
'{"message": "DNS Record Created"}'
&&
_info
"Adding record
$(
__green
"success"
)
"
}
_dns_gandi_existing_rrset_values
()
{
...
...
@@ -145,8 +145,8 @@ _dns_gandi_existing_rrset_values() {
return
1
fi
_debug
"Already has TXT record."
_rrset_values
=
$(
echo
"
$response
"
| _egrep_o
'rrset_values.*\[.*\]'
\
|
_egrep_o
'\[".*\"]'
)
_rrset_values
=
$(
echo
"
$response
"
| _egrep_o
'rrset_values.*\[.*\]'
|
_egrep_o
'\[".*\"]'
)
return
0
}
...
...
dnsapi/dns_gcloud.sh
View file @
b6508ccc
...
...
@@ -78,8 +78,8 @@ _dns_gcloud_execute_tr() {
for
i
in
$(
seq
1 120
)
;
do
if
gcloud dns record-sets changes list
\
--zone
=
"
$managedZone
"
\
--filter
=
'status != done'
\
|
grep
-q
'^.*'
;
then
--filter
=
'status != done'
|
grep
-q
'^.*'
;
then
_info
"_dns_gcloud_execute_tr: waiting for transaction to be comitted (
$i
/120)..."
sleep
5
else
...
...
@@ -137,11 +137,11 @@ _dns_gcloud_find_zone() {
# List domains and find the zone with the deepest sub-domain (in case of some levels of delegation)
if
!
match
=
$(
gcloud dns managed-zones list
\
--format
=
"value(name, dnsName)"
\
--filter
=
"
$filter
"
\
|
while
read
-r
dnsName name
;
do
--filter
=
"
$filter
"
|
while
read
-r
dnsName name
;
do
printf
"%s
\t
%s
\t
%s
\n
"
"
$(
echo
"
$name
"
|
awk
-F
"."
'{print NF-1}'
)
"
"
$dnsName
"
"
$name
"
done
\
|
sort
-n
-r
| _head_n 1 |
cut
-f2
,3 |
grep
'^.*'
)
;
then
done
|
sort
-n
-r
| _head_n 1 |
cut
-f2
,3 |
grep
'^.*'
)
;
then
_err
"_dns_gcloud_find_zone: Can't find a matching managed zone! Perhaps wrong project or gcloud credentials?"
return
1
fi
...
...
dnsapi/dns_he.sh
View file @
b6508ccc
...
...
@@ -101,8 +101,8 @@ dns_he_rm() {
body
=
"
$body
&hosted_dns_editzone=1"
body
=
"
$body
&hosted_dns_delrecord=1"
body
=
"
$body
&hosted_dns_delconfirm=delete"
_post
"
$body
"
"https://dns.he.net/"
\
|
grep
'<div id="dns_status" onClick="hideThis(this);">Successfully removed record.</div>'
\
_post
"
$body
"
"https://dns.he.net/"
|
grep
'<div id="dns_status" onClick="hideThis(this);">Successfully removed record.</div>'
\
>
/dev/null
exit_code
=
"
$?
"
if
[
"
$exit_code
"
-eq
0
]
;
then
...
...
dnsapi/dns_hetzner.sh
View file @
b6508ccc
...
...
@@ -123,10 +123,10 @@ _find_record() {
return
1
else
_record_id
=
$(
echo
"
$response
"
\
|
grep
-o
"{[^
\{\}
]*
\"
name
\"
:
\"
$_record_name
\"
[^
\}
]*}"
\
|
grep
"
\"
value
\"
:
\"
$_record_value
\"
"
\
|
while
read
-r
record
;
do
echo
"
$response
"
|
grep
-o
"{[^
\{\}
]*
\"
name
\"
:
\"
$_record_name
\"
[^
\}
]*}"
|
grep
"
\"
value
\"
:
\"
$_record_value
\"
"
|
while
read
-r
record
;
do
# test for type and
if
[
-n
"
$(
echo
"
$record
"
| _egrep_o
'"type":"TXT"'
)
"
]
;
then
echo
"
$record
"
| _egrep_o
'"id":"[^"]*"'
|
cut
-d
:
-f
2 |
tr
-d
\"
...
...
dnsapi/dns_ispconfig.sh
View file @
b6508ccc
...
...
@@ -95,29 +95,29 @@ _ISPC_getZoneInfo() {
server_id
=
$(
echo
"
${
curResult
}
"
| _egrep_o
"server_id.*"
|
cut
-d
':'
-f
2 |
cut
-d
'"'
-f
2
)
_debug
"Server ID: '
${
server_id
}
'"
case
"
${
server_id
}
"
in
''
|
*
[!
0-9]
*
)
_err
"Server ID is not numeric."
return
1
;;
*
)
_info
"Retrieved Server ID"
;;
''
|
*
[!
0-9]
*
)
_err
"Server ID is not numeric."
return
1
;;
*
)
_info
"Retrieved Server ID"
;;
esac
zone
=
$(
echo
"
${
curResult
}
"
| _egrep_o
"
\"
id.*"
|
cut
-d
':'
-f
2 |
cut
-d
'"'
-f
2
)
_debug
"Zone: '
${
zone
}
'"
case
"
${
zone
}
"
in
''
|
*
[!
0-9]
*
)
_err
"Zone ID is not numeric."
return
1
;;
*
)
_info
"Retrieved Zone ID"
;;
''
|
*
[!
0-9]
*
)
_err
"Zone ID is not numeric."
return
1
;;
*
)
_info
"Retrieved Zone ID"
;;
esac
client_id
=
$(
echo
"
${
curResult
}
"
| _egrep_o
"sys_userid.*"
|
cut
-d
':'
-f
2 |
cut
-d
'"'
-f
2
)
_debug
"Client ID: '
${
client_id
}
'"
case
"
${
client_id
}
"
in
''
|
*
[!
0-9]
*
)
_err
"Client ID is not numeric."
return
1
;;
*
)
_info
"Retrieved Client ID."
;;
''
|
*
[!
0-9]
*
)
_err
"Client ID is not numeric."
return
1
;;
*
)
_info
"Retrieved Client ID."
;;
esac
zoneFound
=
""
zoneEnd
=
""
...
...
@@ -135,11 +135,11 @@ _ISPC_addTxt() {
record_id
=
$(
echo
"
${
curResult
}
"
| _egrep_o
"
\"
response.*"
|
cut
-d
':'
-f
2 |
cut
-d
'"'
-f
2
)
_debug
"Record ID: '
${
record_id
}
'"
case
"
${
record_id
}
"
in
''
|
*
[!
0-9]
*
)
_err
"Couldn't add ACME Challenge TXT record to zone."
return
1
;;
*
)
_info
"Added ACME Challenge TXT record to zone."
;;
''
|
*
[!
0-9]
*
)
_err
"Couldn't add ACME Challenge TXT record to zone."
return
1
;;
*
)
_info
"Added ACME Challenge TXT record to zone."
;;
esac
}
...
...
@@ -153,24 +153,24 @@ _ISPC_rmTxt() {
record_id
=
$(
echo
"
${
curResult
}
"
| _egrep_o
"
\"
id.*"
|
cut
-d
':'
-f
2 |
cut
-d
'"'
-f
2
)
_debug
"Record ID: '
${
record_id
}
'"
case
"
${
record_id
}
"
in
''
|
*
[!
0-9]
*
)
_err
"Record ID is not numeric."
''
|
*
[!
0-9]
*
)
_err
"Record ID is not numeric."
return
1
;;
*
)
unset
IFS
_info
"Retrieved Record ID."
curData
=
"{
\"
session_id
\"
:
\"
${
sessionID
}
\"
,
\"
primary_id
\"
:
\"
${
record_id
}
\"
,
\"
update_serial
\"
:true}"
curResult
=
"
$(
_post
"
${
curData
}
"
"
${
ISPC_Api
}
?dns_txt_delete"
)
"
_debug
"Calling _ISPC_rmTxt: '
${
curData
}
' '
${
ISPC_Api
}
?dns_txt_delete'"
_debug
"Result of _ISPC_rmTxt: '
$curResult
'"
if
_contains
"
${
curResult
}
"
'"code":"ok"'
;
then
_info
"Removed ACME Challenge TXT record from zone."
else
_err
"Couldn't remove ACME Challenge TXT record from zone."
return
1
;;
*
)
unset
IFS
_info
"Retrieved Record ID."
curData
=
"{
\"
session_id
\"
:
\"
${
sessionID
}
\"
,
\"
primary_id
\"
:
\"
${
record_id
}
\"
,
\"
update_serial
\"
:true}"
curResult
=
"
$(
_post
"
${
curData
}
"
"
${
ISPC_Api
}
?dns_txt_delete"
)
"
_debug
"Calling _ISPC_rmTxt: '
${
curData
}
' '
${
ISPC_Api
}
?dns_txt_delete'"
_debug
"Result of _ISPC_rmTxt: '
$curResult
'"
if
_contains
"
${
curResult
}
"
'"code":"ok"'
;
then
_info
"Removed ACME Challenge TXT record from zone."
else
_err
"Couldn't remove ACME Challenge TXT record from zone."
return
1
fi
;;
fi
;;
esac
fi
}
dnsapi/dns_joker.sh
View file @
b6508ccc
...
...
@@ -100,7 +100,7 @@ _get_root() {
fi
# Try to remove a test record. With correct root domain, username and password this will return "OK: ..." regardless
# of record in question existing or not.
# of record in question existing or not.
if
_joker_rest
"username=
$JOKER_USERNAME
&password=
$JOKER_PASSWORD
&zone=
$h
&label=jokerTXTUpdateTest&type=TXT&value="
;
then
if
_startswith
"
$response
"
"OK"
;
then
_sub_domain
=
"
$(
echo
"
$fulldomain
"
|
sed
"s/
\\
.
$h
\$
//"
)
"
...
...
Prev
1
2
Next
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