3

I have server where I want to set up a mail server to let me receive and send email from my domain. I'm currently having a problem where while I am authorized to send email from the server, but according to the logs, am not authorized to receive email from any provider other than my own network.

I'm going off of this tutorial, which shows how to configure a mail server using Postfix, Dovecot, and using MySQL as the backend (here).

Appropriate logs:

Jan  6 13:55:49 mail postfix/smtpd[26857]: permit_mynetworks: mail-la0-f50.google.com 209.85.215.50
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_hostname: mail-la0-f50.google.com ~? 127.0.0.0/8
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_hostaddr: 209.85.215.50 ~? 127.0.0.0/8
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_hostname: mail-la0-f50.google.com ~? 127.0.0.2/32
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_hostaddr: 209.85.215.50 ~? 127.0.0.2/32
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_hostname: mail-la0-f50.google.com ~? 192.99.104.50/32
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_hostaddr: 209.85.215.50 ~? 192.99.104.50/32
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_hostname: mail-la0-f50.google.com ~? [::1]/128
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_hostaddr: 209.85.215.50 ~? [::1]/128
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_list_match: mail-la0-f50.google.com: no match
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_list_match: 209.85.215.50: no match
Jan  6 13:55:49 mail postfix/smtpd[26857]: generic_checks: name=permit_mynetworks status=0
Jan  6 13:55:49 mail postfix/smtpd[26857]: generic_checks: name=reject_unauth_destination
Jan  6 13:55:49 mail postfix/smtpd[26857]: reject_unauth_destination: me@duper51.com
Jan  6 13:55:49 mail postfix/smtpd[26857]: permit_auth_destination: me@duper51.com`
Jan  6 13:55:49 mail postfix/smtpd[26857]: ctable_locate: leave existing entry key me@duper51.com`
Jan  6 13:55:49 mail postfix/smtpd[26857]: NOQUEUE: reject: RCPT from mail-la0-f50.google.com[209.85.215.50]: 554 5.7.1 <me@d$`
Jan  6 13:55:49 mail postfix/smtpd[26857]: generic_checks: name=reject_unauth_destination status=2`
Jan  6 13:55:49 mail postfix/smtpd[26857]: > mail-la0-f50.google.com[209.85.215.50]: 554 5.7.1 <me@duper51.com>: Relay access denied`
Jan  6 13:55:49 mail postfix/smtpd[26857]: < mail-la0-f50.google.com[209.85.215.50]: DATA`
Jan  6 13:55:49 mail postfix/smtpd[26857]: > mail-la0-f50.google.com[209.85.215.50]: 554 5.5.1 Error: no valid recipients`
Jan  6 13:55:49 mail postfix/smtpd[26857]: < mail-la0-f50.google.com[209.85.215.50]: QUIT`
Jan  6 13:55:49 mail postfix/smtpd[26857]: > mail-la0-f50.google.com[209.85.215.50]: 221 2.0.0`

My main.cf:

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
smtpd_tls_cert_file=/etc/ssl/certs/dovecot.pem
smtpd_tls_key_file=/etc/ssl/private/dovecot.pem
smtpd_use_tls=yes
smtpd_tls_auth_only = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
virtual_transport = lmtp:unix:private/dovecot-lmtp
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
smtpd_recipient_restrictions =
      permit_sasl_authenticated,
      permit_mynetworks,
      reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = duper51.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
#mydestination = duper51.com, mail.duper51.com, localhost
mydestination = localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
1

From the config you posted, you had "mydestination" right, but then you commented it out and just set it to "localhost". This would definitely prevent you from receiving mail from the outside world.

  • 1
    Unfortunately, in the tutorial, they tell me to set it to localhost, because that way it reads from the MySQL vHosts. I also tried it with the configuration I had and it still didn't work. Same errors in log. – duper51 Jan 6 '15 at 23:48
  • I'll dig up a working config from one of my mail servers and paste it in here. Will need a day or so to get back to you. – Dale Anderson Jan 7 '15 at 19:03
  • Great! Thanks for your help! If you choose to edit your answer with the config I'll make it the actual answer. – duper51 Jan 7 '15 at 21:44
  • OK, so here's my output from postconf -n (non-default config values): pastebin.com/eh14SHW0 - this is a live server with virtual users, spam filtering, etc. So a lot of it may not be relevant, but you should be able to pick through and compare what's different, and hopefully make adjustments. The only thing I've adjusted is to replace actual host / domain names and IP addresses with fake values. – Dale Anderson Jan 9 '15 at 0:15
1

If you are using a residential connection, your ISP has probably blocked inbound SMTP connections on port 25. Since running servers is typically forbidden by the Terms of Service on residential Internet accounts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.