HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=4)
-   -   -ERR chdir Maildir failed Virtual Users And Domains With Postfix, Courier And MySQL (http://www.howtoforge.com/forums/showthread.php?t=10122)

jacob 26th January 2007 09:40

-ERR chdir Maildir failed Virtual Users And Domains With Postfix, Courier And MySQL
 
I've almost got this working. I can send messages and they show up in /home/vmail/user/domain . I am receiving the following error when I try to pop.

-ERR chdir Maildir failed
Connection closed by foreign host.

maillog:

Jan 25 23:26:57 gabriel pop3d: Connection, ip=[::ffff:xx.xxx.xxx.xx]
Jan 25 23:26:57 gabriel authdaemond: received auth request, service=pop3, authtype=login
Jan 25 23:26:57 gabriel authdaemond: authmysql: trying this module
Jan 25 23:26:57 gabriel authdaemond: SQL query: SELECT email, password, "", 5000, 5000, "/home/vmail", "", "", "", "" FROM users WHERE email = "xxx@xxxxxxxxxx.com"
Jan 25 23:26:57 gabriel authdaemond: password matches successfully
Jan 25 23:26:57 gabriel authdaemond: authmysql: sysusername=<null>, sysuserid=5000, sysgroupid=5000, homedir=/home/vmail, address=xxxxxx@xxxxxxx.com, fullname=<null>, maildir=<null>, quota=<null>, options=<null>
Jan 25 23:26:57 gabriel authdaemond: authmysql: clearpasswd=<null>, passwd=Tw3i7telHCPEw
Jan 25 23:26:57 gabriel authdaemond: Authenticated: sysusername=<null>, sysuserid=5000, sysgroupid=5000, homedir=/home/vmail, address=xxxxx@xxxxxxx.com, fullname=<null>, maildir=<null>, quota=<null>, options=<null>
Jan 25 23:26:57 gabriel authdaemond: Authenticated: clearpasswd=xxxxxxx, passwd=xyxyxyxyxyxyx
Jan 25 23:26:57 gabriel pop3d: chdir Maildir: No such file or directory

Please help !!

jacob 27th January 2007 01:30

Found the problem
 
When the doc says
Then edit /etc/authlib/authmysqlrc. It should look exactly like this (again, make sure to fill in the correct database details):

It really should be exactly :o

I had a space at the begining of the third line from the bottom


MYSQL_SERVER localhost
MYSQL_USERNAME mail_admin
MYSQL_PASSWORD mail_admin_password
MYSQL_PORT 0
MYSQL_DATABASE mail
MYSQL_USER_TABLE users
MYSQL_CRYPT_PWFIELD password
#MYSQL_CLEAR_PWFIELD password
MYSQL_UID_FIELD 5000
MYSQL_GID_FIELD 5000
MYSQL_LOGIN_FIELD email
MYSQL_HOME_FIELD "/home/vmail"
> MYSQL_MAILDIR_FIELD CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')
#MYSQL_NAME_FIELD
MYSQL_QUOTA_FIELD quota

falko 27th January 2007 14:50

Yes, Courier is very finicky about the format.

sremac 5th February 2007 04:35

almost done...
 
Hi to everyone,

POSTFIX is working perfectly, but there is problem:

I made user in mysql database, and then try to login but there is an error when
try to get it via telnet:
(use courrier-pop and courrier-auth):


Escape character is '^]'.
+OK Hello there.
user test3@virtual.test
+OK Password required.
pass test
-ERR chdir virtual.test/test3/ failed
Connection closed by foreign host.



and in /var/log/mail.log:


courierpop3login: chdir virtual.test/test3/: No such file or directory


Only when I send mail to that user or manually make directory
in /home/vmail/virtual.test it works!

Question is: how to automatically add user only via mysql, without need to send e-mail to user or to made directory?

Does it mean that every mail that is sended, POSTFIX will create new directory at /home/vmail/virtual.test ?

Thanx!

martinfst 5th February 2007 09:33

Courier has a tool called
Code:

maildirmake
. See http://www.courier-mta.org/?maildirmake.html for more information.

falko 6th February 2007 14:29

Quote:

Originally Posted by sremac
Only when I send mail to that user or manually make directory
in /home/vmail/virtual.test it works!

That's the normal behaviour. Maildir is created after the first email arrives.

sremac 6th February 2007 15:12

why?
 
So,

it means that senders can send e-mail to my domain, without knowing of my users, and postfix will create directories??

Is there any option like "user unknown", etc?

If postfix create directory for every sent mail (for example test1@domain, test2@domain, test3@domain...) it will be a mess in /home/vmail, won`t it?

martinfst 6th February 2007 16:00

No, postfix default behavioral is to only accept users it knows about. But you need to sent an initial mail to this (existing) user. Or use the maildirmake tool yourself in advance.

sremac 8th February 2007 16:40

I got it..
 
Thanx,

I got it:

first (if using mysql) user must be created in mysql users table (if not postfix will notice "User unknown" error), and then you can send e-mail to that user or create necessery folders in /home/vmail, but must create as vmail user (because there will be error with permissions, for example if root create /home/vmail/virtual_domain).

sremac 9th February 2007 03:15

but...
 
Thought that everything work, but:

when try to send from one host in network (it`s IP is in $mynetworks in main.cf), there is error with username/password:

mail.log:


02:01:29 KanotixBox postfix/smtpd[27738]: > unknown[192.168.2.8]: 334 UGFzc3dvcmQ6
Feb 9 02:01:29 KanotixBox postfix/smtpd[27738]: < unknown[192.168.2.8]: dGVzdA==
Feb 9 02:01:29 KanotixBox postfix/smtpd[27738]: xsasl_cyrus_server_next: decoded response: test
02:01:29 KanotixBox postfix/smtpd[27738]: warning: unknown[192.168.2.8]: SASL LOGIN authentication failed: authentication failure
Feb 9 02:01:29 KanotixBox postfix/smtpd[27738]: > unknown[192.168.2.8]: 535 5.7.0 Error: authentication failed: authenticationfailure
Feb 9 02:01:31 KanotixBox postfix/smtpd[27738]: smtp_get: EOF
02:01:31 KanotixBox postfix/smtpd[27738]: match_hostname: unknown ~? 127.0.0.0/8
Feb 9 02:01:31 KanotixBox postfix/smtpd[27738]: match_hostaddr: 192.168.2.8 ~? 127.0.0.0/8
Feb 9 02:01:31 KanotixBox postfix/smtpd[27738]: match_hostname: unknown ~? 192.168.2.0/24
Feb 9 02:01:31 KanotixBox postfix/smtpd[27738]: match_hostaddr: 192.168.2.8 ~? 192.168.2.0/24
Feb 9 02:01:31 KanotixBox postfix/smtpd[27738]: lost connection after AUTH from unknown[192.168.2.8]
Feb 9 02:01:31 KanotixBox postfix/smtpd[27738]: disconnect from unknown[192.168.2.8]
Feb 9 02:01:31 KanotixBox postfix/smtpd[27738]: master_notify: status 1
Feb 9 02:01:31 KanotixBox postfix/smtpd[27738]: connection closed



it seems like there is error with SASL/mySQL or...?

(username and password are good in mysql and directory is created in /home/vmail.. and smtpd.conf in /etc/postfix/sasl is good, too, also installed SSL sertificate)


All times are GMT +2. The time now is 06:33.

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