Articles with the tag:
Close
Changelog
Close
Help Center
Mail Server for Docker

How to run an external script after starting Mail Server Docker container?

Mail Serverv.1.6 Mail Server changelog

Version 1.6.57

Release date: 04/25/2019

New features

  • Added permanent Fail2Ban ignoreip section for docker containers and its gateway;
  • Added the possibility to create sieve rules for users inside /var/vmail/sieve/;
  • Added new extension to sieve: sieve_extensions -> editheader;
  • Exposed port 4190 for ManageSieve service;
  • Added the possibility to run an external script from the /var/vmail/external.sh or /app/onlyoffice/MailServer/data/external.sh path;
  • Changed the default FIRST_DOMAIN parameter;
  • Replaced the hard-coded password used for the first mailbox with a random one;
  • Removed old useless descriptions for iRedMail administrator console path;
  • Added backticks to the 'CREATE DATABASE' commands;
  • Added the possibility to send mail messages from alias_domain, alias_address and full alias;
  • Added the imapsync command;
  • Added the new Python scripts allowing to create mailboxes, change password and run imapsync batch in /usr/src/iRedMail/tools/scripts folder inside the onlyoffice-mail-server container;
  • Added the Python PIP manager and installation requirements.

Bug fixes

  • Fixed the bug with mailbox not being removed when using third level domain (issue: wrong domain regex);
  • Fixed the bug with the Cannot load 1024-bit DH parameters from file /etc/pki/tls/dhparams.pem warning;
  • Fixed the bug with the No such file or directory being shown in many cases;
  • Fixed the bug with the ECHO_INFO: command not found warning.

Version 1.6.25

Release date: 07/03/2017

Runtime

  • Updated OpenSSL to the latest version (1.0.2).

Version 1.6.21

Release date: 04/26/2017

Runtime

  • Fixed the issue when the amavisd-new interface could not start without the properly configured IPv6.

Version 1.6.20

Release date: 12/13/2016

Connection Settings

  • Added page to the Settings for the integration of Community Server (Windows version) with Mail Server.

Installation Script

  • Fixed the error shown if the mail domain is not specified, now Mail Server will not be installed if this is the case.

Version 1.6.7

Release date: 06/22/2016

Refactoring

  • Removed version from the iRedMail folder;
  • iRedMail completed with commits from v.0.9.2;
  • Deleted unused packages from iRedMail;
  • Added the SpamAssassin setup with initial bayes_tokens.

Runtime

  • Fixed the incorrect MySQL server name in the config;
  • Fixed the issue with the config section duplication when starting the Docker container;
  • Fixed the issue with sending mail to a group/alias address;
  • Fixed the startup API issue.

Logging

  • Fixed logging during the installation.

Networking

  • Fixed the fail2ban and iptables issue when starting Docker in a network mode;
  • Fixed the issue with Mail Server on an external physical server.

Version 1.6.0

Release date: 03/09/2016

Settings

  • Redesigned Mail Server settings page.

Version 1.5.0

Release date: 04/20/2015

Mail Server

  • Mail Server for Docker first release.

If you need to change default settings of the onlyoffice-mail-server, starting from v1.6.57, it is possible to run an external script after the container is started. To do that create your script under the following path /app/onlyoffice/MailServer/data/external.sh and write the necessary commands to edit configuration in it, or use any other commands in bash language (see the example below). The script will be executed each time after the version update or restart.

Previously, if it was necessary to change configuration, you had to make the same changes in the configuration files again after the version update. Now, if you write the necessary commands to edit configuration files into the script and save under the specified path, all the changes will be applied automatically each time the script is run after the version update.

Below is an example of the external.sh file, which can be used to customize the Mail Server according to your needs. You can use not all of the commands listed in the example, but only the ones you need, or add your own commands.

{ANY-YOUR-IPS} must be replaced with any set of IP addresses (separated with space) that you trust.

#!/bin/bash


echo "Add ignore IP addresses"
sed -i -e 's/ignoreip = 127.0.0.1\/8 onlyoffice-community-server 172.18.0.1/ignoreip = 127.0.0.1\/8 onlyoffice-community-server 172.18.0.1 {ANY-YOUR-IPS}/g' /etc/fail2ban/jail.conf


echo "Disable greylist"
sed -i -e '/\[Greylisting\]/!b;n;c enable=0' /etc/policyd/cluebringer.conf


echo "Increase imap connections from one IP"
sed -i -e 's/mail_max_userip_connections = 20/mail_max_userip_connections = 100/g' /etc/dovecot/dovecot.conf


echo "Setup mynetwork"
sed -i -e 's/mynetworks = 127.0.0.1$/mynetworks = 127.0.0.1  {ANY-YOUR-IPS}/g' /etc/postfix/main.cf 


fail2ban-client reload
dovecot reload
postfix reload

Where:

  • Add ignore IP addresses is used to create a list of IP addresses, which are not affected by common Fail2ban rules. If a user from the specified IP address enter an incorrect login or password, this IP address will not be blocked, while unknown IP addresses will be blocked after unsuccessful logn attempts.
  • Disable greylist is used to disable the greylisting feature enabled by default (a spam protection feature based on the principle that, if the recipient's server temporary unable to receive a message, mail servers repeat the attempt to send the message, unlike spammers). Disabling this function may be necessary, for example, to avoid a reduction of the business processes speed if you receive a lot of messages from unknown mail servers.
  • Increase imap connections from one IP is used to enable the possibility to connect a bigger number of clients from a single IP address than specified by default. In the example above, 100 connections from a single IP address are allowed instead of 20 connections.
  • Setup mynetwork is used to specify a list of trusted networks in the Postfix configuration file, that allows to make mail server checks less strict for the IP addresses that belong to the trusted networks.
  • Once the changes are made, the fail2ban-client, dovecot, postfix services read the configuration files once again.

To find out how to perform certain operations using a script, you can refer to the following articles:

Download Host on your own server Available for
Docker, Windows and Linux
You Might Also Like This:
Close