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
d1b197e3
Commit
d1b197e3
authored
Mar 28, 2018
by
Habetdin
Browse files
Merge branch 'patch-1' into dev
parents
e32c2b84
ce9c2274
Changes
6
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
d1b197e3
...
@@ -315,6 +315,7 @@ You don't have to do anything manually!
...
@@ -315,6 +315,7 @@ You don't have to do anything manually!
1.
zonomi.com DNS API
1.
zonomi.com DNS API
1.
DreamHost.com API
1.
DreamHost.com API
1.
DirectAdmin API
1.
DirectAdmin API
1.
KingHost (https://www.kinghost.com.br/)
And:
And:
...
...
dnsapi/README.md
View file @
d1b197e3
...
@@ -787,6 +787,32 @@ acme.sh --issue --dns dns_da -d example.com -d www.example.com
...
@@ -787,6 +787,32 @@ acme.sh --issue --dns dns_da -d example.com -d www.example.com
The
`DA_Api`
and
`DA_Api_Insecure`
will be saved in
`~/.acme.sh/account.conf`
and will be reused when needed.
The
`DA_Api`
and
`DA_Api_Insecure`
will be saved in
`~/.acme.sh/account.conf`
and will be reused when needed.
## 42. Use KingHost DNS API
API access must be enabled at https://painel.kinghost.com.br/painel.api.php
```
export KINGHOST_Username="yourusername"
export KINGHOST_Password="yourpassword"
acme.sh --issue --dns dns_kinghost -d example.com -d *.example.com
```
The
`KINGHOST_username`
and
`KINGHOST_Password`
will be saved in
`~/.acme.sh/account.conf`
and will be reused when needed.
## 43. Use Zilore DNS API
First you need to login to your Zilore account to get your API key.
```
export Zilore_Key="5dcad3a2-36cb-50e8-cb92-000002f9"
```
Ok, let's issue a cert now:
```
acme.sh --issue --dns dns_zilore -d example.com -d www.example.com
```
The
`Zilore_Key`
will be saved in
`~/.acme.sh/account.conf`
and will be reused when needed.
# Use custom API
# Use custom API
...
...
dnsapi/dns_dnsimple.sh
View file @
d1b197e3
...
@@ -39,34 +39,17 @@ dns_dnsimple_add() {
...
@@ -39,34 +39,17 @@ dns_dnsimple_add() {
_get_records
"
$_account_id
"
"
$_domain
"
"
$_sub_domain
"
_get_records
"
$_account_id
"
"
$_domain
"
"
$_sub_domain
"
if
[
"
$_records_count
"
=
"0"
]
;
then
_info
"Adding record"
_info
"Adding record"
if
_dnsimple_rest POST
"
$_account_id
/zones/
$_domain
/records"
"{
\"
type
\"
:
\"
TXT
\"
,
\"
name
\"
:
\"
$_sub_domain
\"
,
\"
content
\"
:
\"
$txtvalue
\"
,
\"
ttl
\"
:120}"
;
then
if
_dnsimple_rest POST
"
$_account_id
/zones/
$_domain
/records"
"{
\"
type
\"
:
\"
TXT
\"
,
\"
name
\"
:
\"
$_sub_domain
\"
,
\"
content
\"
:
\"
$txtvalue
\"
,
\"
ttl
\"
:120}"
;
then
if
printf
--
"%s"
"
$response
"
|
grep
"
\"
name
\"
:
\"
$_sub_domain
\"
"
>
/dev/null
;
then
if
printf
--
"%s"
"
$response
"
|
grep
"
\"
name
\"
:
\"
$_sub_domain
\"
"
>
/dev/null
;
then
_info
"Added"
_info
"Added"
return
0
else
_err
"Unexpected response while adding text record."
return
1
fi
fi
_err
"Add txt record error."
else
_info
"Updating record"
_extract_record_id
"
$_records
"
"
$_sub_domain
"
if
_dnsimple_rest
\
PATCH
\
"
$_account_id
/zones/
$_domain
/records/
$_record_id
"
\
"{
\"
type
\"
:
\"
TXT
\"
,
\"
name
\"
:
\"
$_sub_domain
\"
,
\"
content
\"
:
\"
$txtvalue
\"
,
\"
ttl
\"
:120}"
;
then
_info
"Updated!"
return
0
return
0
else
_err
"Unexpected response while adding text record."
return
1
fi
fi
_err
"Update error"
return
1
fi
fi
_err
"Add txt record error."
}
}
# fulldomain
# fulldomain
...
@@ -84,19 +67,19 @@ dns_dnsimple_rm() {
...
@@ -84,19 +67,19 @@ dns_dnsimple_rm() {
fi
fi
_get_records
"
$_account_id
"
"
$_domain
"
"
$_sub_domain
"
_get_records
"
$_account_id
"
"
$_domain
"
"
$_sub_domain
"
_extract_record_id
"
$_records
"
"
$_sub_domain
"
_extract_record_id
"
$_records
"
"
$_sub_domain
"
if
[
"
$_record_id
"
]
;
then
if
[
"
$_record_id
"
]
;
then
echo
"
$_record_id
"
|
while
read
-r
item
;
do
if
_dnsimple_rest DELETE
"
$_account_id
/zones/
$_domain
/records/
$_record_id
"
;
then
if
_dnsimple_rest DELETE
"
$_account_id
/zones/
$_domain
/records/
$item
"
;
then
_info
"removed record"
"
$_record_id
"
_info
"removed record"
"
$item
"
return
0
return
0
fi
else
_err
"failed to remove record"
"
$item
"
return
1
fi
done
fi
fi
_err
"failed to remove record"
"
$_record_id
"
return
1
}
}
#################### Private functions bellow ##################################
#################### Private functions bellow ##################################
...
...
dnsapi/dns_he.sh
View file @
d1b197e3
...
@@ -143,7 +143,7 @@ _find_zone() {
...
@@ -143,7 +143,7 @@ _find_zone() {
_debug
"Looking for zone
\"
${
_attempted_zone
}
\"
"
_debug
"Looking for zone
\"
${
_attempted_zone
}
\"
"
line_num
=
"
$(
echo
"
$_zone_names
"
|
grep
-n
"
$_attempted_zone
"
|
cut
-d
:
-f
1
)
"
line_num
=
"
$(
echo
"
$_zone_names
"
|
grep
-n
"
^
$_attempted_zone
"
|
cut
-d
:
-f
1
)
"
if
[
"
$line_num
"
]
;
then
if
[
"
$line_num
"
]
;
then
_zone_id
=
$(
echo
"
$_zone_ids
"
|
sed
-n
"
${
line_num
}
p"
)
_zone_id
=
$(
echo
"
$_zone_ids
"
|
sed
-n
"
${
line_num
}
p"
)
...
...
dnsapi/dns_kinghost.sh
0 → 100644
View file @
d1b197e3
#!/usr/bin/env sh
############################################################
# KingHost API support #
# http://api.kinghost.net/doc/ #
# #
# Author: Felipe Keller Braz <felipebraz@kinghost.com.br> #
# Report Bugs here: https://github.com/kinghost/acme.sh #
# #
# Values to export: #
# export KINGHOST_Username="email@provider.com" #
# export KINGHOST_Password="xxxxxxxxxx" #
############################################################
KING_Api
=
"https://api.kinghost.net/acme"
# Usage: add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
# Used to add txt record
dns_kinghost_add
()
{
fulldomain
=
$1
txtvalue
=
$2
KINGHOST_Username
=
"
${
KINGHOST_Username
:-
$(
_readaccountconf_mutable KINGHOST_Username
)
}
"
KINGHOST_Password
=
"
${
KINGHOST_Password
:-
$(
_readaccountconf_mutable KINGHOST_Password
)
}
"
if
[
-z
"
$KINGHOST_Username
"
]
||
[
-z
"
$KINGHOST_Password
"
]
;
then
KINGHOST_Username
=
""
KINGHOST_Password
=
""
_err
"You don't specify KingHost api password and email yet."
_err
"Please create you key and try again."
return
1
fi
#save the credentials to the account conf file.
_saveaccountconf_mutable KINGHOST_Username
"
$KINGHOST_Username
"
_saveaccountconf_mutable KINGHOST_Password
"
$KINGHOST_Password
"
_debug
"Getting txt records"
_kinghost_rest GET
"dns"
"name=
$fulldomain
&content=
$txtvalue
"
#This API call returns "status":"ok" if dns record does not exists
#We are creating a new txt record here, so we expect the "ok" status
if
!
echo
"
$response
"
|
grep
'"status":"ok"'
>
/dev/null
;
then
_err
"Error"
_err
"
$response
"
return
1
fi
_kinghost_rest POST
"dns"
"name=
$fulldomain
&content=
$txtvalue
"
if
!
echo
"
$response
"
|
grep
'"status":"ok"'
>
/dev/null
;
then
_err
"Error"
_err
"
$response
"
return
1
fi
return
0
}
# Usage: fulldomain txtvalue
# Used to remove the txt record after validation
dns_kinghost_rm
()
{
fulldomain
=
$1
txtvalue
=
$2
KINGHOST_Password
=
"
${
KINGHOST_Password
:-
$(
_readaccountconf_mutable KINGHOST_Password
)
}
"
KINGHOST_Username
=
"
${
KINGHOST_Username
:-
$(
_readaccountconf_mutable KINGHOST_Username
)
}
"
if
[
-z
"
$KINGHOST_Password
"
]
||
[
-z
"
$KINGHOST_Username
"
]
;
then
KINGHOST_Password
=
""
KINGHOST_Username
=
""
_err
"You don't specify KingHost api key and email yet."
_err
"Please create you key and try again."
return
1
fi
_kinghost_rest DELETE
"dns"
"name=
$fulldomain
&content=
$txtvalue
"
if
!
echo
"
$response
"
|
grep
'"status":"ok"'
>
/dev/null
;
then
_err
"Error"
_err
"
$response
"
return
1
fi
return
0
}
#################### Private functions below ##################################
_kinghost_rest
()
{
method
=
$1
uri
=
"
$2
"
data
=
"
$3
"
_debug
"
$uri
"
export
_H1
=
"X-Auth-Email:
$KINGHOST_Username
"
export
_H2
=
"X-Auth-Key:
$KINGHOST_Password
"
if
[
"
$method
"
!=
"GET"
]
;
then
_debug data
"
$data
"
response
=
"
$(
_post
"
$data
"
"
$KING_Api
/
$uri
.json"
""
"
$method
"
)
"
else
response
=
"
$(
_get
"
$KING_Api
/
$uri
.json?
$data
"
)
"
fi
if
[
"
$?
"
!=
"0"
]
;
then
_err
"error
$uri
"
return
1
fi
_debug2 response
"
$response
"
return
0
}
dnsapi/dns_namecom.sh
View file @
d1b197e3
...
@@ -123,7 +123,7 @@ _namecom_login() {
...
@@ -123,7 +123,7 @@ _namecom_login() {
# Auth string
# Auth string
# Name.com API v4 uses http basic auth to authenticate
# Name.com API v4 uses http basic auth to authenticate
# need to convert the token for http auth
# need to convert the token for http auth
_namecom_auth
=
$(
printf
"%s:%s"
"
$Namecom_Username
"
"
$Namecom_Token
"
|
base64
)
_namecom_auth
=
$(
printf
"%s:%s"
"
$Namecom_Username
"
"
$Namecom_Token
"
|
_
base64
)
if
_namecom_rest GET
"hello"
;
then
if
_namecom_rest GET
"hello"
;
then
retcode
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
username
\"\:\"
$Namecom_Username
\"
"
)
retcode
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
username
\"\:\"
$Namecom_Username
\"
"
)
...
...
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