Voci con l'etichetta :
Chiudi
Changelog
Chiudi
Provalo nel cloud
Centro assistenza
ONLYOFFICE Mail for Docker

Installing ONLYOFFICE Mail for Docker on a local server

ONLYOFFICE Mail v1.6 ONLYOFFICE Mail 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.

Introduction

ONLYOFFICE Mail is a full-featured mail server solution developed on the base of the iRedMail package, containing the following components: Postfix, Dovecot, SpamAssassin, ClamAV, OpenDKIM, Fail2ban.

Integrated with ONLYOFFICE Groups, ONLYOFFICE Mail allows you to:

  • connect your own domain name;
  • create mailboxes;
  • add aliases for each mailbox;
  • create mailbox groups.

This guide will show you how to install ONLYOFFICE Mail Docker version to your machine.

System requirements

  • CPU
    dual core 2 GHz or better
  • RAM
    4 GB or more
  • HDD
    at least 20 GB of free space
  • SWAP
    at least 4 GB, but depends of the host OS. More is better
  • OS
    amd64 Linux distribution with kernel version 3.10 or later
  • Additional requirements
    • Docker: any version supported by Docker team
On Ubuntu 20.04, you need to disable the default ufw firewall when installing ONLYOFFICE Mail.

Before you start installation

Before you start installation of ONLYOFFICE Mail, you need to link your computer where ONLYOFFICE Mail is going to be installed with the domain selected for the mail server. We recommend that you select a name like mx.yourdomain.com for the A record of your mail server computer. This means that the A record in your Domain Name System (DNS) must point to the IP address of the computer where ONLYOFFICE Mail will be installed and the Pointer (PTR) record on this computer must resolve the computer IP address to a fully-qualified domain name (FQDN) as an opposite to what A record does.

To verify the correctness of the settings for the A record the following command is used:

dig -t A mx.yourdomain.com

If everything is correct you should see the output which contains lines like these among the others:

...
;; ANSWER SECTION:
mx.yourdomain.com.  IN  A   {your IP address}
...

Instead of {your IP address} the real IP address of the server will be shown.

The PTR record is checked with another command:

dig -x {your IP address}

It should return the output which contains lines like these among the others:

...
;; ANSWER SECTION:
{your IP address}   IN  PTR mx.yourdomain.com.
...

Once you make sure that all settings are correct, you can proceed to the next steps.

After you install ONLYOFFICE Mail, you will also need to add an MX record to yourdomain.com so that it pointed to mx.yourdomain.com. This is required for mail to reach @yourdomain.com addresses.

Installing ONLYOFFICE Mail using automatic script command

If you do not want to set everything manually, you can install ONLYOFFICE Mail automatically using our Docker script. You can download the script using our site download page. Or the direct download link can be used, if it is more convenient for you:

wget https://download.onlyoffice.com/install/workspace-install.sh

Once the download is finished, run the following command to install ONLYOFFICE Mail:

bash workspace-install.sh -ics false -ids false -icp false -ims true -md yourdomain.com -es true

Installing ONLYOFFICE Mail manually

If you prefer to have full control of what and how is being installed, you can run the installation in manual mode. To do that follow the steps below.

Installing prerequisites

You need the latest Docker version installed. If you do not have it, please see the Installation section on Docker website to learn how to get it.

Docker specifies Google DNS servers by default. If your ONLYOFFICE Groups is not going to have access to the Internet, we recommend that you change the default Docker DNS address to the address of your local DNS server. To do that go to the /etc/default/docker file and change the IP address in the following line to the IP address of a DNS server in your local network:
docker_OPTS="--dns 8.8.8.8"

For the RPM based operating systems like CentOS:

  1. Create the /etc/docker/daemon.json configuration file with the following contents:
    { "dns" : [ "8.8.8.8" ] }
    
  2. Restart the Docker service:
    
    sudo systemctl restart docker.service
    

Before you start the installation you need to create the following folders:

  1. For MySQL server
    sudo mkdir -p "/app/onlyoffice/mysql/conf.d";
    sudo mkdir -p "/app/onlyoffice/mysql/data";
    sudo mkdir -p "/app/onlyoffice/mysql/initdb";
    
  2. And for ONLYOFFICE Mail data and logs
    sudo mkdir -p "/app/onlyoffice/MailServer/data/certs";
    sudo mkdir -p "/app/onlyoffice/MailServer/logs";
    

Then create the onlyoffice network:

sudo docker network create --driver bridge onlyoffice
Installing MySQL

After that you need to create MySQL server Docker container. Create the configuration file:

echo "[mysqld]
sql_mode = 'NO_ENGINE_SUBSTITUTION'
max_connections = 1000
max_allowed_packet = 1048576000
group_concat_max_len = 2048" > /app/onlyoffice/mysql/conf.d/onlyoffice.cnf

Create the SQL script which will generate the users and issue the rights to them. The onlyoffice_user is required for ONLYOFFICE Community Server, and the mail_admin is required for ONLYOFFICE Mail in case it is going to be installed:

echo "ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'my-secret-pw';
CREATE USER IF NOT EXISTS 'onlyoffice_user'@'%' IDENTIFIED WITH mysql_native_password BY 'onlyoffice_pass';
CREATE USER IF NOT EXISTS 'mail_admin'@'%' IDENTIFIED WITH mysql_native_password BY 'Isadmin123';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
GRANT ALL PRIVILEGES ON *.* TO 'onlyoffice_user'@'%';
GRANT ALL PRIVILEGES ON *.* TO 'mail_admin'@'%';
FLUSH PRIVILEGES;" > /app/onlyoffice/mysql/initdb/setup.sql
Please note, that the above script will set permissions to access SQL server from any domains (%). If you want to limit the access, you can specify hosts which will have access to SQL server.

Now you can create MySQL container setting MySQL version to 8.0.29:

sudo docker run --net onlyoffice -i -t -d --restart=always --name onlyoffice-mysql-server \
 -v /app/onlyoffice/mysql/conf.d:/etc/mysql/conf.d \
 -v /app/onlyoffice/mysql/data:/var/lib/mysql \
 -v /app/onlyoffice/mysql/initdb:/docker-entrypoint-initdb.d \
 -e MYSQL_ROOT_PASSWORD=my-secret-pw \
 -e MYSQL_DATABASE=onlyoffice \
 mysql:8.0.29
If you want to use an external database, you need to set up it (namely, add a user):
CREATE USER 'mail_admin'@'localhost' IDENTIFIED BY 'Isadmin123';
GRANT ALL PRIVILEGES ON * . * TO 'mail_admin'@'%' IDENTIFIED BY 'Isadmin123';
FLUSH PRIVILEGES;
Installing ONLYOFFICE Mail

After you have everything ready, execute the following command:

sudo docker run --init --net onlyoffice --privileged -i -t -d --restart=always --name onlyoffice-mail-server -p 25:25 -p 143:143 -p 587:587 -p 8081:8081 \
 -e MYSQL_SERVER=onlyoffice-mysql-server \
 -e MYSQL_SERVER_PORT=3306 \
 -e MYSQL_ROOT_USER=root \
 -e MYSQL_ROOT_PASSWD=my-secret-pw \
 -e MYSQL_SERVER_DB_NAME=onlyoffice_mailserver \
 -v /app/onlyoffice/MailServer/data:/var/vmail \
 -v /app/onlyoffice/MailServer/data/certs:/etc/pki/tls/mailserver \
 -v /app/onlyoffice/MailServer/logs:/var/log \
 -h yourdomain.com \
 onlyoffice/mailserver

Where yourdomain.com is your mail server hostname.

Your domain that will be used for maintaining correspondence must be valid and configured for this machine (i.e. it should have the appropriate A record in the DNS settings that points your domain name to the IP address of the machine where ONLYOFFICE Mail is installed).
In the command above, the "yourdomain.com" parameter must be understood as a service domain for ONLYOFFICE Mail. It is usually specified in the MX record of the domain that will be used for maintaining correspondence. As a rule, the "yourdomain.com" looks like mx1.onlyoffice.com

In this case the mail server will ensure the mail delivery to internal addresses hosted on this server.

Storing data outside containers

All the data are stored in the specially-designated directories, data volumes, at the following location:

  • /var/log for ONLYOFFICE Mail logs
  • /var/lib/mysql for MySQL database data
  • /var/vmail for mail storage
  • /etc/pki/tls/mailserver for certificates
We recommend We strongly recommend that you store the data outside the Docker containers on the host machine as it allows you to easily update ONLYOFFICE Mail once the new version is released without losing your data.

To get access to your data located outside the container, you need to mount the volumes. It can be done by specifying the -v option in the docker run command.

sudo docker run --privileged -i -t -d -p 25:25 -p 143:143 -p 587:587 -p 8081:8081 \
        -v /app/onlyoffice/MailServer/logs:/var/log  \
        -v /app/onlyoffice/MailServer/mysql:/var/lib/mysql  \
        -v /app/onlyoffice/MailServer/data:/var/vmail  \
        -v /app/onlyoffice/MailServer/data/certs:/etc/pki/tls/mailserver -h yourdomain.com onlyoffice/mailserver
Please note, that in case you are trying to mount the folders which are not yet created, these folders will be created but the access to them will be limited. You will need to change their access rights manually.

Storing the data on the host machine allows you to easily update ONLYOFFICE Mail once the new version is released without losing your data.

Configuring Docker image

To ensure the mail delivery to internal addresses as well as addresses of external servers you need to get your own domain name and configure a DNS server.

The following DNS records are required:

  • A record (used to point a domain to the IP address of the host where this docker image is deployed).
  • Pointer (PTR) record or a reverse DNS record (used to map a network interface (IP) to a hostname).
sudo docker run --privileged -i -t -d -p 25:25 -p 143:143 -p 587:587 \
-v /app/onlyoffice/MailServer/data/certs:/etc/pki/tls/mailserver -h yourdomain.com onlyoffice/mailserver

Where yourdomain.com is your mail server hostname.

Installing the SSL certificates

The self-signed certificates for your domain will be created by default while running the docker container. If you want to use CA sertified certificates, you will need to rename them and copy into the /app/onlyoffice/MailServer/data/certs directory before running the image. The following files are required:

  • /app/onlyoffice/MailServer/data/certs/mail.onlyoffice.key
  • /app/onlyoffice/MailServer/data/certs/mail.onlyoffice.crt
  • /app/onlyoffice/MailServer/data/certs/mail.onlyoffice.ca-bundle

You can copy the SSL certificates into the /app/onlyoffice/MailServer/data/certs directory after running the image. But in this case you will need to restart the docker container.

Available configuration parameters
Please refer the docker run command options for the `--env-file` flag where you can specify all required environment variables in a single file. This will save you from writing a potentially long docker run command.

Below is the complete list of parameters that can be set using environment variables.

  • STORAGE_BASE_DIR: The path to the mail store. Defaults to /var/vmail.
  • FIRST_DOMAIN: The first virtual domain, where the postmaster address will be hosted. This domain should not coincide with the primary mail server domain. Defaults to mailserver.onlyoffice.com.
  • DOMAIN_ADMIN_PASSWD: The postmaster password. The default postmaster address is postmaster@mailserver.onlyoffice.com.

Installing ONLYOFFICE Mail integrated with ONLYOFFICE Docs and ONLYOFFICE Groups

ONLYOFFICE Mail is a part of ONLYOFFICE Workspace that comprises also ONLYOFFICE Docs, ONLYOFFICE Control Panel and ONLYOFFICE Community Server. In case you want to install all of them and integrate with each other, read these instructions.

Alternative ways to install ONLYOFFICE Mail

Alternatively, you can use an automatic installation script to install the whole Workspace at once. For the mail server correct work you need to specify its hostname yourdomain.com.

STEP 1: Download the installation script file

Execute the following command:

wget https://download.onlyoffice.com/install/workspace-install.sh
STEP 2: Install Workspace

Run the following command to do that:

bash workspace-install.sh -md yourdomain.com
Download Host on your own server Available for
Docker, Windows and Linux
Ti potrebbe essere d'aiuto anche...
Chiudi