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
6ae8d101
Commit
6ae8d101
authored
Dec 13, 2020
by
neil
Browse files
support ip cert: rfc
https://tools.ietf.org/html/rfc8738
parent
7d249b6d
Changes
1
Show whitespace changes
Inline
Side-by-side
acme.sh
View file @
6ae8d101
...
...
@@ -59,6 +59,9 @@ VTYPE_HTTP="http-01"
VTYPE_DNS
=
"dns-01"
VTYPE_ALPN
=
"tls-alpn-01"
ID_TYPE_DNS
=
"dns"
ID_TYPE_IP
=
"ip"
LOCAL_ANY_ADDRESS
=
"0.0.0.0"
DEFAULT_RENEW
=
60
...
...
@@ -1222,19 +1225,26 @@ _createcsr() {
if
[
"
$acmeValidationv1
"
]
;
then
domainlist
=
"
$(
_idn
"
$domainlist
"
)
"
printf
--
"
\n
subjectAltName=DNS:
$domainlist
"
>>
"
$csrconf
"
_debug2 domainlist
"
$domainlist
"
for
dl
in
$(
echo
"
$domainlist
"
|
tr
","
' '
)
;
do
if
[
"
$alt
"
]
;
then
alt
=
"
$alt
,
$(
_getIdType
"
$dl
"
| _upper_case
)
:
$dl
"
else
alt
=
"
$(
_getIdType
"
$dl
"
| _upper_case
)
:
$dl
"
fi
done
printf
--
"
\n
subjectAltName=
$alt
"
>>
"
$csrconf
"
elif
[
-z
"
$domainlist
"
]
||
[
"
$domainlist
"
=
"
$NO_VALUE
"
]
;
then
#single domain
_info
"Single domain"
"
$domain
"
printf
--
"
\n
subjectAltName=
DNS
:
$(
_idn
"
$domain
"
)
"
>>
"
$csrconf
"
printf
--
"
\n
subjectAltName=
$(
_getIdType
"
$domain
"
| _upper_case
)
:
$(
_idn
"
$domain
"
)
"
>>
"
$csrconf
"
else
domainlist
=
"
$(
_idn
"
$domainlist
"
)
"
_debug2 domainlist
"
$domainlist
"
if
_contains
"
$domainlist
"
","
;
then
alt
=
"DNS:
$(
_idn
"
$domain
"
)
,DNS:
$(
echo
"
$domainlist
"
|
sed
"s/,,/,/g"
|
sed
"s/,/,DNS:/g"
)
"
else
alt
=
"DNS:
$(
_idn
"
$domain
"
)
,DNS:
$domainlist
"
fi
alt
=
"
$(
_getIdType
"
$domain
"
| _upper_case
)
:
$domain
"
for
dl
in
$(
echo
"
$domainlist
"
|
tr
","
' '
)
;
do
alt
=
"
$alt
,
$(
_getIdType
"
$dl
"
| _upper_case
)
:
$dl
"
done
#multi
_info
"Multi domain"
"
$alt
"
printf
--
"
\n
subjectAltName=
$alt
"
>>
"
$csrconf
"
...
...
@@ -4174,6 +4184,36 @@ _match_issuer() {
_contains
"
$_rootissuer
"
"
$_missuer
"
}
#ip
_isIPv4
()
{
for
seg
in
$(
echo
"
$1
"
|
tr
'.'
' '
)
;
do
if
[
$seg
-ge
0
]
2>/dev/null
&&
[
$seg
-le
255
]
2>/dev/null
;
then
continue
fi
return
1
done
return
0
}
#ip6
_isIPv6
()
{
_contains
"
$1
"
":"
}
#ip
_isIP
()
{
_isIPv4
"
$1
"
||
_isIPv6
"
$1
"
}
#identifier
_getIdType
()
{
if
_isIP
"
$1
"
;
then
echo
"
$ID_TYPE_IP
"
;
else
echo
"
$ID_TYPE_DNS
"
;
fi
}
#webroot, domain domainlist keylength
issue
()
{
if
[
-z
"
$2
"
]
;
then
...
...
@@ -4330,7 +4370,7 @@ issue() {
dvsep
=
','
if
[
-z
"
$vlist
"
]
;
then
#make new order request
_identifiers
=
"{
\"
type
\"
:
\"
dns
\"
,
\"
value
\"
:
\"
$(
_idn
"
$_main_domain
"
)
\"
}"
_identifiers
=
"{
\"
type
\"
:
\"
$(
_getIdType
"
$_main_domain
"
)
\"
,
\"
value
\"
:
\"
$(
_idn
"
$_main_domain
"
)
\"
}"
_w_index
=
1
while
true
;
do
d
=
"
$(
echo
"
$_alt_domains
,"
|
cut
-d
,
-f
"
$_w_index
"
)
"
...
...
@@ -4339,7 +4379,7 @@ issue() {
if
[
-z
"
$d
"
]
;
then
break
fi
_identifiers
=
"
$_identifiers
,{
\"
type
\"
:
\"
dns
\"
,
\"
value
\"
:
\"
$(
_idn
"
$d
"
)
\"
}"
_identifiers
=
"
$_identifiers
,{
\"
type
\"
:
\"
$(
_getIdType
"
$d
"
)
\"
,
\"
value
\"
:
\"
$(
_idn
"
$d
"
)
\"
}"
done
_debug2 _identifiers
"
$_identifiers
"
if
!
_send_signed_request
"
$ACME_NEW_ORDER
"
"{
\"
identifiers
\"
: [
$_identifiers
]}"
;
then
...
...
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