Create fallback certs only if fqdn is already set

This commit is contained in:
Johannes Zellner
2017-01-05 16:29:10 +01:00
parent 5b5ed9e043
commit 2d6d8a7ea8
+4 -2
View File
@@ -194,8 +194,10 @@ if [[ -f "${DATA_DIR}/box/certs/host.cert" && -f "${DATA_DIR}/box/certs/host.key
cp "${DATA_DIR}/box/certs/host.key" "${DATA_DIR}/nginx/cert/host.key"
else
if [[ -z "${arg_tls_cert}" || -z "${arg_tls_key}" ]]; then
echo "==> Creating fallback certs"
# openssl req -x509 -newkey rsa:2048 -keyout "${DATA_DIR}/nginx/cert/host.key" -out "${DATA_DIR}/nginx/cert/host.cert" -days 3650 -subj "/CN=${arg_fqdn}" -nodes
if [[ -n "${arg_fqdn}" ]]; then
echo "==> Creating fallback certs"
openssl req -x509 -newkey rsa:2048 -keyout "${DATA_DIR}/nginx/cert/host.key" -out "${DATA_DIR}/nginx/cert/host.cert" -days 3650 -subj "/CN=${arg_fqdn}" -nodes
fi
else
echo "${arg_tls_cert}" > "${DATA_DIR}/nginx/cert/host.cert"
echo "${arg_tls_key}" > "${DATA_DIR}/nginx/cert/host.key"