1

Some TLC needed here. I am building this postfix/dovecot/clamav mail server following the tutorial here: https://www.exratione.com/2014/05/a-mailserver-on-ubuntu-1404-postfix-dovecot-mysql/

The issue I ran into and have spent tons of hours without any outcome. This server can be accessed by mail clients fine, sending emails out ok, however it won't take / will straight reject any in-bound emails from outside.

The error msg from mail.log is:

Oct  7 12:52:19 mail postfix/smtpd[7612]: NOQUEUE: reject: RCPT from mail-la0-f49.google.com[209.85.215.49]: 554 5.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-la0-f49.google.com>

Here is my postconf -n result:

    append_dot_mydomain = no
    biff = no
    broken_sasl_auth_clients = yes
    config_directory = /etc/postfix
    content_filter = amavis:[127.0.0.1]:10024
    disable_vrfy_command = yes
    dovecot_destination_recipient_limit = 1
    enable_original_recipient = no
    header_checks = regexp:/etc/postfix/header_checks
    inet_interfaces = all
    mailbox_size_limit = 0
    maximal_backoff_time = 8000s
    maximal_queue_lifetime = 7d
    minimal_backoff_time = 1000s
    mydestination =
    myhostname = mail.ncullc.com
    mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    mynetworks_style = host
    myorigin = /etc/hostname
    readme_directory = no
    recipient_delimiter = +
    smtp_helo_timeout = 60s
    smtp_tls_note_starttls_offer = yes
    smtp_tls_security_level = may
    smtpd_banner = $myhostname ESMTP $mail_name
    smtpd_client_restrictions = reject_rbl_client sbl.spamhaus.org, reject_rbl_client blackholes.easynet.nl, reject_rbl_client dnsbl.njabl.org
    smtpd_data_restrictions = reject_unauth_pipelining
    smtpd_delay_reject = yes
    smtpd_hard_error_limit = 12
    smtpd_helo_required = yes
    smtpd_helo_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_hostname, reject_invalid_hostname, permit
    smtpd_recipient_limit = 16
    smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, permit
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_authenticated_header = yes
    smtpd_sasl_local_domain =
    smtpd_sasl_path = private/auth
    smtpd_sasl_security_options = noanonymous
    smtpd_sasl_type = dovecot
    smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, warn_if_reject reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining, permit
    smtpd_soft_error_limit = 3
    smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
    smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
    smtpd_tls_loglevel = 1
    smtpd_tls_received_header = yes
    smtpd_tls_security_level = may
    smtpd_tls_session_cache_timeout = 3600s
    tls_random_source = dev:/dev/urandom
    unknown_local_recipient_reject_code = 450
    virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf, mysql:/etc/postfix/mysql_virtual_alias_domainaliases_maps.cf
    virtual_gid_maps = static:8
    virtual_mailbox_base = /var/vmail
    virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
    virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf, mysql:/etc/postfix/mysql_virtual_mailbox_domainaliases_maps.cf
    virtual_transport = dovecot
    virtual_uid_maps = static:150

Here is my dovecot -n result:

    # 2.2.9: /etc/dovecot/dovecot.conf
    # OS: Linux 3.13.0-36-generic x86_64 Ubuntu 14.04.1 LTS ext3
    auth_mechanisms = plain login
    first_valid_uid = 150
    last_valid_uid = 150
    mail_gid = mail
    mail_location = maildir:/var/vmail/%d/%n
    mail_uid = vmail
    namespace inbox {
      inbox = yes
      location =
      mailbox Drafts {
        special_use = \Drafts
      }
      mailbox Junk {
        special_use = \Junk
      }
      mailbox Sent {
        special_use = \Sent
      }
      mailbox "Sent Messages" {
        special_use = \Sent
      }
      mailbox Trash {
        special_use = \Trash
      }
      prefix =
    }
    passdb {
      args = /etc/dovecot/dovecot-sql.conf.ext
      driver = sql
    }
    postmaster_address = [email protected]
    protocols = " imap pop3"
    service auth {
      unix_listener /var/spool/postfix/private/auth {
        group = postfix
        mode = 0666
        user = postfix
      }
      unix_listener auth-userdb {
        group = mail
        mode = 0666
        user = vmail
      }
    }
    ssl_cert = </etc/ssl/certs/ssl-cert-snakeoil.pem
    ssl_key = </etc/ssl/private/ssl-cert-snakeoil.key
    userdb {
      args = /etc/dovecot/dovecot-sql.conf.ext
      driver = sql
    }

When I send emails from Gmail, it will bounce back the email right away and spit the 554 5.7.1 error code.

I have tried to play with smtpd_relay_restrictions vs smtpd_recipient_restrictions a little bit, has no positie result.

Thanks, Wayne

1 Answer 1

0

I see that your mydestination is empty; this is probably your problem. The server will only accept mail as "incoming" if the destination domain (the part after the @ sign in the recipient address) is listed in mydestination. Otherwise, the server thinks "this domain is not in mydestination so the mail is not for me, I will just relay it".

So, add mydestination = $mydomain to your main.cf.

11
  • I have changed mydestination = mail.ncullc.com, localhost,$mydomain, localhost.$mydomain . It doesn't solve the problem. Besides, if the email is for a virtual domain set up in postfix, $mydomain wouldn't work anyway... please correct me if I am wrong.
    – Wayne
    Oct 7, 2014 at 14:25
  • I see nothing about virtual domains in your postconf. If you want to use virtual domains, you must configure them before you can send any mail to them.
    – fkraiem
    Oct 7, 2014 at 14:28
  • fkraiem, thanks for your input. I am very glad I got someone flying with me now :-)
    – Wayne
    Oct 7, 2014 at 14:30
  • If you scroll down my postconf -n result, you should see virtual_mailbox settings... am I understanding correctly of your question?
    – Wayne
    Oct 7, 2014 at 14:31
  • virtual_mailbox is not the same thing as virtual domains (yes, that's a bit confusing). In any case, now the server is trying to relay the mail, so that means the domain is not listed anywhere, neither in mydestination nor in virtual_mailbox_domains (but because all your virtual mailbox configuration is in other files, we don't have it now).
    – fkraiem
    Oct 7, 2014 at 14:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .