How to run a fastcgi application under root ?

Jordi Farrés Saderra <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
Hi All,
 
I intend to run my fastcgi application (DataSystem.exe) under root perms.
So I first configured apache to add suexec wrapper using:
--enable-suexec
--with-suexec-caller=root
--with-suexec-userdir=/home/usr/cgi/usr
 
And I add next tokens to httpd.conf.
SuexecUserGroup root root
FastCgiWrapper On
FastCgiServer /home/usr/cgi/bin/DataSystem.exe -group root -user root 
 

My environment is:
Operating system: Linux Montavista 2.4.20
Apache version 2.0.55
Mod_fastcgi version 2.4.2
Platform is embedded system using IXP425 processor.
File system is Read Only.
 

The most prominent tokens in httpd.conf are:
 
SuexecUserGroup root root
ServerRoot "/usr/local/apache2"
User cgi-usr
Group users
LoadModule fastcgi_module modules/mod_fastcgi.so
FastCgiServer /home/usr/cgi/bin/DataSystem.exe -group root -user root
DocumentRoot "/home/usr/aweb/tree"
<Directory />
    Options FollowSymLinks
    AllowOverride None
    AuthType Basic
    AuthName "Please enter valid user and password"
    AuthUserFile passwd/passwords
    Require valid-user
</Directory>
<Directory "/home/usr/aweb/tree">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
UserDir /home/usr/cgi/usr
DirectoryIndex ComMainOffline.htm
ErrorLog /usr/local/apache2/logs/error_log
ScriptAlias /cgi-bin/ "/home/usr/cgi/bin/"
<Directory "/home/usr/cgi/bin">
    AllowOverride None
    Options +ExecCGI
    Order allow,deny
    Allow from all
    <IfModule mod_fastcgi.c>
    SetHandler fastcgi-script
</IfModule>
</Directory>
 

The users and rights for the related directories are:
 
# cd /home/usr/cgi/
# ls -al
drwxr-xr-x    1 cgi-usr  users          28 Jan  1  1970 bin
drwxrwxr--    2 cgi-usr  users          40 Jan  1  1970 usr
 
And cgi application 
 
# cd bin
# ls -al
-r-xr-xr-x    1 cgi-usr  users     2675305 Jan  1  1970 DataSystem.exe
 
 
 
Next error appears that when Apache starts:
 
[warn] module fastcgi_module is already loaded, skipping
[warn] (97)Address family not supported by protocol: FastCGI: there is no fastcgi wrapper set, user/group options are ignored
 
error apache Log file reports:
[notice] suEXEC mechanism enabled (wrapper:/usr/local/apache2/bin/suexec)
[warn] module fastcgi_module is already loaded, skipping
[notice] Apache/2.0.55 (Unix) mod_fastcgi/2.4.2 configured -- resuming normal operations
FastCGI: process manager initialized (pid 155)
[warn] FastCGI: server "/home/usr/cgi/bin/DataSystem.exe" started (pid 157)
 

But cgi application starts running in cgi-usr user instead of root I desired.
Apache always starts from root.
 
Here you are a process list from ps comman:
 
root       139  0.0  3.5  5320 2244 ?        S    11:23   0:00 /usr/local/apache2/bin/httpd -k start
 
cgi-usr    154  0.0  3.1  5108 2020 ?        S    11:23   0:00 /usr/local/apache2/bin/httpd -k start
 
cgi-usr    155  0.0  3.2  5108 2028 ?        S    11:23   0:00 /usr/local/apache2/bin/fcgi- -k start
 
cgi-usr    156  0.0  3.6 29904 2316 ?        S    11:23   0:00 /usr/local/apache2/bin/httpd -k start
 
cgi-usr    157  8.8  4.5 25532 2900 ?        S    11:23   1:02 /home/usr/cgi/bin/DataSystem.exe
 

I'm really stuck on all this configuration stuff.
All I need is run cgi application (DataSystem.exe) in root user.
I need do this because this application has to access others programs that only runs in root user (like ifconfig, start-stop daemonds ...)
Security for me is not a problem because it runs in a closed embedded system with no external users.
 
Please some help.
thanks
Jordi Farrés

___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.