Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 9th October 2012, 19:22
ITFixt ITFixt is offline
Junior Member
 
Join Date: Aug 2012
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
Default Incoming emails rejected or POP3 logon rejected

I had ISPConfig 3.0.4 installed and everything working except that all incoming email was rejected with:
Code:
Status: 5.1.1
Diagnostic-Code: x-unix; user unknown
I eventually tracked this down to authentication in Dovecot delivery. The message was being accepted by Postfix, passed through Amavis, back into Postfix and thence to Dovecot.

I then discovered that there had been a problem with the "user_query = " command in /etc/dovecot/dovecot-sql.conf, so I changed it in accordance with

http://bugtracker.ispconfig.org/inde...ned=599&status[0]=

And incoming mails worked! But now email client logging in (which was working) doesn't

It appears that the same SQL statement is used to retrieve the email address during delivery and the account login username at POP3/IMAP login time. If I change the WHERE clause from:
Code:
WHERE login = '%u' AND disable%Ls = 'n'
to
Code:
WHERE email = '%u' AND disable%Ls = 'n'
then the delivery works but login doesn't, and vice-versa.

I should add that ISPConfig is set to allow custom login names.

I *think* a solution is to user the password query to get both username and password (by prepending "userdb_" to the appropriate fields, as per Dovecot docs) and then the user query is only used for delivery. Or, I can change the dovecot config file to use two separate sql config files.

Comments, please?
Reply With Quote
Sponsored Links
  #2  
Old 12th October 2012, 16:30
ITFixt ITFixt is offline
Junior Member
 
Join Date: Aug 2012
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
 
Default

I solved the problem like this:

In dovecot.conf, change
Code:
passdb {
  args = /etc/dovecot/dovecot-sql.conf
  driver = sql
}

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

Code:
passdb {
  args = /etc/dovecot/dovecot-sql.conf
  driver = sql
}
userdb {
  driver = prefetch
}
#Following userdb only used for delivery, so lookup on email
userdb {
  args = /etc/dovecot/dovecot-sql.conf
  driver = sql
}
And in dovecot-sql.conf, I used these two queries:

Code:
password_query = SELECT password, /
maildir AS userdb_home, /
uid AS userdb_uid, /
gid as userdb_gid /
FROM mail_user /
WHERE login = '%u' AND disable%Ls = 'n'

user_query = SELECT email as user, /
maildir as home, /
CONCAT('maildir:', maildir, '/Maildir') as mail, /
uid, gid, /
CONCAT('*:storage=', quota, 'B') AS quota_rule /
FROM mail_user /
WHERE email = '%u' AND disable%Ls = 'n'
This is more efficient than the original as only one query is executed to do user/PW lookup for mail client logon. As I've got ISPConfig set to use fixed UID & GID, it may well be possible to optimise this so that only the maildir & quota needs to be fetched from the DB, the rest of the fields being static.

As before, I'd appreciate comments. Although this now works, I still have the niggling feeling it should have been fixed some other way :}
Reply With Quote
Reply

Bookmarks

Tags
dovecot, imap/pop login refused, incoming email refused, mysql

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix queue problem? murunix Server Operation 7 2nd May 2011 01:55
Fetchmail retrieval configuration on the clients side perfectpol7 Server Operation 8 19th May 2009 15:26
Incoming emails rejected!!!!!!! URGENT wontolla Installation/Configuration 5 15th April 2009 17:56
Can't receive emails via POP3 ajw_doc Installation/Configuration 21 10th July 2008 15:17
Postfix Started Rejecting Incoming Emails samuch Server Operation 1 11th April 2007 16:25


All times are GMT +2. The time now is 11:46.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.