Package:tcpd
Version: 7.6.dbs-8

When running dovecot-imapd from inetd, tcpd fails to exec the
imap-login binary, although "ps ax" suggests otherwise.

The dovecot man page suggests that it is possible to run dovecot from
inetd, and the dovecot wiki <http://wiki.dovecot.org/InetdInstall>
gives an appropriate entry for /etc/inetd.conf (edited to reflect the
file locations in Debian):

imap           stream  tcp     nowait  root    /usr/sbin/tcpd 
/usr/lib/dovecot/imap-login
imaps          stream  tcp     nowait  root    /usr/sbin/tcpd 
/usr/lib/dovecot/imap-login --ssl

Unfortunately this doesn't work. I can telnet to port 143, telnet 
connects OK, and "ps axf" on the server shows that 
/usr/lib/dovecot/imap-login has been started in response to the
incoming connection. I then see a line like 

localhost imap-login[2820]: refused connect from 192.168.1.4 (192.168.1.4)

appear in /var/log/syslog, and the telnet session dies with 

Connection closed by foreign host.

/etc/hosts.allow and /etc/hosts.deny are set to allow connections from 
192.168.1.4, and they work as expected where other services are
concerned. Connecting from localhost produces the same result.

The "sledgehammer" experiment of deleting the imap-login binary gives
the incredible result that no change in the behaviour is observed.
"ps axf" on the server still shows that /usr/lib/dovecot/imap-login
has been started in response to the incoming connection, even though
the file no longer exists. !!!

The less violent experiment of replacing /usr/lib/dovecot/imap-login
with /usr/lib/dovecot/imap in /etc/inetd.conf provides the expected
behaviour as far as the actual connection is concerned, but this of
course bypasses the login process so the IMAP session is automatically
logged in as root as soon as the connection is made - not exactly the
desired behaviour.

A workaround - which seems to be reasonably robust against breakage by
package upgrades AFAICT - is to execute:

mkdir /usr/local/lib/dovecot
ln -s /usr/lib/dovecot/imap-login /usr/local/lib/dovecot/imap

and edit the entries in /etc/inetd.conf accordingly:

imap           stream  tcp     nowait  root    /usr/sbin/tcpd 
/usr/local/lib/dovecot/imap
imaps          stream  tcp     nowait  root    /usr/sbin/tcpd 
/usr/local/lib/dovecot/imap --ssl

This then gives the desired behaviour - logins to the IMAP server
work, and access can be controlled using /etc/hosts.allow and
/etc/hosts.deny.


Kernel: Debian stock 2.4.27-3-686-smp
libc6: 2.3.2.ds1-22sarge3
dovecot-imapd: 0.99.14-1sarge0
netkit-inetd: Version: 0.10-10
Hardware: Dell Poweredge 2450, 512K RAM, 2 x 733MHz PIII

-- 
Pigeon

Be kind to pigeons
Get my GPG key here: 
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x21C61F7F

Attachment: signature.asc
Description: Digital signature

Reply via email to