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
a3f4cb15
Unverified
Commit
a3f4cb15
authored
May 09, 2023
by
lufi42
Committed by
GitHub
May 09, 2023
Browse files
Merge branch 'acmesh-official:dev' into dev
parents
2905edce
b937665b
Changes
25
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_leaseweb.sh
View file @
a3f4cb15
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
#See https://developer.leaseweb.com for more information.
#See https://developer.leaseweb.com for more information.
######## Public functions #####################
######## Public functions #####################
LSW_API
=
"https://api.leaseweb.com/hosting/v2/domains
/
"
LSW_API
=
"https://api.leaseweb.com/hosting/v2/domains"
#Usage: dns_leaseweb_add _acme-challenge.www.domain.com
#Usage: dns_leaseweb_add _acme-challenge.www.domain.com
dns_leaseweb_add
()
{
dns_leaseweb_add
()
{
...
...
dnsapi/dns_nanelo.sh
0 → 100644
View file @
a3f4cb15
#!/usr/bin/env sh
# Official DNS API for Nanelo.com
# Provide the required API Key like this:
# NANELO_TOKEN="FmD408PdqT1E269gUK57"
NANELO_API
=
"https://api.nanelo.com/v1/"
######## Public functions #####################
# Usage: add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
dns_nanelo_add
()
{
fulldomain
=
$1
txtvalue
=
$2
NANELO_TOKEN
=
"
${
NANELO_TOKEN
:-
$(
_readaccountconf_mutable NANELO_TOKEN
)
}
"
if
[
-z
"
$NANELO_TOKEN
"
]
;
then
NANELO_TOKEN
=
""
_err
"You didn't configure a Nanelo API Key yet."
_err
"Please set NANELO_TOKEN and try again."
_err
"Login to Nanelo.com and go to Settings > API Keys to get a Key"
return
1
fi
_saveaccountconf_mutable NANELO_TOKEN
"
$NANELO_TOKEN
"
_info
"Adding TXT record to
${
fulldomain
}
"
response
=
"
$(
_get
"
$NANELO_API$NANELO_TOKEN
/dns/addrecord?type=TXT&ttl=60&name=
${
fulldomain
}
&value=
${
txtvalue
}
"
)
"
if
_contains
"
${
response
}
"
'success'
;
then
return
0
fi
_err
"Could not create resource record, please check the logs"
_err
"
${
response
}
"
return
1
}
dns_nanelo_rm
()
{
fulldomain
=
$1
txtvalue
=
$2
NANELO_TOKEN
=
"
${
NANELO_TOKEN
:-
$(
_readaccountconf_mutable NANELO_TOKEN
)
}
"
if
[
-z
"
$NANELO_TOKEN
"
]
;
then
NANELO_TOKEN
=
""
_err
"You didn't configure a Nanelo API Key yet."
_err
"Please set NANELO_TOKEN and try again."
_err
"Login to Nanelo.com and go to Settings > API Keys to get a Key"
return
1
fi
_saveaccountconf_mutable NANELO_TOKEN
"
$NANELO_TOKEN
"
_info
"Deleting resource record
$fulldomain
"
response
=
"
$(
_get
"
$NANELO_API$NANELO_TOKEN
/dns/deleterecord?type=TXT&ttl=60&name=
${
fulldomain
}
&value=
${
txtvalue
}
"
)
"
if
_contains
"
${
response
}
"
'success'
;
then
return
0
fi
_err
"Could not delete resource record, please check the logs"
_err
"
${
response
}
"
return
1
}
dnsapi/dns_openstack.sh
View file @
a3f4cb15
...
@@ -57,16 +57,16 @@ _dns_openstack_create_recordset() {
...
@@ -57,16 +57,16 @@ _dns_openstack_create_recordset() {
if
[
-z
"
$_recordset_id
"
]
;
then
if
[
-z
"
$_recordset_id
"
]
;
then
_info
"Creating a new recordset"
_info
"Creating a new recordset"
if
!
_recordset_id
=
$(
openstack recordset create
-c
id
-f
value
--type
TXT
--record
"
$txtvalue
"
"
$_zone_id
"
"
$fulldomain
."
)
;
then
if
!
_recordset_id
=
$(
openstack recordset create
-c
id
-f
value
--type
TXT
--record
=
"
$txtvalue
"
"
$_zone_id
"
"
$fulldomain
."
)
;
then
_err
"No recordset ID found after create"
_err
"No recordset ID found after create"
return
1
return
1
fi
fi
else
else
_info
"Updating existing recordset"
_info
"Updating existing recordset"
# Build new list of --record
<rec> args for update
# Build new list of --record
=
<rec> args for update
_record_args
=
"--record
$txtvalue
"
_record_args
=
"--record
=
$txtvalue
"
for
_rec
in
$_records
;
do
for
_rec
in
$_records
;
do
_record_args
=
"
$_record_args
--record
$_rec
"
_record_args
=
"
$_record_args
--record
=
$_rec
"
done
done
# shellcheck disable=SC2086
# shellcheck disable=SC2086
if
!
_recordset_id
=
$(
openstack recordset
set
-c
id
-f
value
$_record_args
"
$_zone_id
"
"
$fulldomain
."
)
;
then
if
!
_recordset_id
=
$(
openstack recordset
set
-c
id
-f
value
$_record_args
"
$_zone_id
"
"
$fulldomain
."
)
;
then
...
@@ -107,13 +107,13 @@ _dns_openstack_delete_recordset() {
...
@@ -107,13 +107,13 @@ _dns_openstack_delete_recordset() {
fi
fi
else
else
_info
"Found existing records, updating recordset"
_info
"Found existing records, updating recordset"
# Build new list of --record
<rec> args for update
# Build new list of --record
=
<rec> args for update
_record_args
=
""
_record_args
=
""
for
_rec
in
$_records
;
do
for
_rec
in
$_records
;
do
if
[
"
$_rec
"
=
"
$txtvalue
"
]
;
then
if
[
"
$_rec
"
=
"
$txtvalue
"
]
;
then
continue
continue
fi
fi
_record_args
=
"
$_record_args
--record
$_rec
"
_record_args
=
"
$_record_args
--record
=
$_rec
"
done
done
# shellcheck disable=SC2086
# shellcheck disable=SC2086
if
!
openstack recordset
set
-c
id
-f
value
$_record_args
"
$_zone_id
"
"
$fulldomain
."
>
/dev/null
;
then
if
!
openstack recordset
set
-c
id
-f
value
$_record_args
"
$_zone_id
"
"
$fulldomain
."
>
/dev/null
;
then
...
...
dnsapi/dns_vultr.sh
View file @
a3f4cb15
...
@@ -78,7 +78,7 @@ dns_vultr_rm() {
...
@@ -78,7 +78,7 @@ dns_vultr_rm() {
return
1
return
1
fi
fi
_record_id
=
"
$(
echo
"
$response
"
|
tr
'{}'
'\n'
|
grep
'"TXT"'
|
grep
--
"
$txtvalue
"
|
tr
','
'\n'
|
grep
-i
'id'
|
cut
-d
:
-f
2
)
"
_record_id
=
"
$(
echo
"
$response
"
|
tr
'{}'
'\n'
|
grep
'"TXT"'
|
grep
--
"
$txtvalue
"
|
tr
','
'\n'
|
grep
-i
'id'
|
cut
-d
:
-f
2
|
tr
-d
'"'
)
"
_debug _record_id
"
$_record_id
"
_debug _record_id
"
$_record_id
"
if
[
"
$_record_id
"
]
;
then
if
[
"
$_record_id
"
]
;
then
_info
"Successfully retrieved the record id for ACME challenge."
_info
"Successfully retrieved the record id for ACME challenge."
...
@@ -116,7 +116,7 @@ _get_root() {
...
@@ -116,7 +116,7 @@ _get_root() {
return
1
return
1
fi
fi
if
printf
"%s
\n
"
"
$response
"
|
grep
'^\{.*\}'
>
/dev/null
;
then
if
printf
"%s
\n
"
"
$response
"
|
grep
-E
'^\{.*\}'
>
/dev/null
;
then
if
_contains
"
$response
"
"
\"
domain
\"
:
\"
$_domain
\"
"
;
then
if
_contains
"
$response
"
"
\"
domain
\"
:
\"
$_domain
\"
"
;
then
_sub_domain
=
"
$(
echo
"
$fulldomain
"
|
sed
"s/
\\
.
$_domain
\$
//"
)
"
_sub_domain
=
"
$(
echo
"
$fulldomain
"
|
sed
"s/
\\
.
$_domain
\$
//"
)
"
return
0
return
0
...
...
notify/smtp.sh
View file @
a3f4cb15
...
@@ -169,7 +169,7 @@ _clean_email_header() {
...
@@ -169,7 +169,7 @@ _clean_email_header() {
# email
# email
_email_has_display_name
()
{
_email_has_display_name
()
{
_email
=
"
$1
"
_email
=
"
$1
"
e
xpr
"
$_email
"
:
'^.*[<>"]'
>
/dev/null
e
cho
"
$_email
"
|
grep
-q
-E
'^.*[<>"]'
}
}
##
##
...
@@ -249,7 +249,7 @@ _mime_encoded_word() {
...
@@ -249,7 +249,7 @@ _mime_encoded_word() {
_text
=
"
$1
"
_text
=
"
$1
"
# (regex character ranges like [a-z] can be locale-dependent; enumerate ASCII chars to avoid that)
# (regex character ranges like [a-z] can be locale-dependent; enumerate ASCII chars to avoid that)
_ascii
=
'] $`"'
"[!#%&'()*+,./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ~^_abcdefghijklmnopqrstuvwxyz{|}~-"
_ascii
=
'] $`"'
"[!#%&'()*+,./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ~^_abcdefghijklmnopqrstuvwxyz{|}~-"
if
e
xpr
"
$_text
"
:
"^.*[^
$_ascii
]"
>
/dev/null
;
then
if
e
cho
"
$_text
"
|
grep
-q
-E
"^.*[^
$_ascii
]"
;
then
# At least one non-ASCII char; convert entire thing to encoded word
# At least one non-ASCII char; convert entire thing to encoded word
printf
"%s"
"=?UTF-8?B?
$(
printf
"%s"
"
$_text
"
| _base64
)
?="
printf
"%s"
"=?UTF-8?B?
$(
printf
"%s"
"
$_text
"
| _base64
)
?="
else
else
...
...
Prev
1
2
Next
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