rename doveauth-dictproxy to doveauth

This commit is contained in:
missytake 2023-11-14 20:38:15 +01:00
parent 322bc9a3aa
commit af90d0a7de
6 changed files with 19 additions and 8 deletions

View File

@ -81,10 +81,11 @@ comprised of minimal setups of
as well as two custom services that are integrated with these two:
- `chatmaild/src/chatmaild/dictproxy.py` implements
- `chatmaild/src/chatmaild/doveauth.py` implements
create-on-login account creation semantics and is used
by Dovecot during login authentication and by Postfix
which in turn uses Dovecot SASL to authenticate users
which in turn uses [Dovecot SASL](https://doc.dovecot.org/configuration_manual/authentication/dict/#complete-example-for-authenticating-via-a-unix-socket)
to authenticate users
to send mails for them.
- `chatmaild/src/chatmaild/filtermail.py` prevents

View File

@ -10,7 +10,7 @@ dependencies = [
]
[project.scripts]
doveauth-dictproxy = "chatmaild.dictproxy:main"
doveauth = "chatmaild.doveauth:main"
filtermail = "chatmaild.filtermail:main"
[tool.pytest.ini_options]

View File

@ -2,7 +2,7 @@
Description=Dict authentication proxy for dovecot
[Service]
ExecStart=/usr/local/bin/doveauth-dictproxy /run/dovecot/doveauth.socket vmail /home/vmail/passdb.sqlite
ExecStart=/usr/local/bin/doveauth /run/dovecot/doveauth.socket vmail /home/vmail/passdb.sqlite
Restart=always
RestartSec=30

View File

@ -7,6 +7,7 @@ from pathlib import Path
from pyinfra import host
from pyinfra.operations import apt, files, server, systemd
from pyinfra.facts.files import File
from pyinfra.facts.systemd import SystemdEnabled
from .acmetool import deploy_acmetool
@ -34,8 +35,17 @@ def _install_chatmaild() -> None:
commands=[f"pip install --break-system-packages {remote_path}"],
)
# disable legacy doveauth-dictproxy.service
if host.get_fact(SystemdEnabled).get("doveauth-dictproxy.service"):
systemd.service(
name="Disable legacy doveauth-dictproxy.service",
service="doveauth-dictproxy.service",
running=False,
enabled=False,
)
for fn in (
"doveauth-dictproxy",
"doveauth",
"filtermail",
):
files.put(

View File

@ -5,8 +5,8 @@ import threading
import queue
import traceback
import chatmaild.dictproxy
from chatmaild.dictproxy import get_user_data, lookup_passdb, handle_dovecot_request
import chatmaild.doveauth
from chatmaild.doveauth import get_user_data, lookup_passdb, handle_dovecot_request
from chatmaild.database import Database, DBError
@ -30,7 +30,7 @@ def test_dont_overwrite_password_on_wrong_login(db):
def test_nocreate_file(db, monkeypatch, tmpdir):
p = tmpdir.join("nocreate")
p.write("")
monkeypatch.setattr(chatmaild.dictproxy, "NOCREATE_FILE", str(p))
monkeypatch.setattr(chatmaild.doveauth, "NOCREATE_FILE", str(p))
lookup_passdb(db, "newuser1@something.org", "zequ0Aimuchoodaechik")
assert not get_user_data(db, "newuser1@something.org")