gentoo on apache with mod_suexec

In my last post I eluded to some difficulties in getting mod_suexec to build for apache on my gentoo host. It used to work for a long time and then it failed around the time that the gentoo team moved and changed some of the build flags from /etc/apache2/apache2-builtin-mods to /etc/make.conf.

I've been lazy and haven't file a bug report, but since I have a work around and it doesn't change that often, the pain factor has not reached critical mass.

At any rate, here is the workaround that seems to work.

Just substitute the versions:

ebuild /usr/portage/www-servers/apache/apache-2.2.9.ebuild compile
cd /var/tmp/portage/www-servers/apache-2.2.9/work/httpd-2.2.9
grep './configure' config.log | head -1 | cut -f4- -d ' ' | sed 's/--disable-suexec/--enable-suexec=shared/'

Then run the command (which will be several lines long) that is printed as a result of the last command. Wait for it to finish and then:

make
cp ./modules/generators/.libs/mod_suexec.so /usr/lib/apache2/modules/mod_suexec.so
cp ./support/suexec /usr/sbin/suexec
ln -s /usr/sbin/suexec /usr/sbin/suexec2
chgrp apache /usr/sbin/suexec
chmod 4750 /usr/sbin/suexec
apachectl configtest
/etc/init.d/apache2 restart

That will restore all mod_suexec magic to full function.