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
da2c386b
Unverified
Commit
da2c386b
authored
Jul 04, 2023
by
Martin Arndt
Committed by
GitHub
Jul 04, 2023
Browse files
Merge branch 'acmesh-official:dev' into dev
parents
d108072b
41b6aebe
Changes
4
Show whitespace changes
Inline
Side-by-side
acme.sh
View file @
da2c386b
#!/usr/bin/env sh
#!/usr/bin/env sh
VER
=
3.0.
6
VER
=
3.0.
7
PROJECT_NAME
=
"acme.sh"
PROJECT_NAME
=
"acme.sh"
...
@@ -2884,6 +2884,7 @@ _initpath() {
...
@@ -2884,6 +2884,7 @@ _initpath() {
fi
fi
fi
fi
_debug DOMAIN_PATH
"
$DOMAIN_PATH
"
_debug DOMAIN_PATH
"
$DOMAIN_PATH
"
export
DOMAIN_PATH
fi
fi
if
[
-z
"
$DOMAIN_BACKUP_PATH
"
]
;
then
if
[
-z
"
$DOMAIN_BACKUP_PATH
"
]
;
then
...
@@ -2935,22 +2936,6 @@ _initpath() {
...
@@ -2935,22 +2936,6 @@ _initpath() {
}
}
_exec
()
{
if
[
-z
"
$_EXEC_TEMP_ERR
"
]
;
then
_EXEC_TEMP_ERR
=
"
$(
_mktemp
)
"
fi
if
[
"
$_EXEC_TEMP_ERR
"
]
;
then
eval
"
$@
2>>
$_EXEC_TEMP_ERR
"
else
eval
"
$@
"
fi
}
_exec_err
()
{
[
"
$_EXEC_TEMP_ERR
"
]
&&
_err
"
$(
cat
"
$_EXEC_TEMP_ERR
"
)
"
&&
echo
""
>
"
$_EXEC_TEMP_ERR
"
}
_apachePath
()
{
_apachePath
()
{
_APACHECTL
=
"apachectl"
_APACHECTL
=
"apachectl"
if
!
_exists apachectl
;
then
if
!
_exists apachectl
;
then
...
@@ -2963,8 +2948,7 @@ _apachePath() {
...
@@ -2963,8 +2948,7 @@ _apachePath() {
fi
fi
fi
fi
if
!
_exec
$_APACHECTL
-V
>
/dev/null
;
then
if
!
$_APACHECTL
-V
>
/dev/null
;
then
_exec_err
return
1
return
1
fi
fi
...
@@ -3016,8 +3000,7 @@ _restoreApache() {
...
@@ -3016,8 +3000,7 @@ _restoreApache() {
cat
"
$APACHE_CONF_BACKUP_DIR
/
$httpdconfname
"
>
"
$httpdconf
"
cat
"
$APACHE_CONF_BACKUP_DIR
/
$httpdconfname
"
>
"
$httpdconf
"
_debug
"Restored:
$httpdconf
."
_debug
"Restored:
$httpdconf
."
if
!
_exec
$_APACHECTL
-t
;
then
if
!
$_APACHECTL
-t
;
then
_exec_err
_err
"Sorry, restore apache config error, please contact me."
_err
"Sorry, restore apache config error, please contact me."
return
1
return
1
fi
fi
...
@@ -3035,8 +3018,7 @@ _setApache() {
...
@@ -3035,8 +3018,7 @@ _setApache() {
#test the conf first
#test the conf first
_info
"Checking if there is an error in the apache config file before starting."
_info
"Checking if there is an error in the apache config file before starting."
if
!
_exec
"
$_APACHECTL
"
-t
>
/dev/null
;
then
if
!
$_APACHECTL
-t
>
/dev/null
;
then
_exec_err
_err
"The apache config file has error, please fix it first, then try again."
_err
"The apache config file has error, please fix it first, then try again."
_err
"Don't worry, there is nothing changed to your system."
_err
"Don't worry, there is nothing changed to your system."
return
1
return
1
...
@@ -3097,8 +3079,7 @@ Allow from all
...
@@ -3097,8 +3079,7 @@ Allow from all
chmod
755
"
$ACME_DIR
"
chmod
755
"
$ACME_DIR
"
fi
fi
if
!
_exec
"
$_APACHECTL
"
graceful
;
then
if
!
$_APACHECTL
graceful
;
then
_exec_err
_err
"
$_APACHECTL
graceful error, please contact me."
_err
"
$_APACHECTL
graceful error, please contact me."
_restoreApache
_restoreApache
return
1
return
1
...
@@ -3183,8 +3164,7 @@ _setNginx() {
...
@@ -3183,8 +3164,7 @@ _setNginx() {
return
1
return
1
fi
fi
_info
"Check the nginx conf before setting up."
_info
"Check the nginx conf before setting up."
if
!
_exec
"nginx -t"
>
/dev/null
;
then
if
!
nginx
-t
>
/dev/null
;
then
_exec_err
return
1
return
1
fi
fi
...
@@ -3211,16 +3191,14 @@ location ~ \"^/\.well-known/acme-challenge/([-_a-zA-Z0-9]+)\$\" {
...
@@ -3211,16 +3191,14 @@ location ~ \"^/\.well-known/acme-challenge/([-_a-zA-Z0-9]+)\$\" {
fi
fi
_debug3
"Modified config:
$(
cat
$FOUND_REAL_NGINX_CONF
)
"
_debug3
"Modified config:
$(
cat
$FOUND_REAL_NGINX_CONF
)
"
_info
"nginx conf is done, let's check it again."
_info
"nginx conf is done, let's check it again."
if
!
_exec
"nginx -t"
>
/dev/null
;
then
if
!
nginx
-t
>
/dev/null
;
then
_exec_err
_err
"It seems that nginx conf was broken, let's restore."
_err
"It seems that nginx conf was broken, let's restore."
cat
"
$_backup_conf
"
>
"
$FOUND_REAL_NGINX_CONF
"
cat
"
$_backup_conf
"
>
"
$FOUND_REAL_NGINX_CONF
"
return
1
return
1
fi
fi
_info
"Reload nginx"
_info
"Reload nginx"
if
!
_exec
"nginx -s reload"
>
/dev/null
;
then
if
!
nginx
-s
reload
>
/dev/null
;
then
_exec_err
_err
"It seems that nginx reload error, let's restore."
_err
"It seems that nginx reload error, let's restore."
cat
"
$_backup_conf
"
>
"
$FOUND_REAL_NGINX_CONF
"
cat
"
$_backup_conf
"
>
"
$FOUND_REAL_NGINX_CONF
"
return
1
return
1
...
@@ -3345,8 +3323,7 @@ _restoreNginx() {
...
@@ -3345,8 +3323,7 @@ _restoreNginx() {
done
done
_info
"Reload nginx"
_info
"Reload nginx"
if
!
_exec
"nginx -s reload"
>
/dev/null
;
then
if
!
nginx
-s
reload
>
/dev/null
;
then
_exec_err
_err
"It seems that nginx reload error, please report bug."
_err
"It seems that nginx reload error, please report bug."
return
1
return
1
fi
fi
...
@@ -4952,18 +4929,6 @@ $_authorizations_map"
...
@@ -4952,18 +4929,6 @@ $_authorizations_map"
if
!
chmod
a+r
"
$wellknown_path
/
$token
"
;
then
if
!
chmod
a+r
"
$wellknown_path
/
$token
"
;
then
_debug
"chmod failed, but we just continue."
_debug
"chmod failed, but we just continue."
fi
fi
if
[
!
"
$usingApache
"
]
;
then
if
webroot_owner
=
$(
_stat
"
$_currentRoot
"
)
;
then
_debug
"Changing owner/group of .well-known to
$webroot_owner
"
if
!
_exec
"chown -R
\"
$webroot_owner
\"
\"
$_currentRoot
/.well-known
\"
"
;
then
_debug
"
$(
cat
"
$_EXEC_TEMP_ERR
"
)
"
_exec_err
>
/dev/null 2>&1
fi
else
_debug
"not changing owner/group of webroot"
fi
fi
fi
fi
elif
[
"
$vtype
"
=
"
$VTYPE_ALPN
"
]
;
then
elif
[
"
$vtype
"
=
"
$VTYPE_ALPN
"
]
;
then
acmevalidationv1
=
"
$(
printf
"%s"
"
$keyauthorization
"
| _digest
"sha256"
"hex"
)
"
acmevalidationv1
=
"
$(
printf
"%s"
"
$keyauthorization
"
| _digest
"sha256"
"hex"
)
"
...
...
dnsapi/dns_1984hosting.sh
View file @
da2c386b
#!/usr/bin/env sh
#!/usr/bin/env sh
#This file name is "dns_1984hosting.sh"
#
This file name is "dns_1984hosting.sh"
#So, here must be a method dns_1984hosting_add()
#
So, here must be a method dns_1984hosting_add()
#Which will be called by acme.sh to add the txt record to your api system.
#
Which will be called by acme.sh to add the txt record to your api system.
#returns 0 means success, otherwise error.
#
returns 0 means success, otherwise error.
#Author: Adrian Fedoreanu
#
Author: Adrian Fedoreanu
#Report Bugs here: https://github.com/acmesh-official/acme.sh
#
Report Bugs here: https://github.com/acmesh-official/acme.sh
# or here... https://github.com/acmesh-official/acme.sh/issues/2851
# or here... https://github.com/acmesh-official/acme.sh/issues/2851
#
######## Public functions #####################
######## Public functions #####################
# Export 1984HOSTING username and password in following variables
# Export 1984HOSTING username and password in following variables
...
@@ -15,32 +15,32 @@
...
@@ -15,32 +15,32 @@
# One984HOSTING_Username=username
# One984HOSTING_Username=username
# One984HOSTING_Password=password
# One984HOSTING_Password=password
#
#
# sessionid cookie is saved in ~/.acme.sh/account.conf
# username/password and csrftoken/sessionid cookies are saved in ~/.acme.sh/account.conf
# username/password need to be set only when changed.
#Usage: dns_1984hosting_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
# Usage: dns_1984hosting_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
# Add a text record.
dns_1984hosting_add
()
{
dns_1984hosting_add
()
{
fulldomain
=
$1
fulldomain
=
$1
txtvalue
=
$2
txtvalue
=
$2
_info
"Add TXT record using 1984Hosting"
_info
"Add TXT record using 1984Hosting
.
"
_debug fulldomain
"
$fulldomain
"
_debug fulldomain
"
$fulldomain
"
_debug txtvalue
"
$txtvalue
"
_debug txtvalue
"
$txtvalue
"
if
!
_1984hosting_login
;
then
if
!
_1984hosting_login
;
then
_err
"1984Hosting login failed for user
$One984HOSTING_Username
. Check
$HTTP_HEADER
file"
_err
"1984Hosting login failed for user
$One984HOSTING_Username
. Check
$HTTP_HEADER
file
.
"
return
1
return
1
fi
fi
_debug
"First detect the root zone"
_debug
"First detect the root zone
.
"
if
!
_get_root
"
$fulldomain
"
;
then
if
!
_get_root
"
$fulldomain
"
;
then
_err
"
i
nvalid domain
"
"
$fulldomain
"
_err
"
I
nvalid domain
'
$fulldomain
'.
"
return
1
return
1
fi
fi
_debug _sub_domain
"
$_sub_domain
"
_debug _sub_domain
"
$_sub_domain
"
_debug _domain
"
$_domain
"
_debug _domain
"
$_domain
"
_debug
"Add TXT record
$fulldomain
with value '
$txtvalue
'"
_debug
"Add TXT record
$fulldomain
with value '
$txtvalue
'
.
"
value
=
"
$(
printf
'%s'
"
$txtvalue
"
| _url_encode
)
"
value
=
"
$(
printf
'%s'
"
$txtvalue
"
| _url_encode
)
"
url
=
"https://1984.hosting/domains/entry/"
url
=
"https://1984.hosting/domains/entry/"
...
@@ -53,93 +53,97 @@ dns_1984hosting_add() {
...
@@ -53,93 +53,97 @@ dns_1984hosting_add() {
_debug2 postdata
"
$postdata
"
_debug2 postdata
"
$postdata
"
_authpost
"
$postdata
"
"
$url
"
_authpost
"
$postdata
"
"
$url
"
response
=
"
$(
echo
"
$_response
"
| _normalizeJson
)
"
if
_contains
"
$_response
"
'"haserrors": true'
;
then
_debug2 response
"
$response
"
_err
"1984Hosting failed to add TXT record for
$_sub_domain
bad RC from _post."
if
_contains
"
$response
"
'"haserrors": true'
;
then
_err
"1984Hosting failed to add TXT record for
$_sub_domain
bad RC from _post"
return
1
return
1
elif
_contains
"
$response
"
"html>"
;
then
elif
_contains
"
$
_
response
"
"html>"
;
then
_err
"1984Hosting failed to add TXT record for
$_sub_domain
. Check
$HTTP_HEADER
file"
_err
"1984Hosting failed to add TXT record for
$_sub_domain
. Check
$HTTP_HEADER
file
.
"
return
1
return
1
elif
_contains
"
$response
"
'"auth": false'
;
then
elif
_contains
"
$
_
response
"
'"auth": false'
;
then
_err
"1984Hosting failed to add TXT record for
$_sub_domain
. Invalid or expired cookie"
_err
"1984Hosting failed to add TXT record for
$_sub_domain
. Invalid or expired cookie
.
"
return
1
return
1
fi
fi
_info
"Added acme challenge TXT record for
$fulldomain
at 1984Hosting"
_info
"Added acme challenge TXT record for
$fulldomain
at 1984Hosting
.
"
return
0
return
0
}
}
#Usage: fulldomain txtvalue
#
Usage: fulldomain txtvalue
#Remove the txt record after validation.
#
Remove the txt record after validation.
dns_1984hosting_rm
()
{
dns_1984hosting_rm
()
{
fulldomain
=
$1
fulldomain
=
$1
txtvalue
=
$2
txtvalue
=
$2
_info
"Delete TXT record using 1984Hosting"
_info
"Delete TXT record using 1984Hosting
.
"
_debug fulldomain
"
$fulldomain
"
_debug fulldomain
"
$fulldomain
"
_debug txtvalue
"
$txtvalue
"
_debug txtvalue
"
$txtvalue
"
if
!
_1984hosting_login
;
then
if
!
_1984hosting_login
;
then
_err
"1984Hosting login failed for user
$One984HOSTING_Username
. Check
$HTTP_HEADER
file"
_err
"1984Hosting login failed for user
$One984HOSTING_Username
. Check
$HTTP_HEADER
file
.
"
return
1
return
1
fi
fi
_debug
"First detect the root zone"
_debug
"First detect the root zone
.
"
if
!
_get_root
"
$fulldomain
"
;
then
if
!
_get_root
"
$fulldomain
"
;
then
_err
"
i
nvalid domain
"
"
$fulldomain
"
_err
"
I
nvalid domain
'
$fulldomain
'.
"
return
1
return
1
fi
fi
_debug _sub_domain
"
$_sub_domain
"
_debug _sub_domain
"
$_sub_domain
"
_debug _domain
"
$_domain
"
_debug _domain
"
$_domain
"
_debug
"Delete
$fulldomain
TXT record"
_debug
"Delete
$fulldomain
TXT record
.
"
url
=
"https://1984.hosting/domains"
url
=
"https://1984.hosting/domains"
if
!
_get_zone_id
"
$url
"
"
$_domain
"
;
then
if
!
_get_zone_id
"
$url
"
"
$_domain
"
;
then
_err
"
i
nvalid zone
"
"
$_domain
"
_err
"
I
nvalid zone
'
$_domain
'.
"
return
1
return
1
fi
fi
_htmlget
"
$url
/
$_zone_id
"
"
$txtvalue
"
_htmlget
"
$url
/
$_zone_id
"
"
$txtvalue
"
_debug2 _response
"
$_response
"
entry_id
=
"
$(
echo
"
$_response
"
| _egrep_o
'entry_[0-9]+'
|
sed
's/entry_//'
)
"
entry_id
=
"
$(
echo
"
$_response
"
| _egrep_o
'entry_[0-9]+'
|
sed
's/entry_//'
)
"
_debug2 entry_id
"
$entry_id
"
_debug2 entry_id
"
$entry_id
"
if
[
-z
"
$entry_id
"
]
;
then
if
[
-z
"
$entry_id
"
]
;
then
_err
"Error getting TXT entry_id for
$1
"
_err
"Error getting TXT entry_id for
$1
.
"
return
1
return
1
fi
fi
_authpost
"entry=
$entry_id
"
"
$url
/delentry/"
_authpost
"entry=
$entry_id
"
"
$url
/delentry/"
response
=
"
$(
echo
"
$_response
"
| _normalizeJson
)
"
if
!
_contains
"
$_response
"
'"ok": true'
;
then
_debug2 response
"
$response
"
_err
"1984Hosting failed to delete TXT record for
$entry_id
bad RC from _post."
if
!
_contains
"
$response
"
'"ok": true'
;
then
_err
"1984Hosting failed to delete TXT record for
$entry_id
bad RC from _post"
return
1
return
1
fi
fi
_info
"Deleted acme challenge TXT record for
$fulldomain
at 1984Hosting"
_info
"Deleted acme challenge TXT record for
$fulldomain
at 1984Hosting
.
"
return
0
return
0
}
}
#################### Private functions below ##################################
#################### Private functions below ##################################
# usage: _1984hosting_login username password
# returns 0 success
_1984hosting_login
()
{
_1984hosting_login
()
{
if
!
_check_credentials
;
then return
1
;
fi
if
!
_check_credentials
;
then return
1
;
fi
if
_check_cookies
;
then
if
_check_cookies
;
then
_debug
"Already logged in"
_debug
"Already logged in
.
"
return
0
return
0
fi
fi
_debug
"Login to 1984Hosting as user
$One984HOSTING_Username
"
_debug
"Login to 1984Hosting as user
$One984HOSTING_Username
.
"
username
=
$(
printf
'%s'
"
$One984HOSTING_Username
"
| _url_encode
)
username
=
$(
printf
'%s'
"
$One984HOSTING_Username
"
| _url_encode
)
password
=
$(
printf
'%s'
"
$One984HOSTING_Password
"
| _url_encode
)
password
=
$(
printf
'%s'
"
$One984HOSTING_Password
"
| _url_encode
)
url
=
"https://1984.hosting/accounts/checkuserauth/"
url
=
"https://1984.hosting/accounts/checkuserauth/"
_get
"https://1984.hosting/accounts/login/"
|
grep
"csrfmiddlewaretoken"
csrftoken
=
"
$(
grep
-i
'^set-cookie:'
"
$HTTP_HEADER
"
| _egrep_o
'csrftoken=[^;]*;'
|
tr
-d
';'
)
"
sessionid
=
"
$(
grep
-i
'^set-cookie:'
"
$HTTP_HEADER
"
| _egrep_o
'sessionid=[^;]*;'
|
tr
-d
';'
)
"
if
[
-z
"
$csrftoken
"
]
||
[
-z
"
$sessionid
"
]
;
then
_err
"One or more cookies are empty: '
$csrftoken
', '
$sessionid
'."
return
1
fi
export
_H1
=
"Cookie:
$csrftoken
;
$sessionid
"
export
_H2
=
"Referer: https://1984.hosting/accounts/login/"
csrf_header
=
$(
echo
"
$csrftoken
"
|
sed
's/csrftoken=//'
| _head_n 1
)
export
_H3
=
"X-CSRFToken:
$csrf_header
"
response
=
"
$(
_post
"username=
$username
&password=
$password
&otpkey="
$url
)
"
response
=
"
$(
_post
"username=
$username
&password=
$password
&otpkey="
$url
)
"
response
=
"
$(
echo
"
$response
"
| _normalizeJson
)
"
response
=
"
$(
echo
"
$response
"
| _normalizeJson
)
"
_debug2 response
"
$response
"
_debug2 response
"
$response
"
...
@@ -149,6 +153,8 @@ _1984hosting_login() {
...
@@ -149,6 +153,8 @@ _1984hosting_login() {
One984HOSTING_CSRFTOKEN_COOKIE
=
"
$(
grep
-i
'^set-cookie:'
"
$HTTP_HEADER
"
| _egrep_o
'csrftoken=[^;]*;'
|
tr
-d
';'
)
"
One984HOSTING_CSRFTOKEN_COOKIE
=
"
$(
grep
-i
'^set-cookie:'
"
$HTTP_HEADER
"
| _egrep_o
'csrftoken=[^;]*;'
|
tr
-d
';'
)
"
export
One984HOSTING_SESSIONID_COOKIE
export
One984HOSTING_SESSIONID_COOKIE
export
One984HOSTING_CSRFTOKEN_COOKIE
export
One984HOSTING_CSRFTOKEN_COOKIE
_saveaccountconf_mutable One984HOSTING_Username
"
$One984HOSTING_Username
"
_saveaccountconf_mutable One984HOSTING_Password
"
$One984HOSTING_Password
"
_saveaccountconf_mutable One984HOSTING_SESSIONID_COOKIE
"
$One984HOSTING_SESSIONID_COOKIE
"
_saveaccountconf_mutable One984HOSTING_SESSIONID_COOKIE
"
$One984HOSTING_SESSIONID_COOKIE
"
_saveaccountconf_mutable One984HOSTING_CSRFTOKEN_COOKIE
"
$One984HOSTING_CSRFTOKEN_COOKIE
"
_saveaccountconf_mutable One984HOSTING_CSRFTOKEN_COOKIE
"
$One984HOSTING_CSRFTOKEN_COOKIE
"
return
0
return
0
...
@@ -157,9 +163,13 @@ _1984hosting_login() {
...
@@ -157,9 +163,13 @@ _1984hosting_login() {
}
}
_check_credentials
()
{
_check_credentials
()
{
One984HOSTING_Username
=
"
${
One984HOSTING_Username
:-
$(
_readaccountconf_mutable One984HOSTING_Username
)
}
"
One984HOSTING_Password
=
"
${
One984HOSTING_Password
:-
$(
_readaccountconf_mutable One984HOSTING_Password
)
}
"
if
[
-z
"
$One984HOSTING_Username
"
]
||
[
-z
"
$One984HOSTING_Password
"
]
;
then
if
[
-z
"
$One984HOSTING_Username
"
]
||
[
-z
"
$One984HOSTING_Password
"
]
;
then
One984HOSTING_Username
=
""
One984HOSTING_Username
=
""
One984HOSTING_Password
=
""
One984HOSTING_Password
=
""
_clearaccountconf_mutable One984HOSTING_Username
_clearaccountconf_mutable One984HOSTING_Password
_err
"You haven't specified 1984Hosting username or password yet."
_err
"You haven't specified 1984Hosting username or password yet."
_err
"Please export as One984HOSTING_Username / One984HOSTING_Password and try again."
_err
"Please export as One984HOSTING_Username / One984HOSTING_Password and try again."
return
1
return
1
...
@@ -171,25 +181,26 @@ _check_cookies() {
...
@@ -171,25 +181,26 @@ _check_cookies() {
One984HOSTING_SESSIONID_COOKIE
=
"
${
One984HOSTING_SESSIONID_COOKIE
:-
$(
_readaccountconf_mutable One984HOSTING_SESSIONID_COOKIE
)
}
"
One984HOSTING_SESSIONID_COOKIE
=
"
${
One984HOSTING_SESSIONID_COOKIE
:-
$(
_readaccountconf_mutable One984HOSTING_SESSIONID_COOKIE
)
}
"
One984HOSTING_CSRFTOKEN_COOKIE
=
"
${
One984HOSTING_CSRFTOKEN_COOKIE
:-
$(
_readaccountconf_mutable One984HOSTING_CSRFTOKEN_COOKIE
)
}
"
One984HOSTING_CSRFTOKEN_COOKIE
=
"
${
One984HOSTING_CSRFTOKEN_COOKIE
:-
$(
_readaccountconf_mutable One984HOSTING_CSRFTOKEN_COOKIE
)
}
"
if
[
-z
"
$One984HOSTING_SESSIONID_COOKIE
"
]
||
[
-z
"
$One984HOSTING_CSRFTOKEN_COOKIE
"
]
;
then
if
[
-z
"
$One984HOSTING_SESSIONID_COOKIE
"
]
||
[
-z
"
$One984HOSTING_CSRFTOKEN_COOKIE
"
]
;
then
_debug
"No cached cookie(s) found"
_debug
"No cached cookie(s) found
.
"
return
1
return
1
fi
fi
_authget
"https://1984.hosting/accounts/loginstatus/"
_authget
"https://1984.hosting/accounts/loginstatus/"
if
_contains
"
$response
"
'"ok": true'
;
then
if
_contains
"
$
_
response
"
'"ok": true'
;
then
_debug
"Cached cookies still valid"
_debug
"Cached cookies still valid
.
"
return
0
return
0
fi
fi
_debug
"Cached cookies no longer valid"
_debug
"Cached cookies no longer valid. Clearing cookies."
One984HOSTING_SESSIONID_COOKIE
=
""
One984HOSTING_SESSIONID_COOKIE
=
""
One984HOSTING_CSRFTOKEN_COOKIE
=
""
One984HOSTING_CSRFTOKEN_COOKIE
=
""
_
save
accountconf_mutable One984HOSTING_SESSIONID_COOKIE
"
$One984HOSTING_SESSIONID_COOKIE
"
_
clear
accountconf_mutable One984HOSTING_SESSIONID_COOKIE
_
save
accountconf_mutable One984HOSTING_CSRFTOKEN_COOKIE
"
$One984HOSTING_CSRFTOKEN_COOKIE
"
_
clear
accountconf_mutable One984HOSTING_CSRFTOKEN_COOKIE
return
1
return
1
}
}
#_acme-challenge.www.domain.com
#
_acme-challenge.www.domain.com
#
r
eturns
#
R
eturns
# _sub_domain=_acme-challenge.www
# _sub_domain=_acme-challenge.www
# _domain=domain.com
# _domain=domain.com
_get_root
()
{
_get_root
()
{
...
@@ -197,16 +208,16 @@ _get_root() {
...
@@ -197,16 +208,16 @@ _get_root() {
i
=
1
i
=
1
p
=
1
p
=
1
while
true
;
do
while
true
;
do
h
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
$i
-100
)
h
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
"
$i
"
-100
)
# not valid
if
[
-z
"
$h
"
]
;
then
if
[
-z
"
$h
"
]
;
then
#not valid
return
1
return
1
fi
fi
_authget
"https://1984.hosting/domains/soacheck/?zone=
$h
&nameserver=ns0.1984.is."
_authget
"https://1984.hosting/domains/soacheck/?zone=
$h
&nameserver=ns0.1984.is."
if
_contains
"
$_response
"
"serial"
&&
!
_contains
"
$_response
"
"null"
;
then
if
_contains
"
$_response
"
"serial"
&&
!
_contains
"
$_response
"
"null"
;
then
_sub_domain
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
1-
$p
)
_sub_domain
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
1-
"
$p
"
)
_domain
=
"
$h
"
_domain
=
"
$h
"
return
0
return
0
fi
fi
...
@@ -216,46 +227,47 @@ _get_root() {
...
@@ -216,46 +227,47 @@ _get_root() {
return
1
return
1
}
}
#
u
sage: _get_zone_id url domain.com
#
U
sage: _get_zone_id url domain.com
#
r
eturns zone id for domain.com
#
R
eturns zone id for domain.com
_get_zone_id
()
{
_get_zone_id
()
{
url
=
$1
url
=
$1
domain
=
$2
domain
=
$2
_htmlget
"
$url
"
"
$domain
"
_htmlget
"
$url
"
"
$domain
"
_debug2 _response
"
$_response
"
_zone_id
=
"
$(
echo
"
$_response
"
| _egrep_o
'zone\/[0-9]+'
| _head_n 1
)
"
_zone_id
=
"
$(
echo
"
$_response
"
| _egrep_o
'zone\/[0-9]+'
| _head_n 1
)
"
_debug2 _zone_id
"
$_zone_id
"
_debug2 _zone_id
"
$_zone_id
"
if
[
-z
"
$_zone_id
"
]
;
then
if
[
-z
"
$_zone_id
"
]
;
then
_err
"Error getting _zone_id for
$2
"
_err
"Error getting _zone_id for
$2
.
"
return
1
return
1
fi
fi
return
0
return
0
}
}
#
a
dd extra headers to request
#
A
dd extra headers to request
_authget
()
{
_authget
()
{
export
_H1
=
"Cookie:
$One984HOSTING_CSRFTOKEN_COOKIE
;
$One984HOSTING_SESSIONID_COOKIE
"
export
_H1
=
"Cookie:
$One984HOSTING_CSRFTOKEN_COOKIE
;
$One984HOSTING_SESSIONID_COOKIE
"
_response
=
$(
_get
"
$1
"
| _normalizeJson
)
_response
=
$(
_get
"
$1
"
| _normalizeJson
)
_debug2 _response
"
$_response
"
_debug2 _response
"
$_response
"
}
}
#
t
runcate huge HTML response
#
T
runcate huge HTML response
#
e
cho: Argument list too long
#
E
cho: Argument list too long
_htmlget
()
{
_htmlget
()
{
export
_H1
=
"Cookie:
$One984HOSTING_CSRFTOKEN_COOKIE
;
$One984HOSTING_SESSIONID_COOKIE
"
export
_H1
=
"Cookie:
$One984HOSTING_CSRFTOKEN_COOKIE
;
$One984HOSTING_SESSIONID_COOKIE
"
_response
=
$(
_get
"
$1
"
|
grep
"
$2
"
)
_response
=
$(
_get
"
$1
"
|
grep
"
$2
"
)
if
_contains
"
$_response
"
"@
$2
"
;
then
if
_contains
"
$_response
"
"@
$2
"
;
then
_response
=
$(
echo
"
$_response
"
|
grep
-v
"[@]"
| _head_n 1
)
_response
=
$(
echo
"
$_response
"
|
grep
-v
"[@]"
| _head_n 1
)
fi
fi
_debug2 _response
"
$_response
"
}
}
#
a
dd extra headers to request
#
A
dd extra headers to request
_authpost
()
{
_authpost
()
{
url
=
"https://1984.hosting/domains"
url
=
"https://1984.hosting/domains"
_get_zone_id
"
$url
"
"
$_domain
"
_get_zone_id
"
$url
"
"
$_domain
"
csrf_header
=
"
$(
echo
"
$One984HOSTING_CSRFTOKEN_COOKIE
"
| _egrep_o
"=[^=][0-9a-zA-Z]*"
|
tr
-d
"="
)
"
csrf_header
=
"
$(
echo
"
$One984HOSTING_CSRFTOKEN_COOKIE
"
| _egrep_o
"=[^=][0-9a-zA-Z]*"
|
tr
-d
"="
)
"
export
_H1
=
"Cookie:
$One984HOSTING_CSRFTOKEN_COOKIE
;
$One984HOSTING_SESSIONID_COOKIE
"
export
_H1
=
"Cookie:
$One984HOSTING_CSRFTOKEN_COOKIE
;
$One984HOSTING_SESSIONID_COOKIE
"
export
_H2
=
"Referer: https://1984.hosting/domains/
$_zone_id
"
export
_H2
=
"Referer: https://1984.hosting/domains/
$_zone_id
"
export
_H3
=
"X-CSRFToken:
$csrf_header
"
export
_H3
=
"X-CSRFToken:
$csrf_header
"
_response
=
$(
_post
"
$1
"
"
$2
"
)
_response
=
"
$(
_post
"
$1
"
"
$2
"
| _normalizeJson
)
"
_debug2 _response
"
$_response
"
}
}
dnsapi/dns_loopia.sh
View file @
da2c386b
...
@@ -107,7 +107,7 @@ _loopia_load_config() {
...
@@ -107,7 +107,7 @@ _loopia_load_config() {
fi
fi
if
_contains
"
$LOOPIA_Password
"
"'"
||
_contains
"
$LOOPIA_Password
"
'"'
;
then
if
_contains
"
$LOOPIA_Password
"
"'"
||
_contains
"
$LOOPIA_Password
"
'"'
;
then
_err
"Password contains quo
ute
or double quo
ute
and this is not supported by dns_loopia.sh"
_err
"Password contains
a
quo
tation mark
or double quo
tation marks
and this is not supported by dns_loopia.sh"
return
1
return
1
fi
fi
...
...
dnsapi/dns_ovh.sh
View file @
da2c386b
...
@@ -14,6 +14,9 @@
...
@@ -14,6 +14,9 @@
#'ovh-eu'
#'ovh-eu'
OVH_EU
=
'https://eu.api.ovh.com/1.0'
OVH_EU
=
'https://eu.api.ovh.com/1.0'
#'ovh-us'
OVH_US
=
'https://api.us.ovhcloud.com/1.0'
#'ovh-ca':
#'ovh-ca':
OVH_CA
=
'https://ca.api.ovh.com/1.0'
OVH_CA
=
'https://ca.api.ovh.com/1.0'
...
@@ -29,9 +32,6 @@ SYS_EU='https://eu.api.soyoustart.com/1.0'
...
@@ -29,9 +32,6 @@ SYS_EU='https://eu.api.soyoustart.com/1.0'
#'soyoustart-ca'
#'soyoustart-ca'
SYS_CA
=
'https://ca.api.soyoustart.com/1.0'
SYS_CA
=
'https://ca.api.soyoustart.com/1.0'
#'runabove-ca'
RAV_CA
=
'https://api.runabove.com/1.0'
wiki
=
"https://github.com/acmesh-official/acme.sh/wiki/How-to-use-OVH-domain-api"
wiki
=
"https://github.com/acmesh-official/acme.sh/wiki/How-to-use-OVH-domain-api"
ovh_success
=
"https://github.com/acmesh-official/acme.sh/wiki/OVH-Success"
ovh_success
=
"https://github.com/acmesh-official/acme.sh/wiki/OVH-Success"
...
@@ -45,6 +45,10 @@ _ovh_get_api() {
...
@@ -45,6 +45,10 @@ _ovh_get_api() {
printf
"%s"
$OVH_EU
printf
"%s"
$OVH_EU
return
return
;;
;;
ovh-us
|
ovhus
)
printf
"%s"
$OVH_US
return
;;
ovh-ca
|
ovhca
)
ovh-ca
|
ovhca
)
printf
"%s"
$OVH_CA
printf
"%s"
$OVH_CA
return
return
...
@@ -65,14 +69,15 @@ _ovh_get_api() {
...
@@ -65,14 +69,15 @@ _ovh_get_api() {
printf
"%s"
$SYS_CA
printf
"%s"
$SYS_CA
return
return
;;
;;
runabove-ca
|
runaboveca
)
# raw API url starts with https://
printf
"%s"
$RAV_CA
https
*
)
printf
"%s"
"
$1
"
return
return
;;
;;
*
)
*
)
_err
"Unknown
parameter
:
$1
"
_err
"Unknown
endpoint
:
$1
"
return
1
return
1
;;
;;
esac
esac
...
...
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