Following the Ubuntu's official guide Install and configure Postfix, when I run
telnet localhost 25 I get
Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. Connection closed by foreign host. When I look into the logs I get
$ sudo tail /var/log/mail.err Dec 7 11:38:17 <host> postfix/smtpd[8477]: fatal: no SASL authentication mechanisms The above example is running in a virtual machine, but the same happens in a server in the cloud, and running telnet remotely to the domain. (I tried to replicate the process in the VM to see if I could spot what happens more easily).
I've read every post, blog, article, old and new, tried every configuration I could think of, and yet the error persists. I can't figure what is wrong. My configurations:
/etc/postfix/main.cf
# See /usr/share/postfix/main.cf.dist for a commented, more complete version # Debian specific: Specifying a file name will cause the first # line of that file to be used as the name. The Debian default # is /etc/mailname. #myorigin = /etc/mailname smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) biff = no # appending .domain is the MUA's job. append_dot_mydomain = no # Uncomment the next line to generate "delayed mail" warnings #delay_warning_time = 4h readme_directory = no # See http://www.postfix.org/COMPATIBILITY_README.html -- default to 3.6 on # fresh installs. compatibility_level = 3.6 # TLS parameters smtpd_tls_cert_file = /etc/ssl/certs/server.crt smtpd_tls_key_file = /etc/ssl/private/server.key smtpd_tls_security_level = may smtp_tls_CApath=/etc/ssl/certs smtp_tls_security_level = may smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination myhostname = <host> alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = <host>, <host>.local, <host>, localhost.localdomain, localhost relayhost = mynetworks = 127.0.0.0/8 [::1]/128 [::ffff:127.0.0.0]/104 [::1]/128 192.168.30.0/24 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all inet_protocols = all home_mailbox = Maildir/ smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth smtpd_sasl_local_domain = smtpd_sasl_security_options = noanonymous,noplaintext smtpd_sasl_tls_security_options = noanonymous broken_sasl_auth_clients = yes smtpd_sasl_auth_enable = yes smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination smtp_tls_note_starttls_offer = yes smtpd_tls_loglevel = 4 smtpd_tls_received_header = yes /etc/dovecot/conf.d/10-master.conf
service auth { unix_listener auth-userdb { #mode = 0666 #user = #group = } # Postfix smtp-auth unix_listener /var/spool/postfix/private/auth { mode = 0660 user = postfix group = postfix } # Auth process is run as this user. #user = $default_internal_user } The SSL files in the VM I created following the official guide Security - Certificates. In my cloud server I tried with Let's encrypt/Certbot files. I added them in the /etc/dovecot/conf.d/10-ssl.conf file
ssl_cert = </etc/ssl/certs/server.crt ssl_key = </etc/ssl/private/server.key I restarted both Postfix and Dovecot services after each change in configuration. The services state:
Postfix
● postfix.service - Postfix Mail Transport Agent Loaded: loaded (/lib/systemd/system/postfix.service; enabled; vendor preset: enabled) Active: active (exited) since Thu 2023-12-07 12:26:07 UTC; 9min ago Docs: man:postfix(1) Process: 3362 ExecStart=/bin/true (code=exited, status=0/SUCCESS) Main PID: 3362 (code=exited, status=0/SUCCESS) CPU: 1ms dic 07 12:26:07 <host> systemd[1]: Starting Postfix Mail Transport Agent... dic 07 12:26:07 <host> systemd[1]: Finished Postfix Mail Transport Agent. Dovecot
● dovecot.service - Dovecot IMAP/POP3 email server Loaded: loaded (/lib/systemd/system/dovecot.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2023-12-07 12:26:08 UTC; 12min ago Docs: man:dovecot(1) https://doc.dovecot.org/ Main PID: 3372 (dovecot) Status: "v2.3.16 (7e2e900c1a) running" Tasks: 5 (limit: 2220) Memory: 3.1M CPU: 44ms CGroup: /system.slice/dovecot.service ├─3372 /usr/sbin/dovecot -F ├─3373 dovecot/anvil ├─3374 dovecot/log ├─3375 dovecot/config └─3381 dovecot/stats dic 07 12:26:08 <host> systemd[1]: Starting Dovecot IMAP/POP3 email server... dic 07 12:26:08 <host> dovecot[3372]: master: Dovecot v2.3.16 (7e2e900c1a) starting up without any protocols (core dumps disabled) dic 07 12:26:08 <host> systemd[1]: Started Dovecot IMAP/POP3 email server. I followed the Troubleshooting section in the guide. I tried many permutations, but nothing works, and the logs don't give any detail I can work with.
The question is already too long, and as I tried so many things I prefer not to make it longer, please ask in the comments and I will edit adding relevant information if needed. Maybe I'm missing something very basic.