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
d670ea4f
Unverified
Commit
d670ea4f
authored
Apr 07, 2018
by
neil
Committed by
GitHub
Apr 07, 2018
Browse files
Merge pull request #1497 from Neilpang/dev
sync
parents
09fed60d
d0d10bc6
Changes
4
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
d670ea4f
...
...
@@ -318,6 +318,7 @@ You don't have to do anything manually!
1.
KingHost (https://www.kinghost.com.br/)
1.
Zilore (https://zilore.com)
1.
Loopia.se API
1.
acme-dns (https://github.com/joohoi/acme-dns)
And:
...
...
dnsapi/README.md
View file @
d670ea4f
...
...
@@ -835,6 +835,22 @@ acme.sh --issue --dns dns_loopia -d example.com -d *.example.com
```
The username and password will be saved in
`~/.acme.sh/account.conf`
and will be reused when needed.
## 45. Use ACME DNS API
ACME DNS is a limited DNS server with RESTful HTTP API to handle ACME DNS challenges easily and securely.
https://github.com/joohoi/acme-dns
```
export ACMEDNS_UPDATE_URL="https://auth.acme-dns.io/update"
export ACMEDNS_USERNAME="<username>"
export ACMEDNS_PASSWORD="<password>"
export ACMEDNS_SUBDOMAIN="<subdomain>"
acme.sh --issue --dns dns_acmedns -d example.com -d www.example.com
```
The credentials will be saved in
`~/.acme.sh/account.conf`
and will
be reused when needed.
# Use custom API
...
...
dnsapi/dns_acmedns.sh
0 → 100644
View file @
d670ea4f
#!/usr/bin/env sh
#
#Author: Wolfgang Ebner
#Report Bugs here: https://github.com/webner/acme.sh
#
######## Public functions #####################
#Usage: dns_acmedns_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
dns_acmedns_add
()
{
fulldomain
=
$1
txtvalue
=
$2
_info
"Using acme-dns"
_debug fulldomain
"
$fulldomain
"
_debug txtvalue
"
$txtvalue
"
ACMEDNS_UPDATE_URL
=
"
${
ACMEDNS_UPDATE_URL
:-
$(
_readaccountconf_mutable ACMEDNS_UPDATE_URL
)
}
"
ACMEDNS_USERNAME
=
"
${
ACMEDNS_USERNAME
:-
$(
_readaccountconf_mutable ACMEDNS_USERNAME
)
}
"
ACMEDNS_PASSWORD
=
"
${
ACMEDNS_PASSWORD
:-
$(
_readaccountconf_mutable ACMEDNS_PASSWORD
)
}
"
ACMEDNS_SUBDOMAIN
=
"
${
ACMEDNS_SUBDOMAIN
:-
$(
_readaccountconf_mutable ACMEDNS_SUBDOMAIN
)
}
"
if
[
"
$ACMEDNS_UPDATE_URL
"
=
""
]
;
then
ACMEDNS_UPDATE_URL
=
"https://auth.acme-dns.io/update"
fi
_saveaccountconf_mutable ACMEDNS_UPDATE_URL
"
$ACMEDNS_UPDATE_URL
"
_saveaccountconf_mutable ACMEDNS_USERNAME
"
$ACMEDNS_USERNAME
"
_saveaccountconf_mutable ACMEDNS_PASSWORD
"
$ACMEDNS_PASSWORD
"
_saveaccountconf_mutable ACMEDNS_SUBDOMAIN
"
$ACMEDNS_SUBDOMAIN
"
export
_H1
=
"X-Api-User:
$ACMEDNS_USERNAME
"
export
_H2
=
"X-Api-Key:
$ACMEDNS_PASSWORD
"
data
=
"{
\"
subdomain
\"
:
\"
$ACMEDNS_SUBDOMAIN
\"
,
\"
txt
\"
:
\"
$txtvalue
\"
}"
_debug data
"
$data
"
response
=
"
$(
_post
"
$data
"
"
$ACMEDNS_UPDATE_URL
"
""
"POST"
)
"
_debug response
"
$response
"
if
!
echo
"
$response
"
|
grep
"
\"
$txtvalue
\"
"
>
/dev/null
;
then
_err
"invalid response of acme-dns"
return
1
fi
}
#Usage: fulldomain txtvalue
#Remove the txt record after validation.
dns_acmedns_rm
()
{
fulldomain
=
$1
txtvalue
=
$2
_info
"Using acme-dns"
_debug fulldomain
"
$fulldomain
"
_debug txtvalue
"
$txtvalue
"
}
#################### Private functions below ##################################
dnsapi/dns_nsupdate.sh
View file @
d670ea4f
...
...
@@ -8,12 +8,14 @@ dns_nsupdate_add() {
txtvalue
=
$2
_checkKeyFile
||
return
1
[
-n
"
${
NSUPDATE_SERVER
}
"
]
||
NSUPDATE_SERVER
=
"localhost"
[
-n
"
${
NSUPDATE_SERVER_PORT
}
"
]
||
NSUPDATE_SERVER_PORT
=
53
# save the dns server and key to the account conf file.
_saveaccountconf NSUPDATE_SERVER
"
${
NSUPDATE_SERVER
}
"
_saveaccountconf NSUPDATE_SERVER_PORT
"
${
NSUPDATE_SERVER_PORT
}
"
_saveaccountconf NSUPDATE_KEY
"
${
NSUPDATE_KEY
}
"
_info
"adding
${
fulldomain
}
. 60 in txt
\"
${
txtvalue
}
\"
"
nsupdate
-k
"
${
NSUPDATE_KEY
}
"
<<
EOF
server
${
NSUPDATE_SERVER
}
server
${
NSUPDATE_SERVER
}
${
NSUPDATE_SERVER_PORT
}
update add
${
fulldomain
}
. 60 in txt "
${
txtvalue
}
"
send
EOF
...
...
@@ -30,9 +32,10 @@ dns_nsupdate_rm() {
fulldomain
=
$1
_checkKeyFile
||
return
1
[
-n
"
${
NSUPDATE_SERVER
}
"
]
||
NSUPDATE_SERVER
=
"localhost"
[
-n
"
${
NSUPDATE_SERVER_PORT
}
"
]
||
NSUPDATE_SERVER_PORT
=
53
_info
"removing
${
fulldomain
}
. txt"
nsupdate
-k
"
${
NSUPDATE_KEY
}
"
<<
EOF
server
${
NSUPDATE_SERVER
}
server
${
NSUPDATE_SERVER
}
${
NSUPDATE_SERVER_PORT
}
update delete
${
fulldomain
}
. txt
send
EOF
...
...
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