diff --git a/README.md b/README.md index e012e8e..41e7b58 100644 --- a/README.md +++ b/README.md @@ -208,6 +208,11 @@ lists.example.org lmtp:inet:127.0.0.1:2424 The daemon logs a warning at startup when LMTP is reachable beyond the machine and `lmtp.allow` is empty. `allow` does not apply to unix sockets: use the permissions of the socket file. +- **Who is posting.** A post is accepted when the SMTP sender is a member *and* the `From` header names the same + address. The SMTP sender can be forged by anyone who can send mail to your MX, and the archive, the rewritten `From` + and `Reply-To` come from the header; so a post whose header names someone else (or has no usable `From`, or several + addresses) is held for moderation instead of delivered, with the reason shown to the admin (API, CLI, UI). Let Postfix + reject forged senders too (SPF, DKIM, DMARC checks on inbound mail). - The API and the admin UI use one bearer token and no TLS: put them behind a reverse proxy with TLS and keep the `api` listener private. diff --git a/admin/src/lib/api.ts b/admin/src/lib/api.ts index a33e798..4cab84b 100644 --- a/admin/src/lib/api.ts +++ b/admin/src/lib/api.ts @@ -28,6 +28,8 @@ export interface Held { subject: string size: number created_at: string + /** Why the message was held, for the admin. */ + reason: string } export interface Message { diff --git a/admin/src/tabs/HeldTab.test.tsx b/admin/src/tabs/HeldTab.test.tsx index 939a393..3a0c169 100644 --- a/admin/src/tabs/HeldTab.test.tsx +++ b/admin/src/tabs/HeldTab.test.tsx @@ -10,6 +10,7 @@ const held = (id: number, over: Partial = {}): Held => ({ subject: `Subject ${id}`, size: 2048, created_at: '2030-01-02T03:04:05Z', + reason: 'the list is moderated', ...over, }) @@ -30,6 +31,21 @@ describe('held tab', () => { expect(screen.getByText('(no subject)')).toBeInTheDocument() }) + it('tells the admin why each message was held', async () => { + await setup([ + held(1), + held(2, { reason: 'the From header does not match the sender of the message (From: bob@example.com)' }), + held(3, { reason: '' }), + ]) + const one = (await screen.findByText('Subject 1')).closest('tr')! + expect(within(one).getByText('the list is moderated')).toBeInTheDocument() + const two = screen.getByText('Subject 2').closest('tr')! + expect(within(two).getByText(/From header does not match the sender/)).toBeInTheDocument() + const three = screen.getByText('Subject 3').closest('tr')! + expect(within(three).getByText('—')).toBeInTheDocument() // messages held before this was recorded + expect(screen.getByRole('columnheader', { name: /reason/i })).toBeInTheDocument() + }) + it('says nothing is waiting', async () => { await setup([]) expect(await screen.findByText(/nothing is waiting/i)).toBeInTheDocument() diff --git a/admin/src/tabs/HeldTab.tsx b/admin/src/tabs/HeldTab.tsx index 2abf69d..bccaa48 100644 --- a/admin/src/tabs/HeldTab.tsx +++ b/admin/src/tabs/HeldTab.tsx @@ -63,6 +63,7 @@ export function HeldTab() { From Received Size + Reason Actions @@ -73,6 +74,7 @@ export function HeldTab() { {h.sender} {formatDate(h.created_at)} {formatBytes(h.size)} + {h.reason || '—'}