Re: [exim] How to reject overlong addresses/local parts in F…

Top Page
Delete this message
Reply to this message
Author: Mike Tubby
Date:  
To: exim-users
Subject: Re: [exim] How to reject overlong addresses/local parts in From: header?

If its the sender address, i.e. the envelope then in acl_check_mail
something like:


        #
        # check length of sender's address
        #
        deny    condition = ${if > {strlen:$sender_address}{200}}
                message = Sender address is too long
                logwrite = MAIL: Rejected sender's from:
$sender_address - address too long

should do it, otherwise if you want to test the 'From' header in the
body do something like:

        #
        # check length of From: header
        #
        deny    condition = ${if > {strlen:$header_From}{200}}
                message = From address header is too long
                logwrite = MAIL: Rejected sender's From: header - too long

in the acl_check_data ?


Mike


On 12/12/2020 15:30, Jeremy Harris via Exim-users wrote:
> On 12/12/2020 14:46, Frank Richter via Exim-users wrote:
>> It comes from an e-mail with an overlong From: header:
>> From: "…"
>> <PPPPPPPPPPPPPPKKKKKKKKKKKKKKKKKTTTTTTTTTTTTTTTTTTTTTTTTRRRRRRRRRRRRRRRRRRRRRRRRSSSSSSSSSSSSSSSSSSSSSSSSSSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADDDDDDDDDDDDDDDDDFFFFFFFFFFFFFFFFFFFFFCCCCCCCCCCCCCCCBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB@…>
>>
>> I'd like to reject such "address monsters". How's the best way to
>> achieve this?
>
> Try a rewrite rule:
>
> ^.{40,}@tuced.eu          deny_me@???
>
> before your existing rule.  Then a simple match-and-deny in your data
> ACL:
>
>   deny condition = ${if eq {deny_me@???} {${address:$h_from:}}}
>
> Rewrites for headers get processed before the data ACL, or you could
> just do it all there.