Installing the iRedMail mail server on CentOS 7. Part 3. Aliases, a web interface for working with aliases

Alias ​​is a short, easy-to-remember name used in place of a longer, more complex name; most commonly used in email applications.

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

We enable the ability to send letters via alias

Editing the Postfix config (/etc/postfix/main.cf), delete the line:

reject_sender_login_mismatch

in iRedMail version 0.9.9 this line was no longer there

Reload postfix

[[email protected]]# systemctl restart postfix

We edit the iRedAPD config (/opt/iredapd/settings.py), add the line:

reject_sender_login_mismatch

in iRedMail version 0.9.9 this line has already been added

Restarting iRedAPD

[[email protected]]# systemctl restart iredapd

Install phpMyAdmin and configure NGINX

Install phpmyadmin:

[[email protected]]# yum install phpmyadmin

Making a link

[[email protected]]# ln -s /usr/share/phpMyAdmin /var/www/html/pma

Restrict access to phpmyadmin by ip

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

where% ip% is the ip-address allowed to access phpmyadmin

Reload nginx

[[email protected]]# systemctl restart nginx

WEB interface for managing aliases

I didn’t want to install the cumbersome postfixadmin to be able to manage aliases, so I quickly sketched out my admin panel

From the iRedMail manual, aliases are added by SQL query

INSERT INTO alias (address, domain, active) VALUES ('[email protected]', 'mydomain.com', 1);
INSERT INTO forwardings (address, forwarding, domain, dest_domain, is_list, active) VALUES ('[email protected]', '[email protected]', 'mydomain.com', 'test.com', 1, 1);

Admin features:

  • Add alias
  • Edit alias
  • Remove alias

In the future, I will add the ability to activate / deactivate the activity of the alias

Download (github)

To install the web interface, create a directory:

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

Unpack the files from the archive into this directory, edit the files: – in the index.php file – edit lines 225, 226 – in the server.php file – edit line 3 (write the password to the database between empty quotes)

Where is the password from the Mysql database for the “vmailadmin” user: After installing the mail server, a letter with all passwords falls on the [email protected] mailbox. Or the password can be found in the configs

Restricting access to the web interface by managing aliases by ip

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

where% ip% is the ip-address allowed to access phpmyadmin

Reload nginx

[[email protected]]# systemctl restart nginx

UPD 03/27/2019

Updated the web admin panel, added the following features:

  • Make alias active / inactive when adding an entry
  • Make alias active / inactive when editing a record
  • When editing a record, made the “alias” field active and added a check if the edited alias exists in the database
Sidebar