Vitavonni

Wed, 02 Nov 2005

Apache2 + FastCGI + Suexec hell

It took me hours to get FastCGI and Suexec working properly. I'm so annoyed by the horrible docs available for it only.

First I tried using fcgid (which at least is DFSG-free) but wasn't able to run moinmoin properly at all. So I gave up on that quickly.

So I ended up trying "non-free" libapache2-mod-fastcgi. Oh what a mess. Getting the non-suexec fastcgi working was easy. Now I tried to make it a bit more secure...

The "Documentation" claims that all you need to do is enable the SuExec Wrapper. So I configured a "FastCgiServer", set -user and -group appropriately, somehow found out that I need to chown the executeable and the dir containing the executeable accordingly, and that the user and group need to be higher than 100 - ok. (Although group www-data would have been okay, I guess). Reloaded apache. And the fastcgi process is started and running with the right userid.

By now I was using a mini test-fastcgi, which prints getuid() - and so I could see that despite my process runing as a different user, it still returned 33 (=www-data). Damn!

The reason I found out later after manually changing URIs to find the right docs etc. was that I need to enable mod_suexec, then add the SuexecUserGroup option to my vhost.

For incoming requests, FastCGI will check for a running fcgi server with the same path and the same user and group ids as the one you defined in the fastcgi config. Otherwise it will start a new dynamic server. And there is no "FastCgiUserGroup" option or something obvious to configure the user and group name for the cgi path - but you need to do that for mod_suexec.

Apache config is a PITA anyway. With its pseudo-XML syntax etc. - we really need to get rid of it sometime...

So here is a short howto for using suexec and mod_fastcgi on apache2:

  • Install apache2 with suexec (should be included) and fastcgi.
  • Name your FastCGI .fcgi, setup +ExecCGI and the fastcgi-script handler
  • Test if your fastcgi runs as www-data user (i.e. non-suexec)
  • Add a "FastCgiServer" statement to the fastcgi.conf with appropriate -user and -group statements, enable FastCgiWrapper
  • chown the CGI and its parent directory to these ids, also consider setting the "immutable" flag on your cgi
  • Enable mod_suexec by calling "a2enmod suexec"
  • In your VHost, add a "SuExecUserGroup appruser apprgroup" statement matching the usernames you gave above.
  • restart apache. You should now see your fcgi process running with the correct userid. Otherwise check suexec.log and apache error log
  • Try to access a web page generated by the fastcgi, and make sure it didn't start another fastcgi daemon...

[category: /en/linux | Permalink]

Sind Raucher einsamer?

... gerade habe ich in einer Statistik gelesen, dass die Raucherquote bei Singles (zugegebener maßen nicht viel, aber trotzem) höher ist.

Ich finde sowieso den Gestank von (vor allem kaltem) Rauch einfach unsexy...

[category: /de | Permalink]
Menu
[planet.debian]
[planet.xmlhack]
[planet SELinux]
[munichblogs]
[email]
[RSS 2 feed]
[English RSS 2]
Categories
< November 2005 >
SuMoTuWeThFrSa
   1 2 3 4 5
6 7 8 9101112
13141516171819
20212223242526
27282930   
Archives
2010-Mar
2010-Feb
2010-Jan
2009-Dec
2009-Nov
2009-Oct
2009-Sep
2009-Aug
2009-Jul
2009-Jun
2009-May
2009-Apr
2009-Mar
2009-Feb
2009-Jan
2008-Dec
2008-Nov
2008-Oct
2008-Sep
2008-Aug
2008-Jul
2008-May
2008-Apr
2008-Mar
2008-Feb
2008-Jan
2007-Dec
2007-Nov
2007-Oct
2007-Sep
2007-Aug
2007-Jul
2007-Jun
2007-May
2007-Apr
2007-Mar
2007-Feb
2007-Jan
2006-Dec
2006-Nov
2006-Oct
2006-Sep
2006-Aug
2006-Jul
2006-Jun
2006-May
2006-Apr
2006-Mar
2006-Feb
2006-Jan
2005-Dec
2005-Nov
2005-Oct
2005-Sep
2005-Aug
2005-Jul
2005-Jun
2005-May
2005-Apr
2005-Mar
2005-Feb
2005-Jan
2004-Dec
2004-Nov
2004-Oct
2004-Sep
2004-Aug
2004-Jul
Other links:
Swing and the City - Lindy Hop in Munich