1

Topic: Block attachments for one domain, but not others

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.8 MARIADB
- Deployed with iRedMail Easy or the downloadable installer?: Installer
- Linux/BSD distribution name and version: CentOS 7.8
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MariaDB
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro?: Yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hi Zhang,

I know how I can block certain attachments for all domains on my system ( https://www.cyberciti.biz/tips/postfix- … files.html ), but how can I block (for example) ".doc" attachments to and from example.com, but let them through on example.net and example.org?

Pro obviously has a way to block IP and email addresses and domains for individual hosted domains, so I'm wondering if there's a similar technique I can use to accomplish the above.

Thanks.


Craig

----

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

2

Re: Block attachments for one domain, but not others

You can achieve this by creating per-domain spam policy (in SQL table "amavisd.policy")

3

Re: Block attachments for one domain, but not others

Thanks Zhang. I looked at docs.iredmail.org but didn't see anything that can help me with this. Any suggestions?

4

Re: Block attachments for one domain, but not others

- Check existing SQL records in "amavisd.policy" for "@." account for general settings.
- Update amavisd config file to define some rules to block '.doc' attachment. For example:

%banned_rules = (
  'NO-MS-DOC'=> new_RE( qr'^\.(doc|docx)$' ),
  'DEFAULT'   => $banned_filename_re,
);

Note: rule 'DEFAULT' is required.
- Update SQL column `policy.banned_rulenames`, specify the name defined in %banned_rules. e.g. 'NO-MS-DOC'.