On 12/23/20 3:32 PM, Martin Gregorie wrote:
- In my case I run every message through SA, diverting spam into a quarantine directory and passing the rest to Postfix for delivery.
I don't quarantine anything on this system. Spam is tagged if the score is between 5 and 15. Spam is rejected /during/ the SMTP transaction if the score is 15 or higher.
- In your case you want to pass mail, which is being sent to a small set of recipients on your server directly to your local MTA for delivery. The rest gets run through SA before being handed to your local MTA, again for local delivery.
Email only passes through the local MTA one time. Sendmail is configured to interface with SpamAssassin via spamass-milter /during/ the SMTP transaction. No looping.
This is also part of why I'm not 100% sure what user SpamAssassin is filtering the messages as. I don't know if it's currently configured as a single user that the daemons are running as -or- if it's somehow changing users to the recipient Unix account.
I know that this particular system was never configured with SQL database for per-user settings. Which I think I needed to do the last time I did per-user settings. But that's been more than a decade ago.
I quite certain that I did not explicitly did anything to enable per-user settings on this system. But I can't rule out some sort of option being default to look for per-user settings in home directories.
The logic needed to do both tasks would seem to be essentially the same:read the names of all recipients that are NOT scanned by SA into a searchable no-scan recipients list.for every message received read the message into a buffer look up its recipient in the no-scan recipients list if the recipient is in the list pass the message on for delivery by writing it to stdout else pass the message to SA for markup as ham or spam via spamc i.e, pipe the buffer content into spamc's stdin channel receive the marked-up message back from spamc i.e. read spamc's stdout channel into a buffer fi pass the marked-up message to your MTA for delivery i.e write the buffer content to stdout clear the buffer end-for
That's not how things work with the milter configuration.
Assuming that you're using Postfix as your MTA, you just replace spamc in the Postfix process chain with a program that does the above.
Nope. As indicated multiple places, Sendmail, not Postfix.
In a little more detail: - This implies writing a program in C, Java or (possibly) Python or Perl.- if your list of no-filter recipients has more than about ten entries, consider using a B-tree to efficiently search the list. In C use bsearch() and in Java use a TreeMap - both are very fast.- the message buffer needs to be self-extending to match any received message. This is a no-brainer in Java (all Strings automatically resize to hold what is put in them, but needs a little more care if written in C because you don't know how big an incomming message is until you've read it.- this approach doesn't need any modifications to your existing SA configuration
That's all considerably more complicated than I'm comfortable with at the moment. It also seems to target an MTA that I'm not running.
I hope this gives you some useful ideas.
Eh .... It's something to think about. But I think it's elephants when I'm talking about trees.
-- Grant. . . . unix || die
smime.p7s
Description: S/MIME Cryptographic Signature