29.20. 测试新的chrooted jail

最后,我们必须测试 Apache Web Server 的新的 chrooted jail 配置。首先要做的是使用以下命令重新启动 syslogd 守护进程
        [root@deep ]/# /etc/rc.d/init.d/syslog restart
      

        Shutting down kernel logger:                               	[  OK  ]
        Shutting down system logger:                               	[  OK  ]
        Starting system logger:                                    	[  OK  ]
        Starting kernel logger:                                		[  OK  ]
      

现在,使用以下命令启动新的 chrooted jail Apache
        [root@deep ]/# /etc/rc.d/init.d/httpd start
      

        Starting httpd:                                            		[  OK  ]
      

如果没有出现任何错误,执行 ps ax | grep httpd 看看是否正在运行
        [root@deep ]/# ps ax | grep httpd
      

        14373 ?        S      0:00 httpd -DSSL
        14376 ?        S      0:00 httpd -DSSL
        14377 ?        S      0:00 httpd -DSSL
        14378 ?        S      0:00 httpd -DSSL
        14379 ?        S      0:00 httpd -DSSL
        14380 ?        S      0:00 httpd -DSSL
        14381 ?        S      0:00 httpd -DSSL
        14382 ?        S      0:00 httpd -DSSL
        14383 ?        S      0:00 httpd -DSSL
        14384 ?        S      0:00 httpd -DSSL
        14385 ?        S      0:00 httpd -DSSL
        14386 ?        S      0:00 httpd -DSSL
        14387 ?        S      0:00 httpd -DSSL
        14388 ?        S      0:00 httpd -DSSL
        14389 ?        S      0:00 httpd -DSSL
        14390 ?        S      0:00 httpd -DSSL
        14391 ?        S      0:00 httpd -DSSL
        14397 ?        S      0:00 httpd -DSSL
        14476 ?        S      0:00 httpd -DSSL
        14477 ?        S      0:00 httpd -DSSL
        14478 ?        S      0:00 httpd -DSSL
      

如果是,让我们通过选择它的一个进程号并执行以下命令来确保它已 chrootedls -la /proc/该进程号/root/.
        [root@deep ]/# ls -la /proc/14373/root/
      
如果看到

        dev
        etc
        home
        lib
        usr
        var
      
恭喜你!

如上所述,如果使用 Perl,您需要复制或硬链接任何系统库、perl 库/usr/lib/perl5和二进制文件到 chroot 区域。 SSLPHP、LDAP、PostgreSQL 和其他程序也适用。