fix(security): LMTP allow list and a warning for an open LMTP port

- Add lmtp.allow: clients outside the list are dropped before the greeting (TCP only)
- Validate the list at load, naming the bad entry
- Warn at startup when LMTP is reachable beyond the machine and no list is set
- Stop publishing the LMTP port in the README and the example config; add Security notes
This commit is contained in:
tgiachi 2026-11-09 20:20:35 +01:00
commit 064e8beed8

View file

@ -36,7 +36,7 @@ Three listeners, each configurable:
| Listener | Default | Purpose |
|----------|---------|---------|
| `lmtp` | `127.0.0.1:2424` | mail from Postfix |
| `lmtp` | `127.0.0.1:2424` | mail from Postfix; **no authentication**, see Security notes |
| `api` | `127.0.0.1:8080` | admin REST API, bearer token |
| `web` | `127.0.0.1:8081` | public archive and unsubscribe pages (`""` disables) |
@ -133,10 +133,11 @@ docker build -t parsimony .
docker run -d --name parsimony --read-only --cap-drop ALL \
-v parsimony-data:/data \
-v $PWD/parsimony.yaml:/etc/parsimony/parsimony.yaml:ro \
-e PARSIMONY_API_TOKEN=... -p 2424:2424 -p 8080:8080 -p 8081:8081 parsimony
-e PARSIMONY_API_TOKEN=... -p 127.0.0.1:8080:8080 -p 8081:8081 parsimony
```
Use `db: /data/parsimony.db` in the config. A new named volume gets the right ownership by itself;
Use `db: /data/parsimony.db` in the config. Do not publish the LMTP port (2424): Postfix reaches it over a Docker network
shared with the container, and `lmtp.allow` should list that network's range (see Security notes). A new named volume gets the right ownership by itself;
for a bind mount, make the host directory writable by uid 65532.
## Delivery and the queue
@ -194,6 +195,22 @@ transport_maps = hash:/etc/postfix/transport
lists.example.org lmtp:inet:127.0.0.1:2424
```
## Security notes
- **LMTP has no authentication.** Whoever can connect to it can send mail as any member. Keep it on `127.0.0.1`, on a
private network, or on a unix socket, and list the clients that may connect:
```yaml
lmtp:
addr: 0.0.0.0:2424
allow: [172.16.0.0/12] # CIDR ranges or single addresses; other clients are dropped before the greeting
```
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.
- 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.
## Licence
Parsimony is free software, released under the GNU General Public License, version 3 or (at your option) any later