Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 409943 - mail-mta/courier installs esmtpd with bad permissions
Summary: mail-mta/courier installs esmtpd with bad permissions
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Hanno Böck
Depends on:
Reported: 2012-03-28 04:39 UTC by Michael Jinks
Modified: 2013-09-18 16:25 UTC (History)
3 users (show)

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


Note You need to log in before you can comment on or make changes to this bug.
Description Michael Jinks 2012-03-28 04:39:36 UTC
On a fresh install, courier runs, starts /usr/sbin/couriertcpd and courieresmtp, but when a connection is opened on port 25, syslog records:

 courieresmtpd: /usr/sbin/courieresmtpd: Permission denied

The courieresmtpd file has ownership/permissions as follows:

-r-xr-x--- 1 root root 1118352 Mar 27 23:11 /usr/lib64/courier/courier/modules/esmtp/courieresmtpd

The courier parent process runs as user 'mail'.  Changing either the owner or the group of the courieresmtpd binary to 'mail' fixes the problem, and mail receipt functions as normal.
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2012-03-28 12:29:05 UTC
Please post your `emerge -vpq mail-mta/courier' output in a comment,
Comment 2 Michael Jinks 2012-03-28 15:05:02 UTC
Realized earlier I forgot to post emerge --info.  Here's that...

% emerge --info               
Portage (default/linux/amd64/10.0, gcc-4.5.3, glibc-2.13-r4, 3.2.12-gentoo x86_64)
System uname: Linux-3.2.12-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_X5650_@_2.67GHz-with-gentoo-2.0.3
Timestamp of tree: Tue, 27 Mar 2012 21:00:01 +0000
app-shells/bash:          4.2_p20
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.2-r3, 3.2.2
dev-util/cmake:           2.8.6-r4
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.68
sys-devel/automake:       1.11.1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.5.3-r2
sys-devel/gcc-config:     1.5-r2
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 3.1 (virtual/os-headers)
sys-libs/glibc:           2.13-r4
Repositories: gentoo
CFLAGS="-O2 -pipe"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
USE="acl amd64 berkdb bzip2 cli cracklib crypt cups cxx dri fortran gdbm gpm iconv ipv6 mmx modules mudflap multilib ncurses nls nptl nptlonly openmp pam pcre pppd readline session sse sse2 ssl sysfs tcpd unicode xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Comment 3 Michael Jinks 2012-03-28 15:06:19 UTC here's the output of "emerge -vpq mail-mta/courier":

% emerge -vpq mail-mta/courier
[ebuild   R   ] mail-mta/courier-0.65.2-r1  USE="crypt nls pam -fam -fax -ipv6 -ldap -mysql -norewrite -postgres -spell -web -webmail"
Comment 4 Michael Jinks 2012-03-28 15:38:04 UTC
Possibly related: I've also discovered that outbound mail suffers from a similar problem, because /usr/lib64/courier/courier/modules/esmtp/courieresmtp is also set read/execute for owner and group only, owned root/root.  Mail from and to localhost delivers fine, but mail to off-host fails with "courieresmtp: Crashed child process [PID], while delivering to [domain]".

"chgrp mail" on courieresmtp appears to fix the problem.

Oddly enough, on another machine (previous incarnation of the one I'm building now), the exact same release and revision of the Courier package never had this problem.  So the cause of the trouble must be external to the Courier ebuild (right?) but I'm not sure where else to look.
Comment 5 Dan Johansson 2012-05-31 19:46:55 UTC
This is happening to me too.
Doing a chgrp mail //usr/lib64/courier/courier/modules/esmtp/* did fix it for me.
It looks like we have had this one before:
Comment 6 MAL 2012-06-07 11:40:27 UTC
Another me too.  It seems to be all the files within the modules/*/ directories that have changed from mail:mail to root:root.  I was able to compare an affected server with one that hadn't been updated yet.
Comment 7 Hanno Böck gentoo-dev 2012-06-07 11:56:27 UTC
I saw and could reproduce this myself, however it was a bit tricky to debug into the problem.

The root cause is that the courier Makefile checks for root rights by testing write access to /etc - portage prevents that. I'm currently trying to get patches up and running for courier upstream, so this should be resolved soon.
Comment 8 Hanno Böck gentoo-dev 2012-06-27 13:11:37 UTC
Together with upstream author Sam Varshavchik I was able to get a fix into courier's code. As it'd be a bit tricky to patch this, I've committed a snapshot release of courier now.
Please test
which is now in ~, it should solve this issue.
Comment 9 Toralf Förster gentoo-dev 2012-06-27 17:57:36 UTC
(In reply to comment #5)
> This is happening to me too.
> Doing a chgrp mail //usr/lib64/courier/courier/modules/esmtp/* did fix it
> for me.
> It looks like we have had this one before:

and here bug #396525
Comment 10 Michael Jinks 2012-06-27 18:40:57 UTC
(In reply to comment #8)
> Please test
> mail-mta/courier-
> which is now in ~, it should solve this issue.

Tested.  Works here.
Comment 11 MAL 2012-06-28 11:34:17 UTC
Tested - working.
Comment 12 Hanno Böck gentoo-dev 2013-09-18 16:25:28 UTC
So seems this is fixed now.