Refactor default_server_san() - Quote all expansions (#494)

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
This commit is contained in:
Richard T Bonhomme 2022-04-22 17:21:27 +01:00
parent 757b2776d7
commit 2a9cd44902
No known key found for this signature in database
GPG Key ID: 2D767DB92FB6C246

View File

@ -1908,10 +1908,10 @@ display_dn() {
# generate default SAN from req/X509, passed by full pathname # generate default SAN from req/X509, passed by full pathname
default_server_san() { default_server_san() {
path="$1" path="$1"
cn=$( cn="$(
easyrsa_openssl req -in "$path" -noout -subject -nameopt sep_multiline | easyrsa_openssl req -in "$path" -noout -subject -nameopt sep_multiline |
awk -F'=' '/^ *CN=/{print $2}' awk -F'=' '/^ *CN=/{print $2}'
) )"
if echo "$cn" | grep -E -q '^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$'; then if echo "$cn" | grep -E -q '^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$'; then
print "subjectAltName = IP:$cn" print "subjectAltName = IP:$cn"