Commit Graph

35 Commits

Author SHA1 Message Date
Tanguy Fardet 057b761178 Option to allow html/plaintext emails in lists 2022-10-10 12:15:29 +02:00
Adnan Maolood 02395e0471 Implement list visibility
Also consolidate list permissions columns into one default_access
column.
2022-06-14 14:19:13 +02:00
Drew DeVault e98f4d73b8 listssrht-lmtp: late reject on validation errors
This was initially changed, but these error messages are not good enough
for what postfix offers. We'll need a more robust solution.

This reverts commit 7e400a2665.
2021-12-01 08:48:20 +01:00
Drew DeVault 7e400a2665 listssrht-lmtp: early reject on validation error
send_error_for can cause an infinite loop on badly configured mail
servers.
2021-11-15 10:16:41 +01:00
Sol Fisher Romanoff 973109bd36 Make list names match [A-Za-z0-9._-]+
List names in URLs and email addresses are now case-insensitive.

Also prohibits use of '.git' and '.hg' as list names.
2021-08-11 09:41:32 +02:00
Drew DeVault bbd6f8e5f4 Re-introduce base64 email fixes
This may have caused issues before, but I'm unable to reproduce them
locally. I'm not certain that we correctly identified the cause.
Re-introducing these changes for a closer examination.

This reverts commit 3a789352fc.
This reverts commit 99886477c7.
2021-01-26 09:19:19 -05:00
Drew DeVault 3a789352fc Revert "Encode e-mails to base64 for Celery"
This was not adequately tested, and causes errors in
lists.sr.ht-process:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/listssrht/process.py", line 43, in wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/listssrht/process.py", line 547, in dispatch_message
    msgid = mail.get("Message-ID").strip()
AttributeError: 'NoneType' object has no attribute 'strip'

This reverts commit e3966d260c.
2021-01-25 10:12:57 -05:00
Simon Ser e3966d260c Encode e-mails to base64 for Celery
This patch allows 8bit messages to be forwarded as-is by lists.sr.ht.

We've been using str(mail) to convert a parsed message to a string.
However Python will convert any 8bit Content-Transfer-Encoding to
quoted-printable or base64 when formatting the string.

To prevent this, directly use the bytes coming from envelope.content.
However, Celery uses JSON to dispatch tasks data, and Python's stdlib
can't encode bytes.

To workaround this limitation, convert to base64.
2021-01-25 09:55:57 -05:00
Drew DeVault 7e97a107eb lmtp: reject emails with read receipts 2021-01-18 12:15:08 -05:00
Drew DeVault 18c6d7b543 Revert "listssrht-lmtp: reject email from suspended users"
This reverts commit 55701f7587.
2020-11-16 10:13:20 -05:00
Drew DeVault df8a878b9e Revert "Unpack tuple properly"
This reverts commit 0ef6826d31.
2020-11-16 10:13:19 -05:00
Drew DeVault 0ef6826d31 Unpack tuple properly 2020-11-16 09:59:34 -05:00
Drew DeVault 55701f7587 listssrht-lmtp: reject email from suspended users 2020-11-16 09:53:39 -05:00
Simon Ser 763c32d29d lmtp: make chown optional
Allow lists.sr.ht-lmtp to be configured not to chown the Unix socket.
2020-11-16 09:33:30 -05:00
Nate Ijams 9a66457cd8 Fix #118: allow either a To or Cc header in emails instead of only To. 2020-05-01 11:02:28 -04:00
Drew DeVault c5363c9621 listssrht-lmtp: add basic instrumentation 2020-02-21 09:02:54 -05:00
Drew DeVault 1063964547 listssrht-lmtp: fix fallback address for . lists 2020-01-10 13:54:08 -05:00
Drew DeVault 510be0838d listssrht-lmtp: more logging 2019-11-27 13:35:03 -05:00
Drew DeVault 41cbe1aa3e Print envelope of rejected messages 2019-11-26 14:02:56 -05:00
Philippe Pepiot 37babb1d5d Allow to serve lmtp on tcp and smtp on unix socket
We previously used "sock" parameter to determine if protocol should be
lmtp (unix socket) or smtp (tcp).
Since it make sense to serve both protocols on tcp or unix socket, introduce a
new "protocol" parameter to switch between lmtp and smtp.
Keep backward compat when protocol is not set by using lmtp over unix
socket and smtp over tcp socket.

Also evaluate "sock-group" option only when using unix socket, so the
option is no longer mandatory for tcp where it's unused.
2019-10-02 15:38:00 -04:00
Simon Ser 04da321c36 Don't split header fields
By default Python's policy has max_line_length=78. This is a good idea when
generating e-mails, however when forwarding them this may re-format long lines.
Because of this, DKIM signatures may get broken [1].

This commit changes max_line_length to 998, the RFC's hard limit.

Additionally, smtp.sendmail calls are replaced with smtp.send_message, which
leaves the formatting to smtplib. Previously email.policy.SMTPUTF8 was used,
which could result in raw UTF-8 being sent to servers which don't support
8BITMIME.

[1]: https://lists.sr.ht/~sircmpwn/sr.ht-discuss/%3C5eyQeHZnsPZb93CeySB5Z78iohHq9_ki7b8rpigjSL8PcrEpPXBViekRWAfua1L1XiP6-bKau7YRp1Rk9PyrjzD_BkiKKN_pkl6jVihvBf8%3D%40emersion.fr%3E#%3CftBrXTFwtU92zRoZnFxa6vMhBqHSdUO-l2ds0l4PA_OVhANM2ArVYMKr4WDaq4Yg4o7C3MtWPRg1QKxwXSADVJiDWocYC8wa2ylEoxoOJX4=@emersion.fr%3E
2019-07-26 14:43:02 -04:00
Drew DeVault 1778c029d0 Send our own bounce emails instead of postfix 2019-07-26 10:54:54 -04:00
Drew DeVault 0486855fb9 Allow admins to permit multipart emails with HTML 2019-07-26 09:43:29 -04:00
Drew DeVault e77dac3130 Implement list redirects for migrating old lists 2019-04-11 10:10:56 -04:00
Drew DeVault 0a0dd50b11 Add SMTP support to listssrht-lmtp 2019-04-10 13:18:01 -04:00
Drew DeVault 0935a45897 Use connection pooling in listssrht-lmtp 2019-04-04 10:22:45 -04:00
Drew DeVault e3757e09c0 Implement user-defined content white/blacklists 2019-03-25 16:06:04 -04:00
Drew DeVault 1651e16b17 Implement user-specific ACLs 2019-03-22 12:25:53 -04:00
emersion 7eef7f300d Always use email.policy.SMTP
The default Python policy violates the RFC by formatting messages with lone LF
characters instead of CRLF. I believe this breaks DKIM verification on some
servers.

This patch makes it so the SMTP policy is used, which formats messages with
CRLF.
2019-03-01 17:14:48 -07:00
Drew DeVault 6c2212c8c7 Fix another typo 2019-02-22 09:56:47 -05:00
Drew DeVault 85a9ca4439 Fix unbound local variable issue with last 2019-02-22 09:49:25 -05:00
Drew DeVault 17861eabd7 Add u.username.list-name@lists.sr.ht shim 2019-02-22 09:43:16 -05:00
Drew DeVault b9e3f8b446 Require a text/plain part for incoming emails 2019-01-31 15:43:49 +01:00
emersion f216e8becc lmtp: add Message-Id to list of required header fields
Otherwise dispatch_message will silently drop the message if the header field
is missing.
2019-01-12 17:30:38 -05:00
Drew DeVault 25cde5af1f Use core.sr.ht-managed alembic 2018-12-31 12:13:38 -05:00