This commit is contained in:
Shelvacu
2024-12-16 01:06:40 -08:00
committed by Shelvacu on fw
parent f660aecb4c
commit ba352cc49b
3 changed files with 2 additions and 81 deletions

View File

@@ -106,7 +106,7 @@
mail_plugins = $mail_plugins notify mail_log
plugin {
sieve_trace_debug = yes
# sieve_trace_debug = yes
mail_log_events = delete undelete expunge save copy mailbox_create mailbox_delete mailbox_rename flag_change
mail_log_fields = uid box msgid size from
}

View File

@@ -1,75 +0,0 @@
import sys
sys.argv.insert(1, "192.168.1.2")
import smtplib
import imaplib
import imap_tools
import time
import ssl
import argparse
import uuid
import requests
from typing import NamedTuple
#--mailfrom whoeve2@example.com --rcptto sieve2est@shelvacu.com --username shelvacu --imap-move-to testFolder --imap-dir testFolder
sys.argv.append("--mailfrom")
sys.argv.append("whoev2@example.com")
sys.argv.append("--rcptto")
sys.argv.append("sieve2est@shelvacu.com")
sys.argv.append("--username")
sys.argv.append("shelvacu")
sys.argv.append("--imap-move-to")
sys.argv.append("testFolder")
sys.argv.append("--imap-dir")
sys.argv.append("testFolder")
parser = argparse.ArgumentParser()
parser.add_argument('host', type = str)
parser.add_argument('--mailfrom', default = 'foo@example.com')
parser.add_argument('--rcptto', default = 'awesome@vacu.store')
parser.add_argument('--subject', default = 'Some test message')
parser.add_argument('--header', action = 'append', default = [])
parser.add_argument('--submission', default = False, action='store_true')
parser.add_argument('--smtp-starttls', default = None, action='store_true')
parser.add_argument('--imap-insecure', default = False, action = 'store_true')
parser.add_argument('--imap-move-to')
parser.add_argument('--imap-dir', default = None)
parser.add_argument('--username')
parser.add_argument('--password')
parser.add_argument('--expect-refused',
dest = 'expect',
action = 'store_const',
const = 'refused',
default = 'received'
)
parser.add_argument('--expect-flag', action = 'append', default = [])
parser.add_argument('--expect-sent', dest = 'expect', action = 'store_const', const = 'sent')
parser.add_argument('--expect-imap-error', dest = 'expect', action = 'store_const', const = 'imap_error')
parser.add_argument('--expect-mailpit-received', dest = 'expect', action = 'store_const', const = 'mailpit_received')
parser.add_argument('--expect-mailpit-not-received', dest = 'expect', action = 'store_const', const = 'mailpit_not_received')
parser.add_argument('--mailpit-url')
args = parser.parse_args()
print(f"got args {args!r}")
args.header.append(f"Subject: {args.subject}")
# smtp_starttls = args.smtp_starttls
# if smtp_starttls is None:
# smtp_starttls = args.submission
username = args.username
password = args.password
if password is None:
password = username
def mk_ctx():
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
return ctx
def connection() -> imap_tools.MailBox:
return imap_tools.MailBox(args.host, ssl_context = mk_ctx()).login(username, password)

View File

@@ -218,12 +218,8 @@ in
}")
checker.succeed("wget http://liam.dis8.net/.well-known/acme-challenge/test")
liam.wait_for_unit("dovecot2.service")
# workaround a bug in dovecot where moving to a not-yet-created but set-to-autocreate mailbox doesn't work
liam.succeed("doveadm mailbox create -u shelvacu INBOX")
liam.succeed("doveadm mailbox create -u shelvacu testFolder")
liam.succeed("doveadm mailbox create -u shelvacu MagicRefilter")
liam.wait_for_unit("postfix.service")
liam.wait_for_unit("dovecot2.service")
relay.wait_for_unit("mailpit.service")
checks = """