1

Topic: attachment file type block per user/domain

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.8 OPENLDAP edition
- Linux/BSD distribution name and version: Ubuntu 16.04 LTS
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hi,

I'm trying to block specific incoming attachments (.doc) with amavis for a particular domain. I followed this post https://forum.iredmail.org/topic3734-ir … users.html but the blocked attachment passes through amavis.

Entry in amavisd.conf

...
%banned_rules = (
  'BLOCK_ALL' =>  new_RE(
   [qr'N=.*\.(doc)$'xmi => 'BOUNCE'],
  'DEFAULT' => $banned_namepath_re,
);

1;  # insure a defined return

I've added the following Attribute to the domain in the openldap backend:

amavisBannedRuleNames: BLOCK_ALL

Am I doing something wrong ?

2

Re: attachment file type block per user/domain

toxic wrote:

I've added the following Attribute to the domain in the openldap backend:

Amavisd is not configured to query LDAP anymore, you should update SQL table "amavisd.policy" (column "banned_rulenames") instead.

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

3

Re: attachment file type block per user/domain

Thanks. Using amavis debug I can see that the rule is being applied now but my .doc filtering does not seem to work (propably a syntax issue). Blocking all attachments as in https://forum.iredmail.org/topic3734-ir … users.html works.

Do you see a problem with this block rule ?

%banned_rules = (
  'BLOCK_DOC' =>  new_RE(
    [ qr'N=.*\.(doc)$'   => 1 ] ),
  'DEFAULT' => $banned_namepath_re,
);

4

Re: attachment file type block per user/domain

It's very possible a syntax error in your %banned_rules setting. Try to tune it and test again.

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

5

Re: attachment file type block per user/domain

It was just a syntax issue. This worked:

%banned_rules = (
  'BLOCK_DOC' =>  new_RE(
    [ qr'\.(doc)$'   => 1 ] ),
  'DEFAULT' => $banned_filename_re,
);