DNSBL with mail proxy

Pat Suwalski pat at suwalski.net
Thu Mar 31 18:17:56 UTC 2016

I managed to solve my own problem with the use of XCLIENT. There isn't a 
whole lot of information out there, so maybe search engines will pick up 
on this post and help someone else.

It was very easy to set up. Simply turn "xclient off" to "xclient on" in 
the nginx configuration as quoted below. Then, in the postfix 
configuration, enable xclient for the proxy's IP:

smtpd_authorized_xclient_hosts =

(It can be turned on globally, but I like being specific).

This seemed to work immediately with the DNSBL/rbl rules already in postfix.


On 2016-03-31 01:23 AM, Pat Suwalski wrote:
> Hello,
> I started using nginx as a proxy for incoming mail, for DDoS protection
> and hiding of origin.
> I have it set up as follows:
> mail {
>          server_name foo.bar.com;
>          auth_http localhost:8080/auth-smtppass.php;
>          server {
>                  listen 25;
>                  protocol smtp;
>                  proxy on;
>                  timeout 5s;
>                  xclient off;
>                  smtp_auth none;
>          }
> }
> And then I have a location handler that tells it where to actually go:
>          location ~ .php$ {
>                  add_header Auth-Server;
>                  add_header Auth-Port 25;
>                  return 200;
>          }
> This works great, except that the real mail server ( in
> this example) doesn't see where the mail is actually coming from, and
> therefore loses its ability to apply the DNSBL.
> One obvious way to use the DNSBL would be to have an actual auth script
> that does the DNSBL checking. However, it's really nice to have it all
> handled without calling out to php or perl.
> I could also have a local postfix that does nothing but DNSBL and relay
> to the real server, but that seems like just another layer of complication.
> Anyone have any creative ideas on how this could be implemented right in
> nginx? Maybe someone's written an auth script that does DNSBL?
> Thanks,
> --Pat
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

More information about the nginx mailing list