I don't understand why, with identical versions of Postfix/Dovecot/Openssl, and very close configurations, on one server I can auth with AUTH LOGIN and not with AUTH PLAIN, and on the other, that's the contrary.
# openssl s_client -starttls smtp -connect localhost:587
Server 1:
read R BLOCK
AUTH LOGIN
334 VXNlcm5hbWU6
###username_coded_base64###
334 UGFzc3dvcmQ6
###password_coded_base64###
235 2.7.0 Authentication successful
read R BLOCK
AUTH PLAIN ###username+password_coded_base64###
535 5.7.8 Error: authentication failed:
Server 2:
read R BLOCK
AUTH LOGIN
334 VXNlcm5hbWU6
###username_coded_base64###
334 UGFzc3dvcmQ6
###password_coded_base64###
RENEGOTIATING
40F7446F017F0000:error:0A00010A:SSL routines:can_renegotiate:wrong ssl version:../openssl-3.0.10/ssl/ssl_lib.c:2304:
read R BLOCK
AUTH PLAIN ###username+password_coded_base64###
235 2.7.0 Authentication successful
###username_coded_base64### and ###password_coded_base64### produced by : echo -ne "string" | base64
###username_coded_base64### produced by : echo -ne "\000username\000password" | base64
postfix-3.8.1
dovecot-2.3.20-r1
openssl-3.0.10
Edit1:
The problem on Server 1 with AUTH PLAIN was about the way to encode the string.
echo -ne "\000username\000password" | base64
doesn't work, but:
perl -MMIME::Base64 -e 'print encode_base64("\000username\000password")'
doesn't give the same result, and this one works !
For Server 2 I never found why AUTH LOGIN doesn't work totally but I realized that it works for virtual users but not for local users. I'm still looking for why. May be something about dovecot configuration...