Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-13 23:57 UTC

Thread

Add 2 headers to message

Add 2 headers to message

2016-08-31 by Alvaro_Mar=c3=adn

Hi,

I've some rules to greylist "bad" IPs, and one last rule to add a header
with the IP and country code of senders:

racl whitelist default addheader "X-Mail-Country: IP: %i | Country: %C"

Runs fine, but now, I want to add the SPF test result, so I've compiled
milter-greylist to support it and I've added these lines:

racl continue spf pass addheader "X-Mail-AuthResults: %QS"
racl continue spf fail addheader "X-Mail-AuthResults: %QS"
racl continue spf softfail addheader "X-Mail-AuthResults: %QS"

so the file looks like:

...
racl greylist dnsrbl "RBL" delay 5m
racl continue spf pass addheader "X-Mail-AuthResults: %QS"
racl continue spf fail addheader "X-Mail-AuthResults: %QS"
racl continue spf softfail addheader "X-Mail-AuthResults: %QS"
racl whitelist default addheader "X-Mail-Country: IP: %i | Country: %C"

The problem is that only the last header (X-Mail-Country) is added. Logs:

milter-greylist: SPF return fail (test code 3, result 1)
milter-greylist: SPF lookup performed in 0.002375s
milter-greylist: Mail from=x@..., rcpt=x@...,
addr=X.X.X.X is matched by entry racl 659 continue spf fail [addheader
"X-Mail-AuthResults: %QS"] [maxpeek -1]
milter-greylist: Mail from=x@..., rcpt=x@...,
addr=X.X.X.X is matched by entry racl 661 whitelist [addheader
"X-Mail-Country: IP: %i | Country: %C"] [maxpeek -1] default

How can I do it? If I use whitelist instead of continue for the SPF
rule, the other one isn't added. Of course, I can use only one header to
mix all the data, but I prefer separated headers, if it's possible...

Thank you!
Regards,


-- 
Alvaro Mar\ufffdn Illera
Hostalia Internet
www.hostalia.com

Re: [milter-greylist] Add 2 headers to message

2016-09-02 by Alvaro_Mar=c3=adn

Hi again,

if I use these rules:

racl continue from /.*/ addheader "X-Mail-Country: IP: %i | Country: %C"
dacl continue from /.*/ addheader "Authentication-Results: %QS"

one with racl and the other one with dacl, both headers are added. If I
use them with racl both, only the last one is added.
Is there any limitation to add multiple headers with racl rules?

Regards,

El 31/08/16 a las 18:22, Alvaro Mar\ufffdn alvaro@...
[milter-greylist] escribi\ufffd:
> Hi,
> 
> I've some rules to greylist "bad" IPs, and one last rule to add a header
> with the IP and country code of senders:
> 
> racl whitelist default addheader "X-Mail-Country: IP: %i | Country: %C"
> 
> Runs fine, but now, I want to add the SPF test result, so I've compiled
> milter-greylist to support it and I've added these lines:
> 
> racl continue spf pass addheader "X-Mail-AuthResults: %QS"
> racl continue spf fail addheader "X-Mail-AuthResults: %QS"
> racl continue spf softfail addheader "X-Mail-AuthResults: %QS"
> 
> so the file looks like:
> 
> ...
> racl greylist dnsrbl "RBL" delay 5m
> racl continue spf pass addheader "X-Mail-AuthResults: %QS"
> racl continue spf fail addheader "X-Mail-AuthResults: %QS"
> racl continue spf softfail addheader "X-Mail-AuthResults: %QS"
> racl whitelist default addheader "X-Mail-Country: IP: %i | Country: %C"
> 
> The problem is that only the last header (X-Mail-Country) is added. Logs:
> 
> milter-greylist: SPF return fail (test code 3, result 1)
> milter-greylist: SPF lookup performed in 0.002375s
> milter-greylist: Mail from=x@..., rcpt=x@...,
> addr=X.X.X.X is matched by entry racl 659 continue spf fail [addheader
> "X-Mail-AuthResults: %QS"] [maxpeek -1]
> milter-greylist: Mail from=x@..., rcpt=x@...,
> addr=X.X.X.X is matched by entry racl 661 whitelist [addheader
> "X-Mail-Country: IP: %i | Country: %C"] [maxpeek -1] default
> 
> How can I do it? If I use whitelist instead of continue for the SPF
> rule, the other one isn't added. Of course, I can use only one header to
> mix all the data, but I prefer separated headers, if it's possible...
> 
> Thank you!
> Regards,
> 
> 


-- 
Alvaro Mar\ufffdn Illera
Hostalia Internet
www.hostalia.com

Re: [milter-greylist] Add 2 headers to message

2016-09-14 by manu@...

Alvaro MarĂ­n alvaro@... [milter-greylist]
<milter-greylist@yahoogroups.com> wrote:

> Is there any limitation to add multiple headers with racl rules?

Yes, there is a limitation. Currently we store the headers to add in a
single-valued field. That happens in acl_actions() from acl.c here:

        if (ap->ap_addheader) {
                priv->priv_sr.sr_addheader = strdup(ap->ap_addheader);
                if (priv->priv_sr.sr_addheader == NULL) {
                        mg_log(LOG_ERR, "strdup failed");
                        exit(EX_OSERR);
                }
         (...)

Supporting multiple addheader clauses, either on a single ACL or on
multiple ones, requires changing the priv_sr.sr_addheader field to be a
chained list (see LIST_INIT/LIST_INSERT_HEAD/LIST_FOREACH/LIST_REMOVE
macros for examples). That seems an average-level contribution. Feel
free to work on it, your patch will be welcome.


-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu@...

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.