# courier-imapd issues (SOLVED)

## Akaihiryuu

I'm trying to set up courier-imap...it seems to be running and working, however I am unable to access anything with an imap client.  I'm using the Maildir/ system, postfix delivers my mail, and I am able to check my inbox with Pine.  If I try to telnet to my imap server, it immediately disconnects without any delay, as far as I know it should be waiting for USER and PASS arguments:

triforce courier-imap # telnet localhost 143

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

* BYE imaplogin expected exactly two arguments.

Connection closed by foreign host.

If I try to connect with an imap client, it asks for my password and then immediately says connect failed.  Here's my imapd config file:

ADDRESS=0

PORT=143

MAXDAEMONS=40

MAXPERIP=4

PIDFILE=/var/run/imapd.pid

TCPDOPTS="-nodnslookup -noidentlookup"

IMAP_CAPABILITY="IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THRE

AD=REFERENCES SORT QUOTA IDLE"

IMAP_KEYWORDS=1

IMAP_CAPABILITY_ORIG="IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT

 THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=CRAM-SHA1 IDLE"

IMAP_PROXY=0

IMAP_PROXY_FOREIGN=0

IMAP_IDLE_TIMEOUT=60

IMAP_CAPABILITY_TLS="$IMAP_CAPABILITY AUTH=PLAIN"

IMAP_CAPABILITY_TLS_ORIG="$IMAP_CAPABILITY_ORIG AUTH=PLAIN"

IMAP_DISABLETHREADSORT=0

IMAP_CHECK_ALL_FOLDERS=0

IMAP_OBSOLETE_CLIENT=0

IMAP_UMASK=022

IMAP_ULIMITD=65536

IMAP_USELOCKS=1

IMAP_SHAREDINDEXFILE=/etc/courier-imap/shared/index

IMAP_ENHANCEDIDLE=0

IMAP_TRASHFOLDERNAME=Trash

IMAP_EMPTYTRASH=Trash:7

IMAP_MOVE_EXPUNGE_TO_TRASH=0

SENDMAIL=/usr/sbin/sendmail

HEADERFROM=X-IMAP-Sender

IMAPDSTART=YES

MAILDIRPATH=Maildir

PRERUN=Last edited by Akaihiryuu on Sat Jan 14, 2006 12:16 am; edited 1 time in total

----------

## vladgrigorescu

Try setting DEBUG_LOGIN to 2 in /etc/courier/authlib/authdaemonrc and imapd, and then check /var/log/messages.  Hope this helps!Last edited by vladgrigorescu on Tue Jan 10, 2006 5:25 am; edited 1 time in total

----------

## Akaihiryuu

Jan  9 19:29:34 triforce authdaemond: Installation complete: authpam

Jan  9 19:29:34 triforce authdaemond: Installing libauthuserdb

Jan  9 19:29:34 triforce authdaemond: Installation complete: authuserdb

Jan  9 19:29:34 triforce authdaemond: Installing libauthshadow

Jan  9 19:29:34 triforce authdaemond: Installation complete: authshadow

Jan  9 19:29:34 triforce authdaemond: Installing libauthcustom

Jan  9 19:29:34 triforce authdaemond: Installation complete: authcustom

Jan  9 19:29:34 triforce authdaemond: Installing libauthpipe

Jan  9 19:29:34 triforce authdaemond: authpipe: disabled: failed to stat pipe program /etc/courier/authlib/authProg: No such file or directory

Jan  9 19:29:34 triforce authdaemond: Installation complete: authpipe

I don't get any additional errors when I try to telnet to the imap server.

----------

## vladgrigorescu

What are you using for logging?  Where do debug messages get sent?  For example, I had to edit my syslog.conf and send debug messages to /var/log/messages.

----------

## Akaihiryuu

They're being sent to /var/log/messages.  I'm using syslog-ng.  I changed debug level in courier/authlib/authlibdaemonrc to 2, then restarted it, those are the error messages I got.  I didn't get any errors when I tried to telnet to the imap server.

----------

## vladgrigorescu

What about in the mail.* logs?

----------

## Akaihiryuu

I don't have anything in /var/log that starts with mail.*  I'm pretty sure everything is going to /var/log/messages.  All of my postfix logs go into /var/log/messages, so courier-imap is probably logging there as well.  I'm mainly just trying to figure out why courier-imap isn't accepting connections.  It disconnects immediately without even trying to wait for a user/pass if I telnet, IMAP email clients just immediately say login failed after I type the username/password.

----------

## vladgrigorescu

Here's what I have in my default syslog-ng.conf:

```
destination mail { file("/var/log/mail.log"); };

destination mailinfo { file("/var/log/mail.info"); };

destination mailwarn { file("/var/log/mail.warn"); };

destination mailerr { file("/var/log/mail.err"); };
```

Where are those getting sent for you?

----------

## Akaihiryuu

Here's the relevant part of my syslog-ng.conf:

source src { unix-stream("/dev/log"); internal(); pipe("/proc/kmsg"); };

destination messages { file("/var/log/messages"); };

# By default messages are logged to tty12...

destination console_all { file("/dev/tty12"); };

# ...if you intend to use /dev/console for programs like xconsole

# you can comment out the destination line above that references /dev/tty12

# and uncomment the line below.

#destination console_all { file("/dev/console"); };

log { source(src); destination(messages); };

log { source(src); destination(console_all); };

Looks like everything is getting sent to /var/log/messages.  I assume with my settings that everything will go to messages, and that if I were to specify the mail.* files like you did it would split the messages up into several files?

----------

## vladgrigorescu

I'm looking higher up, at the filters.  Anyway, try adding those 4 lines and also 

```
filter f_debug { not facility(auth, authpriv, news, mail); };
```

to the filter section of the file (the top), and 

```
log { source(src); filter(f_mail); destination(mail); };

log { source(src); filter(f_mail); filter(f_info); destination(mailinfo); };

log { source(src); filter(f_mail); filter(f_warn); destination(mailwarn); };

log { source(src); filter(f_mail); filter(f_err); destination(mailerr); };

log { source(src); filter(f_debug); destination(syslog); };
```

to the bottom section.

----------

## vladgrigorescu

Also, make sure you restart syslog-ng after that!

----------

## Akaihiryuu

Okay...I don't have any filters in my syslog-ng.conf right now, so I assume it will just send everything to /var/log/messages.  That's fine...I don't run any internet-related servers, only stuff for my LAN.  Will syslog-ng fail to log some things if I don't add those lines?  Because I'm not really concerned about the logs as much as I am courier-imap not accepting connections.

----------

## vladgrigorescu

 *Akaihiryuu wrote:*   

> Will syslog-ng fail to log some things if I don't add those lines?

 

Indeed it will.  It will not log debugging messages (which is what is getting sent by DEBUG_LOGIN) without those lines (well, mainly without the two debug lines).

----------

## Akaihiryuu

Cut/pasted those lines, now syslog-ng won't start

 * Starting syslog-ng ...

unresolved reference: f_mail

Error initializing configuration, exiting.

I put the filter line at the top, and the log lines at the bottom, after my current log lines.

----------

## vladgrigorescu

Here's my syslog-ng.conf if it helps:

```
options { chain_hostnames(off); sync(0); };

source src { unix-stream("/dev/log"); internal(); };

source kernsrc { file("/proc/kmsg"); };

destination authlog { file("/var/log/auth.log"); };

destination syslog { file("/var/log/syslog"); };

destination cron { file("/var/log/cron.log"); };

destination daemon { file("/var/log/daemon.log"); };

destination kern { file("/var/log/kern.log"); file("/dev/tty12"); };

destination lpr { file("/var/log/lpr.log"); };

destination user { file("/var/log/user.log"); };

destination mail { file("/var/log/mail.log"); };

#destination avc { file("/var/log/avc.log"); };

#destination audit { file("/var/log/audit.log"); };

#destination pax { file("/var/log/pax.log"); };

#destination grsec { file("/var/log/grsec.log"); };

destination mailinfo { file("/var/log/mail.info"); };

destination mailwarn { file("/var/log/mail.warn"); };

destination mailerr { file("/var/log/mail.err"); };

destination newscrit { file("/var/log/news/news.crit"); };

destination newserr { file("/var/log/news/news.err"); };

destination newsnotice { file("/var/log/news/news.notice"); };

destination debug { file("/var/log/debug"); };

destination messages { file("/var/log/messages"); };

destination console { usertty("root"); };

destination console_all { file("/dev/tty12"); };

#destination loghost { udp("loghost" port(999)); };

destination xconsole { pipe("/dev/xconsole"); };

filter f_auth { facility(auth); };

filter f_authpriv { facility(auth, authpriv); };

filter f_syslog { not facility(authpriv, mail); };

filter f_cron { facility(cron); };

filter f_daemon { facility(daemon); };

filter f_kern { facility(kern); };

filter f_lpr { facility(lpr); };

filter f_mail { facility(mail); };

filter f_user { facility(user); };

#filter f_ppp { facility(ppp); };

filter f_news { facility(news); };

filter f_debug { not facility(auth, authpriv, news, mail); };

filter f_messages { level(info..warn)

        and not facility(auth, authpriv, mail, news); };

filter f_emergency { level(emerg); };

filter f_info { level(info); };

filter f_notice { level(notice); };

filter f_warn { level(warn); };

filter f_crit { level(crit); };

filter f_err { level(err); };

filter f_avc { match(".*avc: .*"); };

filter f_audit { match("^audit.*") and not match(".*avc: .*"); };

filter f_pax { match("^PAX:.*"); };

filter f_grsec { match("^grsec:.*"); };

log { source(src); filter(f_authpriv); destination(authlog); };

log { source(src); filter(f_syslog); destination(syslog); };

log { source(src); filter(f_cron); destination(cron); };

log { source(src); filter(f_daemon); destination(daemon); };

log { source(kernsrc); filter(f_kern); destination(kern); };

log { source(src); filter(f_lpr); destination(lpr); };

log { source(src); filter(f_mail); destination(mail); };

log { source(src); filter(f_user); destination(user); };

log { source(kernsrc); filter(f_pax); destination(pax); };

log { source(kernsrc); filter(f_grsec); destination(grsec); };

log { source(kernsrc); filter(f_audit); destination(audit); };

log { source(kernsrc); filter(f_avc); destination(avc); };

log { source(src); filter(f_mail); filter(f_info); destination(mailinfo); };

log { source(src); filter(f_mail); filter(f_warn); destination(mailwarn); };

log { source(src); filter(f_mail); filter(f_err); destination(mailerr); };

log { source(src); filter(f_news); filter(f_crit); destination(newscrit); };

log { source(src); filter(f_news); filter(f_err); destination(newserr); };

log { source(src); filter(f_news); filter(f_notice); destination(newsnotice); };

#log { source(src); filter(f_debug); destination(debug); };

log { source(src); filter(f_debug); destination(syslog); };

log { source(src); filter(f_messages); destination(messages); };

log { source(src); filter(f_emergency); destination(console); };

#log { source(src); filter(f_ppp); destination(ppp); };

log { source(src); destination(console_all); };
```

----------

## Akaihiryuu

Wow, that's about 10x longer than mine.  I've just been using the default one.  I don't have any more time to fool with syslog while I'm at work, it'll have to wait until I get home later.

----------

## Akaihiryuu

What would I have to add to JUST get it to log debug messages?  I don't really want to delve into changing my logfiles at this point.

----------

## Akaihiryuu

I also had something called cyrus-sasl installed as a dependency of either apache, courier-imap, or postfix (I don't remember which)...is it possible that I just need to set something in it up as well?

----------

## kashani

sasl is a dependency of Postfix if you've set the use flag. There is nothing about it that should stop Courier-imap from working.

However if this is a new system I'd make sure to send the user in question some mail. Courier tends to flake in interesting ways if the .maildir/ does not exist.

kashani

----------

## Akaihiryuu

The Maildir/ directory does exist.  In fact, there were already a couple of messages in it.  The thing is, it doesn't matter which user it is...it doesn't even allow a login attempt, it bombs before any auth can be attempted.

----------

## Akaihiryuu

Solved.  I had MAILDIRPATH=Maildir, however MAILDIR was commented out.  I had to also set MAILDIR=Maildir, now courier-imap is working fine.

----------

