# [SOLVED] Imapd failing (CAUSE authdaemonrc)

## Gentoo-Ed

Hi I finished my mail server and try to login with squirrelmail. I get the error ERROR: Connection dropped by IMAP server. The configtest is all okay. Where to go from here?

I followed the guide for email for the home network. I go to squirrelmail WITHOUT https (so http) the guide uses https...Last edited by Gentoo-Ed on Thu Feb 22, 2007 6:54 am; edited 9 times in total

----------

## bunder

try checking your imap server's max connections per ip.  it could be possible that you have expended those, and when you log into SM, it logs you right back out.

cheers

----------

## Gentoo-Ed

maybe dumb of me, but where do I find those?

----------

## bunder

depends on your imap server, for me (courier)... it's /etc/courier-imap/imapd

cheers

----------

## Gentoo-Ed

Thanks I also saw thread https://forums.gentoo.org/viewtopic-t-317319-highlight-imap+connection+dropped.html and altering that and restarting I now get unknown user I also have authpam

```
 /etc/init.d/courier-authlib restart

 * Stopping courier-imapd over SSL ...                                    [ ok ]

 * Stopping courier-authlib: authdaemond ...                              [ ok ]

 * Starting courier-authlib: authdaemond ...                              [ ok ]

 * Starting courier-imapd over SSL ...                                    [ ok ]
```

----------

## bunder

okay, so we're getting somewhere.   :Laughing: 

what's in /var/log/messages and /var/log/mail.*... anything useful?

edit: i noticed it said SSL, i think you want courier-imapd not courier-imapd-ssl

cheers

----------

## Gentoo-Ed

var/log/mail/current:

```
Feb 18 13:58:47 [imapd-ssl] couriertls: /var/lib/courier-imap/couriersslcache: No such file or directory

Feb 18 13:58:47 [imapd-ssl] Connection, ip=[78.6.1.50]

Feb 18 13:58:47 [imapd-ssl] LOGIN FAILED, user=root@computer-01, ip=[78.6.1.50]

Feb 18 13:58:52 [imapd-ssl] LOGOUT, ip=[78.6.1.50]
```

There is no /var/lib/courier-imap I found this had to do with caching in the file imapd-ssl so I disabled that and restarted the service no the log shows

```
Feb 18 14:12:07 [authdaemond] stopping authdaemond children

Feb 18 14:12:07 [authdaemond] modules="authpam", daemons=5

Feb 18 14:12:07 [authdaemond] Installing libauthpam

Feb 18 14:12:07 [authdaemond] Installation complete: authpam

Feb 18 14:12:20 [imapd-ssl] Connection, ip=[78.6.1.50]

Feb 18 14:12:20 [imapd-ssl] LOGIN FAILED, user=ekoster, ip=[78.6.1.50]

Feb 18 14:12:25 [imapd-ssl] LOGOUT, ip=[78.6.1.50]
```

Squirrel mail gives unknown user or password

My authdaemondrc en authdaemond.conf file only contain one line

----------

## Gentoo-Ed

I tried telnet into localhost 143 (removed ssl)

```
A LOGIN user password

A NO Login failed.
```

Sigh, I don't know what to do anymore. I tried tons of thing but some how the authorization isn't doing what it should. What config files do you need to help?

----------

## Gentoo-Ed

Surfing along I found that most /etc/pam.d/imap have entire paths mine is:

```
auth       required     pam_nologin.so

auth       required     pam_stack.so service=system-auth

account    required     pam_stack.so service=system-auth

session    required     pam_stack.so service=system-auth

```

----------

## Gentoo-Ed

I'm trying to get courier-imapd-ssl running. When I start the service and do the following:

```
computer-01 courier-imap # telnet computer-01 993

Trying 78.6.1.50...

Connected to computer-01.DOMAIN

Escape character is '^]'.

A LOGIN ekoster SECRET

Connection closed by foreign host.
```

the /var/log/mail/current log shows:

```
Feb 20 18:41:37 [authdaemond] stopping authdaemond children

Feb 20 18:41:43 [authdaemond] modules="authpam", daemons=0

Feb 20 18:41:43 [authdaemond] Configuration error - missing 'daemons' setting, using 1

Feb 20 18:41:43 [authdaemond] Installing libauthpam

Feb 20 18:41:43 [authdaemond] Installation complete: authpam

Feb 20 18:41:54 [imapd-ssl] couriertls: accept: error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol

```

Top rows are from starting ofcourse

UPDATE

using "openssl s_client -connect computer-01:993" it will connect !! the log then says connected running the "A LOGIN then fails with login failed the final line for the openssl command will say:

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

This failure LOGIN FAILED, user=USER, ip ...  is the same as with just imap!!

where can i increase the loging on this? Found that in /etc/courier/authlib/authdaemonrc it says now:

```
Feb 20 21:22:06 [courier-authlib] authpam: trying this module

Feb 20 21:22:06 [courier-authlib] authpam: sysusername=ekoster, sysuserid=<null>, sysgroupid=1000, homedir=/home/ekoster, address=ekoster, fullname=, maildir=<null>, $

Feb 20 21:22:06 [courier-authlib] authpam: clearpasswd=<null>, passwd=x

Feb 20 21:22:06 [courier-authlib] pam_service=imap, pam_username=ekoster

Feb 20 21:22:06 [courier-authlib] pam_authenticate failed, result 28

Feb 20 21:22:06 [courier-authlib] authpam: REJECT - try next module

Feb 20 21:22:06 [courier-authlib] FAIL, all modules rejected

Feb 20 21:22:06 [imapd] LOGIN FAILED, user=ekoster, ip=[78.6.1.50]

```

So how to not reject the module

GREAT !!!

I solved it I added authshadow. I works for normal imap. Thats good enough for me, no to set everything else.

----------

## RafaSant

Ufff  Had the same problem.  

Thanks

----------

