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
- 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 <<EOF > 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
-
add FQDN name in
docker-compose.ymlfile -
create file
envfiles/iredmail-env.conffor iredmail, like this:
cat <<EOF > 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
- create file
envfiles/mariadb-env.conffor mariadb, like this:
cat <<EOF > envfiles/mariadb-env.conf
#root password for database(the same as MYSQL_ROOT_PASSWD in iredmail env file)
MYSQL_ROOT_PASSWORD=
EOF
- Create directory for mail and for certificates (default is
mail_dir,cert_dirandconf_dir. For other location this filder need to be change indocker-compose.ymlfile )
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:
-
config - file with all used passwords and configs in system
-
access - file, with admin account - postmaster@