# HELP - FAIL: imap2 address from=127.0.0.1

## Moriah

I am having trouble getting uw-imap to work with ssl/tls and passwords on a new server.  An older server works great, but I can't seem to find any differences anywhere that I know to look.  Obviously I am overlooking some config file  somewhere.   The uw-imap daemon is launched from xinetd as either imap or imaps, but when trying to open squirrelmail I get the following in /ver/log/messages:

```

Jun 13 23:45:15 iidcpac xinetd[7326]: START: imap2 pid=7812 from=127.0.0.1

Jun 13 23:45:15 iidcpac xinetd[7812]: FAIL: imap2 address from=127.0.0.1

Jun 13 23:45:15 iidcpac xinetd[7326]: EXIT: imap2 status=0 pid=7812 duration=0(sec)

```

It sounds like it is griping about the fact that the connection is being originated from localhost, but that's what squirrelmail does, and it works on the other machine.    :Confused: 

Anybody have a clue what I might be doing wrong here?     :Question: 

----------

## nativemad

Hi, 

it seems like xinetd is blocking the connection!

What do yu have in /etc/xinetd.conf as "only_from" under the defaults!?

----------

## Moriah

Here are what I think are the relevant files.

/etc/xinetd.conf

```

# Copyright 1999-2004 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: /var/cvsroot/gentoo-x86/sys-apps/xinetd/files/xinetd.conf,v 1.6 2004/07/15 00:53:48 agriffis Exp $

# Sample configuration file for xinetd

defaults

{

#       only_from      = localhost

        instances      = 60

        log_type       = SYSLOG authpriv info

        log_on_success = HOST PID

        log_on_failure = HOST

        cps            = 25 30

}

includedir /etc/xinetd.d

```

/etc/xinetd.d/imap

```

# default: off

# $Header: /var/cvsroot/gentoo-x86/net-mail/uw-imap/files/uw-imap.xinetd,v 1.2 2002/06/07 02:01:38 woodchip Exp $

# description: The IMAP service allows remote users to access their mail using \

#              an IMAP client such as Mutt, Pine, fetchmail, or Netscape \

#              Communicator.

service imap2

{

   socket_type      = stream

   wait         = no

   user         = root

   server         = /usr/sbin/imapd

   log_on_success      += HOST DURATION USERID

   log_on_failure      += HOST USERID

   disable         = no

}

```

/etc/xinetd.d/imaps

```

# default: off

# $Header: /var/cvsroot/gentoo-x86/net-mail/uw-imap/files/uw-imaps.xinetd,v 1.2 2002/06/07 02:01:38 woodchip Exp $

# description: The IMAPS service allows remote users to access their mail \

#          using an IMAP client with SSL support such as Netscape \

#          Communicator or fetchmail.

service imaps

{

   socket_type      = stream

   wait         = no

   user         = root

   server         = /usr/sbin/imapd

   log_on_success      += DURATION USERID

   log_on_failure      += USERID

   disable         = no

}

```

So the "only_from"  == localhost, which ought to be correct.    :Confused: 

Do you see anything else wrong here?    :Question: 

----------

## nativemad

I've just emerged uw-imap and compared the two configs... looks quite similar and also works with HOST as logging parameter over here!?

Does it work on the command line if you just use /usr/sbin/imapd?

----------

## Moriah

Hmmm...   Good idea using the command line.  The actual need is where imap is invoked from localhost by squirrelmail.  I've never run imapd from the command line.  How should I invoke it?

----------

## nativemad

Here is a little guide to imap using an interactive telnet session...http://bobpeers.com/technical/telnet_imap the same behavior can be used if you just use a plain `imapd` on the command line!   :Wink: 

```
# imapd                                                                                                                                                                  

* OK [CAPABILITY IMAP4REV1 I18NLEVEL=1 LITERAL+ SASL-IR LOGIN-REFERRALS STARTTLS LOGINDISABLED] archer IMAP4rev1 2007e.404 at Fri, 17 Jun 2011 21:09:56 +0200 (CEST)                

^C              
```

----------

## Moriah

That link shows a procedure that absolutely does not work on either my problem machine or on my machine that works fine with a regular imap client, so I conclude that the web page has suffered bit-rot, as it is dated in the examples at 1-Feb-2006.  5 years is more than eternity in computer stuff.    :Surprised: 

----------

## nativemad

ok, the site is really old, but imagine what would have probably happened if the imap protocol would have changed!? have you seen the dots before the commands?

```
telnet mail.nativenet.ch 143

Trying 84.253.36.227...

Connected to mail.nativenet.ch.

Escape character is '^]'.

* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE STARTTLS AUTH=PLAIN AUTH=LOGIN AUTH=DIGEST-MD5 AUTH=CRAM-MD5] Nativenet Mailsystem ready.

. login mad *mypasswordhere*

. OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT IDLE CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS QUOTA] Logged in

. list "" "*"

* LIST (\HasChildren) "." "INBOX"

* LIST (\HasNoChildren) "." "INBOX.nativenet"

* LIST (\HasNoChildren) "." "INBOX.Spam"

* LIST (\HasNoChildren) "." "INBOX.sent-mail"

* LIST (\HasNoChildren) "." "INBOX.fun"

* LIST (\HasNoChildren) "." "INBOX.linux"

* LIST (\HasNoChildren) "." "INBOX.fotos"

* LIST (\HasNoChildren) "." "INBOX.Drafts"

* LIST (\HasNoChildren) "." "INBOX.Entw&APw-rfe"

* LIST (\HasNoChildren) "." "INBOX.Sent"

* LIST (\HasNoChildren) "." "INBOX.drafts"

* LIST (\HasNoChildren) "." "INBOX.gentoo-bugs"

* LIST (\HasNoChildren) "." "INBOX.gentoo-dev"

. OK List completed.

. logout

* BYE Logging out

. OK Logout completed.

Connection closed by foreign host.

```

also it should produce a log message if you just start start it and press enter one time and after that ctrl&c to stop it!

```
Jun 17 21:44:45 archer imapd[12733]: Null command before authentication host=SSH_CLIENT=192.168.0.112
```

----------

## Moriah

 *Quote:*   

> 
> 
> have you seen the dots before the commands? 
> 
> 

 

Aha!  Dots da problem!    :Wink: 

Well, it seemed to get a bit farther, but even my working box says:

```

rj@eli ~ $ telnet localhost 143

Trying 127.0.0.1...

Connected to localhost.localdomain.

Escape character is '^]'.

* OK [CAPABILITY IMAP4REV1 I18NLEVEL=1 LITERAL+ SASL-IR LOGIN-REFERRALS STARTTLS] localhost.localdomain IMAP4rev1 2007e.404 at Fri, 17 Jun 2011 16:55:18 -0400 (EDT)

x login me@goodbox.com password

x NO Invalid login credentials

```

Furthermore, the server said:

```

Jun 17 17:00:19 goodbox xinetd[2227]: START: imap2 pid=5136 from=127.0.0.1

Jun 17 17:00:19 goodbox imapd[5136]: imap service init from 127.0.0.1

Jun 17 17:00:33 goodbox imapd[5136]: Login failed user=me@goodbox.com auth=me@goodbox.com host=localhost.localdomain [127.0.0.1]

```

So I take it that even the good box did not like my password.  Given that my password does contain -- as recomended for good security reasons -- a wad of special characters, I must ask, "Do I need to escape or quote any special characters in the password?"    :Shocked: 

----------

## nativemad

khm... i do not have any special characters in my password... khm! dont speak about it in public! khm!   :Wink:   :Laughing: 

i just meat that you could determine if it is xinetd or uwimap who causes the problem that way... (sorry, cant test it actually, as i use dovecot in production)

For the record; xinetd is just a tcp wrapper for stdin/out! i've got a bash script running through it actually!   :Wink: 

So if you are able to invoke `/usr/sbin/imapd` and get the syslog messages as mentioned before with just an `enter`[edit] actually you shoud see the imap header at this point[/edit], then your problem IS xinetd!

If that works, `telnet localhost 143` would simulate squirrelmail then... if you also get the header with this command, then i would say your problem is the php stack under squirrelmail!  

...sorry, i have to give up for today... have a nice weekend!  :Razz: 

Cheers!

----------

