Reputation: 34751
I need to DKIM sign possibly huge emails (up to 150MB). I’m running Postfix and so far want to keep that MTA.
Conceptually DKIM needs to go over the email twice: once to calculate and sign the checksum and once to write it out with the result of the previous step in the headers.1
A DKIM signer can do this by either keeping the message in memory (a no-go for me) or write it to a file.
For the task at hand I want to use a Postfix (filter) mechanism that allows me to do that without keeping the message in memory and without having it written to disc twice!
So far I see that the after-queue content filter mechanism forces you to write the email to disc again, and for no good reason! It should instead pass a seekable file descriptor to filter’s stdin, but the implementation does not do it.
The alternative, the before-queue milter, is insufficiently documented for me to see if it avoids keeping the message in memory and avoids writing the original mail to file twice. – This is why I have opendkim
in my tags: maybe those experts know how the milter API can avoid and how opendkim
indeed does avoid these pitfalls.
1...as Posix file systems have no prepend operation
Upvotes: 0
Views: 455
Reputation: 34751
Postfix queue files are not flat mails. Adding a header does not require a rewrite. To take advantage of that use the milter interface. The answers I got from postfix-users make me believe mail is not kept in memory during milter processing either. At least not by Postfix.
Using the pipe mechanism with the after-queue content filter would not do it as mentioned in the question. A write out to file to avoid the mail in memory would probably be reasonable enough though and better than keeping it in memory.
While the milter interface is good enough for DKIM, I’ld like to list it’s shortcomings (all of them could have been avoided):
Postfix has some shortcomings as well:
Upvotes: 1