2015-12-23 04:10:41 -06:00
|
|
|
# [DEPRECATED] Per-user outbound restrictions
|
2014-12-10 05:27:09 -06:00
|
|
|
|
2017-12-29 22:02:52 -06:00
|
|
|
!!! warning "DEPRECATED"
|
|
|
|
|
|
|
|
__WARNING: THIS DOCUMENT IS *DEPRECATED*, PLEASE use per-user
|
|
|
|
white/blacklists instead, [doc here](./manage.iredapd.html).__
|
2015-06-26 20:50:52 -05:00
|
|
|
|
|
|
|
## SQL backends
|
2014-12-10 05:27:09 -06:00
|
|
|
|
|
|
|
iRedAPD (a simple Postfix policy server developed by iRedMail team) provides
|
2015-06-26 20:50:52 -05:00
|
|
|
plugin `sql_user_restrictions` for per-user inbound/outbound restrictions.
|
2014-12-10 05:27:09 -06:00
|
|
|
|
|
|
|
Please make sure plugin `sql_user_restrictions` is enabled in iRedAPD config
|
|
|
|
file `/opt/iredapd/settings.py` like below:
|
|
|
|
|
2015-06-26 20:50:52 -05:00
|
|
|
```python
|
2014-12-10 05:27:09 -06:00
|
|
|
# Part of file: /opt/iredapd/settings.py
|
|
|
|
|
|
|
|
plugins = [..., 'sql_user_restrictions']
|
|
|
|
```
|
|
|
|
|
|
|
|
Restarting iRedAPD service is required if you modified `/opt/iredapd/settings.py`.
|
|
|
|
|
2015-06-26 20:50:52 -05:00
|
|
|
You can store allowed or disallowed recipient in 2 SQL columns in `vmail` database:
|
2014-12-10 05:27:09 -06:00
|
|
|
|
|
|
|
* `mailbox.rejectedrecipients`: disallow user to send email to listed recipients.
|
|
|
|
* `mailbox.allowedrecipients`: allow user to send email to listed recipients.
|
|
|
|
|
|
|
|
Valid sender/recipient formats are:
|
|
|
|
|
|
|
|
* `@.`: all addresses (user, domain, sub-domain). Be careful: There's a dot after `@`.
|
|
|
|
* `@domain.com`: entire domain.
|
|
|
|
* `@.domain.com`: entire domain and all its sub-domains. Be careful: There's a dot after `@`.
|
|
|
|
* `user@domain.com`: single email address
|
2014-12-15 22:51:15 -06:00
|
|
|
* empty value means no restriction.
|
2014-12-10 05:27:09 -06:00
|
|
|
|
2015-06-26 20:50:52 -05:00
|
|
|
NOTE: Multiple recipients must be separated by comma (`,`).
|
2014-12-10 05:27:09 -06:00
|
|
|
|
|
|
|
Sample usage:
|
|
|
|
|
2015-06-26 20:50:52 -05:00
|
|
|
* allow local mail user `user@example.com` to send to domain (`example.com`)
|
|
|
|
and `gmail.com`, but not others.
|
2014-12-10 05:27:09 -06:00
|
|
|
|
2015-06-16 07:53:58 -05:00
|
|
|
```sql
|
2014-12-10 05:27:09 -06:00
|
|
|
sql> USE vmail;
|
2015-06-16 07:53:58 -05:00
|
|
|
sql> UPDATE mailbox
|
|
|
|
SET
|
2015-06-26 20:50:52 -05:00
|
|
|
rejectedrecipients='@.',
|
2015-06-16 07:53:58 -05:00
|
|
|
allowedrecipients='@example.com,@gmail.com'
|
|
|
|
WHERE
|
2014-12-10 05:27:09 -06:00
|
|
|
username='user@example.com';
|
|
|
|
```
|
|
|
|
|
|
|
|
## OpenLDAP backend special
|
|
|
|
|
|
|
|
OpenLDAP backend requires iRedAPD plugin `ldap_amavisd_block_blacklisted_senders`.
|
|
|
|
|
|
|
|
* If you have iRedAdmin-Pro, you can manage this restriction in user profile page.
|
|
|
|
|
|
|
|
* If you don't have iRedAdmin-Pro, you can manage it with phpLDAPadmin or other
|
|
|
|
LDAP management tools. Related LDAP attributes are:
|
|
|
|
|
|
|
|
* `mailWhitelistRecipient`: same as SQL `mailbox.allowedrecipients`
|
|
|
|
* `mailBlacklistRecipient`: same as `mailbox.rejectedrecipients`
|
|
|
|
|
|
|
|
Values for these LDAP attributes use the same format as mentioned above.
|
2015-06-26 20:50:52 -05:00
|
|
|
|
|
|
|
Note: multiple recipients must be stored in multiple attributes like below:
|
|
|
|
|
|
|
|
```
|
|
|
|
mailWhitelistRecipient: @example.com
|
|
|
|
mailWhitelistRecipient: @gmail.com
|
|
|
|
mailWhitelistRecipient: @iredmail.org
|
|
|
|
```
|