Browse Source

run initial secret creation as root

root 7 months ago
parent
commit
321bf9b617
3 changed files with 4 additions and 5 deletions
  1. 1 2
      build/Dockerfile
  2. 2 2
      build/totp/new-secret.py
  3. 1 1
      new-secret.sh

+ 1 - 2
build/Dockerfile

@@ -1,7 +1,6 @@
 FROM alpine:3.16
 RUN  apk add tzdata python3 py3-pip && \
-     pip3 install --upgrade pyotp pyqrcode && \
-     mkdir /mnt/secret && chown -R 1000:1000 /mnt/secret
+     pip3 install --upgrade pyotp pyqrcode
 
 COPY --chown=1000:1000 totp/ /opt/totp
 

+ 2 - 2
build/totp/new-secret.py

@@ -15,10 +15,10 @@ TOTP_URL=pyotp.totp.TOTP(TOTP_SECRET).provisioning_uri(email, issuer_name=issuer
 #print(TOTP_SECRET)
 #print(pyqrcode.create(TOTP_URL).terminal(quiet_zone=1))
 
-env = open('/mnt/secret/.env', 'w')
+env = open('/mnt/.env', 'w')
 env.write("SECRET=" + TOTP_SECRET)
 env.close()
 
-qr = open('/mnt/secret/secret.qr', 'w')
+qr = open('/mnt/secret.qr', 'w')
 qr.write(pyqrcode.create(TOTP_URL).terminal(quiet_zone=1))
 qr.close()

+ 1 - 1
new-secret.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 
-docker run -it --rm -v $PWD:/mnt/secret toastie89/totp-auth new-secret.py
+docker run -it --rm -u 0 -v $PWD:/mnt/secret toastie89/totp-auth new-secret.py