Re: TUX & CGI

"Christians, Stefan Mr." <[email protected]>
Newsgroups gmane.network.tux
Organization K.K. Alice
Message-ID <[email protected]>
On Tue, 2003-08-12 at 20:14, Bill Rugolsky Jr. wrote:

> Use bind mounts.  See mount(8).

Oh. I never saw that one before. Simple and great. Works like soap on
the shower floor. Thank you very much. That convinces me, and I will let TUX do the job.

The entire setup sequence should read:

1) Configuration
================

a) file /etc/sysconfig/tux:
--
DOCROOT=/var/www/html
CGIROOT=/

If CGIROOT is not set to the root directory, TUX will spit out the
chroot error complaining that cgiroot is not set correctly.


b) file /etc/tux.mime.types:
--
make sure the line
TUX/CGI   cgi pl
is active (uncommented) and make sure the file extensions cgi and pl are
not also assigned to any other mime types. (If they are, just delete
them there).


c) file /etc/sysctl.tux
--
net.tux.mode_allowed (default 4) and net.tux.mode_forbidden (default 0)
seem to be working fine, so I am not using any /etc/sysctl.tux file.


2) CGI scripts
==============

This is a little bit confusing. TUX requires the CGI scripts to be in
the cgi-bin subdir, which is relative to DOCROOT. So

mkdir -p /var/www/html/cgi-bin

and put all your *.cgi and *.pl files in there.

At the same time, however, TUX checks whether it is allowed to serve the
files, and these checks are done on files inside DOCROOT. So either

cp /var/www/html/cgi-bin/* /var/www/html/

or make sure that for each file in cgi-bin there is a file in DOCROOT
with the same name, user, group, and permissions. These copies can be
zero length, TUX only checks the attributes.


3) Binaries and Libraries
=========================

Even though TUX should chroot into CGIROOT, for some odd reason the
binaries and libraries needed to execute the CGI scripts are still
required in DOCROOT.

As Bill Rugolsky has pointed out, a very simple and efficient way to
make them available is to use bind mounts, which make the contents of a
directory accessible in two places.

a) Create the mount points:
--
mkdir /var/www/html/bin
mkdir /var/www/html/lib
mkdir -p /var/www/html/usr/bin
mkdir /var/www/html/usr/lib

b) Add following mount information to /etc/fstab:
--
/bin         /var/www/html/bin         none     ro,bind
/lib         /var/www/html/lib         none     ro,bind
/usr/bin     /var/www/html/usr/bin     none     ro,bind
/usr/lib     /var/www/html/usr/lib     none     ro,bind

c) Commit the mounts:
--
mount /var/www/html/bin
mount /var/www/html/lib
mount /var/www/html/usr/bin
mount /var/www/html/usr/lib


4) Start TUX
============

chkconfig tux on
service tux start


-- 
Stefan Christians
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.