[docker] added SESSION_KEY environment variable for initial configuration
Simon Schön committed
Jul 23, 2022 at 13:22 UTC
558fe0ad6419db584a45782b919f7b7de0690ebe
2 files changed
+5
docker/Dockerfile
+1
@@ -64,6 +64,7 @@ ENV LOCALSESSIONRECORDING="false"
64
ENV MINIFY="true"
65
ENV WEBRTC="false"
66
ENV IFRAME="false"
67
+ENV SESSION_KEY=""
68
ENV REVERSE_PROXY="false"
69
ENV REVERSE_PROXY_TLS_PORT=""
70
docker/startup.sh
+4
@@ -15,6 +15,10 @@ if [ -f "meshcentral-data/${CONFIG_FILE}" ]
15
sed -i "s/\"minify\": true/\"minify\": $MINIFY/" meshcentral-data/${CONFIG_FILE}
16
sed -i "s/\"WebRTC\": false/\"WebRTC\": $WEBRTC/" meshcentral-data/${CONFIG_FILE}
17
sed -i "s/\"AllowFraming\": false/\"AllowFraming\": $IFRAME/" meshcentral-data/${CONFIG_FILE}
18
+ if [ -z "$SESSION_KEY" ]; then
19
+ SESSION_KEY="$(cat /dev/urandom | tr -dc 'A-Za-z0-9!#$%&()*+,-./:;<=>?@[\]^_`{|}~' | fold -w 32 | head -n 1)";
20
+ fi
21
+ sed -i "s/\"_sessionKey\": \"MyReallySecretPassword1\"/\"sessionKey\": \"$SESSION_KEY\"/" meshcentral-data/${CONFIG_FILE}
22
if [ "$REVERSE_PROXY" != "false" ]; then
23
sed -i "s/\"_certUrl\": \"my\.reverse\.proxy\"/\"certUrl\": \"https:\/\/$REVERSE_PROXY:$REVERSE_PROXY_TLS_PORT\"/" meshcentral-data/${CONFIG_FILE}
24
node meshcentral/meshcentral --configfile ${CONFIG_FILE}