From e89d354834dd4ac229ecb08278e740e5aecc0179 Mon Sep 17 00:00:00 2001 From: Ionut Filip Date: Tue, 27 Nov 2018 19:36:24 +0200 Subject: [PATCH] Encrypted input db password --- setup/flavors/stack/docker-compose.yml | 6 ++++++ setup/server.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/setup/flavors/stack/docker-compose.yml b/setup/flavors/stack/docker-compose.yml index 98ba61b1..1506e761 100644 --- a/setup/flavors/stack/docker-compose.yml +++ b/setup/flavors/stack/docker-compose.yml @@ -13,6 +13,12 @@ services: volumes: - "{{ root }}/redis:/data" + {% if db_flavor == 'postgresql' and postgresql == 'internal' %} + database: + image: ${DOCKER_ORG:-mailu}/postgresql:${MAILU_VERSION:-{{ version }}} + env_file: {{ env }} + {% endif %} + # Core services front: image: ${DOCKER_ORG:-mailu}/nginx:${MAILU_VERSION:-{{ version }}} diff --git a/setup/server.py b/setup/server.py index 6f60c3c0..8c506a64 100644 --- a/setup/server.py +++ b/setup/server.py @@ -8,6 +8,7 @@ import uuid import string import random import ipaddress +import hashlib app = flask.Flask(__name__) @@ -77,6 +78,8 @@ def build_app(path): data = flask.request.form.copy() data['uid'] = str(uuid.uuid4()) data['dns'] = str(ipaddress.IPv4Network(data['subnet'])[-2]) + md5_password = hashlib.md5(data['db_pw'].encode()) + data['db_pw'] = md5_password.hexdigest() db.set(data['uid'], json.dumps(data)) return flask.redirect(flask.url_for('.setup', uid=data['uid']))