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
dac75a1d
Commit
dac75a1d
authored
May 03, 2019
by
neilpang
Browse files
rename
parent
f1c0f3d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_one.sh
View file @
dac75a1d
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
# Author: github: @diseq
# Author: github: @diseq
# Created: 2019-02-17
# Created: 2019-02-17
#
#
# export ONECOM_U
SER
="username"
# export ONECOM_U
ser
="username"
# export ONECOM_P
ASSWORD
="password"
# export ONECOM_P
assword
="password"
#
#
# Usage:
# Usage:
# acme.sh --issue --dns dns_one -d example.com
# acme.sh --issue --dns dns_one -d example.com
...
@@ -19,26 +19,26 @@ dns_one_add() {
...
@@ -19,26 +19,26 @@ dns_one_add() {
txtvalue
=
$2
txtvalue
=
$2
# get credentials
# get credentials
ONECOM_U
SER
=
"
${
ONECOM_U
SER
:-
$(
_readaccountconf_mutable ONECOM_U
SER
)
}
"
ONECOM_U
ser
=
"
${
ONECOM_U
ser
:-
$(
_readaccountconf_mutable ONECOM_U
ser
)
}
"
ONECOM_P
ASSWORD
=
"
${
ONECOM_P
ASSWORD
:-
$(
_readaccountconf_mutable ONECOM_P
ASSWORD
)
}
"
ONECOM_P
assword
=
"
${
ONECOM_P
assword
:-
$(
_readaccountconf_mutable ONECOM_P
assword
)
}
"
if
[
-z
"
$ONECOM_U
SER
"
]
||
[
-z
"
$ONECOM_P
ASSWORD
"
]
;
then
if
[
-z
"
$ONECOM_U
ser
"
]
||
[
-z
"
$ONECOM_P
assword
"
]
;
then
ONECOM_U
SER
=
""
ONECOM_U
ser
=
""
ONECOM_P
ASSWORD
=
""
ONECOM_P
assword
=
""
_err
"You didn't specify a one.com username and password yet."
_err
"You didn't specify a one.com username and password yet."
_err
"Please create the key and try again."
_err
"Please create the key and try again."
return
1
return
1
fi
fi
#save the api key and email to the account conf file.
#save the api key and email to the account conf file.
_saveaccountconf_mutable ONECOM_U
SER
"
$ONECOM_U
SER
"
_saveaccountconf_mutable ONECOM_U
ser
"
$ONECOM_U
ser
"
_saveaccountconf_mutable ONECOM_P
ASSWORD
"
$ONECOM_P
ASSWORD
"
_saveaccountconf_mutable ONECOM_P
assword
"
$ONECOM_P
assword
"
# Login with user and password
# Login with user and password
postdata
=
"loginDomain=true"
postdata
=
"loginDomain=true"
postdata
=
"
$postdata
&displayUsername=
$ONECOM_U
SER
"
postdata
=
"
$postdata
&displayUsername=
$ONECOM_U
ser
"
postdata
=
"
$postdata
&username=
$ONECOM_U
SER
"
postdata
=
"
$postdata
&username=
$ONECOM_U
ser
"
postdata
=
"
$postdata
&targetDomain=
$mydomain
"
postdata
=
"
$postdata
&targetDomain=
$mydomain
"
postdata
=
"
$postdata
&password1=
$ONECOM_P
ASSWORD
"
postdata
=
"
$postdata
&password1=
$ONECOM_P
assword
"
postdata
=
"
$postdata
&loginTarget="
postdata
=
"
$postdata
&loginTarget="
#_debug postdata "$postdata"
#_debug postdata "$postdata"
...
@@ -64,7 +64,7 @@ dns_one_add() {
...
@@ -64,7 +64,7 @@ dns_one_add() {
response
=
"
$(
echo
"
$response
"
| _normalizeJson
)
"
response
=
"
$(
echo
"
$response
"
| _normalizeJson
)
"
_debug response
"
$response
"
_debug response
"
$response
"
id
=
$(
printf
--
"%s"
"
$response
"
|
sed
-n
"s/{
\"
result
\"
:{
\"
data
\"
:{
\"
type
\"
:
\"
dns_custom_records
\"
,
\"
id
\"
:
\"\(
[^
\"
]*
\)\"
,
\"
attributes
\"
:{
\"
prefix
\"
:
\"
$mysubdomain
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
content
\"
:
\"
$txtvalue
\"
,
\"
priority
\"
:0,
\"
ttl
\"
:600}}},
\"
metadata
\"
:null}/
\1
/p"
)
id
=
$(
echo
"
$response
"
|
sed
-n
"s/{
\"
result
\"
:{
\"
data
\"
:{
\"
type
\"
:
\"
dns_custom_records
\"
,
\"
id
\"
:
\"\(
[^
\"
]*
\)\"
,
\"
attributes
\"
:{
\"
prefix
\"
:
\"
$mysubdomain
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
content
\"
:
\"
$txtvalue
\"
,
\"
priority
\"
:0,
\"
ttl
\"
:600}}},
\"
metadata
\"
:null}/
\1
/p"
)
if
[
-z
"
$id
"
]
;
then
if
[
-z
"
$id
"
]
;
then
_err
"Add txt record error."
_err
"Add txt record error."
...
@@ -82,11 +82,11 @@ dns_one_rm() {
...
@@ -82,11 +82,11 @@ dns_one_rm() {
txtvalue
=
$2
txtvalue
=
$2
# get credentials
# get credentials
ONECOM_U
SER
=
"
${
ONECOM_U
SER
:-
$(
_readaccountconf_mutable ONECOM_U
SER
)
}
"
ONECOM_U
ser
=
"
${
ONECOM_U
ser
:-
$(
_readaccountconf_mutable ONECOM_U
ser
)
}
"
ONECOM_P
ASSWORD
=
"
${
ONECOM_P
ASSWORD
:-
$(
_readaccountconf_mutable ONECOM_P
ASSWORD
)
}
"
ONECOM_P
assword
=
"
${
ONECOM_P
assword
:-
$(
_readaccountconf_mutable ONECOM_P
assword
)
}
"
if
[
-z
"
$ONECOM_U
SER
"
]
||
[
-z
"
$ONECOM_P
ASSWORD
"
]
;
then
if
[
-z
"
$ONECOM_U
ser
"
]
||
[
-z
"
$ONECOM_P
assword
"
]
;
then
ONECOM_U
SER
=
""
ONECOM_U
ser
=
""
ONECOM_P
ASSWORD
=
""
ONECOM_P
assword
=
""
_err
"You didn't specify a one.com username and password yet."
_err
"You didn't specify a one.com username and password yet."
_err
"Please create the key and try again."
_err
"Please create the key and try again."
return
1
return
1
...
@@ -94,10 +94,10 @@ dns_one_rm() {
...
@@ -94,10 +94,10 @@ dns_one_rm() {
# Login with user and password
# Login with user and password
postdata
=
"loginDomain=true"
postdata
=
"loginDomain=true"
postdata
=
"
$postdata
&displayUsername=
$ONECOM_U
SER
"
postdata
=
"
$postdata
&displayUsername=
$ONECOM_U
ser
"
postdata
=
"
$postdata
&username=
$ONECOM_U
SER
"
postdata
=
"
$postdata
&username=
$ONECOM_U
ser
"
postdata
=
"
$postdata
&targetDomain=
$mydomain
"
postdata
=
"
$postdata
&targetDomain=
$mydomain
"
postdata
=
"
$postdata
&password1=
$ONECOM_P
ASSWORD
"
postdata
=
"
$postdata
&password1=
$ONECOM_P
assword
"
postdata
=
"
$postdata
&loginTarget="
postdata
=
"
$postdata
&loginTarget="
response
=
"
$(
_post
"
$postdata
"
"https://www.one.com/admin/login.do"
""
"POST"
"application/x-www-form-urlencoded"
)
"
response
=
"
$(
_post
"
$postdata
"
"https://www.one.com/admin/login.do"
""
"POST"
"application/x-www-form-urlencoded"
)
"
...
...
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