Loading Dockerfile +0 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ COPY app/requirements.txt . RUN apk add --no-cache openssl \ && apk add --no-cache --virtual build-deps build-base libffi-dev openssl-dev \ && pip install --upgrade pip \ && pip install --no-cache-dir -r requirements.txt \ && apk del build-deps Loading app/forbidden_usernames 0 → 100644 +23 −0 Original line number Diff line number Diff line abuse hostmaster postmaster webmaster postmaster root sendmail postfix contact info sales marketing news newsletter eelo job jobs career admin legal apache postfix mysql No newline at end of file app/main.py +6 −1 Original line number Diff line number Diff line Loading @@ -39,12 +39,17 @@ class MyHandler(BaseHTTPRequestHandler): fallback_email: str, # new parameter nextcloud_quota: str # new parameter ): target_username = target_email.split('@')[0] with open('forbidden_usernames') as f: if target_username in f.read().splitlines(): self.respond(403, 'this username is not allowed') return # create account via postfixadmin ssh ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.MissingHostKeyPolicy) ssh.connect(hostname='postfixadmin', username='pfexec', password=os.environ['POSTFIXADMIN_SSH_PASSWORD']) ftp = ssh.open_sftp() temp_file_name = '/tmp/' + target_email.split('@')[0] + '-details' temp_file_name = '/tmp/' + target_username + target_email.split('@')[0] + '-details' temp_file = ftp.file(temp_file_name, 'w') temp_file.writeln(target_email) temp_file.writeln(password) Loading Loading
Dockerfile +0 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ COPY app/requirements.txt . RUN apk add --no-cache openssl \ && apk add --no-cache --virtual build-deps build-base libffi-dev openssl-dev \ && pip install --upgrade pip \ && pip install --no-cache-dir -r requirements.txt \ && apk del build-deps Loading
app/forbidden_usernames 0 → 100644 +23 −0 Original line number Diff line number Diff line abuse hostmaster postmaster webmaster postmaster root sendmail postfix contact info sales marketing news newsletter eelo job jobs career admin legal apache postfix mysql No newline at end of file
app/main.py +6 −1 Original line number Diff line number Diff line Loading @@ -39,12 +39,17 @@ class MyHandler(BaseHTTPRequestHandler): fallback_email: str, # new parameter nextcloud_quota: str # new parameter ): target_username = target_email.split('@')[0] with open('forbidden_usernames') as f: if target_username in f.read().splitlines(): self.respond(403, 'this username is not allowed') return # create account via postfixadmin ssh ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.MissingHostKeyPolicy) ssh.connect(hostname='postfixadmin', username='pfexec', password=os.environ['POSTFIXADMIN_SSH_PASSWORD']) ftp = ssh.open_sftp() temp_file_name = '/tmp/' + target_email.split('@')[0] + '-details' temp_file_name = '/tmp/' + target_username + target_email.split('@')[0] + '-details' temp_file = ftp.file(temp_file_name, 'w') temp_file.writeln(target_email) temp_file.writeln(password) Loading