Louis-David Mitterrand a écrit : > Hi, > > A lot of spam comes from certain ip ranges (e.g. west africa) through > relays (large ISPs) that would be too onerous to block. To filter these > I am presently matching: > > /^((Received|X-Originating-IP):.+\b(124\.120\.1\.(<IP RANGE IN > REGEX>)\b/ > > in pcre:/etc/postfix/header_access. But converting IP ranges to regex'es > is time consuming and error prone.
except for simple cases, it is impossible. > > Is there a way to use a cidr table for header matching while retaining > control of the prefix ^(Received|X-Originating-IP) ? > you need a proxy_filter or a milter. or a content_filter if it is ok to tag/:quarantine/... instead of reject. in my SA, I have things like these: # Nigeria header COUNTRY_NG X-Relay-Countries=~/\bNG\b/ describe COUNTRY_NG Relayed via Nigeria # Cote d'Ivoire header COUNTRY_CI X-Relay-Countries=~/\bCI\b/ describe COUNTRY_CI Relayed via Cote-d-Ivoire ... > Or another better way? > > Thanks,