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
6b07a955
Unverified
Commit
6b07a955
authored
Jan 07, 2022
by
neil
Committed by
GitHub
Jan 07, 2022
Browse files
Merge pull request #3877 from jvandborg/master
Cannot wait for PR #3673 to be completed
parents
b1bf6341
e23c0257
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_simply.sh
View file @
6b07a955
#!/usr/bin/env sh
#!/usr/bin/env sh
#
# API-integration for Simply.com (https://www.simply.com)
#SIMPLY_AccountName="accountname"
#SIMPLY_AccountName="accountname"
#
#SIMPLY_ApiKey="apikey"
#SIMPLY_ApiKey="apikey"
#
#
#SIMPLY_Api="https://api.simply.com/1/[ACCOUNTNAME]/[APIKEY]"
#SIMPLY_Api="https://api.simply.com/1/[ACCOUNTNAME]/[APIKEY]"
SIMPLY_Api_Default
=
"https://api.simply.com/1"
SIMPLY_Api_Default
=
"https://api.simply.com/1"
#This is used for determining success of REST call
#This is used for determining success of REST call
SIMPLY_SUCCESS_CODE
=
'"status":
200'
SIMPLY_SUCCESS_CODE
=
'"status":200'
######## Public functions #####################
######## Public functions #####################
#Usage: add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
#Usage: add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
...
@@ -51,7 +51,7 @@ dns_simply_rm() {
...
@@ -51,7 +51,7 @@ dns_simply_rm() {
_simply_save_config
_simply_save_config
_debug
"Fi
rst detect
the
root
zone"
_debug
"Fi
nd
the
DNS
zone"
if
!
_get_root
"
$fulldomain
"
;
then
if
!
_get_root
"
$fulldomain
"
;
then
_err
"invalid domain"
_err
"invalid domain"
...
@@ -77,8 +77,8 @@ dns_simply_rm() {
...
@@ -77,8 +77,8 @@ dns_simply_rm() {
for
record
in
$records
;
do
for
record
in
$records
;
do
_debug record
"
$record
"
_debug record
"
$record
"
record_data
=
$(
echo
"
$record
"
|
cut
-d
","
-f
3 |
sed
's/"//g'
|
grep
"data"
|
cut
-d
":"
-f
2
)
record_data
=
$(
echo
"
$record
"
|
sed
-n
"s/.*
\"
data
\"
:
\"\(
[^
\"
]*
\)\"
.*/
\1
/p"
)
record_type
=
$(
echo
"
$record
"
|
cut
-d
","
-f
4 |
sed
's/"//g'
|
grep
"type"
|
cut
-d
":"
-f
2
)
record_type
=
$(
echo
"
$record
"
|
sed
-n
"s/.*
\"
type
\"
:
\"\(
[^
\"
]*
\)\"
.*/
\1
/p"
)
_debug2 record_data
"
$record_data
"
_debug2 record_data
"
$record_data
"
_debug2 record_type
"
$record_type
"
_debug2 record_type
"
$record_type
"
...
@@ -151,7 +151,7 @@ _simply_save_config() {
...
@@ -151,7 +151,7 @@ _simply_save_config() {
_simply_get_all_records
()
{
_simply_get_all_records
()
{
domain
=
$1
domain
=
$1
if
!
_simply_rest GET
"my/products/
$domain
/dns/records"
;
then
if
!
_simply_rest GET
"my/products/
$domain
/dns/records
/
"
;
then
return
1
return
1
fi
fi
...
@@ -169,7 +169,7 @@ _get_root() {
...
@@ -169,7 +169,7 @@ _get_root() {
return
1
return
1
fi
fi
if
!
_simply_rest GET
"my/products/
$h
/dns"
;
then
if
!
_simply_rest GET
"my/products/
$h
/dns
/
"
;
then
return
1
return
1
fi
fi
...
@@ -193,7 +193,7 @@ _simply_add_record() {
...
@@ -193,7 +193,7 @@ _simply_add_record() {
data
=
"{
\"
name
\"
:
\"
$sub_domain
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
data
\"
:
\"
$txtval
\"
,
\"
priority
\"
:0,
\"
ttl
\"
: 3600}"
data
=
"{
\"
name
\"
:
\"
$sub_domain
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
data
\"
:
\"
$txtval
\"
,
\"
priority
\"
:0,
\"
ttl
\"
: 3600}"
if
!
_simply_rest POST
"my/products/
$domain
/dns/records"
"
$data
"
;
then
if
!
_simply_rest POST
"my/products/
$domain
/dns/records
/
"
"
$data
"
;
then
_err
"Adding record not successfull!"
_err
"Adding record not successfull!"
return
1
return
1
fi
fi
...
@@ -214,7 +214,7 @@ _simply_delete_record() {
...
@@ -214,7 +214,7 @@ _simply_delete_record() {
_debug record_id
"Delete record with id
$record_id
"
_debug record_id
"Delete record with id
$record_id
"
if
!
_simply_rest DELETE
"my/products/
$domain
/dns/records/
$record_id
"
;
then
if
!
_simply_rest DELETE
"my/products/
$domain
/dns/records/
$record_id
/
"
;
then
_err
"Deleting record not successfull!"
_err
"Deleting record not successfull!"
return
1
return
1
fi
fi
...
@@ -250,6 +250,8 @@ _simply_rest() {
...
@@ -250,6 +250,8 @@ _simply_rest() {
return
1
return
1
fi
fi
response
=
"
$(
echo
"
$response
"
| _normalizeJson
)
"
_debug2 response
"
$response
"
_debug2 response
"
$response
"
if
_contains
"
$response
"
"Invalid account authorization"
;
then
if
_contains
"
$response
"
"Invalid account authorization"
;
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