mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 17:38:54 +00:00
712fc63f93
* Normalize Flask initialization API use. * Use Flask-Talisman. * Enable HSTS when HTTPS is enforced. * More details about how CSP is formatted and write CSP directives as a string. * Use CSP frame-ancestors directive and not X-Frame-Options for embedable endpoints. * Add link to flask-talisman docs. * set remember_token cookie to be HTTP-Only and Secure * Reorganize secret key configuration to be forward thinking and backward compatible.
22 lines
782 B
Bash
22 lines
782 B
Bash
#!/bin/sh
|
|
|
|
FLAG="/var/log/generate_secrets.log"
|
|
if [ ! -f $FLAG ]; then
|
|
COOKIE_SECRET=$(pwgen -1s 32)
|
|
SECRET_KEY=$(pwgen -1s 32)
|
|
POSTGRES_PASSWORD=$(pwgen -1s 32)
|
|
REDASH_DATABASE_URL="postgresql:\/\/postgres:$POSTGRES_PASSWORD@postgres\/postgres"
|
|
|
|
sed -i "s/REDASH_COOKIE_SECRET=.*/REDASH_COOKIE_SECRET=$COOKIE_SECRET/g" /opt/redash/env
|
|
sed -i "s/REDASH_SECRET_KEY=.*/REDASH_SECRET_KEY=$SECRET_KEY/g" /opt/redash/env
|
|
sed -i "s/POSTGRES_PASSWORD=.*/POSTGRES_PASSWORD=$POSTGRES_PASSWORD/g" /opt/redash/env
|
|
sed -i "s/REDASH_DATABASE_URL=.*/REDASH_DATABASE_URL=$REDASH_DATABASE_URL/g" /opt/redash/env
|
|
|
|
#the next line creates an empty file so it won't run the next boot
|
|
echo "$(date) Updated secrets." >> $FLAG
|
|
else
|
|
echo "Secrets already set, skipping."
|
|
fi
|
|
|
|
exit 0
|