diff --git a/setup/start.sh b/setup/start.sh index 2801e3239..cb2471d55 100755 --- a/setup/start.sh +++ b/setup/start.sh @@ -123,8 +123,13 @@ if [[ -f "${DATA_DIR}/box/certs/host.cert" && -f "${DATA_DIR}/box/certs/host.key cp "${DATA_DIR}/box/certs/host.cert" "${DATA_DIR}/nginx/cert/host.cert" cp "${DATA_DIR}/box/certs/host.key" "${DATA_DIR}/nginx/cert/host.key" else - echo "${arg_tls_cert}" > "${DATA_DIR}/nginx/cert/host.cert" - echo "${arg_tls_key}" > "${DATA_DIR}/nginx/cert/host.key" + 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 + else + echo "${arg_tls_cert}" > "${DATA_DIR}/nginx/cert/host.cert" + echo "${arg_tls_key}" > "${DATA_DIR}/nginx/cert/host.key" + fi fi set_progress "33" "Changing ownership"