ACL Policy Daemon for Postfix
Translation of the original in Catalan. Read it in: CatalàCastellano
Until now the only policy daemon I used for postfix is policyd v1 which is made with C and for performance reasons gave me great features, speed and scalability especially thanks to its MySQL backend. But today I have been forced to install ACL Policy Daemon which is programmed with Twisted+Python and that through its ability to configure the Postfix access rules via ACLs I have been able to set up a somewhat far-fetched feature that I needed for a client.
The problem is that this client needs:
-
Receive mail for its domains
-
Allow relay after authentication of its roadwarriors
Well then that poses a problem due to a contradictory feature. If we configure Postfix to receive local mail, we can protect this mail against UBE as much as we want and more but if the origin specified in the SMTP transaction indicates that the sender is a mail account of the same domain as the destination (often the same mail account), this mail will be accepted as legitimate and authentication will not be requested because the MTA where the mail is being sent is the destination of the same. Thanks to that the mail will be accepted at the MTA and will only be at the mercy of the anti-spam and UBE rules to stop it, which despite the fact that via SPF and other similar ones will try to stop this mail that will not always be possible and even less if the injection attempts are in the order of tens of thousands a day. We found that some tens passed the filters anyway.
So, thanks to this policy daemon I have been able to program a rule that says something like:
-
if the sender IP is not local
-
if the origin of the mail is a local domain
-
if the destination of the mail is a local destination
-
if the user has not authenticated
-
this mail CANNOT be sent!
Clients that are outside the company (roadwarriors) whenever they send a mail do it via ASMTP so, if they want to send a mail to any account of the same domain as theirs they will do it in an authenticated way. On the other hand, if an internal mail client of the company tries to send a mail it will do it with a local IP of the company and this filter will not block it.
As you can see the problem is a bit tangled. On the other hand, if you want to take a look at the policy.conf configuration file (one of the configuration files of apolicyd) that I have created it is in the style of this one:
acl wl client_address NET_IP/MASK
action nice_users DUNNO
access wl nice_users
acl remitent sender @example.com
acl desti recipient @example.com
acl aut sasl_method (PLAIN|LOGIN)
action rej REJECT Auth required
access remitent desti !aut rej
Even though I have used apolicyd for very specific things it must be said that its source code is very understandable and simple to modify, besides supporting a great many features out of the box that allow adjusting our filtering rules a great deal. It has really surprised me in a very positive way, I did not expect it to be so well thought out.
1 comment
Comments from the old blog, as they were written. Comments are closed.
Sabueso
No esta tan bien pensado.
Depende que tipo de reglas montas , no las evalua correctamente.
En los proximos dias tengo ganas de escribir sobre un error de apolicy que notifique en su dia en la lista de desarrollo :)
Ya te contare.