-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not hardcode django secret key used in production
- Loading branch information
1 parent
ce948ee
commit 0b78e60
Showing
6 changed files
with
35 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.docker_container_id | ||
.docker_secret_key | ||
.docker_volume_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ | |
FROM debian:12 | ||
MAINTAINER Francesco Ballarin <[email protected]> | ||
|
||
ARG SECRET_KEY | ||
|
||
WORKDIR /root | ||
|
||
RUN apt update -y -q && \ | ||
|
@@ -20,7 +22,7 @@ RUN bash patches/turing/apply_patches.sh && \ | |
|
||
RUN cat <<EOF >> /root/turing/Turing/settings.ini | ||
[settings] | ||
SECRET_KEY=ab&v1v}7G+$*m$pg:zkUNHUhhYA&yKuWPETi!r{b?T{UXKuj=t | ||
SECRET_KEY=$SECRET_KEY | ||
DEBUG=True | ||
DEV_MODE=False | ||
ALLOWED_HOSTS=* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
# Copyright (C) 2024 by the Turing @ DMF authors | ||
# | ||
# This file is part of Turing @ DMF. | ||
# | ||
# SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
set -e | ||
|
||
SECRET_KEY_FILE=".docker_secret_key" | ||
if [[ -f "${SECRET_KEY_FILE}" ]]; then | ||
echo "A secret key already exists!" | ||
echo "If you want to destroy it and create a new one, please remove the ${SECRET_KEY_FILE} file" | ||
exit 1 | ||
else | ||
SECRET_KEY=$(cat /dev/urandom | tr -dc 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)' | head -c 50; echo) | ||
echo ${SECRET_KEY} > ${SECRET_KEY_FILE} | ||
fi |