2

I have a mail server with postfix and dovecot that uses ssl. Everything was working fine, but it stopped working apparently without reason. I already tried to update the ssl certificates, change inet_protocols to accepdt only ipv4 on main.cf, change mydestionation parameters and nothing worked.

/etc/postfix/main.cf

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
inet_protocols = ipv4
mailbox_size_limit = 0
mydestination = localhost
mydomain = domain.com.br
myhostname = mail.domain.com.br
mynetworks = 127.0.0.1 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_security_level = may
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_CAfile = /etc/letsencrypt/live/domain.com.br/chain.pem
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/letsencrypt/live/domain.com.br/cert.pem
smtpd_tls_key_file = /etc/letsencrypt/live/domain.com.br/privkey.pem
smtpd_tls_security_level = may
smtpd_use_tls = yes
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp

commando mailq

-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
1F7A4C0012      849 Wed Jan  3 16:40:28  user@domain.com.br
(connect to alt4.gmail-smtp-in.l.google.com[173.194.79.27]:25: Connection timed out)
                                         user2@gmail.com

5873EC0414     1259 Wed Jan  3 16:49:44  user@domain.com.br
(connect to alt4.gmail-smtp-in.l.google.com[173.194.79.27]:25: Connection timed out)
                                         user2@gmail.com

Thanks for your help.

EDIT: Enabling the verbose on smtpd, I identified the following strange lines:

Jan  4 10:45:05 user postfix/smtpd[4729]: ctable_locate: leave existing entry key destination@yahoo.com.br
Jan  4 10:45:05 user postfix/smtpd[4729]: maps_find: recipient_canonical_maps: destination@yahoo.com.br: not found
Jan  4 10:45:05 user postfix/smtpd[4729]: match_string: yahoo.com.br ~? localhost
Jan  4 10:45:05 user postfix/smtpd[4729]: match_list_match: yahoo.com.br: no match
Jan  4 10:45:05 user postfix/smtpd[4729]: maps_find: recipient_canonical_maps: @yahoo.com.br: not found
Jan  4 10:45:05 user postfix/smtpd[4729]: mail_addr_find: destination@yahoo.com.br -> (not found)
Jan  4 10:45:05 user postfix/smtpd[4729]: maps_find: canonical_maps: destination@yahoo.com.br: not found
Jan  4 10:45:05 user postfix/smtpd[4729]: match_string: yahoo.com.br ~? localhost
Jan  4 10:45:05 user postfix/smtpd[4729]: match_list_match: yahoo.com.br: no match
Jan  4 10:45:05 user postfix/smtpd[4729]: maps_find: canonical_maps: @yahoo.com.br: not found
Jan  4 10:45:05 user postfix/smtpd[4729]: mail_addr_find: destination@yahoo.com.br -> (not found)
Jan  4 10:45:05 user postfix/smtpd[4729]: dict_mysql_get_active: attempting to connect to host 127.0.0.1
Jan  4 10:45:05 user postfix/smtpd[4729]: dict_mysql: successful connection to host 127.0.0.1
Jan  4 10:45:05 user postfix/smtpd[4729]: dict_mysql: successful query from host 127.0.0.1
Jan  4 10:45:05 user postfix/smtpd[4729]: dict_mysql_lookup: retrieved 0 rows
Jan  4 10:45:05 user postfix/smtpd[4729]: maps_find: virtual_alias_maps: destination@yahoo.com.br: not found
Jan  4 10:45:05 user postfix/smtpd[4729]: match_string: yahoo.com.br ~? localhost
Jan  4 10:45:05 user postfix/smtpd[4729]: match_list_match: yahoo.com.br: no match
Jan  4 10:45:05 user postfix/smtpd[4729]: dict_mysql_get_active: found active connection to host 127.0.0.1
Jan  4 10:45:05 user postfix/smtpd[4729]: dict_mysql: successful query from host 127.0.0.1
Jan  4 10:45:05 user postfix/smtpd[4729]: dict_mysql_lookup: retrieved 0 rows
Jan  4 10:45:05 user postfix/smtpd[4729]: maps_find: virtual_alias_maps: @yahoo.com.br: not found
Jan  4 10:45:05 user postfix/smtpd[4729]: mail_addr_find: destination@yahoo.com.br -> (not found)

1 Answers1

1

It looks like you are trying to deliver all your mail via google (possibly to you). A few questions:

  • Do you have a dynamic IP address? This will result in problems delivering outgoing email. Configure your Postfix server to use your ISP's email relay for deliveries.
  • Did you install or modify a firewall? Make sure you have enabled outgoing traffic on port 25.
  • Are you relaying to multiple addresses via Google? Configure Postfix to use an authenticated connection on port 587 (Submission).
  • Have you tried using a TCP capable traceroute to determine where your connection dies? It is possible your ISP has chosen to block outgoing email (spam) traffic from dynamic IP addresses. Get a static IP address and configure our SMTP server correctly: rDNS validation; SPF; DKIM; DMARC; etc.

Read the canonical answer on avoiding having your email classified as Spam. Search for other answers on delivery issues.

BillThor
  • 28,293
  • 3
  • 39
  • 70