Auto create self-signed keys

If the USE_SSl var is true and the private key and certificate does not
exist, then automatically create self signed keys. The common name would
be invalid so you would have to change it later. This addition was added
so the server would not crash if USE_SSL is true and keys do not exist.
This commit is contained in:
Kelvin Chen 2015-11-11 00:10:08 -05:00
parent 3baef2d522
commit 85328b8eea
1 changed files with 6 additions and 0 deletions

View File

@ -12,6 +12,12 @@ cp -f /etc/nginx/common_default.conf /etc/nginx/common.conf
${USE_SSL:=false} ${USE_SSL:=false}
if $USE_SSL ; then if $USE_SSL ; then
echo "include ssl.conf;" >> /etc/nginx/common.conf echo "include ssl.conf;" >> /etc/nginx/common.conf
# Create self-signed certificate if using ssl and keys do not exist.
# You can always replace these with your own keys later.
if [[ ! -f /config/frontend/ssl.key || ! -f /config/frontend/ssl.crt ]]; then
ssl-gen seedbox
fi
fi fi
nginx -g "daemon off;" nginx -g "daemon off;"