2012
S F D 2012 @ HUS


Securing an Apache Web Server using
               Chroot

                                     Nguyễn Năng Thắng

               Fedora Ambassador Vietnam
  HN Community Space, HanoiLUG, Ubuntu-vn
    thangnguyennang1988 [at] gmail [dot] com
    This presentation is licensed under a Creative Commons   2
         Attribution-ShareAlike (CC-BY-SA) 3.0 license.
Chroot () environment
Chroot jail
Workshop




                        3
Chroot Environment




chroot () environment?




                         4
Chroot () Environment




                        5
Chroot Environment




  “chroot jail”?




                     6
Workshop




           7
Objectives
Building a chroot environment
Securing an Apache Web Server using chroot


Requirements
Server: Apache Web Server
Server OS: CentOS-5
Jail directory: chroot
                                         8
TODO

Step1. Create a jail directory
Step2. Install Apache
Step3. Install mod_chroot
Step4. Configure Apache mod_chroot
Step5. Disable SELinux
Step6. Patch up /etc/init.d/httpd
Step7. Start chrooted httpd
                                     9
Step1. Create a jail directory




                                 10
Step2. Install Apache




                        11
Install Apache
Install required packages
# httpd, httpd-devel, php ...
Create required directory
  /chroot/var/www/html
  /chroot/var/run
  /chroot/tmp
  /chroot/home/httpd
Notes
  /chroot/var/run: store PID ... (root.root)
  /chroot/tmp: used by many scripts ... (777/???)   12
Step3. Install mod_chroot



                            13
Install mod_chroot
The mod_chroot project
Download source code from the Internet
Untar the source code
 Using apxs to compile and install the source
code




                                                14
Step4. Configure Apache mod_chroot




                                15
Step5. Disable SELinux




                         16
Step6. Patch up /etc/init.d/httpd



                                    17
Step7. Start chrooted httpd



                              18
Thank you!



             19
Questions?



             20

Sfd2012Hanoi - Nguyễn Năng Thắng - Chroot with Apache