Etat de fonctionnement - Dovecot Opendkim
Configuration de dovecot
Installation des service et outils
- Executez la commande suivante sur votre terminal docker
apt install dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-mysql-y
- Exécutez la commande suivante afin de générer une clé ssl pour la configuration de dovecot
openssl req -newkey rsa:2048 -nodes -keyout /etc/ssl/private/woodymail.pem -x509 -days 365 -out /etc/ssl/certs/woodymail.pem -subj "/C=BE/ST=Braban/L=Louvain-La-Neuve/O=EPHEC/OU=IT/CN=mail.m1-3.ephec-ti.be"
Configuration principale
- Dans le fichier principale de configuration
/etc/dovecot/dovecot.conf on fera la liaison avec les autres fichiers de configuration
## Dovecot configuration file
# Enable installed protocols
!include_try /usr/share/dovecot/protocols.d/*.protocol
protocols = imap pop3 lmtp
listen = *, ::
dict {
#quota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
#expire = sqlite:/etc/dovecot/dovecot-dict-sql.conf.ext
}
!include_try local.conf
Dans le dossier de configuration /etc/dovecot/conf.d
- Dans le fichier
/etc/dovecot/conf.d/10-auth.conf rajouter les lignes suivantes
auth_mechanisms = plain login
!include auth-sql.conf.ext
- Dans le fichier
/etc/dovecot/conf.d/10-logging.conf rajouter les lignes suivantes
log_path=/var/log/dovecot.log
auth_verbose = yes
auth_verbose_passwords = yes
auth_debug = yes
auth_debug_passwords = yes
mail_debug = yes
plugin {
# Events to log. Also available: flag_change append
#mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename
# Available fields: uid, box, msgid, from, subject, size, vsize, flags
# size and vsize are available only for expunge and copy events.
#mail_log_fields = uid box msgid size
}
- Dans le fichier
/etc/dovecot/conf.d/10-mail.conf rajouter les lignes suivantes
##
## Mailbox locations and namespaces
##
mail_location = maildir:/var/mail/%d/%n/
namespace inbox {
separator = /
inbox = yes
mailbox "Drafts" {
auto = subscribe
special_use = \Drafts
}
mailbox "Sent" {
auto = subscribe
special_use = \Sent
}
mailbox "Trash" {
auto = subscribe
special_use = \Trash
}
}
mail_privileged_group = mail
protocol !indexer-worker {}
- Dans le fichier
/etc/dovecot/conf.d/10-master.conf
#default_internal_user = dovecot
service imap-login {
inet_listener imap {
port = 143
}
inet_listener imaps {
port = 993
ssl = yes
}
}
#service pop3
service pop3-login {
inet_listener pop3 {
port = 110
}
inet_listener pop3s {
port = 995
ssl = yes
}
}
service submission-login {
inet_listener submission {
port = 587
}
}
#service lmtp
service lmtp {
#unix_listener lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
mode = 0600
user = postfix
group = postfix
#mode = 0666
}
}
service imap {}
service pop3 {}
service submission {}
service auth {
unix_listener auth-userdb {
mode = 0600
user = vmail
#group =
}
# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix
}
user = dovecot
}
service auth-worker {
user = vmail
}
service dict {
# If dict proxy is used, mail processes should have access to its socket.
# For example: mode=0660, group=vmail and global mail_access_groups=vmail
unix_listener dict {
}
}
default_process_limit = 100
}
- Dans le fichier
/etc/dovecot/conf.d/10-ssl.conf rajoutez les lignes suivantes
ssl = required
ssl_cert = </etc/ssl/certs/woodymail.pem
ssl_key = </etc/ssl/private/woodymail.pem
# RedHat-based systems.
ssl_client_ca_dir = /etc/ssl/certs
ssl_dh = </usr/share/dovecot/dh.pem
- Dans le fichier
/etc/dovecot/conf.d/auth-sql.conf.ext configurer l'authentification de utilisateur afin de leur permettre de stocker
passdb {
driver = sql
# Path for SQL configuration file, see example-config/dovecot-sql.conf.ext
args = /etc/dovecot/dovecot-sql.conf.ext
}
userdb {
driver = static
args = uid=vmail gid=vmail home=/var/mail/%d/%n
}
Configuration Opendkim
Installation du service
apt-get install opendkim opendkim-tools
- Ajouter le user postfix au groupe opendkim
gpasswd -a postfix opendkim
Configuration du service
- Copiez les lignes suivantes dans le fichier /etc/opendkim.conf
# Log to syslog
Syslog yes
UMask 002
Canonicalization relaxed/simple
Mode sv
SubDomains no
AutoRestart yes
AutoRestartRate 10/1M
SignatureAlgorithm rsa-sha256
Socket inet:[email protected]
PidFile /var/run/opendkim/opendkim.pid
OversignHeaders From
TrustAnchorFile /usr/share/dns/root.key
UserID opendkim:opendkim
KeyTable refile:/etc/opendkim/KeyTable
SigningTable refile:/etc/opendkim/SigningTable
ExternalIgnoreList refile/etc/opendkim/TrustedHosts
InternalHosts refile/etc/opendkim/TrustedHosts
- Générez la clé opendkim pour signer les mails entrant et rajoutez la dans le fichier de zone de votre domaine
cd /etc/opendkim
opendkim-genkey -d m1-3.ephec-ti.be -s dkimdey
cat /etc/opendkim/dkimkey.txt
- Rajouter les fichiers KeyTable, TrustedHosts et SigningTable dans le
dossier /etc/opendkim
- Pour le fichier KeyTable
default._domainkey.m1-3.ephec-ti.be m1-3.ephec-ti.be:default:/etc/opendkim/keys/m1-3.ephec-ti.be/default.private
- Pour le fichier TrustedHosts
127.0.0.1
localhost
::1
*.m1-3.ephec-ti.be
- Pour le fichier SigningTable
*@m1-3.ephec-ti.be default._domainkey.m1-3.ephec-ti.be