mirror of
https://github.com/linuxserver/docker-ldap-auth.git
synced 2026-02-20 01:01:02 +08:00
more py3 fixes
This commit is contained in:
parent
42fa7ba2c2
commit
ffbb63bc0c
@ -136,6 +136,7 @@ class AppHandler(BaseHTTPRequestHandler):
|
||||
|
||||
cipher_suite = Fernet(REPLACEWITHFERNETKEY)
|
||||
enc = cipher_suite.encrypt(ensure_bytes(user + ':' + passwd))
|
||||
enc = enc.decode()
|
||||
self.send_header('Set-Cookie', 'nginxauth=' + enc + '; httponly')
|
||||
|
||||
self.send_header('Location', target)
|
||||
|
||||
@ -87,7 +87,8 @@ class AuthHandler(BaseHTTPRequestHandler):
|
||||
try:
|
||||
cipher_suite = Fernet(REPLACEWITHFERNETKEY)
|
||||
self.log_message('Trying to dechipher credentials...')
|
||||
auth_decoded = cipher_suite.decrypt(auth_header[6:])
|
||||
auth_decoded = auth_header[6:].encode()
|
||||
auth_decoded = cipher_suite.decrypt(auth_decoded)
|
||||
auth_decoded = auth_decoded.decode("utf-8")
|
||||
user, passwd = auth_decoded.split(':', 1)
|
||||
except InvalidToken:
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
# generate fernet key for ldap if it doesn't exist
|
||||
[[ $(cat /app/ldap-backend-app.py | grep 'REPLACEWITHFERNETKEY') ]] && \
|
||||
FERNETKEY=$(python3 /app/fernet-key.py) && \
|
||||
sed -i "s/REPLACEWITHFERNETKEY/${FERNETKEY}/" /app/ldap-backend-app.py && \
|
||||
sed -i "s/REPLACEWITHFERNETKEY/${FERNETKEY}/" /app/nginx-ldap-auth-daemon.py
|
||||
if grep -q 'REPLACEWITHFERNETKEY' /app/ldap-backend-app.py; then
|
||||
FERNETKEY=$(python3 /app/fernet-key.py)
|
||||
sed -i "s/REPLACEWITHFERNETKEY/${FERNETKEY}/" /app/ldap-backend-app.py
|
||||
sed -i "s/REPLACEWITHFERNETKEY/${FERNETKEY}/" /app/nginx-ldap-auth-daemon.py
|
||||
echo "generated fernet key"
|
||||
fi
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user