Capturing headers and bodies
Out of the box Mailinois only sees log lines: addresses, queue IDs, Message-IDs and SMTP responses. To see headers or bodies, Postfix has to hand it a copy of each message, which it does through a milter. Captures are off until you turn them on.
capture.mode |
What is kept |
|---|---|
off |
Nothing. The default. |
headers |
The message’s headers. |
full |
Headers and body. |
capture.max_size caps the bytes kept per message (default 1048576, 1 MiB). Anything past it is cut, and the capture is marked as cut.
Turn it on in Mailinois
Section titled “Turn it on in Mailinois”Give the milter an address and pick a mode:
listen: milter: ":8892"capture: mode: full max_size: 1048576MAILINOIS_MILTER=:8892 does the same as listen.milter. A capture mode needs a milter address: Mailinois will not start with one and not the other.
Point Postfix at it
Section titled “Point Postfix at it”Add Mailinois to main.cf, after the milters you already have:
smtpd_milters = <existing milters>, { inet:mailinois:8892, default_action=accept }non_smtpd_milters = $smtpd_miltersmilter_protocol = 6milter_command_timeout = 5smilter_content_timeout = 15sWith OpenDKIM on port 8891, for example, the first line reads smtpd_milters = inet:localhost:8891, { inet:mailinois:8892, default_action=accept }. Then reload Postfix with postfix reload.
What each line does:
smtpd_milterssends mail that arrives over SMTP through the milters in order. List Mailinois after OpenDKIM, so it sees theDKIM-Signatureheader OpenDKIM adds and can verify it.default_action=accept, inside the braces, means that if Mailinois is down or does not answer, Postfix accepts the mail anyway. Mail keeps flowing. That message just has no capture. The braces form needs Postfix 3.0 or later (MILTER_README).non_smtpd_milters = $smtpd_miltersdoes the same for mail submitted locally, withsendmailor through the pickup directory.milter_protocol = 6sets the milter protocol version.
milter_command_timeout = 5sandmilter_content_timeout = 15sare lower than Postfix’s defaults (30s and 300s), so a stuck Mailinois costs each message seconds, not minutes.
Keep the milter port private. Only Postfix should be able to reach it.
With the agent
Section titled “With the agent”When Postfix runs on another network, do not point its milter across the internet: every SMTP transaction would wait on that round trip. Run the milter in the agent on the mail server instead:
mailinois agent -server https://mailinois.example.com -token <ingest token> \ -file /var/log/mail.log -milter 127.0.0.1:8892 -capture fullUse inet:127.0.0.1:8892 in main.cf. The agent takes the copy locally and sends it on to Mailinois over HTTPS.
What the dashboard shows
Section titled “What the dashboard shows”A message with a capture shows:
- the parsed headers;
- the text part;
- the HTML part, in a sandboxed frame with scripts and remote content blocked, so opening it loads nothing from the sender;
- attachments, listed by name, type and size;
- DKIM verification of the captured message;
- a download of the
.eml, for signed-in users.
has:capture in search finds messages that have one, and GET /api/v1/messages/{id}/eml returns the .eml through the API.
Retention
Section titled “Retention”Captures have their own retention, retention.captures, which defaults to 168h (seven days) against 720h for messages. When a capture expires, the message’s log record stays until retention.messages removes it.
retention: messages: 720h captures: 168h