[résolu][postfix] erreur de certificat SSL en SMTPS

Bonjour,

J’ai bien importé mon certificat SSL dans Icedove et la récupération en IMAP via SSL/TLS se fait correctement ; tout ce gâte lors d’un test d’envoi :frowning:

voici les informations utiles :

/etc/postfix/master.cf
> smtp inet n - - - - smtpd

    submission inet n       -       -       -       -       smtpd
      -o syslog_name=postfix/submission
      -o smtpd_tls_dh1024_param_file=${config_directory}/dh2048.pem
      -o smtpd_tls_security_level=encrypt
      -o smtpd_sasl_auth_enable=yes
      -o smtpd_client_restrictions=permit_sasl_authenticated,reject
    pickup    unix  n       -       -       60      1       pickup
    cleanup   unix  n       -       -       -       0       cleanup
    qmgr      unix  n       -       n       300     1       qmgr
    tlsmgr    unix  -       -       -       1000?   1       tlsmgr
    rewrite   unix  -       -       -       -       -       trivial-rewrite
    bounce    unix  -       -       -       -       0       bounce
    defer     unix  -       -       -       -       0       bounce
    trace     unix  -       -       -       -       0       bounce
    verify    unix  -       -       -       -       1       verify
    flush     unix  n       -       -       1000?   0       flush
    proxymap  unix  -       -       n       -       -       proxymap
    proxywrite unix -       -       n       -       1       proxymap
    smtp      unix  -       -       -       -       -       smtp
    relay     unix  -       -       -       -       -       smtp
    showq     unix  n       -       -       -       -       showq
    error     unix  -       -       -       -       -       error
    retry     unix  -       -       -       -       -       error
    discard   unix  -       -       -       -       -       discard
    local     unix  -       n       n       -       -       local
    virtual   unix  -       n       n       -       -       virtual
    lmtp      unix  -       -       -       -       -       lmtp
    anvil     unix  -       -       -       -       1       anvil
    scache    unix  -       -       -       -       1       scache
    maildrop  unix  -       n       n       -       -       pipe
      flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
    uucp      unix  -       n       n       -       -       pipe
      flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
    ifmail    unix  -       n       n       -       -       pipe
      flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
    bsmtp     unix  -       n       n       -       -       pipe
      flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
    scalemail-backend unix	-	n	n	-	2	pipe
      flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
    mailman   unix  -       n       n       -       -       pipe
      flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
      ${nexthop} ${user}

ports :
> tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 4116/master

    tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN      3136/dovecot    
    tcp        0      0 0.0.0.0:587             0.0.0.0:*               LISTEN      4116/master     
    tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      3136/dovecot    

Lors du test d’envoi depuis Icedove ; les logs coté serveurs :

May 14 20:49:22 x postfix/submission/smtpd[5469]: connect from nor75-7-81-57-85-231.fbx.proxad.net[xxxxxxx]
May 14 20:49:23 x postfix/submission/smtpd[5469]: Anonymous TLS connection established from nor75-7-81-57-85-231.fbx.proxad.net[xxxxxxxx]: TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)
May 14 20:49:23 x postfix/submission/smtpd[5469]: warning: TLS library problem: error:14094412:SSL routines:SSL3_READ_BYTES:sslv3 alert bad certificate:s3_pkt.c:1294:SSL alert number 42:
May 14 20:49:23 x postfix/submission/smtpd[5469]: lost connection after STARTTLS from nor75-7-81-57-85-231.fbx.proxad.net[xxxxxxxxx]
May 14 20:49:23 2emedb postfix/submission/smtpd[5469]: disconnect from nor75-7-81-57-85-231.fbx.proxad.net[xxxxxxxxx]

coté client :

 L'envoi du message a échoué.
Le message n'a pas pu être envoyé en utilisant le serveur sortant (SMTP) « FQDN » pour une raison inconnue. Veuillez vérifier que les paramètres de votre serveur sortant (SMTP) sont corrects et essayez à nouveau.

Le certificat du serveur est déjà dans la liste des certificats autorisés, le Handshake se fait bien coté IMAP:993 mais pas pour SMTP:587

J’ai un pop-up qui me propose de télécharger le certificat sur mon fqdn:587 mais quand je mets “obtenir le certificat”, tout devient grisé et seul le bouton annuler reste actif.
Quand je fais “voir le certificat” j’ai:
> ce certificat a été certifié pour les utilisations suivantes :

    Certificat client SSL
    Certificat serveur SSL
    Certificat de signature de courrier
    Certificat de réception de courrier 

Il ne semble pas valide pour l’envoi ??? :confused: et comment modifier ça ???

openssl s_client -connect 2emedb.leotxando.net:587
CONNECTED(00000003)
139758597551760:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:795:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 7 bytes and written 289 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
---

Aucun handshake ne se fait :’(

pourtant :

telnet localhost 25
Trying ::1…
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 2emedb.leotxando.net ESMTP Postfix (Debian/GNU)
ehlo localhost
250-2emedb.leotxando.net
250-PIPELINING
250-SIZE 502400000
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

STARTTLS est bien activé.

petit extrait du /etc/postfix/main.cf :

 > # Smtp ( OUTGOING / Client )
smtp_tls_loglevel            = 1
smtp_tls_security_level      = may
smtp_tls_CAfile              = /etc/ssl/certs/ca.cert.pem
smtp_tls_protocols           = !SSLv2, !SSLv3
smtp_tls_mandatory_protocols = !SSLv2, !SSLv3
smtp_tls_mandatory_ciphers   = high
smtp_tls_exclude_ciphers     = aNULL, eNULL, EXPORT, DES, 3DES, RC2, RC4, MD5, PSK, SRP, DSS, AECDH, ADH
smtp_tls_note_starttls_offer = yes
# ---------------------------------------------------------------------------------------------------
# Smtpd ( INCOMING / Server )
smtpd_tls_loglevel            = 1
smtpd_tls_auth_only           = yes
smtpd_tls_security_level      = may
smtpd_tls_received_header     = yes
smtpd_tls_protocols           = !SSLv2, !SSLv3
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
smtpd_tls_mandatory_ciphers   = medium
# Infos (voir : postconf -d)
# Medium cipherlist = aNULL:-aNULL:ALL:!EXPORT:!LOW:+RC4:@STRENGTH
# High cipherlist   = aNULL:-aNULL:ALL:!EXPORT:!LOW:!MEDIUM:+RC4:@STRENGTH
# smtpd_tls_exclude_ciphers   = NE PAS modifier cette directive pour des raisons de compatibilité
#                               avec les autres serveurs de mail afin d'éviter une erreur du type
#                               "no shared cipher" ou "no cipher overlap" puis un fallback en
#                               plain/text...
# smtpd_tls_cipherlist        = Ne pas modifier non plus !
smtpd_tls_CAfile              = $smtp_tls_CAfile
smtpd_tls_cert_file           = /etc/ssl/certs/mailserver.crt
smtpd_tls_key_file            = /etc/ssl/private/mailserver.key
smtpd_tls_dh1024_param_file   = $config_directory/dh2048.pem
smtpd_tls_dh512_param_file    = $config_directory/dh512.pem

Un grand merci pour votre aide !
:smiley:

heu…

grosse lenteur sur le réseau je crois, ou de Icedove, car au bout de 10minutes il m a été possible de confirmer l’exception de sécurité… O_o
tout est en ordre…
désolé du dérangement…

Ça ne fait rien … en tous cas je reverrais que tout le monde pose des question avec autant de précisions que toi. Ça fait plaisir a lire :slight_smile:

merci Mimoza, j’avais peur d’être trop brouillon :blush:

à bientôt :smiley: