mirror of
https://github.com/chatmail/relay.git
synced 2026-05-11 16:34:39 +00:00
Compare commits
1 Commits
link2xt/py
...
link2xt/no
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15a9b4a2ef |
@@ -2,13 +2,13 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
|
import crypt
|
||||||
from socketserver import (
|
from socketserver import (
|
||||||
UnixStreamServer,
|
UnixStreamServer,
|
||||||
StreamRequestHandler,
|
StreamRequestHandler,
|
||||||
ThreadingMixIn,
|
ThreadingMixIn,
|
||||||
)
|
)
|
||||||
import pwd
|
import pwd
|
||||||
import subprocess
|
|
||||||
|
|
||||||
from .database import Database
|
from .database import Database
|
||||||
|
|
||||||
@@ -16,17 +16,9 @@ NOCREATE_FILE = "/etc/chatmail-nocreate"
|
|||||||
|
|
||||||
|
|
||||||
def encrypt_password(password: str):
|
def encrypt_password(password: str):
|
||||||
password = password.encode("ascii")
|
|
||||||
# https://doc.dovecot.org/configuration_manual/authentication/password_schemes/
|
# https://doc.dovecot.org/configuration_manual/authentication/password_schemes/
|
||||||
process = subprocess.Popen(
|
passhash = crypt.crypt(password, crypt.METHOD_SHA512)
|
||||||
["doveadm", "pw", "-s", "SHA512-CRYPT"],
|
return "{SHA512-CRYPT}" + passhash
|
||||||
stdin=subprocess.PIPE,
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
)
|
|
||||||
stdout_data, _stderr_data = process.communicate(
|
|
||||||
input=password + b"\n" + password + b"\n"
|
|
||||||
)
|
|
||||||
return stdout_data.decode("ascii").strip()
|
|
||||||
|
|
||||||
|
|
||||||
def create_user(db, user, password):
|
def create_user(db, user, password):
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ deploy-chatmail/venv/bin/pip install -e deploy-chatmail
|
|||||||
deploy-chatmail/venv/bin/pip install -e chatmaild
|
deploy-chatmail/venv/bin/pip install -e chatmaild
|
||||||
|
|
||||||
python3 -m venv chatmaild/venv
|
python3 -m venv chatmaild/venv
|
||||||
sudo apt install -y dovecot-core && sudo systemctl disable --now dovecot
|
|
||||||
chatmaild/venv/bin/pip install --upgrade pytest build 'setuptools>=68'
|
chatmaild/venv/bin/pip install --upgrade pytest build 'setuptools>=68'
|
||||||
chatmaild/venv/bin/pip install -e chatmaild
|
chatmaild/venv/bin/pip install -e chatmaild
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user