1

Topic: messages winth unwanted attachments have "banned" header, but passed

==== Required information ====
- iRedMail version (check /etc/iredmail-release):
- Linux/BSD distribution name and version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
======== Required information ====
- iRedMail version (check /etc/iredmail-release):
- Linux/BSD distribution name and version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

======== Required information ====
- iRedMail version 0.9.7 MARIADB edition.
- Linux/BSD distribution name and version: ubuntu server 16.04 
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  MARIADB
- Web server (Apache or Nginx):nginx
- Manage mail accounts with iRedAdmin-Pro? nope

====
Greetings.
I need to remove\ban attachment archive from messages like  jar -> zip, because normal interlocutors don't send archives like this (in my company), but virus senders loves it .
I'm digged amavis config files and found section for this, there are more file types an extensions, so i uncommented them all:

/etc/amavis/conf.d/50-user:

...
$banned_namepath_re = new_RE(
    #[qr'T=(rar|arc|arj|zoo|gz|bz2)(,|\t)'xmi => 'DISCARD'],     # Compressed file types
    [qr'T=x-(msdownload|msdos-program|msmetafile)(,|\t)'xmi => 'DISCARD'],
    [qr'T=(hta)(,|\t)'xmi => 'DISCARD'],

    # Dangerous mime types
    [qr'T=(9|386|LeChiffre|aaa|abc|aepl|ani|aru|atm|aut|b64|bat|bhx|bin|bkd|blf|bll|bmw|boo|bps|bqf|breaking_bad|buk|bup|bxz|cc|ccc|ce0|ceo|cfxxe|chm|cih|cla|class|cmd|com|cpl|crinf|crjoker|crypt|cryptolocker|cryptowall|ctbl|cxq|cyw|dbd|delf|dev|dlb|dli|dll|dllx|dom|drv|dx|dxz|dyv|dyz|ecc|exe|exe-ms|exe1|exe_renamed|exx|ezt|ezz|fag|fjl|fnr|fuj|good|gzquar|hlp|hlw|hqx|hsq|hts|iva|iws|jar|js|kcd|keybtc@inbox_com|let|lik|lkh|lnk|locky|lok|lol!|lpaq5|magic|mfu|micro|mim|mjg|mjz|nls|oar|ocx|osa|ozd|pcx|pgm|php2|php3|pid|pif|plc|pr|pzdc|qit|qrn|r5a|rhk|rna|rsc_tmp|s7p|scr|shs|ska|smm|smtmp|sop|spam|ssy|swf|sys|tko|tps|tsa|tti|ttt|txs|upa|uu|uue|uzy|vb|vba|vbe|vbs|vbx|vexe|vxd|vzr|wlpginstall|ws|wsc|wsf|wsh|wss|xdu|xir|xlm|xlv|xnt|xnxx|xtbl|xxe|xxx|xyz|zix|zvz|zzz)(,|\t)'xmi => 'DISCARD'],

    # Dangerous file name extensions
    [qr'N=.*\.(9|386|LeChiffre|aaa|abc|aepl|ani|aru|atm|aut|b64|bat|bhx|bin|bkd|blf|bll|bmw|boo|bps|bqf|breaking_bad|buk|bup|bxz|cc|ccc|ce0|ceo|cfxxe|chm|cih|cla|class|cmd|com|cpl|crinf|crjoker|crypt|cryptolocker|cryptowall|ctbl|cxq|cyw|dbd|delf|dev|dlb|dli|dll|dllx|dom|drv|dx|dxz|dyv|dyz|ecc|exe|exe-ms|exe1|exe_renamed|exx|ezt|ezz|fag|fjl|fnr|fuj|good|gzquar|hlp|hlw|hqx|hsq|hts|iva|iws|jar|js|kcd|keybtc@inbox_com|let|lik|lkh|lnk|locky|lok|lol!|lpaq5|magic|mfu|micro|mim|mjg|mjz|nls|oar|ocx|osa|ozd|pcx|pgm|php2|php3|pid|pif|plc|pr|pzdc|qit|qrn|r5a|rhk|rna|rsc_tmp|s7p|scr|shs|ska|smm|smtmp|sop|spam|ssy|swf|sys|tko|tps|tsa|tti|ttt|txs|upa|uu|uue|uzy|vb|vba|vbe|vbs|vbx|vexe|vxd|vzr|wlpginstall|ws|wsc|wsf|wsh|wss|xdu|xir|xlm|xlv|xnt|xnxx|xtbl|xxe|xxx|xyz|zix|zvz|zzz)$'xmi => 'DISCARD'],
);
...

And messages with unwanted attachments start to get header

X-Amavis-Alert: BANNED, message contains .asc,vmail (1).sql.jar

but still messages pass throught to user mbox with attachment


After that i set

$final_banned_destiny = D_BOUNCE;
and
$defang_banned 1

but it makes no effect.

Is there some method to remove bad attachment with user notify, or wrap whole message to another message with alert?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: messages winth unwanted attachments have "banned" header, but passed

iRedMail stores the spam policy in SQL table "amavisd.policy", you should find a SQL record with "policy_name=@." in this table, update it and set to:

banned_files_lover=N
bypass_banned_checks=N
banned_quarantine_to='banned-quarantine'

Then it should quarantine email with banned attachment to SQL db.

3

Re: messages winth unwanted attachments have "banned" header, but passed

ZhangHuangbin wrote:

iRedMail stores the spam policy in SQL table "amavisd.policy", you should find a SQL record with "policy_name=@." in this table, update it and set to:

banned_files_lover=N
bypass_banned_checks=N
banned_quarantine_to='banned-quarantine'

Then it should quarantine email with banned attachment to SQL db.


Yep, it works for me, thanks. Is there a standard way to find these attachments in non-paid version of iRedMail?

4

Re: messages winth unwanted attachments have "banned" header, but passed

boris.berezovskiy wrote:

Is there a standard way to find these attachments in non-paid version of iRedMail?

This policy is configured by iRedMail by default, iRedAdmin-Pro just helps you manage them.