mirror of
https://github.com/chatmail/relay.git
synced 2026-10-22 05:44:16 +00:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c155e699d5 | ||
|
|
eec041a44e | ||
|
|
f27de2ad24 | ||
|
|
a3693f07c5 | ||
|
|
305d83fff3 |
@@ -167,6 +167,24 @@ class Deployer:
|
||||
return self.put_template(src, dest, **kwargs)
|
||||
return self.put_file(src, dest)
|
||||
|
||||
def comment_out(self, path: str, config_key: str, config_value: str = "", comment_char: str = "#", **kwargs):
|
||||
"""Comment out a config parameter in a file with a
|
||||
|
||||
:param path: the config file to change
|
||||
:param config_key: the key which should be commented out
|
||||
:param config_value: the value that should be in the leftover comment
|
||||
:param comment_char: the character the config file uses to comment out
|
||||
"""
|
||||
res = files.line(
|
||||
name=f"Comment out {config_key} in {path}",
|
||||
path=path ,
|
||||
line=f"^({comment_char}|){config_key}=(.*)",
|
||||
replace = f"{comment_char}{config_key}={config_value}",
|
||||
extended_regex = True,
|
||||
**kwargs,
|
||||
)
|
||||
return self._update_restart_signals(path, res)
|
||||
|
||||
def put_file(self, src, dest, mode="644", **kwargs):
|
||||
if isinstance(src, str):
|
||||
src = get_resource(src)
|
||||
|
||||
@@ -354,7 +354,11 @@ class IrohDeployer(Deployer):
|
||||
|
||||
class JournaldDeployer(Deployer):
|
||||
def configure(self):
|
||||
self.put_file("journald.conf", "/etc/systemd/journald.conf")
|
||||
overwrite_path = "/etc/systemd/journald.conf.d/90-volatile-logging.conf"
|
||||
journald_conf = "/etc/systemd/journald.conf"
|
||||
self.put_file("90-volatile-logging.conf", overwrite_path)
|
||||
self.comment_out(journald_conf, "MaxRetentionSec", f"3d # set in {overwrite_path}")
|
||||
self.comment_out(journald_conf, "Storage", f"volatile # set in {overwrite_path}")
|
||||
|
||||
def activate(self):
|
||||
self.ensure_service("systemd-journald.service")
|
||||
|
||||
@@ -127,6 +127,7 @@ lmtp-filtermail_destination_concurrency_limit=10000
|
||||
|
||||
# Do not try to deliver messages for more than 2 days.
|
||||
maximal_queue_lifetime = 2d
|
||||
bounce_queue_lifetime = 2d
|
||||
|
||||
{% if not config.ipv4_relay %}
|
||||
# DKIM-sign locally generated mail (bounces, DSNs).
|
||||
|
||||
@@ -91,7 +91,7 @@ def test_concurrent_logins_same_account(
|
||||
|
||||
def test_no_vrfy(cmfactory, chatmail_config, maildomain):
|
||||
ac = cmfactory.get_online_account()
|
||||
addr = ac.get_config("addr")
|
||||
addr = ac.list_transports()[0]["addr"]
|
||||
|
||||
s = smtplib.SMTP(maildomain)
|
||||
s.starttls()
|
||||
|
||||
@@ -133,8 +133,8 @@ def test_use_two_chatmailservers(cmfactory, maildomain2):
|
||||
ac1 = cmfactory.get_online_account()
|
||||
ac2 = cmfactory.get_online_account(domain=maildomain2)
|
||||
cmfactory.get_accepted_chat(ac1, ac2)
|
||||
domain1 = ac1.get_config("addr").split("@")[1]
|
||||
domain2 = ac2.get_config("addr").split("@")[1]
|
||||
domain1 = ac1.list_transports()[0]["addr"].split("@")[1]
|
||||
domain2 = ac2.list_transports()[0]["addr"].split("@")[1]
|
||||
assert domain1 != domain2
|
||||
|
||||
|
||||
|
||||
@@ -15,8 +15,10 @@ from cmdeploy.remote import rshell
|
||||
@pytest.fixture
|
||||
def imap_mailbox(cmfactory, ssl_context):
|
||||
(ac1,) = cmfactory.get_online_accounts(1)
|
||||
user = ac1.get_config("addr")
|
||||
password = ac1.get_config("mail_pw")
|
||||
# Delta Chat 2.63 stopped writing the legacy addr and mail_pw config keys.
|
||||
transport = ac1.list_transports()[0]
|
||||
user = transport["addr"]
|
||||
password = transport["password"]
|
||||
host = user.split("@")[1].strip("[").strip("]")
|
||||
mailbox = imap_tools.MailBox(host, ssl_context=ssl_context)
|
||||
mailbox.login(user, password)
|
||||
@@ -88,7 +90,7 @@ class TestEndToEndDeltaChat:
|
||||
ac1, ac2 = cmfactory.get_online_accounts(2)
|
||||
chat = cmfactory.get_accepted_chat(ac1, ac2)
|
||||
|
||||
user = ac2.get_config("configured_addr")
|
||||
user = ac2.list_transports()[0]["addr"]
|
||||
|
||||
def parse_size_limit(limit: str) -> int:
|
||||
"""Parse a size limit and return the number of bytes as integer.
|
||||
@@ -190,9 +192,10 @@ def test_hide_senders_ip_address(cmfactory, ssl_context):
|
||||
|
||||
chat.send_text("testing submission header cleanup")
|
||||
user2.wait_for_incoming_msg()
|
||||
addr = user2.get_config("addr")
|
||||
transport = user2.list_transports()[0]
|
||||
addr = transport["addr"]
|
||||
host = addr.split("@")[1].strip("[").strip("]")
|
||||
pw = user2.get_config("mail_pw")
|
||||
pw = transport["password"]
|
||||
mailbox = imap_tools.MailBox(host, ssl_context=ssl_context)
|
||||
mailbox.login(addr, pw)
|
||||
msgs = list(mailbox.fetch(mark_seen=False))
|
||||
|
||||
Reference in New Issue
Block a user