Hi all,

 I spotted a problem in my config that was causing the above issue. I
accidentally had commented out the authmodulelist and left in
authmodulelistorig. One I set authmodulelist = 'mysql' that solved the
above problem. But now it seems that courier imap cannot create the user's
folder.

 When I test out the mail server portion alone from courier IMAP everything
is working as planned. The mail server can send and receive to the virtual
accounts I've setup.

root@mail:~# telnet localhost 25

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

220 mail.example.com ESMTP Postfix (Ubuntu)

helo mail.example.com

250 mail.example.com

mail from: <bluethu...@external.com>

250 2.1.0 Ok

RCPT TO: <m...@example.com>

250 2.1.5 Ok

DATA

354 End data with <CR><LF>.<CR><LF>

test test

.

250 2.0.0 Ok: queued as 783AA43606

quit

221 2.0.0 Bye

The mail log sees this:

root@mail:~# grep 783AA43606 /var/log/mail.log

Mar  9 16:08:17 ip-172-31-41-226 postfix/smtpd[14135]: 783AA43606:
client=localhost[127.0.0.1]

Mar  9 16:08:27 ip-172-31-41-226 postfix/cleanup[14139]: 783AA43606:
message-id=<20140309160817.783aa43...@mail.example.com>

Mar  9 16:08:27 ip-172-31-41-226 postfix/qmgr[13820]: 783AA43606: from=<
bluethu...@external.com>, size=325, nrcpt=1 (queue active)

Mar  9 16:08:27 ip-172-31-41-226 postfix/smtp[14141]: 783AA43606: to=<
bluethu...@external.com>, orig_to=<m...@example.com>, relay=
external-smtp-in.l.google.com[173.194.68.26]:25, delay=23,
delays=22/0.01/0.12/0.65, dsn=2.0.0, status=sent (250 2.0.0 OK 1394381307
g16si8122650qgd.165 - gsmtp)

Mar  9 16:08:27 ip-172-31-41-226 postfix/qmgr[13820]: 783AA43606: removed

However courier imap is having trouble creating the user's mailbox:

root@mail:~# telnet localhost 143

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT
THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP
ready. Copyright 1998-2011 Double Precision, Inc.  See COPYING for
distribution information.

a login m...@example.com secret

* BYE [ALERT] Fatal error: No such file or directory: No such file or
directory

Connection closed by foreign host.

And if I have a look at the mail directory I can verify that the user's
directory is in fact not there:

root@mail:~# ls -l /var/spool/mail/virtual/

total 0

So what I need to try and figure out is why courier imap is not
automatically creating the user's mail directory.

I'm seeing this in the mail logs:

Mar  9 16:02:58 ip-172-31-41-226 imapd: Connection, ip=[::ffff:127.0.0.1]

Mar  9 16:03:04 ip-172-31-41-226 authdaemond: received auth request,
service=imap, authtype=login

Mar  9 16:03:04 ip-172-31-41-226 authdaemond: authmysql: trying this module

Mar  9 16:03:04 ip-172-31-41-226 authdaemond: authmysqllib: connected.
Versions: header 50522, client 50535, server 50535

Mar  9 16:03:04 ip-172-31-41-226 authdaemond: SQL query: SELECT id, crypt,
"", uid, gid, home, concat(home,'/',maildir), "", name, "" FROM users WHERE
id = 'm...@example.com'  AND (enabled=1)

Mar  9 16:03:04 ip-172-31-41-226 authdaemond: password matches successfully

Mar  9 16:03:04 ip-172-31-41-226 authdaemond: authmysql:
sysusername=<null>, sysuserid=5000, sysgroupid=5000,
homedir=/var/spool/mail/virtual, address=m...@example.com, fullname=Beta
developer, maildir=/var/spool/mail/virtual/matt/, quota=<null>,
options=<null>

Mar  9 16:03:04 ip-172-31-41-226 authdaemond: authmysql:
clearpasswd=<null>, passwd=secret

Mar  9 16:03:04 ip-172-31-41-226 authdaemond: Authenticated:
sysusername=<null>, sysuserid=5000, sysgroupid=5000,
homedir=/var/spool/mail/virtual, address=m...@example.com, fullname=Beta
developer, maildir=/var/spool/mail/virtual/matt/, quota=<null>,
options=<null>

Mar  9 16:03:04 ip-172-31-41-226 authdaemond: Authenticated:
clearpasswd=iluvjf,
passwd=$5$2c8074c793fe9fcd$rvrJc3HY1P.h0xTzDWr6Hy6GFT8.fLj/Qg0NDSffRJ9

Mar  9 16:03:04 ip-172-31-41-226 imapd: chdir
/var/spool/mail/virtual/matt/: No such file or directory

Mar  9 16:03:04 ip-172-31-41-226 imapd: m...@example.com: No such file or
directory


This is what I have in my setup:

This is the output of postconf -n

root@mail:~# postconf -n

alias_database = hash:/etc/postfix/aliases

alias_maps = hash:/etc/postfix/aliases

append_dot_mydomain = no

biff = no

config_directory = /etc/postfix

delay_warning_time = 4h

disable_vrfy_command = yes

inet_interfaces = all

local_recipient_maps =

mailbox_size_limit = 0

masquerade_domains = mail.example.com example.com !sub.dyndomain.com

masquerade_exceptions = root

maximal_backoff_time = 8000s

maximal_queue_lifetime = 7d

minimal_backoff_time = 1000s

mydestination =

myhostname = mail.example.com

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

mynetworks_style = host

myorigin = example.com

readme_directory = no

recipient_delimiter = +

relayhost =

smtp_helo_timeout = 60s

smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)

smtpd_client_restrictions = reject_rbl_client sbl.spamhaus.org,
reject_rbl_client blackholes.easynet.nl

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_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks,
reject_non_fqdn_recipient, reject_unknown_recipient_domain,
reject_unauth_destination, permit

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated
defer_unauth_destination

smtpd_sender_restrictions = 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_session_cache_database = btree:${data_directory}/smtpd_scache

smtpd_use_tls = yes

transport_maps = mysql:/etc/postfix/mysql_transport.cf

unknown_local_recipient_reject_code = 450

virtual_alias_maps = mysql:/etc/postfix/mysql_alias.cf

virtual_gid_maps = static:5000

virtual_mailbox_base = /var/spool/mail/virtual

virtual_mailbox_domains = mysql:/etc/postfix/mysql_domains.cf

virtual_mailbox_maps = mysql:/etc/postfix/mysql_mailbox.cf

virtual_uid_maps = static:5000


And this is what I have in my authdaemonrc

root@mail:/etc/postfix# cat /etc/courier/authdaemonrc | grep -v "#"

authmodulelist="authmysql"

authmodulelistorig="authuserdb authpam authpgsql authldap authmysql
authcustom authpipe"

daemons=5

authdaemonvar=/var/run/courier/authdaemon

DEBUG_LOGIN=2

DEFAULTOPTIONS=""

LOGGEROPTS=""

And this is the contents of my authmysqlrc

root@mail:/etc/postfix# cat /etc/courier/authmysqlrc | grep -v "#"

MYSQL_SERVER            127.0.0.1

MYSQL_USERNAME          mail

MYSQL_PASSWORD          secret

MYSQL_PORT              0

MYSQL_OPT               0

MYSQL_DATABASE          maildb

MYSQL_USER_TABLE        users

MYSQL_CRYPT_PWFIELD     crypt

MYSQL_UID_FIELD         uid

MYSQL_GID_FIELD         gid

MYSQL_LOGIN_FIELD       id

MYSQL_HOME_FIELD        home

MYSQL_NAME_FIELD        name

MYSQL_MAILDIR_FIELD concat(home,'/',maildir)

MYSQL_WHERE_CLAUSE enabled=1

I'm hoping someone out there can help me with a few more troubleshooting
steps.

Thank you
------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to