Hay varios métodos para enjaular apache pero me gustaría usar mod_chroot (libapache2-mod-chroot) antes que mod_security o el chroot clásico. Creo que puede ser la forma más sencilla pero no consigo hacerlo funcionar. Estoy siguiendo este manual, más o menos: http://core.segfault.pl/~hobbit/mod_chroot/apache20.html
He tenido que añadir /etc/mimes.types, copiar los sockets y también en vez de crear un enlace a /var/run/apache2.pid he creado un fichero nuevo dentro del chroot. Sino hago el enlace como indica en el manual me da el siguiente error en el log: [Tue Feb 27 10:02:01 2007] [error] (40)Too many levels of symbolic links: could not create /var/run/apache2.pid [Tue Feb 27 10:02:01 2007] [error] apache2: could not log pid to file /var/run/apache2.pid La lista de directorios y archivos en el chroot, /home/apache . |-- etc | `-- mime.types `-- var |-- log |-- run | |-- apache2 | | |-- cgisock.17690 | | |-- cgisock.19844 | | |-- cgisock.22180 | | |-- cgisock.5294 | | |-- cgisock.5308 | | |-- cgisock.5351 | | |-- cgisock.6235 | | |-- cgisock.9293 | | `-- cgisock.9305 | |-- apache2.pid | `-- mysqld `-- www `-- index.html He cargado el mod: a2enmod mod_chroot Añadido el chroot en /etc/apache2/httpd.conf : PidFile /var/run/apache2.pid ChrootDir /home/apache/ Y finalmente arranco apache2. La primera petición la sirve bien, después no vuelve a cargar. Al parar Apache2 dice lo siguiente: $ /etc/init.d/apache2 stop Stopping web server (apache2)...apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.1.50 for ServerName httpd (no pid file) not running Por otra parte en /var/log/apache2/error.log libgcc_s.so.1 must be installed for pthread_cancel to work [Tue Feb 27 09:49:20 2007] [notice] mod_chroot: changed root to /home/apache/. [Tue Feb 27 09:49:20 2007] [warn] pid file /var/run/apache2.pid overwritten -- Unclean shutdown of previous Apache run? [Tue Feb 27 09:49:20 2007] [notice] Apache/2.2.3 (Debian) mod_chroot/0.5 configured -- resuming normal operations libgcc_s.so.1 must be installed for pthread_cancel to work libgcc_s.so.1 must be installed for pthread_cancel to work [Tue Feb 27 09:49:21 2007] [notice] child pid 25440 exit signal Aborted (6) [Tue Feb 27 09:49:21 2007] [notice] child pid 25442 exit signal Aborted (6) libgcc_s.so.1 must be installed for pthread_cancel to work [Tue Feb 27 09:49:23 2007] [notice] child pid 25497 exit signal Aborted (6) libgcc_s.so.1 must be installed for pthread_cancel to work [Tue Feb 27 09:49:25 2007] [notice] child pid 25525 exit signal Aborted (6) libgcc_s.so.1 must be installed for pthread_cancel to work Y se tira así todo el rato. Saludos.