mirror of
https://github.com/chatmail/relay.git
synced 2026-05-13 09:24:43 +00:00
Compare commits
5 Commits
quota-test
...
link2xt/au
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e15094dd1 | ||
|
|
e19cce7c69 | ||
|
|
1d312f7cfe | ||
|
|
8bed8578ad | ||
|
|
0bfeb2ae5e |
@@ -4,14 +4,11 @@ protocols = imap lmtp
|
|||||||
|
|
||||||
auth_mechanisms = plain
|
auth_mechanisms = plain
|
||||||
|
|
||||||
mail_plugins = quota
|
auth_verbose = yes
|
||||||
mail_debug = yes
|
auth_debug = yes
|
||||||
|
auth_debug_passwords = yes
|
||||||
# uncomment this if you want to debug authentication and user creation
|
auth_verbose_passwords = plain
|
||||||
#auth_verbose = yes
|
auth_cache_size = 100M
|
||||||
#auth_debug = yes
|
|
||||||
#auth_debug_passwords = yes
|
|
||||||
#auth_verbose_passwords = plain
|
|
||||||
|
|
||||||
# Authentication for system users.
|
# Authentication for system users.
|
||||||
passdb {
|
passdb {
|
||||||
@@ -63,28 +60,13 @@ mail_privileged_group = vmail
|
|||||||
# Enable IMAP COMPRESS (RFC 4978).
|
# Enable IMAP COMPRESS (RFC 4978).
|
||||||
# <https://datatracker.ietf.org/doc/html/rfc4978.html>
|
# <https://datatracker.ietf.org/doc/html/rfc4978.html>
|
||||||
protocol imap {
|
protocol imap {
|
||||||
mail_plugins = $mail_plugins imap_zlib imap_quota
|
mail_plugins = $mail_plugins imap_zlib
|
||||||
}
|
|
||||||
|
|
||||||
protocol lmtp {
|
|
||||||
mail_plugins = $mail_plugins quota
|
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin {
|
plugin {
|
||||||
imap_compress_deflate_level = 6
|
imap_compress_deflate_level = 6
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin {
|
|
||||||
# for now we define static quota-rules for all users
|
|
||||||
quota = maildir:User quota
|
|
||||||
quota_rule = *:storage=100M
|
|
||||||
quota_max_mail_size=30M
|
|
||||||
quota_grace = 0
|
|
||||||
quota_over_flag_value = TRUE
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
service lmtp {
|
service lmtp {
|
||||||
user=vmail
|
user=vmail
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ submission inet n - y - - smtpd
|
|||||||
-o smtpd_recipient_restrictions=
|
-o smtpd_recipient_restrictions=
|
||||||
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
|
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
|
||||||
-o milter_macro_daemon_name=ORIGINATING
|
-o milter_macro_daemon_name=ORIGINATING
|
||||||
-o content_filter=filter:unix:private/filtermail
|
-o content_filter=filter:unix:private/filtemail
|
||||||
smtps inet n - y - - smtpd
|
smtps inet n - y - - smtpd
|
||||||
-o syslog_name=postfix/smtps
|
-o syslog_name=postfix/smtps
|
||||||
-o smtpd_tls_wrappermode=yes
|
-o smtpd_tls_wrappermode=yes
|
||||||
|
|||||||
@@ -1,8 +1,3 @@
|
|||||||
import os.path
|
|
||||||
import random
|
|
||||||
import time
|
|
||||||
|
|
||||||
|
|
||||||
class TestMailSending:
|
class TestMailSending:
|
||||||
def test_one_on_one(self, cmfactory, lp):
|
def test_one_on_one(self, cmfactory, lp):
|
||||||
ac1, ac2 = cmfactory.get_online_accounts(2)
|
ac1, ac2 = cmfactory.get_online_accounts(2)
|
||||||
@@ -14,32 +9,3 @@ class TestMailSending:
|
|||||||
lp.sec("wait for ac2 to receive message")
|
lp.sec("wait for ac2 to receive message")
|
||||||
msg2 = ac2._evtracker.wait_next_incoming_message()
|
msg2 = ac2._evtracker.wait_next_incoming_message()
|
||||||
assert msg2.text == "message0"
|
assert msg2.text == "message0"
|
||||||
|
|
||||||
def test_exceed_quota(self, cmfactory, lp, tmpdir):
|
|
||||||
ac1, ac2 = cmfactory.get_online_accounts(2)
|
|
||||||
chat = cmfactory.get_accepted_chat(ac1, ac2)
|
|
||||||
|
|
||||||
ac2.set_config("download_limit", 1024 * 2) # set download_limit to 2 KB avoid downloading all those 5MB files
|
|
||||||
|
|
||||||
lp.sec("ac1: send 25 5 MB files to ac2")
|
|
||||||
alphanumeric = "abcdefghijklmnopqrstuvwxyz1234567890"
|
|
||||||
for i in range(25):
|
|
||||||
attachment = tmpdir / f"attachment{i}"
|
|
||||||
with open(attachment, "w+") as f:
|
|
||||||
for j in range(1024 * 1024 * 5):
|
|
||||||
f.write(random.choice(alphanumeric))
|
|
||||||
|
|
||||||
print("Sent out msg", str(i))
|
|
||||||
chat.send_file(str(attachment))
|
|
||||||
|
|
||||||
ac2.wait_next_incoming_message()
|
|
||||||
lp.sec("ac2: check that at least one message failed")
|
|
||||||
failed = False
|
|
||||||
for i in range(25):
|
|
||||||
if chat.get_messages()[i].is_out_failed():
|
|
||||||
failed = True
|
|
||||||
print(chat.get_messages()[i].get_message_info())
|
|
||||||
try:
|
|
||||||
assert failed
|
|
||||||
except:
|
|
||||||
import pdb; pdb.set_trace()
|
|
||||||
|
|||||||
7
plan.txt
7
plan.txt
@@ -2,10 +2,13 @@
|
|||||||
|
|
||||||
## Dovecot goals/steps
|
## Dovecot goals/steps
|
||||||
|
|
||||||
- automatic expiry of messages older than M days
|
2. (holger) per-user storage quota (adaptive)
|
||||||
|
a) define a static 100MB per-user quota
|
||||||
|
|
||||||
|
3. automatic expiry of messages older than M days
|
||||||
- delete unconditionally messages older than 40 days
|
- delete unconditionally messages older than 40 days
|
||||||
|
|
||||||
- limit: configure max-connections per account
|
4. limit: max-connections per account
|
||||||
|
|
||||||
|
|
||||||
## Filtermail
|
## Filtermail
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ domain = os.environ.get("CHATMAIL_DOMAIN", "c3.testrun.org")
|
|||||||
print("connecting")
|
print("connecting")
|
||||||
conn = imaplib.IMAP4_SSL(domain)
|
conn = imaplib.IMAP4_SSL(domain)
|
||||||
print("logging in")
|
print("logging in")
|
||||||
conn.login(f"imapcapa", "pass")
|
conn.login(f"measure{time.time()}", "pass")
|
||||||
status, res = conn.capability()
|
status, res = conn.capability()
|
||||||
for capa in sorted(res[0].decode().split()):
|
for capa in sorted(res[0].decode().split()):
|
||||||
print(capa)
|
print(capa)
|
||||||
|
|||||||
Reference in New Issue
Block a user