Skip to content

Commit b000213

Browse files
committed
remove echobot from relay deployment and make sure it's un-installed during "cmdeploy run"
1 parent 51d16b6 commit b000213

File tree

14 files changed

+21
-281
lines changed

14 files changed

+21
-281
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## untagged
44

5+
- Remove echobot from relays
6+
([#753](https://github.com/chatmail/relay/pull/753))
7+
58
- Add robots.txt to exclude all web crawlers
69
([#732](https://github.com/chatmail/relay/pull/732))
710

chatmaild/pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "chatmaild"
7-
version = "0.2"
7+
version = "0.3"
88
dependencies = [
99
"aiosmtpd",
1010
"iniconfig",
@@ -25,7 +25,6 @@ where = ['src']
2525
doveauth = "chatmaild.doveauth:main"
2626
chatmail-metadata = "chatmaild.metadata:main"
2727
filtermail = "chatmaild.filtermail:main"
28-
echobot = "chatmaild.echo:main"
2928
chatmail-metrics = "chatmaild.metrics:main"
3029
chatmail-expire = "chatmaild.expire:main"
3130
chatmail-fsreport = "chatmaild.fsreport:main"

chatmaild/src/chatmaild/config.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
from chatmaild.user import User
66

7-
echobot_password_path = Path("/run/echobot/password")
8-
97

108
def read_config(inipath):
119
assert Path(inipath).exists(), inipath
@@ -72,10 +70,7 @@ def get_user(self, addr) -> User:
7270
raise ValueError(f"invalid address {addr!r}")
7371

7472
maildir = self.mailboxes_dir.joinpath(addr)
75-
if addr.startswith("echo@"):
76-
password_path = echobot_password_path
77-
else:
78-
password_path = maildir.joinpath("password")
73+
password_path = maildir.joinpath("password")
7974

8075
return User(maildir, addr, password_path, uid="vmail", gid="vmail")
8176

chatmaild/src/chatmaild/doveauth.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ def is_allowed_to_create(config: Config, user, cleartext_password) -> bool:
4040
return False
4141
localpart, domain = parts
4242

43-
if localpart == "echo":
44-
# echobot account should not be created in the database
45-
return False
46-
4743
if (
4844
len(localpart) > config.username_max_length
4945
or len(localpart) < config.username_min_length

chatmaild/src/chatmaild/echo.py

Lines changed: 0 additions & 109 deletions
This file was deleted.

chatmaild/src/chatmaild/tests/test_lastlogin.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,3 @@ def test_handle_dovecot_request_last_login(testaddr, example_config):
3636
res = dictproxy.handle_dovecot_request(msg, dictproxy_transactions)
3737
assert res == "O\n"
3838
assert len(dictproxy_transactions) == 0
39-
40-
41-
def test_handle_dovecot_request_last_login_echobot(example_config):
42-
dictproxy = LastLoginDictProxy(config=example_config)
43-
44-
authproxy = AuthDictProxy(config=example_config)
45-
testaddr = f"echo@{example_config.mail_domain}"
46-
authproxy.lookup_passdb(testaddr, "ignore")
47-
user = dictproxy.config.get_user(testaddr)
48-
49-
transactions = {}
50-
51-
# set last-login info for user
52-
tx = "1111"
53-
msg = f"B{tx}\t{testaddr}"
54-
res = dictproxy.handle_dovecot_request(msg, transactions)
55-
assert not res
56-
assert transactions == {tx: dict(addr=testaddr, res="O\n")}
57-
58-
timestamp = int(time.time())
59-
msg = f"S{tx}\tshared/last-login/{testaddr}\t{timestamp}"
60-
res = dictproxy.handle_dovecot_request(msg, transactions)
61-
assert not res
62-
assert len(transactions) == 1
63-
read_timestamp = user.get_last_login_timestamp()
64-
assert read_timestamp is None

cmdeploy/src/cmdeploy/cmdeploy.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,6 @@ def run_cmd(args, out):
109109
try:
110110
retcode = out.check_call(cmd, env=env)
111111
if retcode == 0:
112-
if not args.disable_mail:
113-
print("\nYou can try out the relay by talking to this echo bot: ")
114-
sshexec = SSHExec(args.config.mail_domain, verbose=args.verbose)
115-
print(
116-
sshexec(
117-
call=remote.rshell.shell,
118-
kwargs=dict(command="cat /var/lib/echobot/invite-link.txt"),
119-
)
120-
)
121112
out.green("Deploy completed, call `cmdeploy dns` next.")
122113
elif not remote_data["acme_account_url"]:
123114
out.red("Deploy completed but letsencrypt not configured")

cmdeploy/src/cmdeploy/deployers.py

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,14 @@ def install(self):
270270
path="/var/log/journal/",
271271
present=False,
272272
)
273+
# remove echobot if it is still running
274+
if host.get_fact(SystemdEnabled).get("echobot.service"):
275+
systemd.service(
276+
name="Disable echobot.service",
277+
service="echobot.service",
278+
running=False,
279+
enabled=False,
280+
)
273281

274282

275283
def check_config(config):
@@ -404,30 +412,6 @@ def activate(self):
404412
self.need_restart = False
405413

406414

407-
class EchobotDeployer(Deployer):
408-
#
409-
# This deployer depends on the dovecot and postfix deployers because
410-
# it needs to base its decision of whether to restart the service on
411-
# whether those two services were restarted.
412-
#
413-
def __init__(self, mail_domain):
414-
self.mail_domain = mail_domain
415-
self.units = ["echobot"]
416-
417-
def install(self):
418-
apt.packages(
419-
# required for setfacl for echobot
420-
name="Install acl",
421-
packages="acl",
422-
)
423-
424-
def configure(self):
425-
configure_remote_units(self.mail_domain, self.units)
426-
427-
def activate(self):
428-
activate_remote_units(self.units)
429-
430-
431415
class ChatmailVenvDeployer(Deployer):
432416
def __init__(self, config):
433417
self.config = config
@@ -590,7 +574,6 @@ def deploy_chatmail(config_path: Path, disable_mail: bool) -> None:
590574
PostfixDeployer(config, disable_mail),
591575
FcgiwrapDeployer(),
592576
NginxDeployer(config),
593-
EchobotDeployer(mail_domain),
594577
MtailDeployer(config.mtail_address),
595578
GithashDeployer(),
596579
]

cmdeploy/src/cmdeploy/service/echobot.service.f

Lines changed: 0 additions & 67 deletions
This file was deleted.

cmdeploy/src/cmdeploy/tests/online/test_1_basic.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ def test_status_cmd(chatmail_config, capsys, request):
8181
"chatmail-metadata",
8282
"doveauth",
8383
"dovecot",
84-
"echobot",
8584
"fcgiwrap",
8685
"filtermail-incoming",
8786
"filtermail",

0 commit comments

Comments
 (0)