Beginner Question

Glenn Steen glenn.steen at gmail.com
Wed Nov 21 13:40:57 GMT 2007


On 21/11/2007, Andreas Kasenides <Andreas.Kasenides at cs.ucy.ac.cy> wrote:
> UxBoD wrote:
> > Andreas,
> >
> > 1) As part of the installation for Postfix and MailScanner the main.cf file is changed so that a header check is performed on every email that is processed.  As "Received" appears in all messages, RFC compliance, then the message is put into a hold queue.  MailScanner monitors this directory and when it sees messages it will process them, and on successfully processing, will the deliver them into the outbound queue for Postfix to deliver.  If MailScanner was to die half way through processing a message it would still be safe, as it does not remove the message from the hold queue until such time successful processing has taken place.
> >
> Let me elaborate a little further on this issue:
> Excuse me if I insist on this and correct me if necessary. The HOLD
> queue is NOT an inactive queue
> as Glenn suggests but rather a different kind of queue (from the
> incoming queue for example)
> in that messages are put there by Postfix and forgotten rather than
> being continuesly monitored.
What on earth are you on about?! This is exactly it: The queue manager
of Postfix _will never touch the hold queue_. Calling it a queue is a
misnomer, at best. It is a "black bag of parked messages". The ONLY
way to get them out of there (that Postfix support) is via the
postsuper command.
The massages put in the HOLD "queue" never ever go to the incoming queue.

> The issue though is how does MS make sure that during its routine scanning
> of the HOLD queue it does not pick up one of the messages that are just
> being written
> (and not finished yet) by Postfix.
Read the code! It is actually not that hard to follow:-):-).
For "pre milter support" various test will be done, ending with trying
to find the "end record" (type E). For "milter support" (versions
2.3/2.4 with a milter defined) pretty much the same things will be
tested, but where MS used to skip past the body, we now have to spin
through/verify the "record structure". All this is needed since....

> In other words is it your understanding that Postfix properly "locks"
> the files and that MS properly
> detects the locks to avoid any mishaps.
.... Wietse doesn't do locking. There are no file locks on the queue files.
So the only way to know is to peek through the file. If it isn't
complete, it is ignored (by MailScanner).
As said, read the code... If you don't believe me;-).
I've been through this code pretty extensively, since I'm the one to
blame for the milter-support change;).

> I expect that the above is standard these days and therefore the only
> issue that remains is for MS
> to properly understand the Postfix queue file format. Correct?
Well, we have to do our very best with that, yes. Since there is no
file locking, and since we want to get at information hidden in the
diverse records (like envelope sender/recipient(s) etc).

> thanks a zillion for all clarifications
> Andreas
Hope that clarifies it some:-).

Cheers
-- 
-- Glenn
email: glenn < dot > steen < at > gmail < dot > com
work: glenn < dot > steen < at > ap1 < dot > se


More information about the MailScanner mailing list