LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Postfix SMTP Authentication (https://www.linuxquestions.org/questions/linux-server-73/postfix-smtp-authentication-765358/)

lomax0990 10-29-2009 11:38 AM

Postfix SMTP Authentication
 
I'm hoping someone can help me with Postfix/Dovecot SMTP authentication.

When trying to send a test message with a mail client over the internet I get the following error:

Code:

The message could not be sent because one of the recipients was rejected by the server. The rejected e-mail address was username@gmail.com'. Subject 'test', Account: 'mailgw.mydomain.com', Server: 'mailgw.mydomain.com', Protocol: SMTP, Server Response: '554 5.7.1 <username@gmail.com>: Relay access denied', Port: 25, Secure(SSL): No, Server Error: 554, Error Number: 0x800CCC79
The g-mail account is the address I'm sending to. The account i'm sending from has an account on the server and I can successfully download messages using this client. I can also log in to squirrelmail using this account. So I know that dovecot is authenticating it.

Ideally I would like anyone that can authenticate from domain example.com to be able to send mail through my server.

Below are what I think are the relevant portions of my main.cf and dovecot.conf file.

Main.cf
----------
Code:

virtual_mailbox_domains = /etc/postfix/virtual_config/virtual_domains
virtual_mailbox_maps = hash:/etc/postfix/virtual_config/virtual_mailboxes
virtual_mailbox_base = /var/spool/virtual_mail
virtual_minimum_uid = 100
virtual_uid_maps = static:501
virtual_gid_maps = static:501
virtual_alias_maps = hash:/etc/postfix/virtual_config/virtual_aliases

smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
broken_sasl_auth_clients = yes
#smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks


Dovecot.conf
----------------
Code:

auth default {
  # Space separated list of wanted authentication mechanisms:
  #  plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi otp skey
  #  gss-spnego
  # NOTE: See also disable_plaintext_auth setting.
  mechanisms = plain login cram-md5

 passdb passwd-file {
    # File contains a list of usernames, one per line
    args = /etc/postfix/virtual_config/virtual_passwords
    #args = /etc/dovecot.deny
    #deny = yes
  }

  userdb passwd {
  }
  userdb static {
        args = uid=501 gid=501 home=/var/spool/virtual_mail/%d/%n
        }

socket listen {
    #master {
      # Master socket provides access to userdb information. It's typically
      # used to give Dovecot's local delivery agent access to userdb so it
      # can find mailbox locations.
      #path = /var/run/dovecot/auth-master
      #mode = 0600
      # Default user/group is the one who started dovecot-auth (root)
      #user =
      #group =
    #}
    client {
      # The client socket is generally safe to export to everyone. Typical use
      # is to export it to your SMTP server so it can do SMTP AUTH lookups
      # using it.
      #path = /var/run/dovecot/auth-client
      path = /var/spool/postfix/private/auth
      mode = 0660
      user = postfix
      group = postfix
    }
 }
}

Any help is much appreciated. This server hosts e-mail for multiple domains and it's done with virtual users.

archangel_617b 10-30-2009 12:23 PM

In my main.cf, I have these lines:

Code:

smtpd_recipient_restrictions =
        permit_sasl_authenticated,
        permit_mynetworks

I'd have to re-read the differences beween smtpd_sender vs smtpd_recipient restrictions again so all I can say is "works for me" ... I don't have any smtpd_sender_restrictions in my config these days. Everything is under recipient_restrictions.

Ciao,
- Arch


All times are GMT -5. The time now is 05:52 PM.