Skip to content

Commit ce3ca0f

Browse files
committed
fix: -S option without -s option
1 parent 2b8fc04 commit ce3ca0f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

sslcert-cli

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,11 @@ ssl_create() {
145145
local CA_FQDN_CRT_FILE="${OPTIONS["OUTPUT_DIR"]}/${OPTIONS["FQDN"]}.ca.crt"
146146
echo "# Generate CA private key and CRT files: ${CA_FQDN_CRT_FILE}"
147147
# Use the same private key and options
148-
openssl req -new -x509 -sha256 -days "${OPTIONS["EXPIRE_DAYS"]}" -key "${FQDN_PRIVATE_KEY}" -out "${CA_FQDN_CRT_FILE}" -subj "${OPTIONS["SUBJECT"]}"
148+
if [[ -z "${OPTIONS["SUBJECT"]}" ]]; then
149+
openssl req -new -x509 -sha256 -days "${OPTIONS["EXPIRE_DAYS"]}" -key "${FQDN_PRIVATE_KEY}" -out "${CA_FQDN_CRT_FILE}"
150+
else
151+
openssl req -new -x509 -sha256 -days "${OPTIONS["EXPIRE_DAYS"]}" -key "${FQDN_PRIVATE_KEY}" -out "${CA_FQDN_CRT_FILE}" -subj "${OPTIONS["SUBJECT"]}"
152+
fi
149153

150154
# Server certificate
151155
# SAN: Subject Alternative Name

0 commit comments

Comments
 (0)