Installation of the mail server iRedMail on CentOS 7. Part 8. White and black lists. Web interface

White list email addresses contains your approved near or domain name email addresses from which you can send emails to your domain. Black list e-mail addresses contains e-mail addresses of almost or domain names, messages from which should not end up in your domain.

A series of articles on installing and configuring the iRedMail mail server

  • Installing the iRedMail mail server on CentOS 7. Part 1. Basic installation
  • Installing the iRedMail mail server on CentOS 7. Part 2. Fighting spam
  • Installing the iRedMail mail server on CentOS 7. Part 3. Aliases, a web interface for working with aliases
  • Installing the iRedMail mail server on CentOS 7. Part 4. Configuring Postfix, authorization without entering a domain
  • Installing the iRedMail mail server on CentOS 7. Part 5. Storage structure of virtual mailboxes
  • Installing the iRedMail mail server on CentOS 7. Part 6. DKIM, SPF, DMARC
  • Installing the iRedMail mail server on CentOS 7. Part 7. Greylisting whitelist, WEB interface, Dovecot quota
  • Installation of the mail server iRedMail on CentOS 7. Part 8. White and black lists. Web interface

Documentation on managing whitelist and blacklist can be viewed on the official iRedMail website.

This functionality is available in the paid version of iRedMail, but in the free version there is a python script with which you can manage White and Black lists

For example, to add a domain name to the white or black list, run the command:

python /opt/iredapd/tools/wblist_admin.py --add --whitelist @example.com
python /opt/iredapd/tools/wblist_admin.py --add --blacklist @example.com

To remove a domain name from the white or black list, run the command:

python /opt/iredapd/tools/wblist_admin.py --delete --whitelist @example.com
python /opt/iredapd/tools/wblist_admin.py --delete --blacklist @example.com

To view the white or black list, run the command:

python /opt/iredapd/tools/wblist_admin.py --list --whitelist
python /opt/iredapd/tools/wblist_admin.py --list --blacklist

Web admin interface

After analyzing the python script, you can see that whitelists and blacklists are stored in the amavisd MySQL database

I didn’t want to use phpMyAdmin to manage white and black lists, so I sketched my admin panel.

Download (github)

Admin features:

  • Add to list
  • List type selection (white / black)
  • Edit entry
  • Remove from list

To install the web interface, create a directory:

[[email protected]]# mkdir /var/www/html/whitelist

Unpack the files from the archive into this directory, edit the files: – in the server.php file – edit line 3 (replace% password% with your value)

The password for the amavisd database can be found in the letter that was sent to you after installing the iRedMail mail server

We restrict access to the web interface by managing white / black lists by ip:

[[email protected]]# nano /etc/nginx/templates/misc.tmpl
...
location ~ ^/whitelist/$ {
    allow %ip%;
    deny all;
}

where% ip% is the ip-address that is allowed access

Reload nginx

[[email protected]]# systemctl restart nginx
Sidebar