Skip to content
Snippets Groups Projects
Unverified Commit 288a95eb authored by Thomas Picouet's avatar Thomas Picouet Committed by Rémy Huet
Browse files

mise au propre dockerfile + entrypoint

parent 36f7a576
No related branches found
No related tags found
1 merge request!20pica-mailnt
......@@ -11,14 +11,11 @@ RUN apt-get update -y \
dovecot-common dovecot-imapd dovecot-lmtpd dovecot-ldap nano telnet \
&& rm -rf /var/lib/apt/lists/*
#configuration de dovecot
#adresse ip locale du lda (serveur qui réceptionne les courriers de fin de chaîne de postfix)
# copie de tous les fichiers de config modifiés dans le répertoire de config de Dovecot
COPY ./conf.d/* /etc/dovecot/conf.d/
COPY ./dovecot-ldap.conf.ext /etc/dovecot/dovecot-ldap.conf.ext
#COPY ./conf.d/* /etc/dovecot/conf.d/
#COPY ./dovecot-ldap.conf.ext /etc/dovecot/dovecot-ldap.conf.ext
COPY entrypoint.sh /
COPY fichiers_de_configuration.sh /
ENTRYPOINT ["/entrypoint.sh"]
......@@ -2,27 +2,30 @@
#protocoles supportés par le mda
#lmtp est le protocole permettant de faire du lda
cat <<EOF >> /etc/dovecot/dovecot.conf
protocols = imap lmtp
EOF
#cat <<EOF >> /etc/dovecot/dovecot.conf
#protocols = imap lmtp
#EOF
#on enlève la communication lmtp en socket unix...
#il faut récupérer l'adresse IP par laquelle le conteneur communique avec son hôte
ETH0_ADRESS=$(ip address show eth0 | grep inet | cut -b 10-19)
#ETH0_ADRESS=$(ip address show eth0 | grep inet | cut -b 10-19)
cat <<EOF >> /etc/dovecot/conf.d/10-master.conf
service lmtp {
inet_listener lmtp {
address = ${ETH0_ADRESS} 127.0.0.1
port = 24
}
}
EOF
#cat <<EOF >> /etc/dovecot/conf.d/10-master.conf
#service lmtp {
# inet_listener lmtp {
# address = ${ETH0_ADRESS} 127.0.0.1
# port = 24
# }
#}
#EOF
#désactiver l'utilisation du protocole ssl
cat <<EOF >> /etc/dovecot/conf.d/10-ssl.conf
ssl = no
EOF
#cat <<EOF >> /etc/dovecot/conf.d/10-ssl.conf
#ssl = no
#EOF
chmod 744 fichiers_de_configuration.sh
./fichiers_de_configuration.sh
#ajouter utilisateur et groupe vmail (utilisateur système qui permet aux utilisateurs dits "virtuels" (en fait LDAP) d'accéder à leur BAL)
addgroup --gid 1000 vmail
......
#!/bin/bash
######################################################################################
### Script de modification des paramètres des fichiers de configuration de Dovecot ###
######################################################################################
### Définition des variables d'environnement.
# Récupération de l'adresse IP avec laquelle le conteneur communique avec son hôte
ETH0_ADRESS=$(ip address show eth0 | grep inet | cut -b 10-19)
# LDAP
LDAP_ADRESS=ldap.test.picasoft.net
LDAP_CN=nss
LDAP_DC2=picasoft
LDAP_DC1=net
LDAP_DNPASS=rdonly
# Modification de /etc/dovecot/dovecot-ldap.conf.ext
#
sed -i 's/^#hosts =.*/hosts = '"${LDAP_ADRESS}"'/' /etc/dovecot/dovecot-ldap.conf.ext
sed -i 's/^#dn =.*/dn = cn='"${LDAP_CN}"',dc='"${LDAP_DC2}"',dc='"${LDAP_DC1}"'/' /etc/dovecot/dovecot-ldap.conf.ext
sed -i 's/^#dnpass =.*/dnpass = '"${LDAP_DNPASS}"'/' /etc/dovecot/dovecot-ldap.conf.ext
sed -i 's/^#auth_bind = no/auth_bind = yes/' /etc/dovecot/dovecot-ldap.conf.ext
sed -i 's/^base =.*/base = dc='"${LDAP_DC2}"',dc='"${LDAP_DC1}"'/' /etc/dovecot/dovecot-ldap.conf.ext
sed -i 's/^#scope = subtree.*/scope = subtree/' /etc/dovecot/dovecot-ldap.conf.ext
sed -i 's/^#user_attrs =.*/user_attrs =/' /etc/dovecot/dovecot-ldap.conf.ext
sed -i 's/^#user_filter = .*/user_filter = (uid=%n)/' /etc/dovecot/dovecot-ldap.conf.ext
sed -i 's/^#pass_attrs = .*/pass_attrs = uid=user,userPassword=password/' /etc/dovecot/dovecot-ldap.conf.ext
sed -i 's/^#pass_filter = .*/pass_filter = (uid=%n)/' /etc/dovecot/dovecot-ldap.conf.ext
#sed -i 's/^# = .*//' /etc/dovecot/dovecot-ldap.conf.ext
# modification de /etc/dovecot/conf.d/10-auth.conf
sed -i 's/^!include auth-system\.conf\.ext.*/#!include auth-system.conf.ext/' /etc/dovecot/conf.d/10-auth.conf
sed -i 's/^#!include auth-ldap\.conf\.ext.*/!include auth-ldap.conf.ext/' /etc/dovecot/conf.d/10-auth.conf
#sed -i 's/^# = .*//' /etc/dovecot/conf.d/10-auth.conf
# modification de /etc/dovecot/conf.d/10-logging.conf
sed -i 's/^#log_path = .*/log_path = \/var\/log\/dovecot.log/' /etc/dovecot/conf.d/10-logging.conf
#sed -i 's/^# = .*//' /etc/dovecot/conf.d/10-logging.conf
# modification de /etc/dovecot/conf.d/10-mail.conf
sed -i 's/^mail_location = .*/mail_location = maildir:\/home\/vmail\/%n\/Maildir\
mail_home = \/home\/vmail\/%n/' /etc/dovecot/conf.d/10-mail.conf
sed -i 's/^#mail_uid =.*/mail_uid = vmail/' /etc/dovecot/conf.d/10-mail.conf
sed -i 's/^#mail_gid =.*/mail_gid = vmail/' /etc/dovecot/conf.d/10-mail.conf
#sed -i 's/^# = .*//' /etc/dovecot/conf.d/10-mail.conf
# modification de /etc/dovecot/conf.d/10-master.conf
#sed -i 's/^service lmtp {.*/#service lmtp {/' /etc/dovecot/conf.d/10-master.conf
sed -i 's/^ unix_listener lmtp {.*/# unix_listener lmtp {/' /etc/dovecot/conf.d/10-master.conf
sed -i 's/^ #mode = .*/# #mode = 0666/' /etc/dovecot/conf.d/10-master.conf
sed -i '51s/^ }.*/ #}/' /etc/dovecot/conf.d/10-master.conf
sed -i 's/^ #inet_listener lmtp {.*/ inet_listener lmtp {/' /etc/dovecot/conf.d/10-master.conf
sed -i '56s/^ #address =.*/ address = '"${ETH0_ADRESS}"' 127.0.0.1/' /etc/dovecot/conf.d/10-master.conf
sed -i '57s/^ #port =.*/ port = 24/' /etc/dovecot/conf.d/10-master.conf
sed -i '58s/^ #}.*/ }/' /etc/dovecot/conf.d/10-master.conf
echo "protocols = imap lmtp" >> /etc/dovecot/conf.d/10-master.conf
#sed -i 's/^# = .*//' /etc/dovecot/conf.d/10-master.conf
......@@ -53,6 +53,7 @@ COPY spam/dkimkeys/* /etc/dkimkeys/
COPY spam/opendkim /etc/default/opendkim
COPY spam/opendmarc /etc/default/opendmarc
COPY --chown=opendkim:opendkim spam/nov2018.picasoft.net.rsa /etc/dkimkeys/nov2018.picasoft.net.rsa
RUN mkdir /etc/opendmarc
COPY --chown=opendmarc:opendmarc spam/ignore.hosts /etc/opendmarc/ignore.hosts
COPY saslauthd-postfix /etc/default/
......
......@@ -102,7 +102,7 @@ postconf -e "non_smtpd_milters = local:/opendkim/opendkim.sock, local:/opendmarc
#création des répertoires où transiteront les sockets + gestion des permissions
mkdir /var/spool/postfix/opendkim
mkdir /var/spool/postfix/opendmarc
mkdir /etc/opendmarc
#mkdir /etc/opendmarc
chown -R opendmarc:opendmarc /etc/opendmarc
chown -R opendkim:opendkim /etc/opendkim.conf /etc/dkimkeys
chown opendmarc:opendmarc /etc/opendmarc.conf
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment