Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMM-12738-fix-certificate-conf #2704

Merged
merged 7 commits into from
Jan 18, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,42 @@
set -o errexit

mkdir -p /srv/nginx
if [ ! -w "/srv/nginx" ]; then
echo "Directory /srv/nginx is not writable";
error=false
if [ ! -e /srv/nginx/certificate.key ]
then
echo "The file /srv/nginx/certificate.key does not exist." >&2
error=true
fi

if [ ! -e /srv/nginx/certificate.crt ]
then
echo "The file /srv/nginx/certificate.crt does not exist." >&2
error=true
fi

if [ ! -e /srv/nginx/ca-certs.pem ]
then
echo "The file /srv/nginx/ca-certs.pem does not exist." >&2
error=true
fi

if [ ! -e /srv/nginx/dhparam.pem ]
then
echo "The file /srv/nginx/dhparam.pem does not exist." >&2
error=true
fi

if [ "$error" = true ]
then
echo "Exiting due to missing file(s)." >&2
exit 1;
else
ademidoff marked this conversation as resolved.
Show resolved Hide resolved
echo "Using existing self-signed certificate.";
exit 0;
ademidoff marked this conversation as resolved.
Show resolved Hide resolved
fi
fi

if [ ! -e /srv/nginx/dhparam.pem ]; then
cp /etc/nginx/ssl/dhparam.pem /srv/nginx/dhparam.pem
Expand All @@ -17,8 +53,8 @@ if [ ! -e /srv/nginx/certificate.conf ]; then
cp /etc/nginx/ssl/certificate.conf /srv/nginx/certificate.conf
fi

if [ ! -e /srv/nginx/certificate.key -o ! -e /srv/nginx/certificate.crt ]; then
if [ ! -e /etc/nginx/ssl/certificate.key -o ! -e /etc/nginx/ssl/certificate.crt ]; then
if [ ! -e /srv/nginx/certificate.key ] || [ ! -e /srv/nginx/certificate.crt ]; then
if [ ! -e /etc/nginx/ssl/certificate.key ] || [ ! -e /etc/nginx/ssl/certificate.crt ]; then
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /etc/nginx/ssl/certificate.key \
-out /etc/nginx/ssl/certificate.crt \
Expand Down
Loading