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-sen...@example.com' &&
        $recipient eq 'com-re...@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] <sen...@example.com> -> <re...@example.org>,<com-re...@example.org>, quarantine: [...]

(00739-03) Passed BANNED (text/plain,.asc,file.com) {DiscardedInbound,RelayedInbound,Quarantined}, [127.0.0.1] <com-sen...@example.com> -> <com-re...@example.org>, quarantine: [...]

(00739-03) Blocked BANNED (text/plain,.asc,file.com) {DiscardedInbound,RelayedInbound,Quarantined}, [127.0.0.1] <com-sen...@example.com> -> <re...@example.org>, quarantine: [...]

(00739-04) Blocked BANNED (text/plain,.asc,file.exe) {DiscardedInbound,Quarantined}, [127.0.0.1] <com-sen...@example.com> -> <re...@example.org>,<com-re...@example.org>, quarantine: [...]

No guarantees, though.

Reply via email to