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
a2259865
Unverified
Commit
a2259865
authored
Apr 12, 2018
by
neil
Committed by
GitHub
Apr 12, 2018
Browse files
Merge pull request #1501 from jkroepke/inwx_mtan
Add Support for inwx.de mobile tan
parents
d0d10bc6
63f32835
Changes
2
Hide whitespace changes
Inline
Side-by-side
dnsapi/README.md
View file @
a2259865
...
@@ -641,6 +641,14 @@ acme.sh --issue --dns dns_inwx -d example.com -d www.example.com
...
@@ -641,6 +641,14 @@ acme.sh --issue --dns dns_inwx -d example.com -d www.example.com
The
`INWX_User`
and
`INWX_Password`
settings will be saved in
`~/.acme.sh/account.conf`
and will be reused when needed.
The
`INWX_User`
and
`INWX_Password`
settings will be saved in
`~/.acme.sh/account.conf`
and will be reused when needed.
If your account is secured by mobile tan you have also defined the shared secret.
```
export INWX_Shared_Secret="shared secret"
```
You may need to re-enable the mobile tan to gain the shared secret.
## 34. User Servercow API v1
## 34. User Servercow API v1
Create a new user from the servercow control center. Don't forget to activate
**DNS API**
for this user.
Create a new user from the servercow control center. Don't forget to activate
**DNS API**
for this user.
...
...
dnsapi/dns_inwx.sh
View file @
a2259865
...
@@ -4,6 +4,10 @@
...
@@ -4,6 +4,10 @@
#INWX_User="username"
#INWX_User="username"
#
#
#INWX_Password="password"
#INWX_Password="password"
#
# Dependencies:
# -------------
# - oathtool (When using 2 Factor Authentication)
INWX_Api
=
"https://api.domrobot.com/xmlrpc/"
INWX_Api
=
"https://api.domrobot.com/xmlrpc/"
...
@@ -16,6 +20,7 @@ dns_inwx_add() {
...
@@ -16,6 +20,7 @@ dns_inwx_add() {
INWX_User
=
"
${
INWX_User
:-
$(
_readaccountconf_mutable INWX_User
)
}
"
INWX_User
=
"
${
INWX_User
:-
$(
_readaccountconf_mutable INWX_User
)
}
"
INWX_Password
=
"
${
INWX_Password
:-
$(
_readaccountconf_mutable INWX_Password
)
}
"
INWX_Password
=
"
${
INWX_Password
:-
$(
_readaccountconf_mutable INWX_Password
)
}
"
INWX_Shared_Secret
=
"
${
INWX_Shared_Secret
:-
$(
_readaccountconf_mutable INWX_Shared_Secret
)
}
"
if
[
-z
"
$INWX_User
"
]
||
[
-z
"
$INWX_Password
"
]
;
then
if
[
-z
"
$INWX_User
"
]
||
[
-z
"
$INWX_Password
"
]
;
then
INWX_User
=
""
INWX_User
=
""
INWX_Password
=
""
INWX_Password
=
""
...
@@ -27,6 +32,7 @@ dns_inwx_add() {
...
@@ -27,6 +32,7 @@ dns_inwx_add() {
#save the api key and email to the account conf file.
#save the api key and email to the account conf file.
_saveaccountconf_mutable INWX_User
"
$INWX_User
"
_saveaccountconf_mutable INWX_User
"
$INWX_User
"
_saveaccountconf_mutable INWX_Password
"
$INWX_Password
"
_saveaccountconf_mutable INWX_Password
"
$INWX_Password
"
_saveaccountconf_mutable INWX_Shared_Secret
"
$INWX_Shared_Secret
"
_debug
"First detect the root zone"
_debug
"First detect the root zone"
if
!
_get_root
"
$fulldomain
"
;
then
if
!
_get_root
"
$fulldomain
"
;
then
...
@@ -148,8 +154,46 @@ _inwx_login() {
...
@@ -148,8 +154,46 @@ _inwx_login() {
</methodCall>'
$INWX_User
$INWX_Password
)
</methodCall>'
$INWX_User
$INWX_Password
)
response
=
"
$(
_post
"
$xml_content
"
"
$INWX_Api
"
""
"POST"
)
"
response
=
"
$(
_post
"
$xml_content
"
"
$INWX_Api
"
""
"POST"
)
"
_H1
=
$(
printf
"Cookie: %s"
"
$(
grep
"domrobot="
"
$HTTP_HEADER
"
|
grep
"^Set-Cookie:"
| _tail_n 1 | _egrep_o
'domrobot=[^;]*;'
|
tr
-d
';'
)
"
)
export
_H1
printf
"Cookie: %s"
"
$(
grep
"domrobot="
"
$HTTP_HEADER
"
|
grep
"^Set-Cookie:"
| _tail_n 1 | _egrep_o
'domrobot=[^;]*;'
|
tr
-d
';'
)
"
#https://github.com/inwx/php-client/blob/master/INWX/Domrobot.php#L71
if
_contains
"
$response
"
"tfa"
;
then
if
[
-z
"
$INWX_Shared_Secret
"
]
;
then
_err
"Mobile TAN detected."
_err
"Please define a shared secret."
return
1
fi
if
!
_exists oathtool
;
then
_err
"Please install oathtool to use 2 Factor Authentication."
_err
""
return
1
fi
tan
=
"
$(
oathtool
--base32
--totp
"
${
INWX_Shared_Secret
}
"
2>/dev/null
)
"
xml_content
=
$(
printf
'<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>account.unlock</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>tan</name>
<value>
<string>%s</string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>'
"
$tan
"
)
response
=
"
$(
_post
"
$xml_content
"
"
$INWX_Api
"
""
"POST"
)
"
fi
}
}
...
@@ -161,8 +205,8 @@ _get_root() {
...
@@ -161,8 +205,8 @@ _get_root() {
i
=
2
i
=
2
p
=
1
p
=
1
_H1
=
$(
_inwx_login
)
_inwx_login
export
_H1
xml_content
=
'<?xml version="1.0" encoding="UTF-8"?>
xml_content
=
'<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodCall>
<methodName>nameserver.list</methodName>
<methodName>nameserver.list</methodName>
...
...
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