Mise à jour de 'Configuration opensmtp'
parent
f3b6ecce4a
commit
00b97e8790
179
Configuration-opensmtp.md
Normal file
179
Configuration-opensmtp.md
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
A ce jour pywallter ne supporte qu'un seul domaine par machine du coup hostname doit renvoyer le domaine correspondant
|
||||||
|
à vos adresses e-mails.
|
||||||
|
|
||||||
|
Si vous vous voulez des adresses kitoy@mondomaine.net la commande hostname doit renvoyer mondomaine.net
|
||||||
|
|
||||||
|
Vous aurez préalablement:
|
||||||
|
* configuré rspamd
|
||||||
|
* créé vos certificats SSL
|
||||||
|
* vos clefs de signatures dkim :). (letsencrypt, zeroSSL)
|
||||||
|
* Édité correctement votre zone DNS
|
||||||
|
|
||||||
|
|
||||||
|
Et pour celleux qui ne savent pas comment faire un article sur le [le blog](https://kitoy.me/blog) arrive bientôt.
|
||||||
|
|
||||||
|
Là c'est juste pour montrer la config qui marche avec les scripts d'exemple fourni et tout et tout.
|
||||||
|
|
||||||
|
## Configuration opensmtpd
|
||||||
|
|
||||||
|
Il vous faudra installer les paquets suivants :
|
||||||
|
|
||||||
|
* opensmtpd-filter-dkimsign
|
||||||
|
* opensmtpd-filter-rspamd
|
||||||
|
* opensmtpd-extras
|
||||||
|
|
||||||
|
Ensuite rendez dans le dossier /etc/mail et il vous faudra créer 3 fichiers :
|
||||||
|
|
||||||
|
* passwd # Liste des login et le mot de passe
|
||||||
|
* virtuals # Liste des alias et des boites mails
|
||||||
|
* reserved # Listes des adresses e-mail resevé (pour une application typiquement)
|
||||||
|
|
||||||
|
On edite le fichier smtpd.conf comme ceci :
|
||||||
|
|
||||||
|
# See smtpd.conf(5) for more information.
|
||||||
|
# To accept external mail, replace with: listen on all
|
||||||
|
#
|
||||||
|
|
||||||
|
# les Certificats SSL
|
||||||
|
pki "cert_mail" cert "/etc/ssl/mondomaine.net.crt"
|
||||||
|
pki "cert_mail" key "/etc/ssl/private/mondomaine.net.key"
|
||||||
|
|
||||||
|
# Les table des utilsateurs etc
|
||||||
|
table aliases file:/etc/mail/aliases
|
||||||
|
table passwd file:/etc/mail/passwd
|
||||||
|
table virtuals file:/etc/mail/virtuals
|
||||||
|
|
||||||
|
filter "rspamd" proc-exec "filter-rspamd"
|
||||||
|
filter "dkimsign" proc-exec "filter-dkimsign -d mondomaine.net -s dkim -k /etc/mail/dkim/mondomaine.key" user _dkimsign group _dkimsign
|
||||||
|
|
||||||
|
# Check du reverse DNS
|
||||||
|
#filter check_rdns phase connect match !rdns disconnect "550 no rDNS available"
|
||||||
|
#filter check_fcrdns phase connect match !fcrdns disconnect "550 no FCrDNS available"
|
||||||
|
|
||||||
|
# To accept external mail, replace with: listen on all
|
||||||
|
|
||||||
|
|
||||||
|
listen on all tls pki "cert_mail" hostname "mondomaine.net" filter rspamd
|
||||||
|
listen on all port submission tls-require pki "cert_mail" auth <passwd> filter dkimsign
|
||||||
|
|
||||||
|
action "local_mail" mbox alias <aliases>
|
||||||
|
# Pour la ligne dessous cela nécéssite d'avoir un utilisateur vmail avec son repertoire
|
||||||
|
# personnel /var/vmail
|
||||||
|
action "domain_mail" maildir "/var/vmail/mondomaine.net/%{dest.user:lowercase}" virtual <virtuals>
|
||||||
|
action "outbound" relay
|
||||||
|
|
||||||
|
|
||||||
|
# Uncomment the following to accept external mail for domain "example.org"
|
||||||
|
match from any for domain "mondomaine.net" action "domain_mail"
|
||||||
|
match from local for local action "local_mail"
|
||||||
|
|
||||||
|
match auth from any for any action "outbound"
|
||||||
|
|
||||||
|
## Configuration Dovecot
|
||||||
|
Il faut installer les paquets :
|
||||||
|
|
||||||
|
* dovecot
|
||||||
|
* dovecot-pigeonhole
|
||||||
|
|
||||||
|
Ensuite, il faut editer le fichiers
|
||||||
|
|
||||||
|
/etc/dovecot/local.conf
|
||||||
|
|
||||||
|
comme ceci :
|
||||||
|
|
||||||
|
listen = *
|
||||||
|
protocols = imap
|
||||||
|
first_valid_uid = 1000
|
||||||
|
first_valid_gid = 1000
|
||||||
|
mail_location = maildir:/var/vmail/%d/%n
|
||||||
|
mail_plugin_dir = /usr/local/lib/dovecot
|
||||||
|
disable_plaintext_auth = yes
|
||||||
|
|
||||||
|
managesieve_notify_capability = mailto
|
||||||
|
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext imapsieve vnd.dovecot.imapsieve
|
||||||
|
|
||||||
|
mbox_write_locks = fcntl
|
||||||
|
mmap_disable = yes
|
||||||
|
namespace inbox {
|
||||||
|
inbox = yes
|
||||||
|
location =
|
||||||
|
mailbox Archive {
|
||||||
|
auto = subscribe
|
||||||
|
special_use = \Archive
|
||||||
|
}
|
||||||
|
mailbox Drafts {
|
||||||
|
auto = subscribe
|
||||||
|
special_use = \Drafts
|
||||||
|
}
|
||||||
|
mailbox Junk {
|
||||||
|
auto = subscribe
|
||||||
|
special_use = \Junk
|
||||||
|
}
|
||||||
|
mailbox Sent {
|
||||||
|
auto = subscribe
|
||||||
|
special_use = \Sent
|
||||||
|
}
|
||||||
|
mailbox Trash {
|
||||||
|
auto = subscribe
|
||||||
|
special_use = \Trash
|
||||||
|
}
|
||||||
|
prefix =
|
||||||
|
}
|
||||||
|
|
||||||
|
service auth {
|
||||||
|
user = $default_internal_user
|
||||||
|
group = _maildaemons
|
||||||
|
}
|
||||||
|
|
||||||
|
passdb {
|
||||||
|
args = scheme=blf-crypt /etc/mail/passwd
|
||||||
|
driver = passwd-file
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protocols = imap sieve
|
||||||
|
service imap-login {
|
||||||
|
inet_listener imap {
|
||||||
|
port = 143
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ssl = required
|
||||||
|
|
||||||
|
ssl_min_protocol = TLSv1.2
|
||||||
|
ssl_cipher_list = EECDH+AESGCM
|
||||||
|
ssl_prefer_server_ciphers = yes
|
||||||
|
#ssl_cipher_list = ALL:!DH:!kRSA:!SRP:!kDHd:!DSS:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK:!RC4:!ADH:!LOW@STRENGTH
|
||||||
|
|
||||||
|
ssl_cert = </etc/ssl/mondomaine.net.crt
|
||||||
|
ssl_key = </etc/ssl/private/mondomaine.net.key
|
||||||
|
|
||||||
|
userdb {
|
||||||
|
driver = static
|
||||||
|
args = uid=vmail gid=vmail home=/var/vmail/%d/%n/
|
||||||
|
}
|
||||||
|
|
||||||
|
protocol imap {
|
||||||
|
mail_plugins = " imap_sieve"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## Configuration de pywallter
|
||||||
|
Ensuite on configure pywallter pour activer la fonction serveur mail
|
||||||
|
pour ça on édite le fichier config.py pour modifier les variables comme ceci:
|
||||||
|
|
||||||
|
MAIL_SERVER = True
|
||||||
|
|
||||||
|
# Doas or sudo
|
||||||
|
SETUID='doas'
|
||||||
|
|
||||||
|
On copie les scripts d'exemple dans /usr/local/bin et vérifie qu'ils s'exécute bien avec sudo :
|
||||||
|
|
||||||
|
# cp scripts/set_mail_passwd scripts/set_mail_alias /usr/local/bin/
|
||||||
|
$ sudo set_mail_alias
|
||||||
|
$ echo $? # si ca renvoie le code erreur 4 il ne s'exècute pas en root sinon c'est bon ca renvoie le code erreur 3
|
||||||
|
$ sudo set_mail_passwd
|
||||||
|
$ echo $? # si ca renvoie le code erreur 4 il ne s'exècute pas en root sinon c'est bon ca renvoie le code erreur 3
|
||||||
|
|
||||||
|
On lance les services mail, dovecot, rspamd et on relance pywallter ca devrat être bon :).
|
||||||
|
|
Loading…
Reference in New Issue
Block a user