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
168d712d
Commit
168d712d
authored
Jun 29, 2017
by
RaidenII
Browse files
Fixed URL of Name.com API and removed useless debug for retcode.
parent
e64ad517
Changes
1
Show whitespace changes
Inline
Side-by-side
dnsapi/dns_namecom.sh
View file @
168d712d
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
#Utilize name.com API to finish dns-01 verifications.
#Utilize name.com API to finish dns-01 verifications.
######## Public functions #####################
######## Public functions #####################
namecom_api
=
"https://api.name.com/api
/
"
namecom_api
=
"https://api.name.com/api"
#Usage: dns_namecom_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
#Usage: dns_namecom_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
dns_namecom_add
()
{
dns_namecom_add
()
{
...
@@ -45,7 +45,6 @@ dns_namecom_add() {
...
@@ -45,7 +45,6 @@ dns_namecom_add() {
_namecom_addtxt_json
=
"{
\"
hostname
\"
:
\"
$_sub_domain
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
content
\"
:
\"
$txtvalue
\"
,
\"
ttl
\"
:
\"
300
\"
,
\"
priority
\"
:
\"
10
\"
}"
_namecom_addtxt_json
=
"{
\"
hostname
\"
:
\"
$_sub_domain
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
content
\"
:
\"
$txtvalue
\"
,
\"
ttl
\"
:
\"
300
\"
,
\"
priority
\"
:
\"
10
\"
}"
if
_namecom_rest POST
"dns/create/
$_domain
"
"
$_namecom_addtxt_json
"
;
then
if
_namecom_rest POST
"dns/create/
$_domain
"
"
$_namecom_addtxt_json
"
;
then
retcode
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
code
\"
:100"
)
retcode
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
code
\"
:100"
)
_debug retcode
"
$retcode
"
if
[
!
-z
"
$retcode
"
]
;
then
if
[
!
-z
"
$retcode
"
]
;
then
_info
"Successfully added TXT record, ready for validation."
_info
"Successfully added TXT record, ready for validation."
_namecom_logout
_namecom_logout
...
@@ -76,7 +75,6 @@ dns_namecom_rm() {
...
@@ -76,7 +75,6 @@ dns_namecom_rm() {
# Get the record id.
# Get the record id.
if
_namecom_rest GET
"dns/list/
$_domain
"
;
then
if
_namecom_rest GET
"dns/list/
$_domain
"
;
then
retcode
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
code
\"
:100"
)
retcode
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
code
\"
:100"
)
_debug retcode
"
$retcode
"
if
[
!
-z
"
$retcode
"
]
;
then
if
[
!
-z
"
$retcode
"
]
;
then
_record_id
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
record_id
\"
:
\"
[0-9]+
\"
,
\"
name
\"
:
\"
$fulldomain
\"
,
\"
type
\"
:
\"
TXT
\"
"
|
cut
-d
:
-f
2 |
cut
-d
\"
-f
2
)
_record_id
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
record_id
\"
:
\"
[0-9]+
\"
,
\"
name
\"
:
\"
$fulldomain
\"
,
\"
type
\"
:
\"
TXT
\"
"
|
cut
-d
:
-f
2 |
cut
-d
\"
-f
2
)
_debug record_id
"
$_record_id
"
_debug record_id
"
$_record_id
"
...
@@ -92,7 +90,6 @@ dns_namecom_rm() {
...
@@ -92,7 +90,6 @@ dns_namecom_rm() {
_namecom_rmtxt_json
=
"{
\"
record_id
\"
:
\"
$_record_id
\"
}"
_namecom_rmtxt_json
=
"{
\"
record_id
\"
:
\"
$_record_id
\"
}"
if
_namecom_rest POST
"dns/delete/
$_domain
"
"
$_namecom_rmtxt_json
"
;
then
if
_namecom_rest POST
"dns/delete/
$_domain
"
"
$_namecom_rmtxt_json
"
;
then
retcode
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
code
\"
:100"
)
retcode
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
code
\"
:100"
)
_debug retcode
"
$retcode
"
if
[
!
-z
"
$retcode
"
]
;
then
if
[
!
-z
"
$retcode
"
]
;
then
_info
"Successfully removed the TXT record."
_info
"Successfully removed the TXT record."
_namecom_logout
_namecom_logout
...
@@ -133,7 +130,6 @@ _namecom_login() {
...
@@ -133,7 +130,6 @@ _namecom_login() {
if
_namecom_rest POST
"login"
"
$namecom_login_json
"
;
then
if
_namecom_rest POST
"login"
"
$namecom_login_json
"
;
then
retcode
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
code
\"
:100"
)
retcode
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
code
\"
:100"
)
_debug retcode
"
$retcode
"
if
[
!
-z
"
$retcode
"
]
;
then
if
[
!
-z
"
$retcode
"
]
;
then
_info
"Successfully logged in. Fetching session token..."
_info
"Successfully logged in. Fetching session token..."
sessionkey
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
session_token
\"
:
\"
.+"
|
cut
-d
\"
-f
4
)
sessionkey
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
session_token
\"
:
\"
.+"
|
cut
-d
\"
-f
4
)
...
...
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