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
2cf72bad
Commit
2cf72bad
authored
May 10, 2022
by
AlvinSchiller
Browse files
domain lookup for DNS_MAP changed.
parent
c4df8090
Changes
1
Show whitespace changes
Inline
Side-by-side
dnsapi/dns_selfhost.sh
View file @
2cf72bad
...
@@ -4,11 +4,13 @@
...
@@ -4,11 +4,13 @@
# Report Bugs here: https://github.com/Marvo2011/acme.sh/issues/1
# Report Bugs here: https://github.com/Marvo2011/acme.sh/issues/1
# Last Edit: 17.02.2022
# Last Edit: 17.02.2022
DNS_CHALLENGE_PREFIX_ESCAPED
=
"_acme-challenge
\.
"
dns_selfhost_add
()
{
dns_selfhost_add
()
{
domain
=
$1
full
domain
=
$1
txt
=
$2
txt
=
$2
_info
"Calling acme-dns on selfhost"
_info
"Calling acme-dns on selfhost"
_debug fulldomain
"
$domain
"
_debug fulldomain
"
$
full
domain
"
_debug txtvalue
"
$txt
"
_debug txtvalue
"
$txt
"
SELFHOSTDNS_UPDATE_URL
=
"https://selfhost.de/cgi-bin/api.pl"
SELFHOSTDNS_UPDATE_URL
=
"https://selfhost.de/cgi-bin/api.pl"
...
@@ -31,7 +33,16 @@ dns_selfhost_add() {
...
@@ -31,7 +33,16 @@ dns_selfhost_add() {
SELFHOSTDNS_LAST_SLOT
=
1
SELFHOSTDNS_LAST_SLOT
=
1
fi
fi
rid
=
$(
echo
"
$SELFHOSTDNS_MAP
"
|
grep
-Eoi
"
$domain
:(
\d
+)"
|
tr
-d
"
$domain
:"
)
# cut DNS_CHALLENGE_PREFIX_ESCAPED from fulldomain if present at the beginning of the string
lookupdomain
=
$(
echo
"
$fulldomain
"
|
sed
"s/^
$DNS_CHALLENGE_PREFIX_ESCAPED
//"
)
_debug lookupdomain
"
$lookupdomain
"
# get the RID for lookupdomain or fulldomain from SELFHOSTDNS_MAP
# only match full domains (at the beginning of the string or with a leading whitespace),
# e.g. don't match mytest.example.com or sub.test.example.com for test.example.com
# replace the whole string with the RID (matching group 3) for assignment
# if the domain is defined multiple times only the last occurance will be matched
rid
=
$(
echo
"
$SELFHOSTDNS_MAP
"
|
sed
-n
"s/
\(
^
\|
^.*
\s\)\(
$lookupdomain
:
\|
$fulldomain
:
\)\(
[0-9][0-9]*
\)\(
.*
\)
/
\3
/Ip"
)
if
test
-z
"
$rid
"
;
then
if
test
-z
"
$rid
"
;
then
if
[
$SELFHOSTDNS_LAST_SLOT
=
"2"
]
;
then
if
[
$SELFHOSTDNS_LAST_SLOT
=
"2"
]
;
then
...
@@ -69,9 +80,9 @@ dns_selfhost_add() {
...
@@ -69,9 +80,9 @@ dns_selfhost_add() {
}
}
dns_selfhost_rm
()
{
dns_selfhost_rm
()
{
domain
=
$1
full
domain
=
$1
txt
=
$2
txt
=
$2
_debug fulldomain
"
$domain
"
_debug fulldomain
"
$
full
domain
"
_debug txtvalue
"
$txt
"
_debug txtvalue
"
$txt
"
_info
"Creating and removing of records is not supported by selfhost API, will not delete anything."
_info
"Creating and removing of records is not supported by selfhost API, will not delete anything."
}
}
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