Support SSL for web interface

Thanks to @MasterofJOKers, here is basic support for SSL:
You need to create your key and certificate and copy them to the `data`
directory, named `ssl.cert` and `ssl.key`.
Then, set `PAPERLESS_USE_SSL` in `docker-compose.env` to `true`.

Solves #576.
This commit is contained in:
Fabian Winter
2019-11-03 18:24:03 +01:00
parent af27ce4183
commit d740b6d5e7
3 changed files with 15 additions and 2 deletions

View File

@@ -101,8 +101,14 @@ if [[ "$1" != "/"* ]]; then
if [[ "$1" = "gunicorn" ]]; then
shift
EXTRA_PARAMS=""
SSL_KEY_PATH="/usr/src/paperless/data/ssl.key"
SSL_CERT_PATH="/usr/src/paperless/data/ssl.cert"
if [ "${PAPERLESS_USE_SSL}" = "true" ] && [ -f "${SSL_KEY_PATH}" ] && [ -f "${SSL_CERT_PATH}" ]; then
EXTRA_PARAMS="--certfile=${SSL_CERT_PATH} --keyfile=${SSL_KEY_PATH}"
fi
cd /usr/src/paperless/src/ && \
exec sudo -HEu paperless /usr/bin/gunicorn -c /usr/src/paperless/gunicorn.conf "$@" paperless.wsgi
exec sudo -HEu paperless /usr/bin/gunicorn -c /usr/src/paperless/gunicorn.conf ${EXTRA_PARAMS} "$@" paperless.wsgi
else
exec sudo -HEu paperless "/usr/src/paperless/src/manage.py" "$@"
fi