2019-11-27 21:02:57 -06:00
|
|
|
# Manage iRedAPD (white/blacklists, greylisting, throttling and more)
|
2016-01-21 23:23:12 -06:00
|
|
|
|
|
|
|
[TOC]
|
|
|
|
|
2016-03-29 19:14:36 -06:00
|
|
|
!!! note
|
|
|
|
|
|
|
|
All iRedAPD features listed in current page can be managed with our
|
2017-11-16 21:48:44 -06:00
|
|
|
web-based admin panel - [iRedAdmin-Pro](https://www.iredmail.org/admin_panel.html).
|
2016-01-21 23:23:12 -06:00
|
|
|
|
2020-07-05 21:56:05 -05:00
|
|
|
!!! attention
|
|
|
|
|
|
|
|
iRedAPD-4.0 and later releases requires Python 3, if you're running
|
|
|
|
iRedAPD-3.6 or earlier release, please run commands with Python 2 instead.
|
|
|
|
|
2016-01-21 23:23:12 -06:00
|
|
|
## Introduce iRedAPD
|
|
|
|
|
|
|
|
iRedAPD is a simple Postfix policy server, written in Python, with plugin
|
2018-09-06 05:39:28 -05:00
|
|
|
support. It listens on `127.0.0.1:7777` by default, and runs as a low-privileged
|
2016-01-21 23:23:12 -06:00
|
|
|
user `iredapd`.
|
|
|
|
|
2019-12-08 21:38:29 -06:00
|
|
|
Source code is hosted on [GitHub](https://github.com/iredmail/iRedAPD).
|
2018-09-06 05:39:28 -05:00
|
|
|
|
2016-03-29 19:14:36 -06:00
|
|
|
## How to disable iRedAPD service
|
2016-02-10 09:32:17 -06:00
|
|
|
|
2016-02-12 07:58:38 -06:00
|
|
|
To disable iRedAPD service:
|
|
|
|
|
|
|
|
1. please remove all `check_policy_service inet:127.0.0.1:7777` in Postfix config file
|
2016-02-10 09:32:17 -06:00
|
|
|
`/etc/postfix/main.cf` (Linux/OpenBSD) or `/usr/local/etc/postfix/main.cf`
|
2016-02-12 07:58:38 -06:00
|
|
|
(FreeBSD).
|
|
|
|
1. Restart or reload Postfix service.
|
|
|
|
1. Disable iredapd service.
|
2016-02-10 09:32:17 -06:00
|
|
|
|
2016-03-29 19:14:36 -06:00
|
|
|
## How to enable or disable iRedAPD plugins
|
|
|
|
|
2020-04-15 00:54:43 -05:00
|
|
|
iRedAPD plugins are Python files under `/opt/iredapd/plugins/` directory. To
|
2016-03-29 19:14:36 -06:00
|
|
|
enable a plugin, please find line `plugins =` in iRedAPD config file
|
|
|
|
`/opt/iredapd/settings.py`, for example:
|
|
|
|
|
|
|
|
```
|
2020-04-15 00:54:43 -05:00
|
|
|
plugins = ['greylisting', 'throttle']
|
2016-03-29 19:14:36 -06:00
|
|
|
```
|
|
|
|
|
|
|
|
If you want to enable plugin `reject_sender_login_mismatch` (file
|
|
|
|
`/opt/iredapd/plugins/reject_sender_login_mismatch.py`), please add the plugin
|
2020-04-15 00:54:43 -05:00
|
|
|
name without extension `.py` in `plugins =` like below, then restart iRedAPD
|
|
|
|
service:
|
2016-03-29 19:14:36 -06:00
|
|
|
|
|
|
|
```
|
2020-04-15 00:54:43 -05:00
|
|
|
plugins = ['greylisting', 'throttle', 'reject_sender_login_mismatch']
|
2016-03-29 19:14:36 -06:00
|
|
|
```
|
|
|
|
|
|
|
|
The priorities of plugins shipped in iRedAPD are hard-coded, so the order of
|
2020-04-15 00:54:43 -05:00
|
|
|
plugin names doesn't matter.
|
2016-03-29 19:14:36 -06:00
|
|
|
|
|
|
|
To disable a plugin, just remove the plugin name and restart iRedAPD service.
|
|
|
|
|
2016-04-13 08:19:33 -05:00
|
|
|
## How to add custom settings
|
|
|
|
|
|
|
|
iRedAPD has some default settings in file
|
|
|
|
`/opt/iredapd/libs/default_settings.py`, but you should never modify it.
|
|
|
|
Instead, you should copy the settings you want to modify from
|
|
|
|
`/opt/iredapd/libs/default_settings.py` to `/opt/iredapd/settings.py`, then
|
|
|
|
update it with new values. This way you will keep custom settings after
|
|
|
|
upgrading iRedAPD -- because iRedAPD upgrade tool will copy
|
|
|
|
`/opt/iredapd/settings.py` to new iRedAPD release during upgrading.
|
|
|
|
|
2016-05-26 01:40:49 -05:00
|
|
|
## Features
|
|
|
|
|
|
|
|
### Sender Address Restrictions
|
2016-05-03 01:33:13 -05:00
|
|
|
|
|
|
|
Plugin `reject_sender_login_mismatch` will reject emails if:
|
|
|
|
|
2016-11-24 08:22:20 -06:00
|
|
|
* smtp authentication username (`sasl_username`) is different from sender
|
|
|
|
address (`From:` in mail header). This is called `sender login mismatch`.
|
|
|
|
Note: This can be performed by Postfix with restriction rule
|
|
|
|
`reject_sender_login_mismatch` in `smtpd_sender_restrictions =`, but iRedAPD
|
|
|
|
plugin does more work.
|
|
|
|
* sender domain is hosted on localhost, but sender doesn't perform smtp auth
|
|
|
|
to send email. This is called "forged" email.
|
2016-05-03 01:33:13 -05:00
|
|
|
|
|
|
|
It offers some parameters to control whether or not to reject email:
|
|
|
|
|
|
|
|
* for forged sender address checking:
|
|
|
|
|
|
|
|
```
|
|
|
|
# Check whether sender is forged in message sent without smtp auth.
|
|
|
|
CHECK_FORGED_SENDER = True
|
|
|
|
|
|
|
|
# If you allow someone or some service providers to send email as forged
|
|
|
|
# (your local) address, you can list all allowed addresses in this parameter.
|
|
|
|
# For example, if some ISPs may send email as 'user@mydomain.com' (mydomain.com
|
|
|
|
# is hosted on your server) to you, you should add `user@mydomain.com` as one
|
|
|
|
# of forged senders.
|
|
|
|
# Sample: ALLOWED_FORGED_SENDERS = ['user@mydomain.com', 'mydomain.com']
|
|
|
|
ALLOWED_FORGED_SENDERS = []
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
* for sender login mismatch:
|
|
|
|
|
|
|
|
```
|
|
|
|
# Allow sender login mismatch for specified senders or sender domains.
|
|
|
|
#
|
|
|
|
# Sample setting: allow local user `user@local_domain_1.com` and all users
|
|
|
|
# under `local_domain_2.com` to send email as other users.
|
|
|
|
#
|
|
|
|
# ALLOWED_LOGIN_MISMATCH_SENDERS = ['user@local_domain_1.com', 'local_domain_2.com']
|
|
|
|
ALLOWED_LOGIN_MISMATCH_SENDERS = []
|
|
|
|
|
|
|
|
# Strictly allow sender to send as one of user alias addresses. Default is True.
|
|
|
|
ALLOWED_LOGIN_MISMATCH_STRICTLY = True
|
|
|
|
|
|
|
|
# Allow member of mail lists/alias account to send email as mail list/alias
|
|
|
|
# ('From: <email_of_mail_list>' in mail header). Default is False.
|
|
|
|
ALLOWED_LOGIN_MISMATCH_LIST_MEMBER = False
|
|
|
|
```
|
|
|
|
|
2016-05-26 01:40:49 -05:00
|
|
|
### White/Blacklisting
|
2016-01-21 23:23:12 -06:00
|
|
|
|
2016-05-26 01:40:49 -05:00
|
|
|
#### How to disable white/blacklists completely
|
2016-02-02 04:48:01 -06:00
|
|
|
|
|
|
|
To disable white/blacklists completely, please remove plugin name
|
|
|
|
`amavisd_wblist` in iRedAPD config file `/opt/iredapd/settings.py`,
|
|
|
|
parameter `plugins =`:
|
|
|
|
|
|
|
|
```
|
|
|
|
plugins = [..., 'amavisd_wblist', ...]
|
|
|
|
```
|
|
|
|
|
|
|
|
Restarting iRedAPD service is required.
|
|
|
|
|
2016-05-26 01:40:49 -05:00
|
|
|
#### Manage white/blacklists
|
2016-02-15 05:45:31 -06:00
|
|
|
|
|
|
|
> * White/blacklisting is available in iRedAPD-1.4.4 and later releases.
|
|
|
|
> * Script `tools/wblist_admin.py` is available in iRedAPD-1.7.0 and later releases.
|
|
|
|
|
|
|
|
White/blacklisting is controlled by plugin `amavisd_wblist` (file
|
|
|
|
`/opt/iredapd/plugins/amavisd_wblist.py`), you can manage it with script
|
|
|
|
`/opt/iredapd/tools/wblist_admin.py`.
|
|
|
|
|
2016-05-26 01:40:49 -05:00
|
|
|
##### Available arguments
|
2016-01-21 23:23:12 -06:00
|
|
|
|
|
|
|
```
|
|
|
|
--outbound
|
|
|
|
Manage white/blacklist for outbound messages.
|
|
|
|
|
|
|
|
If no '--outbound' argument, defaults to manage inbound messages.
|
|
|
|
|
|
|
|
--account account
|
|
|
|
Add white/blacklists for specified (local) account. Valid formats:
|
|
|
|
|
|
|
|
- a single user: username@domain.com
|
|
|
|
- a single domain: @domain.com
|
|
|
|
- entire domain and all its sub-domains: @.domain.com
|
|
|
|
- anyone: @. (the ending dot is required)
|
|
|
|
|
|
|
|
if no '--account' argument, defaults to '@.' (anyone).
|
|
|
|
|
|
|
|
--add
|
|
|
|
Add white/blacklists for specified (local) account.
|
|
|
|
|
|
|
|
--delete
|
|
|
|
Delete specified white/blacklists for specified (local) account.
|
|
|
|
|
|
|
|
--delete-all
|
|
|
|
Delete ALL white/blacklists for specified (local) account.
|
|
|
|
|
|
|
|
--list
|
|
|
|
Show existing white/blacklists for specified (local) account. If no
|
|
|
|
account specified, defaults to manage server-wide white/blacklists.
|
|
|
|
|
|
|
|
--whitelist sender1 [sender2 sender3 ...]
|
|
|
|
Whitelist specified sender(s). Multiple senders must be separated by a space.
|
|
|
|
|
|
|
|
--blacklist sender1 [sender2 sender3 ...]
|
|
|
|
Blacklist specified sender(s). Multiple senders must be separated by a space.
|
|
|
|
|
|
|
|
WARNING: Do not use --list, --add-whitelist, --add-blacklist at the same time.
|
|
|
|
```
|
|
|
|
|
2016-05-26 01:40:49 -05:00
|
|
|
##### Sample usages
|
2016-01-21 23:23:12 -06:00
|
|
|
|
|
|
|
* Show and add server-wide whitelists or blacklists:
|
|
|
|
|
|
|
|
```
|
2020-07-05 21:56:05 -05:00
|
|
|
python3 wblist_admin.py --list --whitelist
|
|
|
|
python3 wblist_admin.py --list --blacklist
|
2017-12-05 20:14:53 -06:00
|
|
|
|
|
|
|
# Whitelist IP address, email address, entire domain, subdomain (including main domain)
|
2020-07-05 21:56:05 -05:00
|
|
|
python3 wblist_admin.py --add --whitelist 192.168.1.10 user@domain.com @iredmail.org @.example.com
|
2017-12-05 20:14:53 -06:00
|
|
|
|
|
|
|
# Blacklist IP address, email address, entire domain, subdomain (including main domain)
|
2020-07-05 21:56:05 -05:00
|
|
|
python3 wblist_admin.py --add --blacklist 202.96.134.133 bad-user@domain.com @bad-domain.com @.sub-domain.com
|
2016-01-21 23:23:12 -06:00
|
|
|
```
|
|
|
|
|
|
|
|
* For per-user or per-domain whitelists and blacklists, please use option
|
|
|
|
`--account`. for example:
|
|
|
|
|
|
|
|
```
|
2020-07-05 21:56:05 -05:00
|
|
|
python3 wblist_admin.py --account @mydomain.com --add --whitelist 192.168.1.10 user@example.com
|
|
|
|
python3 wblist_admin.py --account user@mydomain.com --add --blacklist 172.16.1.10 baduser@example.com
|
2016-01-21 23:23:12 -06:00
|
|
|
|
2020-07-05 21:56:05 -05:00
|
|
|
python3 wblist_admin.py --account @mydomain.com --list --whitelist
|
|
|
|
python3 wblist_admin.py --account user@mydomain.com --list --blacklist
|
2016-01-21 23:23:12 -06:00
|
|
|
```
|
|
|
|
|
2016-05-26 01:40:49 -05:00
|
|
|
### Greylisting
|
2016-01-21 23:23:12 -06:00
|
|
|
|
2016-05-20 04:31:36 -05:00
|
|
|
!!! attention
|
2016-04-13 08:19:33 -05:00
|
|
|
|
|
|
|
Greylisting is available in iRedAPD-1.7.0 and later releases.
|
|
|
|
|
2016-04-12 08:49:36 -05:00
|
|
|
For technical details about greylisting, please visit <http://greylisting.org/>
|
|
|
|
|
2019-06-13 03:14:08 -05:00
|
|
|
#### How to disable greylisting service globally
|
2016-02-02 04:48:01 -06:00
|
|
|
|
2019-06-13 03:14:08 -05:00
|
|
|
To disable greylisting global, please run command below:
|
2016-02-02 04:48:01 -06:00
|
|
|
|
|
|
|
```
|
2020-07-05 21:56:05 -05:00
|
|
|
python3 /opt/iredapd/tools/greylisting_admin.py --disable --from '@.'
|
2016-02-02 04:48:01 -06:00
|
|
|
```
|
|
|
|
|
2016-05-26 01:40:49 -05:00
|
|
|
#### General settings
|
2016-04-13 08:19:33 -05:00
|
|
|
|
|
|
|
There're several settings for greylisting behaviour, default values are defined
|
|
|
|
in `/opt/iredapd/libs/default_settings.py`. If you want to modify them, please
|
|
|
|
add the settings with custom values in `/opt/iredapd/settings.py`.
|
|
|
|
|
2017-06-05 08:58:16 -05:00
|
|
|
* `GREYLISTING_TRAINING_MODE`: enable greylisting service, but don't reject
|
|
|
|
any emails. This training mode is useful if this is a new mail server, it
|
|
|
|
collects information of sender servers for further use.
|
2016-04-13 08:19:33 -05:00
|
|
|
* `GREYLISTING_MESSAGE`: the rejection message which will be sent to sender
|
|
|
|
server. Default is `Intentional policy rejection, please try again later`.
|
|
|
|
* `GREYLISTING_BLOCK_EXPIRE`: Time (in MINUTES) to wait before client retrying,
|
|
|
|
client will be rejected if retires too soon (in less than specified minutes).
|
|
|
|
Defaults to `15` minutes.
|
|
|
|
* `GREYLISTING_AUTH_TRIPLET_EXPIRE`: Disable greylisting for how long (in DAYS)
|
|
|
|
for clients which passed greylisting (retried and delivered). It's also used
|
|
|
|
to clean up old greylisting tracking records. Defaults to `30` days.
|
|
|
|
* `GREYLISTING_UNAUTH_TRIPLET_EXPIRE`: Time (in DAYS) to keep tracking records
|
|
|
|
if client didn't pass the greylisting, and no further deliver attempts.
|
|
|
|
Defaults to `2` days.
|
|
|
|
|
2016-05-26 01:40:49 -05:00
|
|
|
#### Manage greylisting settings
|
2016-02-15 05:45:31 -06:00
|
|
|
|
|
|
|
> * Script `tools/greylisting_admin.py` is available in iRedAPD-1.8.0 and
|
|
|
|
> later releases.
|
|
|
|
|
|
|
|
Greylisting is controlled by plugin `greylisting` (file
|
|
|
|
`/opt/iredapd/plugins/greylisting.py`), you can manage it with script
|
|
|
|
`/opt/iredapd/tools/greylisting_admin.py`.
|
|
|
|
|
2016-05-26 01:40:49 -05:00
|
|
|
##### Available arguments
|
2016-01-21 23:23:12 -06:00
|
|
|
|
|
|
|
```
|
2016-05-07 19:49:48 -05:00
|
|
|
--list-whitelist-domains
|
|
|
|
Show ALL whitelisted sender domain names (in `greylisting_whitelist_domains`)
|
|
|
|
|
|
|
|
--list-whitelists
|
|
|
|
Show ALL whitelisted sender addresses (in `greylisting_whitelists`)
|
|
|
|
|
|
|
|
--whitelist-domain
|
|
|
|
Whitelist the IP addresses/networks in SPF record of specified sender
|
|
|
|
domain for greylisting service. Whitelisted domain is stored in sql
|
|
|
|
table `greylisting_whitelist_domains`.
|
|
|
|
|
|
|
|
--remove-whitelist-domain
|
|
|
|
Remove whitelisted sender domain
|
|
|
|
|
2016-01-21 23:23:12 -06:00
|
|
|
--list
|
|
|
|
Show ALL existing greylisting settings.
|
|
|
|
|
|
|
|
--from <from_address>
|
|
|
|
--to <to_address>
|
|
|
|
Manage greylisting setting from email which is sent from <from_address>
|
|
|
|
to <to_address>.
|
2017-12-05 20:14:53 -06:00
|
|
|
|
2016-01-21 23:23:12 -06:00
|
|
|
Valid formats for both <from_address> and <to_address>:
|
|
|
|
|
|
|
|
- a single user: username@domain.com
|
|
|
|
- a single domain: @domain.com
|
|
|
|
- entire domain and all its sub-domains: @.domain.com
|
|
|
|
- anyone: @. (the ending dot is required)
|
|
|
|
|
|
|
|
if no '--from' or '--to' argument, defaults to '@.' (anyone).
|
|
|
|
|
|
|
|
--enable
|
|
|
|
Explicitly enable greylisting for specified account.
|
|
|
|
|
|
|
|
--disable
|
|
|
|
Explicitly disable greylisting for specified account.
|
|
|
|
|
|
|
|
--delete
|
|
|
|
Delete specified greylisting setting.
|
|
|
|
```
|
|
|
|
|
2016-05-26 01:40:49 -05:00
|
|
|
##### Sample usages
|
2016-01-21 23:23:12 -06:00
|
|
|
|
2016-05-07 19:49:48 -05:00
|
|
|
* List all existing greylisting settings:
|
2016-01-21 23:23:12 -06:00
|
|
|
|
|
|
|
```
|
2020-07-05 21:56:05 -05:00
|
|
|
python3 greylisting_admin.py --list
|
2016-05-07 19:49:48 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
* List all whitelisted sender domain names (in SQL table `greylisting_whitelist_domains`):
|
|
|
|
|
|
|
|
```
|
2020-07-05 21:56:05 -05:00
|
|
|
python3 greylisting_admin.py --list-whitelist-domains
|
2016-05-07 19:49:48 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
* List all whitelisted sender addresses (in SQL table `greylisting_whitelists`):
|
|
|
|
|
|
|
|
```
|
2020-07-05 21:56:05 -05:00
|
|
|
python3 greylisting_admin.py --list-whitelists
|
2016-05-07 19:49:48 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
* Whitelist IP networks/addresses specified in sender domain:
|
|
|
|
|
|
|
|
```
|
2020-07-05 21:56:05 -05:00
|
|
|
python3 greylisting_admin.py --whitelist-domain --from '@example.com'
|
2016-05-07 19:49:48 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
This is same as:
|
|
|
|
|
|
|
|
```
|
2020-07-05 21:56:05 -05:00
|
|
|
python3 spf_to_whitelist_domains.py --submit example.com
|
2016-05-07 19:49:48 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
* Remove a whitelisted sender domain:
|
|
|
|
|
|
|
|
```
|
2020-07-05 21:56:05 -05:00
|
|
|
python3 greylisting_admin.py --remove-whitelist-domain --from '@example.com'
|
2016-01-21 23:23:12 -06:00
|
|
|
```
|
|
|
|
|
|
|
|
* Enable greylisting for emails which are sent from anyone to local mail domain `example.com`:
|
|
|
|
|
|
|
|
```
|
2020-07-05 21:56:05 -05:00
|
|
|
python3 greylisting_admin.py --enable --to '@example.com'
|
2016-01-21 23:23:12 -06:00
|
|
|
```
|
|
|
|
|
|
|
|
* Disable greylisting for emails which are sent from anyone to local mail user `user@example.com`:
|
|
|
|
|
|
|
|
```
|
2020-07-05 21:56:05 -05:00
|
|
|
python3 greylisting_admin.py --disable --to 'user@example.com'
|
2016-01-21 23:23:12 -06:00
|
|
|
```
|
|
|
|
|
2016-05-07 19:49:48 -05:00
|
|
|
* Disable greylisting for emails which are sent from `gmail.com` to local mail user `user@example.com`:
|
2016-01-21 23:23:12 -06:00
|
|
|
|
|
|
|
```
|
2020-07-05 21:56:05 -05:00
|
|
|
python3 greylisting_admin.py --disable --from '@gmail.com' --to 'user@example.com'
|
2016-01-21 23:23:12 -06:00
|
|
|
```
|
|
|
|
|
2017-09-01 22:17:04 -05:00
|
|
|
* Disable greylisting for sender IP:
|
|
|
|
|
|
|
|
```
|
2020-07-05 21:56:05 -05:00
|
|
|
python3 greylisting_admin.py --disable --from '45.56.127.226'
|
2017-09-01 22:17:04 -05:00
|
|
|
```
|
|
|
|
|
2016-05-07 19:49:48 -05:00
|
|
|
* Delete greylisting setting for emails which are sent from anyone to local domain `test.com`:
|
2016-01-21 23:23:12 -06:00
|
|
|
|
|
|
|
```
|
2020-07-05 21:56:05 -05:00
|
|
|
python3 greylisting_admin.py --delete --to '@test.com'
|
2016-01-21 23:23:12 -06:00
|
|
|
```
|
2016-01-22 09:16:02 -06:00
|
|
|
|
2016-05-26 01:40:49 -05:00
|
|
|
##### RECOMMENDED: Additional greylisting whitelist support
|
2016-01-22 09:16:02 -06:00
|
|
|
|
2016-08-01 02:53:18 -05:00
|
|
|
Since many companies setup their mail servers to re-deliver returned email
|
2016-01-22 09:16:02 -06:00
|
|
|
immediately from another server, this causes trouble with greylisting.
|
|
|
|
|
|
|
|
Possible solutions:
|
|
|
|
|
|
|
|
1. Disable greylisting on your server completely.
|
2016-05-07 19:49:48 -05:00
|
|
|
1. [Recommended] Whitelist IP addresses/networks of their mail servers.
|
2016-01-22 09:16:02 -06:00
|
|
|
|
|
|
|
For solution #2, you can whitelist those mail servers with script
|
2016-04-09 23:25:07 -05:00
|
|
|
`/opt/iredapd/tools/spf_to_greylist_whitelists.py`.
|
2016-01-22 09:16:02 -06:00
|
|
|
|
2016-05-07 19:49:48 -05:00
|
|
|
!!! attention
|
|
|
|
|
|
|
|
Script `tools/spf_to_greylist_whitelists.py` is available in iRedAPD-1.8.0 and later releases.
|
2016-01-22 09:16:02 -06:00
|
|
|
|
|
|
|
It queries SPF and MX records of specified mail domain names, then store all
|
|
|
|
converted IP addresses/networks defined in SPF/MX records in SQL table
|
|
|
|
`iredapd.greylisting_whitelists`.
|
|
|
|
|
|
|
|
To whitelist IP addresses/networks of some mail domain, for example,
|
|
|
|
`outlook.com`, `microsoft.com`, please run command like below:
|
|
|
|
|
|
|
|
```
|
2020-07-05 21:56:05 -05:00
|
|
|
cd /opt/iredapd/tools/
|
|
|
|
python3 spf_to_greylist_whitelists.py outlook.com microsoft.com
|
2016-01-22 09:16:02 -06:00
|
|
|
```
|
|
|
|
|
2016-11-27 23:22:47 -06:00
|
|
|
!!! note
|
|
|
|
|
|
|
|
Above command stores server addresses/networks in SPF/MX records in SQL
|
|
|
|
table, but doesn't store whitelisted domain name in SQL, that means
|
|
|
|
iRedAPD won't re-query their DNS records regularly (via cron job) to get
|
|
|
|
the latest servers listed in SPF record. To store domain names and update
|
|
|
|
their server addresses/networks, please run above command with `--submit`
|
|
|
|
option.
|
|
|
|
|
2016-01-22 09:16:02 -06:00
|
|
|
If you want to whitelist more mail domains, just run the command with the
|
|
|
|
domain names like above sample.
|
|
|
|
|
|
|
|
Since iRedAPD-1.8.0, we have SQL table `iredapd.greylisting_whitelist_domains`
|
2016-04-09 23:25:07 -05:00
|
|
|
to store these mail domain names. if you run `spf_to_greylist_whitelists.py`
|
2017-12-05 20:14:53 -06:00
|
|
|
without any argument, it will fetch all mail domains stored in sql table
|
2016-01-22 09:16:02 -06:00
|
|
|
`greylisting_whitelist_domains` instead of fetching from command line arguments.
|
|
|
|
|
|
|
|
```
|
2020-07-05 21:56:05 -05:00
|
|
|
python3 spf_to_greylist_whitelists.py
|
2016-01-22 09:16:02 -06:00
|
|
|
```
|
|
|
|
|
|
|
|
You should setup a cron job to run this script, so that it can keep the IP
|
2016-05-07 19:49:48 -05:00
|
|
|
addresses/networks up to date. iRedMail sets up the cron job to run every 10 or
|
|
|
|
30 minutes, like below:
|
2016-01-22 09:16:02 -06:00
|
|
|
|
|
|
|
```
|
2020-07-05 21:56:05 -05:00
|
|
|
*/30 * * * * /usr/bin/python3 /opt/iredapd/tools/spf_to_greylist_whitelists.py &>/dev/null
|
2016-01-22 09:16:02 -06:00
|
|
|
```
|