# Courier-imap: no telnet

## bravecobra

I've got the following problem:

I have qmail installed and that works perfectly. Now I would like to offer the maildirs as IMAP folders and I want to use courier-imap to do that. Also POP is to be achieved  :Wink: 

I've installed the qmail-pop3d and that one works perfectly. However the courier-pop3d does not seem to work for some reason(with the qmail-pop3d disabled of course). I'm using PAM authentication.

When I try to telnet the daemon (# telnet localhost 110) for POP, he connects and then says the foreign host closed the connection, like this

```
Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

Connection closed by foreign host.

```

There is no firewall running. I can get a perfect connection running the qmail-pop3d, so the port is not blocked.Running the courier-imapd gives me the same result for a telnet session

My guess is that there is something wrong with the authentication daemon. It looks like the hosts are being rejected. The setting of address is 0, making it to listen to all addresses.

I have no idea where I can set any other settings regarding to hosts.

Should I have someting extra in /etc/make.conf when emerging courier-imap. My USE variable  looked like this when emerging courier-imap:

```

USE="kde qt -alsa gnome gtk ssl pam tcpd imap"

```

To give you some more settings:

in authdaemond.conf:

```
AUTHDAEMOND="authdaemond.plain"
```

in authdaemonrc(deleted out the comments here):

```

authmodulelist="authpwd authpam"

authmodulelistorig="authcustom authcram authuserdb authmysql authpam"

daemons=5

version=authdaemond.plain

authdaemonvar=/var/lib/courier-imap/authdaemon

```

/etc/courier-imap/pop3d(deleted the comments here):

```

PIDFILE=/var/run/pop3d.pid

MAXDAEMONS=40

MAXPERIP=4

AUTHMODULES="authdaemon"

AUTHMODULES_ORIG="authdaemon"

DEBUG_LOGIN=2

POP3AUTH="LOGIN"

POP3AUTH_ORIG="LOGIN CRAM-MD5 CRAM-SHA1"

POP3AUTH_TLS=""

POP3AUTH_TLS_ORIG="LOGIN PLAIN"

PORT=110

ADDRESS=0

TCPDOPTS="-nodnslookup -noidentlookup"

POP3DSTART=YES

MAILDIR=~/.maildir/

```

What could I be doing wrong here?

----------

## msalerno

Are you sure that the daemon is running ?

Is there anything in the logs ?

What gets returned when you execute :

/etc/init.d/courier-pop3d statusLast edited by msalerno on Thu Dec 26, 2002 9:52 pm; edited 1 time in total

----------

## bravecobra

Yes, daemon is running and there is nothing in the logs to be found. I find it all very strange too.

----------

## msalerno

Just for testing, I diabled the qmail-pop3d and enabled the courier-pop3d daemon, and everything worked !  Are you using the latest version of Courier-Imapd ?

Here is a working copy of my /etc/courier-imap/pop3d with no modifications except that I removed the comments.

prefix=/usr

exec_prefix=/usr

sbindir="/usr/sbin"

PIDFILE=/var/run/pop3d.pid

MAXDAEMONS=40

MAXPERIP=4

AUTHMODULES="authdaemon"

AUTHMODULES_ORIG="authdaemon"

POP3AUTH=""

POP3AUTH_ORIG="LOGIN CRAM-MD5 CRAM-SHA1"

POP3AUTH_TLS=""

POP3AUTH_TLS_ORIG="LOGIN PLAIN"

PORT=110

ADDRESS=0

TCPDOPTS="-nodnslookup -noidentlookup"

POP3DSTART=NO

MAILDIR=.maildir

----------

## bravecobra

I think the problem lies in the authentication daemon. Tried your solution. Don't work!

----------

## msalerno

The only difference between my authdaemon and your authdaemon configuration is in the authdaemonrc file.

The authmodulelist line:

authmodulelist="authcustom authcram authuserdb authmysql authpam"

And my version line:

version=""

----------

## bravecobra

Nope, tried that one too, but it didn't work. Something very strange is going on here. I'm guessing something went wrong during emerging.

What should my USE look like?

----------

## bravecobra

Do I need an MX record in my DNS server in order to get this working?

----------

## Messiah

No you do not need an mx record in your dns to have this working. I don't think it's a problem in authentication, I have seen many problems with courier-imap and authenticating, all of them had the same symptoms, you can login, and you will randomly get authenticated, or not authenticated at all.

Maybe it has something to do with permissions, or something else. Are you binding to a specific ip?

----------

## bravecobra

yep fixed ip 192.168.0.2, I've tried setting adress to 192.168.0.2, but that doesn't help. I guess something happens in the emerging although I don't get any errors, only one warning (can't really remember which one, but I was told it was innocent.).

----------

## Messiah

but when you bind courier-imap to the ip 192.168.0.2, then you should connect to that ip instead of 127.0.0.1, did you try that also?

So, what does the following do:

telnet 192.168.0.2 110

----------

## bravecobra

The same thing. Connection closed by foreign host.

----------

## stimpy

I'm in a similar sounding situation. Recently my IMAP (courier-imap-1.6.2) stopped accepting login's

```

Jan 14 15:08:00 abc imapd: Connection, ip=[x.y.z.a]

Jan 14 15:08:00 abc imapd: LOGIN: DEBUG: ip=[x.y.z.a], command=LOGIN

Jan 14 15:08:00 abc imapd: LOGIN: DEBUG: ip=[x.y.z.a], username=stimpy

Jan 14 15:08:00 abc imapd: LOGIN: DEBUG: ip=[x.y.z.a], password=****

Jan 14 15:08:05 abc imapd: LOGIN FAILED, ip=[x.y.z.a]

```

It conincided exactly with an update of pam from pam-0.75-r6 to  pam-0.75-r11.

Haven't worked out a solution yet.

----------

## JWU42

I am having the same problem   :Confused: 

PS - Gotta love Stimpy!

----------

## btg308

Works here, using pam 0.75-r10. Haven't tried r11.

```

authmodulelist="authpam"

version="authdaemond.plain"

```

Are you sure the authdaemon is running?

----------

## JWU42

Only difference I saw in my /etc/courier-imap/authdaemonrc was this

```

authmodulelist="authpam"

version""

```

What is unusual is everything was working fine yesterday morning.  After updating several things yesterday (including pam to -r11 and courier-imap to 1.6.2) it doesn't allow the login.

----------

## stimpy

I have to admit to a shameful amount of incompetence  :Embarassed: 

Although I'd restarted imap, rebuilt everything, checked the configuration of authentication options for courier, had authdaemon running, i'd forgotten/overlooked restarting the authdaemon.

It only gets started on my system due to a dependency in courier-imapd, so although I'd restarted courier-imapd, the dependency was being statisfied by its earlier invocation.

Now it works just fine... Sigh!

(now to fix my libgnomeprintui compilation problem!)

----------

## JWU42

All I should need to have running is...

postfix

courier-imapd

courier-imapd-ssl

Am I missing something?

----------

## stimpy

you need your authdaemond running as well I believe. It should start up "Transparently" if you start courier-imapd through a dependency in /etc/init.d/courier-imapd{,-ssl}

(It has to be configured as mentioned above as well obviously.)

It will start a process authdaemond, authdaemond.plain, or whatever is configured.

----------

## JWU42

Isn't the authdaemon, in my case authpam, loaded in /etc/courier-imapd/authdaemonrc with this

```

authmodulelist="authpam"

```

----------

