View Single Post
  #5  
Old 13th March 2012, 04:38
flyingaggie flyingaggie is offline
Junior Member
 
Join Date: Mar 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Playing around again with this today, I did get it to send mail correctly using the alternate login instead of the true email address. I changed the password_query to this:

Code:
password_query = SELECT password, email FROM mail_user WHERE login = '%u' AND disable%Ls = 'n'
Basically, I just added the email selection to it and now the mail shows from name@virtualdomain.com instead of login@servername.com.

the user_query is:

Code:
user_query = SELECT email as user, maildir as home, CONCAT('maildir:', maildir, '/Maildir') as mail, uid, gid, CONCAT('*:storage=', quota, 'B') AS quota_rule, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE login = '%u' AND disable%Ls = 'n'
Just as a note the master.cf shows this for the dovecot:

Code:
dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}
I guess the question I should be asking, when dovecot receives the email from the MTA (postfix in this case), where does it look to find if the user exists? According to the logs, postfix is correctly handing it off to dovecot. Does it use the password_query, user_query, both or none of the above? I think that will help diagnose why it's not finding the user. It's definitely strange to me that it works perfect when I don't try to use an alternate login and makes me think it's looking at the wrong id to check for the user.

Just in case it's needed, here's the authentication section of the dovecot.conf

Code:
## Authentication processes

# Executable location
#auth_executable = /usr/lib/dovecot/dovecot-auth
auth default {
  mechanisms = plain login

  # SQL database <doc/wiki/AuthDatabase.SQL.txt>
  passdb sql {
    # Path for SQL configuration file
    args = /etc/dovecot/dovecot-sql.conf
  }

# new quota support:
  userdb prefetch {
  }

  userdb sql {
    args = /etc/dovecot/dovecot-sql.conf
  }


  ## dovecot-lda specific settings
  ##
  socket listen {
    master {
      path = /var/run/dovecot/auth-master
      mode = 0600
      user = vmail # User running Dovecot LDA
      #group = vmail # Or alternatively mode 0660 + LDA user in this group
    }
  client {
          path = /var/spool/postfix/private/auth
          mode = 0660
          user = postfix
          group = postfix
        }
  }

}

mail_location = maildir:/var/vmail/%d/%n/Maildir

mail_uid = <removed>
mail_gid = <removed>
Thanks again for the help!
Reply With Quote