# IREDDOCKER This is the iRedMail docker image with included external ldap authentication and ability of usage an external mysql database. ## Install Clone git repository to local folder ```git clone https://gitlab.resds.ru/temasky/ireddocker.git``` ## Configure 1. If you need to enable replication of mysql server, you need to run preconfigured mysql container. To do this, create config file with parameters for mysql slave server: ``` cat < slave.cnf [mysqld] server-id = 102 log_bin = /var/log/mysql/mysql-bin.log relay-log = /var/log/mysql/mysql-relay-bin.log binlog_do_db = amavisd binlog_do_db = iredadmin binlog_do_db = iredapd binlog_do_db = roundcubemail bind-address = 0.0.0.0 EOF ``` ... and run container from this directory: ```docker run --name slave-mariadb -v ./slave.cnf:/etc/mysql/conf.d/slave.cnf -e MYSQL_ROOT_PASSWORD=(the sama password as in master server) -d -p 3306:3306 mariadb:latest``` 1. add FQDN name in ```docker-compose.yml``` file 1. create file ```envfiles/iredmail-env.conf``` for iredmail, like this: ``` cat < envfiles/iredmail-env.conf #USE OR NOT EXTERNAL DATABASE LDAP_EXTERNAL_USE=YES #ldap server address LDAP_EXTERNAL_SERVER= #bind password for ldap LDAP_EXTERNAL_BINDPW= #bind user for ldap LDAP_EXTERNAL_BINDUSER= #base dn for mail users LDAP_EXTERNAL_BASE= #mail domain name FIRST_DOMAIN= #address of master server in case of replication MYSQL_MASTER_ADDRESS= #address of slave server in case of replication MYSQL_SLAVE_ADDRESS= #MYSQL DATABASES FOR REPLICATION MYSQL_DATABASES=amavis iredadmin iredapd roundcubemail #usage existing databse MYSQL_EXTERNAL=YES #USE OR NOT EXTERNAL DATABASE REPLICATION MYSQL_USE_REPLICTION=YES #name for admin(root) user of external database MYSQL_ROOT_USER= #passwd for admin(root) user of external database MYSQL_ROOT_PASSWD= #usage of external cert file. If Yes - place certfile in cert_dir directory, in global catalog CUSTOM_CERT_USE=NO #Name of external key file CUSTOM_CERT_KEYFILE=privkey.pem #Name of external cert file CUSTOM_CERT_CERTFILE=fullchain.pem EOF ``` 1. create file ```envfiles/mariadb-env.conf``` for mariadb, like this: ``` cat < envfiles/mariadb-env.conf #root password for database(the same as MYSQL_ROOT_PASSWD in iredmail env file) MYSQL_ROOT_PASSWORD= EOF ``` 1. Create directory for mail and for certificates (default is ```mail_dir```, ```cert_dir``` and ```conf_dir``` . For other location this filder need to be change in ```docker-compose.yml``` file ) ``` mkdir conf_dir mkdir mail_dir mkdir cert_dir ``` ## RUN ```docker-compose up -d``` ## USAGE At the first boot system spend mutch time to initialize, configure required components, load required files. When initialization is finished, you can see two file in conf_dir: 1. config - file with all used passwords and configs in system 1. access - file, with admin account - postmaster@