Postfix certificat expiré?

Bonjour à tous,

Je galere avec Pstfix. Je n’ai jamais été tres fort dans sa configuration (à mon plus grand desespoir), mais la, je desespere totalement :D:D
Mon postfix est actif depuis quelques années, sans soucis particuliers. Depuis quelques jours, plus moyen d’envoyer des mails depuis gmail en passant par le smtp de mon serveur. Le user / pass utilisés fonctionnent (validés en me connectant en SSH avec), ca ressemble plus à un souci de certificat. J’ai trouvé une commande permettant de valider la validité du certificat, celui-ci me semble pourtant bon :

[user@myserver 2020-04-29 11:44:39 ~]#printf 'quit\n' | openssl s_client -connect smtp.myserver.com:25 -starttls smtp | openssl x509 -enddate -noout
depth=0 C = FR, ST = France, L = Lille, O = myserver, CN = myserver.com, emailAddress = moi@gmail.com
verify error:num=18:self signed certificate
verify return:1
depth=0 C = FR, ST = France, L = Lille, O = myserver, CN = myserver.com, emailAddress = moi@gmail.com
verify return:1
250 DSN
DONE
notAfter=Aug  4 17:08:06 2027 GMT

Je tourne sous Debian Jessie (nan, pas de pierres, svp :P).
Et j’ai ce message d’erreur quand je veux le configurer comme compte externe sous gmail :

Désolé, je n’ai pas trouvé mon post sur le forum Debian ?
Dans tous les cas, ca me semble (à tort ?) etre plus un probleme Postfix que Debian ou Ubuntu ?
Pour ta question justifiée sur le mix SMTP / GMail, une histoire d’existant et de dette technique, pour faire simple :smiley:
Et pour l’erreur d’authentification, oui, c’est le message qui ressort. Mais le message d’erreur parle bien de nego TLS, pourtant. Et le user utilisé pour l’acces au SMTP de mon serveur n’a pas bougé depuis 2 ans, et cette config marchait encore il y a 1 mois. Quelle différence entre il y a un mois et auj ? Aucune idée. Certificat expiré ? D’apres la commande que j’ai collée dans mon premier message, non. Certificat auto signé et regles gmail qui ont changé ? Peut etre … ?

Voici mon master.cf complet :

#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master" or
# on-line: http://www.postfix.org/master.5.html).
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       -       -       -       smtpd
#smtp      inet  n       -       -       -       1       postscreen
#smtpd     pass  -       -       -       -       -       smtpd
#dnsblog   unix  -       -       -       -       0       dnsblog
#tlsproxy  unix  -       -       -       -       0       tlsproxy
#submission inet n       -       -       -       -       smtpd
#submission inet n       -       n       -       -       smtpd
#  -o smtpd_tls_security_level=encrypt
submission inet n       -       -       -       -       smtpd
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o syslog_name=postfix/submission
#  -o smtpd_tls_security_level=encrypt
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
#  -o smtpd_recipient_restrictions=
#  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#smtps     inet  n       -       -       -       -       smtpd
#  -o syslog_name=postfix/smtps
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
#  -o smtpd_recipient_restrictions=
#  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#628       inet  n       -       -       -       -       qmqpd
pickup    unix  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
#qmgr     unix  n       -       n       300     1       oqmgr
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
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
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
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
#   lmtp    cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
#  mailbox_transport = lmtp:inet:localhost
#  virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus     unix  -       n       n       -       -       pipe
#  user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix  -       n       n       -       -       pipe
#  flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
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}

Et mon main.cf (allegé des lignes de commentaires) :

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

append_dot_mydomain = no

readme_directory = no

# TLS parameters
smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_sasl_auth_enable = yes

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination permit_inet_interfaces
alias_maps = hash:/etc/aliases
myorigin = $mydomain
mydestination = myserver.com, myserver.com, localhost.myhoster.net, localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 localhost
mailbox_size_limit = 0
recipient_delimiter = +
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination permit_inet_interfaces
broken_sasl_auth_clients = yes
# Milter configuration
# OpenDKIM
milter_default_action = accept
# Postfix ≥ 2.6 milter_protocol = 6, Postfix ≤ 2.5 milter_protocol = 2
milter_protocol = 6
smtpd_milters = local:/opendkim/opendkim.sock
non_smtpd_milters = local:/opendkim/opendkim.sock

smtpd_tls_security_level=may
smtpd_tls_loglevel = 1

Qu’est-ce que je peux vérifier maintenant ?
Merci d’avance pour toute l’aide que je pourrais avoir ici, je suis plus que preneur :wink:
Prenez soin de vous …
Olivier.

Et pour information complète, voici le résultat quand je tente d’envoyer un mail :

Merci pour votre aide :wink:

Bonjour,

Voir cette discussion : https://forum.ubuntu-fr.org/viewtopic.php?id=2051974

L’authentification SASL n’est pas configurée.

Hello Bruno :wink:

Je ne pensais pas te retrouver ici :rofl:
Et pourtant, il y a encore 2 mois, ca fonctionnait.
Je creuse quand meme de ce coté la, pour voir un peu. Le lien que tu as fourni n’est pas le bon par contre, mauvais copié / collé ?
Merci pour le coup de main :smiley:

Ça fonctionnait comment ? Avec cette configuration cela me paraît impossible.
Je ne vois rien dans ta configuration qui permette à un utilisateur de s’autehentifier avec un nom d’utilisateur et un mot de passe .
Est-ce que tu as un historique des modifications du fichier main.cf ?

J’vous jure m’dame, ca marchait y’a 2 mois avec cette configuration ! :smiley:
La derniere modification du main.cf date de fevrier 2019 :

[moi@myserver 2020-05-12 10:27:11 ~]#ls /etc/postfix
total 116K
drwxr-xr-x   4 root root 4.0K Feb 21  2019 .
drwxr-xr-x 106 root root 4.0K Apr 15 17:38 ..
-rw-r--r--   1 root root 2.2K Feb 21  2019 main.cf
-rw-r--r--   1 root root 6.3K Aug  6  2017 master.cf

Hello par ici,
J’ai bien lu la doc SASL, rien vu qui me semblait bizarre. Pour autant, j’ai tenté de me connecter en SSH à mon serveur, qui ecoute bien sur le port 587, avec le login /pass que je connais (encodés en base64), via openSSL pour windows. Et la connexion fonctionne bien, et le login / pass sont bien reconnus :

C:\Users\moi>openssl.exe s_client -connect smtp.myserver.com:587 -starttls smtp
CONNECTED(00000198)
depth=0 C = FR, ST = France, L = Lille, O = Myserver, CN = myserver.com, emailAddress = mypersonalemail@gmail.com
verify error:num=18:self signed certificate
verify return:1
depth=0 C = FR, ST = France, L = Lille, O = Myserver, CN = myserver.com, emailAddress = mypersonalemail@gmail.com
verify return:1
---
Certificate chain
 0 s:C = FR, ST = France, L = Lille, O = Myserver, CN = myserver.com, emailAddress = mypersonalemail@gmail.com
   i:C = FR, ST = France, L = Lille, O = Myserver, CN = myserver.com, emailAddress = mypersonalemail@gmail.com
---
Server certificate
-----BEGIN CERTIFICATE-----
MIICeTCCAeICCQCG5cKwOb+jOjANBgkqhkiG9w0BAQsFADCBgDELMAkGA1UEBhMC
//Certificat ecourté pour des raisons de securité
dAUXvkpfcYZ1xovCtckILdVAKWglETcqdv8y+mQlxrVpoQzCHznMBbc0apb8SUf+
AOmGXiiyHb6D59qLOQ==
-----END CERTIFICATE-----
subject=C = FR, ST = France, L = Lille, O = Myserver, CN = myserver.com, emailAddress = mypersonalemail@gmail.com

issuer=C = FR, ST = France, L = Lille, O = Myserver, CN = myserver.com, emailAddress = mypersonalemail@gmail.com

---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: RSA
Server Temp Key: ECDH, P-256, 256 bits
---
SSL handshake has read 1409 bytes and written 480 bytes
Verification error: self signed certificate
---
New, TLSv1.2, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 1024 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES256-GCM-SHA384
    Session-ID: 10AD2C170517B2BF11A2567D0F14F967CB46E930B9B1D1D31AFEC982EE9601EF
    Session-ID-ctx:
    Master-Key: 1EFD5EC35AFAD051C75285F9EC64628082B5D4319A5FA3D2E0072B3937C454880B3AB0AD1D99B14B657D5B72D8536606
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    TLS session ticket lifetime hint: 7200 (seconds)
    TLS session ticket:
    0000 - 3b f0 05 6b 92 08 a4 3c-cd c4 1a 08 69 e0 40 e8   ;..k...<....i.@.
    0010 - 8a 8f aa 35 8f 71 0c 67-bb 3b ad 05 86 cb a7 c2   ...5.q.g.;......
    0020 - 16 97 02 4d d9 ce df 3b-b8 8c e6 0a 33 08 1b bd   ...M...;....3...
    0030 - 73 52 a1 af 04 e5 8c 22-fc e9 bb 58 f1 5b cf b4   sR....."...X.[..
    0040 - ca 4d 8a 9b 07 43 29 bb-aa f8 28 79 b7 10 14 eb   .M...C)...(y....
    0050 - 33 98 56 30 22 53 94 b5-2b 1e 01 9b da c1 15 55   3.V0"S..+......U
    0060 - 61 a2 27 6e 4e 3c 71 2f-b4 9a 7e c7 59 80 09 62   a.'nN<q/..~.Y..b
    0070 - 30 aa 16 df d0 b4 fd b1-25 d1 9d 7b 2e 17 60 8c   0.......%..{..`.
    0080 - c0 2a ac 92 9d 03 75 f8-34 ac a6 27 4b 65 2d 88   .*....u.4..'Ke-.
    0090 - 89 3d 66 8d 5d 91 f6 13-4f 75 2c 65 52 53 73 b2   .=f.]...Ou,eRSs.
    00a0 - 61 8f b6 74 25 18 ff f3-87 27 a3 62 8c e6 f7 17   a..t%....'.b....
    00b0 - 1d 0b 28 4a 53 a5 5c 15-4e ac 84 5b d5 9b 88 0b   ..(JS.\.N..[....

    Start Time: 1589804420
    Timeout   : 7200 (sec)
    Verify return code: 18 (self signed certificate)
    Extended master secret: no
---
250 DSN
EHLO there
250-myserver.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
AUTH PLAIN AG1haEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAxNw==
235 2.7.0 Authentication successful
421 4.4.2 myserver.com Error: timeout exceeded
closed

Le seul truc que je vois, qui n’a pas l’air de lui plaire, c’est le certificat auto signé ?
Merci :wink:
Olivier.

Hop, bon ben je 'en suis finalement sorti :sunglasses: :sunglasses:
Pour info, génération d’un certificat via Letsencrypt (commande, en gros : certbot certonly --webroot -w /var/www_myserver -d smtp.myserver.com), parametrage main.cf :
smtpd_tls_cert_file = /etc/letsencrypt/live/www.myserver.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/www.myserver.com/privkey.pem
smtpd_tls_CAfile = /etc/letsencrypt/live/www.myserver.com/fullchain.pem

Redemarrage du service postfix, et tout bon :heart_eyes: :heart_eyes:
Je clos ce topic, merci pour l’aide apportée :+1: :+1:

Tant mieux si cela fonctionne mais je reste dubitatif sur ta configuration…
Par curiosité peut-on voir le retour de :

postconf -n | grep sasl

Sans pb :

postconf: warning: /etc/postfix/main.cf, line 64: overriding earlier entry: smtpd_tls_CAfile=/etc/letsencrypt/live/www.myserver.com/fullchain.pem
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination permit_inet_interfaces
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination permit_inet_interfaces
smtpd_sasl_auth_enable = yes

Merci.
Je suppose donc que tu utilises la vieille méthode avec saslauthd (paquet sasl2-bin) pour authentifier les utilisateurs. Chose à laquelle je n’avais pas pensé au départ et que tu n’avais pas précisé.

La, honnetement je n’en sais rien. Je ne peux pas te répondre la dessus, ce dont j’etais sur c’est que ca marchait avant, tel quel :wink:
Et que ca me semblait fortement lié à un souci de certificat. Mais pas assez spécialiste en Postfix ni TLS / SSL / SASL (à mon grand regret) pour t’en dire plus que ce que j’ai dit precedemment.
Merci pour le coup de main, en tous cas :wink: