Browse Source

init secrets via /dev/random

/ # nc postsrsd 10001
get fabianpeter@test.local
500 No secrets in SRS configuration.
Fabian Peter Hammerle 4 years ago
parent
commit
c2f7872652
1 changed files with 5 additions and 1 deletions
  1. 5 1
      Dockerfile

+ 5 - 1
Dockerfile

@@ -19,4 +19,8 @@ EXPOSE 10001/tcp
 EXPOSE 10002/tcp
 
 # > Cannot open file with secret: /etc/postsrsd/secrets/list
-CMD touch "$SRS_SECRET" && postsrsd -l0.0.0.0 -e
+CMD set -x; \
+    if [ ! -f "$SRS_SECRET" ]; \
+        then tr -dc '1-9a-zA-Z' < /dev/random | head -c 32 > "$SRS_SECRET"; \
+    fi \
+    && postsrsd -l0.0.0.0 -e