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
afa3fc8b
Unverified
Commit
afa3fc8b
authored
Dec 28, 2016
by
Armando Lüscher
Browse files
Adapt to use general naming rule for account variables.
parent
09eccf6f
Changes
2
Hide whitespace changes
Inline
Side-by-side
dnsapi/README.md
View file @
afa3fc8b
...
...
@@ -311,9 +311,9 @@ You only need to set your cyon.ch login credentials.
If you also have 2 Factor Authentication (OTP) enabled, you need to set your secret token too and have
`oathtool`
installed.
```
export
cyon_u
sername="your_cyon_username"
export
cyon_p
assword="your_cyon_password"
export
cyon_otp_s
ecret="your_otp_secret" # Only required if using 2FA
export
CY_U
sername="your_cyon_username"
export
CY_P
assword="your_cyon_password"
export
CY_OTP_S
ecret="your_otp_secret" # Only required if using 2FA
```
To issue a cert:
...
...
@@ -321,7 +321,7 @@ To issue a cert:
acme.sh --issue --dns dns_cyon -d example.com -d www.example.com
```
The
`
cyon_u
sername`
,
`
cyon_p
assword`
and
`
cyon_otp_s
ecret`
will be saved in
`~/.acme.sh/account.conf`
and will be reused when needed.
The
`
CY_U
sername`
,
`
CY_P
assword`
and
`
CY_OTP_S
ecret`
will be saved in
`~/.acme.sh/account.conf`
and will be reused when needed.
# Use custom API
...
...
dnsapi/dns_cyon.sh
View file @
afa3fc8b
...
...
@@ -43,17 +43,17 @@ dns_cyon_rm() {
_cyon_load_credentials
()
{
# Convert loaded password to/from base64 as needed.
if
[
"
${
cyon_p
assword_
b
64
}
"
]
;
then
cyon_p
assword
=
"
$(
printf
"%s"
"
${
cyon_p
assword_
b
64
}
"
| _dbase64
"multiline"
)
"
elif
[
"
${
cyon_p
assword
}
"
]
;
then
cyon_p
assword_
b
64
=
"
$(
printf
"%s"
"
${
cyon_p
assword
}
"
| _base64
)
"
if
[
"
${
CY_P
assword_
B
64
}
"
]
;
then
CY_P
assword
=
"
$(
printf
"%s"
"
${
CY_P
assword_
B
64
}
"
| _dbase64
"multiline"
)
"
elif
[
"
${
CY_P
assword
}
"
]
;
then
CY_P
assword_
B
64
=
"
$(
printf
"%s"
"
${
CY_P
assword
}
"
| _base64
)
"
fi
if
[
-z
"
${
cyon_u
sername
}
"
]
||
[
-z
"
${
cyon_p
assword
}
"
]
;
then
if
[
-z
"
${
CY_U
sername
}
"
]
||
[
-z
"
${
CY_P
assword
}
"
]
;
then
# Dummy entries to satify script checker.
cyon_u
sername
=
""
cyon_p
assword
=
""
cyon_otp_s
ecret
=
""
CY_U
sername
=
""
CY_P
assword
=
""
CY_OTP_S
ecret
=
""
_err
""
_err
"You haven't set your cyon.ch login credentials yet."
...
...
@@ -64,12 +64,12 @@ _cyon_load_credentials() {
# Save the login credentials to the account.conf file.
_debug
"Save credentials to account.conf"
_saveaccountconf
cyon_u
sername
"
${
cyon_u
sername
}
"
_saveaccountconf
cyon_p
assword_
b
64
"
$
cyon_p
assword_
b
64
"
if
[
!
-z
"
${
cyon_otp_s
ecret
}
"
]
;
then
_saveaccountconf
cyon_otp_secret
"
$cyon_otp_s
ecret
"
_saveaccountconf
CY_U
sername
"
${
CY_U
sername
}
"
_saveaccountconf
CY_P
assword_
B
64
"
$
CY_P
assword_
B
64
"
if
[
!
-z
"
${
CY_OTP_S
ecret
}
"
]
;
then
_saveaccountconf
CY_OTP_Secret
"
$CY_OTP_S
ecret
"
else
_clearaccountconf
cyon_otp_s
ecret
_clearaccountconf
CY_OTP_S
ecret
fi
}
...
...
@@ -140,8 +140,8 @@ _cyon_get_cookie_header() {
_cyon_login
()
{
_info
" - Logging in..."
username_encoded
=
"
$(
printf
"%s"
"
${
cyon_u
sername
}
"
| _cyon_urlencode
)
"
password_encoded
=
"
$(
printf
"%s"
"
${
cyon_p
assword
}
"
| _cyon_urlencode
)
"
username_encoded
=
"
$(
printf
"%s"
"
${
CY_U
sername
}
"
| _cyon_urlencode
)
"
password_encoded
=
"
$(
printf
"%s"
"
${
CY_P
assword
}
"
| _cyon_urlencode
)
"
login_url
=
"https://my.cyon.ch/auth/index/dologin-async"
login_data
=
"
$(
printf
"%s"
"username=
${
username_encoded
}
&password=
${
password_encoded
}
&pathname=%2F"
)
"
...
...
@@ -165,7 +165,7 @@ _cyon_login() {
# todo: instead of just checking if the env variable is defined, check if we actually need to do a 2FA auth request.
# 2FA authentication with OTP?
if
[
!
-z
"
${
cyon_otp_s
ecret
}
"
]
;
then
if
[
!
-z
"
${
CY_OTP_S
ecret
}
"
]
;
then
_info
" - Authorising with OTP code..."
if
!
_exists oathtool
;
then
...
...
@@ -175,7 +175,7 @@ _cyon_login() {
fi
# Get OTP code with the defined secret.
otp_code
=
"
$(
oathtool
--base32
--totp
"
${
cyon_otp_s
ecret
}
"
2>/dev/null
)
"
otp_code
=
"
$(
oathtool
--base32
--totp
"
${
CY_OTP_S
ecret
}
"
2>/dev/null
)
"
login_otp_url
=
"https://my.cyon.ch/auth/multi-factor/domultifactorauth-async"
login_otp_data
=
"totpcode=
${
otp_code
}
&pathname=%2F&rememberme=0"
...
...
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