Excluding blocking macro/xlsx/docx files to specific recipients?

Damian amavis at arcsin.de
Fri Feb 25 15:59:50 CET 2022


> Is it possible to allow certain file types from certain addresses to
> certain recipients without knowing the sending IP to add them to a
> policy bank?

File types are considered in the context of banned checks, which can be 
configured by various banned_* confvars. Generally some confvars are 
global, some are per policybank, but I know only two confvars that can 
make other policybanks be loaded. The banned_* confvars are not one of 
those.

However, if you're really desperate, you can try something like this:

> @banned_filename_maps = sub {
>     my ($msginfo, $recipient) = ($Amavis::MSGINFO, @_);
>
>     if ($msginfo->sender eq 'com-sender at example.com' &&
>         $recipient eq 'com-recip at example.org') {
>         return { '.' => [new_RE(qr/\.exe/)] };
>     } else {
>         return { '.' => [new_RE(qr/\.(?:com|exe)/)] };
>     }
> };
It yields

> (00739-02) Blocked BANNED (text/plain,.asc,file.com) 
> {DiscardedInbound,Quarantined}, [127.0.0.1] <sender at example.com> -> 
> <recip at example.org>,<com-recip at example.org>, quarantine: [...]
>
> (00739-03) Passed BANNED (text/plain,.asc,file.com) 
> {DiscardedInbound,RelayedInbound,Quarantined}, [127.0.0.1] 
> <com-sender at example.com> -> <com-recip at example.org>, quarantine: [...]
>
> (00739-03) Blocked BANNED (text/plain,.asc,file.com) 
> {DiscardedInbound,RelayedInbound,Quarantined}, [127.0.0.1] 
> <com-sender at example.com> -> <recip at example.org>, quarantine: [...]
>
> (00739-04) Blocked BANNED (text/plain,.asc,file.exe) 
> {DiscardedInbound,Quarantined}, [127.0.0.1] <com-sender at example.com> 
> -> <recip at example.org>,<com-recip at example.org>, quarantine: [...]

No guarantees, though.



More information about the amavis-users mailing list