Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 61316 - Gentoo Courier 3.0.5 sets TLS options on both imapdssl and imapd
Summary: Gentoo Courier 3.0.5 sets TLS options on both imapdssl and imapd
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Net-Mail Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-22 18:48 UTC by Tom
Modified: 2004-08-23 13:06 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
/etc/pam.d/imap (imap,474 bytes, text/plain)
2004-08-23 11:59 UTC, Tom
Details
/etc/courier-imap/authdaemond.conf (authdaemond.conf,544 bytes, text/plain)
2004-08-23 11:59 UTC, Tom
Details
/etc/courier-imap/imapd (imapd,12.20 KB, text/plain)
2004-08-23 12:00 UTC, Tom
Details
/etc/courier-imap/imapd-ssl (imapd-ssl,5.86 KB, text/plain)
2004-08-23 12:00 UTC, Tom
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom 2004-08-22 18:48:47 UTC
I did an upgrade from courier 3.0.2 to 3.0.5 and found my non secure IMAP mail client unable to sign in.  Doing a telnet localhost 143 revealed this:

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

Note the STARTTLS.  That option is not enabled in /etc/courier-imap/imapd but it is in /etc/courier-imap/imapd-ssl.  My make.conf has the following USE line:

USE="ssl -ipv6 ldap -mysql -X -kde -gnome imap maildir -gtk sasl -qt libwww -mbox cups foomaticdb ppds"

I believe the problem lies in the file /usr/lib/courier-imap/gentoo-imapd.rc
Commenting out lines 22 and 23 resolved my problem.

Reproducible: Always
Steps to Reproduce:
1. Uncomment lines 22 and 23 in /usr/lib/courier-imap/gentoo-imapd.rc
2. Restart courier imap


Actual Results:  
normal imap server now demands STARTTLS

Expected Results:  
seperate TLS settings between imap and imap-ssl

Portage 2.0.50-r9 (default-x86-1.4, gcc-3.3.3, glibc-2.3.3.20040420-r1,
2.6.7-gentoo-r6)
=================================================================
System uname: 2.6.7-gentoo-r6 i686 Pentium III (Coppermine)
Gentoo Base System version 1.4.16
distcc 2.13 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
Autoconf: sys-devel/autoconf-2.59-r4
Automake: sys-devel/automake-1.8.5-r1
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=pentium3 -funroll-loops -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /opt/jetty/etc /usr/kde/2/share/config
/usr/kde/3/share/config /usr/share/config /var/bind /var/qmail/control
/var/www/localhost/htdocs/squirrelmail/config"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -march=pentium3 -funroll-loops -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="ftp://ftp.gtlib.cc.gatech.edu/pub/gentoo
rsync://csociety-ftp.ecn.purdue.edu/pub/gentoo/
http://mirror.tucdemonic.org/gentoo/ ftp://ftp.ussg.iu.edu/pub/linux/gentoo"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="apm arts avi berkdb crypt cups encode foomaticdb gdbm gif gpm gtk2 imap
imlib java jpeg ldap libg++ libwww mad maildir mikmod motif mpeg ncurses nls
oggvorbis opengl oss pam pdflib perl png ppds python quicktime readline sasl sdl
slang spell ssl svga tcpd truetype x86 xml2 xmms xv zlib"
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-08-22 23:13:12 UTC
STARTTLS != SSL

STARTTLS is SSL support over the normal 143 port. The TLS is initated from inside the connection. With SSL on port 993, it's initiated outside of the IMAP conversation.

Go and look at /etc/courier-imap/imapd and see the IMAP_CAPABILITY* settings.
I can login to 3.0.7 quite fine on the normal IMAP port both with and without STARTTLS-capable clients.
Comment 2 Tom 2004-08-23 09:32:54 UTC
IMAP_CAPABILITY="IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTN=PLAIN IDLE"

telnet localhost 143

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

If I uncomment lines 22 and 23 in /usr/lib/courier-imap/gentoo-imapd.rc, the telnet now shows

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

At that point Squirrelmail cannot log in without enabling TLS.  Something I don't wish to do, as it breaks the imapproxy I use to speed up the web mail for users.  

Oddly, something during this upgrade broke the serversidefilters plugin of Squirrelmail too.  It uses IMAP authentication to verify the user before using a su to that user to change files in their home directory.  Something has changed how Courier wants to do logins without me changing anything.
Comment 3 Tuan Van (RETIRED) gentoo-dev 2004-08-23 10:08:50 UTC
please attach your '/etc/courier-imap/authdaemond.conf' and '/etc/pam.d/imap'

your problem is "LOGINDISABLED" capability in the greeting.

$ telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=CRAM-SHA1 IDLE STARTTLS ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2004 Double Precision, Inc.  See COPYING for distribution information.
a login mailuser password
a OK LOGIN Ok.
a logout
* BYE Courier-IMAP server shutting down
a OK LOGOUT completed
Connection closed by foreign host.
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-08-23 10:31:47 UTC
I get a very different result (using 3.0.7)
I have the gentoo-imapd.rc totally stock (eg lines 22,23 uncommented)
and I get:
telnet localhost 143
* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2004 Double Precision, Inc.  See COPYING for distribution information

The only time I can produce the LOGINDISABLED is if I set IMAP_TLS_REQUIRED=1 in
/etc/courier-imap/imapd-ssl

attach your /etc/courier-imap/imap* as well.
Comment 5 Tom 2004-08-23 11:59:24 UTC
Created attachment 38040 [details]
/etc/pam.d/imap
Comment 6 Tom 2004-08-23 11:59:56 UTC
Created attachment 38041 [details]
/etc/courier-imap/authdaemond.conf
Comment 7 Tom 2004-08-23 12:00:17 UTC
Created attachment 38042 [details]
/etc/courier-imap/imapd
Comment 8 Tom 2004-08-23 12:00:33 UTC
Created attachment 38043 [details]
/etc/courier-imap/imapd-ssl
Comment 9 Tom 2004-08-23 12:03:01 UTC
Files attached.  I do have IMAP_TLS_REQUIRED=1 in the imapd-ssl, because I want that enabled there.  I however do not want it enabled on my imapd process.

I run imapd-ssl on port 993 (standard) with accessability to all
I also run imapd on port 994, limited to localhost, for an imapproxy running on localhost to connect to.  I do not want any secure process on 994, TLS or SSL.  The problem seems to be the new rc file added that combines variables from both imapd and imapd-ssl instead of treating them seperate.
Comment 10 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-08-23 12:16:57 UTC
therein lies your problem.
the IMAP_TLS_REQUIRED=1 setting ONLY affects imapd and NOT imapd-ssl.
set it to 0 and you'll be fine.
Comment 11 Tom 2004-08-23 12:21:30 UTC
Why is IMAP_TLS_REQUIRED=1 in the imapd-ssl file then?  It was there before the upgrade, and never caused such a problem.  Only the update to 3.0.5 caused issues.
Comment 12 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-08-23 12:39:53 UTC
one of the gentoo bugs fixed in the 3.0.5 (actually slightly before) was that TLS wasn't being enabled for the plain imapd, due to a glitch in our gentoo-imapd.rc script.

The option is present in the imapd-ssl file because it makes logical sense to put it there.
imapd contains all the base imap options, and imapd-ssl contains all options for SSL/TLS. the fact that the configuration files happen to have the same name as two of the binaries is just co-incidental.
Comment 13 Tom 2004-08-23 12:51:33 UTC
Ahh, ok.  To resolve this, I'd recommend putting in a note explaining that the TLS option only affects imapd.

Still tracking down why my serversidefilter plugin for Squirrelmail broke in the upgrade.  Since thats not in Gentoo, I'm checking the squirrelmail plugin list for help on it.  Seems to fail on plain authentication now for some bizare reason.
Comment 14 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-08-23 13:06:56 UTC
if you want that, submit a docs patch. I think it's fairly obvious as if you connect to the imap-ssl port, SSL(TLS) is in effect already.