SlideShare une entreprise Scribd logo
1  sur  102
Extreme security in
                                  web servers




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   1
Creative Commons License



The art of disguise - Anti-fingerprinting techniques
by Daniel García García a.k.a. cr0hn is licensed under a:

Creative Commons Reconocimiento-NoComercial-SinObraDerivada 3.0 Unported License.

Permissions beyond the scope of this license may be available at: dani@iniqua.com.




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   2
Acknowledgments
 •         Manuel Trujillo <TooManySecrets>

 •         Francisco Jesus Gomez Rodriguez (@ffranz)

 •         @capi_x <capi_x@haibane.org>

 •         Maikel Mayán <@AloneInTheShell>




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   3
About what is this talk?
 1. Infrastructure: virtualization vs physical.

 2. Choosing OS base: FreeBSD.

 3. Brief intro to configuration of FreeBSD.

 4. Isolating process.




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   4
1 - Infrastructure:
                  Virtualization vs physical



Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   5
1 – Infrastructure: Virtualization vs physical

        a) Virtualization advantages.

        b) Virtualization’s solutions.

        c) Why use server virtualization system?

        d) Organizing the virtual machines: approaches.




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   6
1.a - Virtualization advantages
 • Less physical space.

 • Less energy costs.

 • More use of resources.

 • Scalability.

 • Simplicity of administration.



Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   7
1.b - Virtualization solutions




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   8
1.c - Why use server virtualization system?
 •         Scalability

 •         Centralized storage system.

 •         Hot cloning.

 •         Hot migrating of machines.

 •         Modular architecture.

 •         Simplicity management.



Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   9
1.c - Why use server virtualization system?
Examples:

•   VMWare ESXi

•   Xen

•   Proxmox
1.d - Organizing the virtual machines: approaches

 I.         One machine for all.




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   11
1.d - Organizing the virtual machines: approaches

 II. Two machines: frontend and backend.




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   12
1.d - Organizing the virtual machines: approaches

 III. Multilevel:




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   13
2 – Choosing OS base:




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   14
2 – Choosing OS base: FreeBSD

        a) Why use FreeBSD?


        b) Who use FreeBSD?




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   15
2.a – Why use FreeBSD?
 • Simplicity of kernel.

 • Simplicity of re-compile all system.

 • Build-in security features.

 • Isolating features, like jails.

 • Administration simplicity.

 • Can run Linux binaries

Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   16
2.b – Who use FreeBSD?
 • JunOS
 • Citrix
 • Nokia’s firewalls
 • PlayStation 3
 • Netflix
 • Netcraft
 • Some parts of Apple OS X
 • …


Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   17
3 – Configuration of system




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   18
3 – Configuration of system.

 a) Adjust system binaries.


 b) Configuration files.


 c) Kernel and “user-land”.



Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   19
3.a – Adjust system binaries




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   20
I.              Install LLVM/clang
  Q: Why use LLVM/clang?
  A: Generate more optimized code than gcc.
  See a comparison:
  http://blog.buguroo.com/?tag=compilador-gcc-llvm-clang-benchmark&lang=en




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   21
II. Patch and reinstall OpenSSH
 Q: Why path openSSH?
 A: Patch to evade fingerprinting techniques.
 See how to path it in:
 http://www.slideshare.net/cr0hn/the-art-of-disguise-antifingerprinting-techniques




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   22
3.b – Configuration files.




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   23
I.               /etc/src.conf




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   24
II. /etc/auth.conf




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   25
III. /etc/login.conf




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   26
IV. /etc/sysctl.conf




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   27
V. /etc/make.conf
                                                                                              Difficult the of
                                                                                                execution
                                                                                                  exploits




                                                                                                     Prevent
                                                                                                     hooking




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel                      28
VI. /etc/rc.conf




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   29
3.c – Kernel and “user-land”



Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   30
I.              Update system source
 • First, we need cvsup tool.



 • Configure our repository config file:




 • Update system source (also include kernel).




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   31
II. Configure kernel
 • Configuration file:




 • Adjust some basic parameters:




            Only if you don’t need fat/vfat support!
Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   32
III. Compile the kernel
                                                                                        Our kernel
                                                                                     configuration file




                Enable LLVM static
                    analyzer




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel               33
IIII. The “user-land”
 Q: What’s “user-land”?
 A: The user-land is a way to naming all basic
   binaries and programs of system, like: syslog,
   common commands (sed, awk, sort…), gcc,
   clang…

 Q: How configure the “user-land”?
 A: You can customize what include the user-land
   with the file: “/etc/src.conf”
Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   34
IIII. Recompile the user-land
                     Delete old compiled objects


                                      Make erasable all files




                                                   Enable static
                                               optimizations of LLVM



Daniel García García a.k.a cr0hn (@ggdaniel)       http://es.linkedin.com/in/garciagarciadaniel   35
4 – Isolating processes




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   36
4 – Isolating process
 a) Concept of jail.

 b) How to create basic a jail?.

 c) Maintainable jail system.

 d) Jail deploy: Approaches.

 e) How deploy a web site using jails.

Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   37
4.a – Concept of jail
                                                  Jail ≠ chroot

                                                                  Jail
                                 chroot                             rules                          Resources




                                               Network                                     tools




Daniel García García a.k.a cr0hn (@ggdaniel)       http://es.linkedin.com/in/garciagarciadaniel                38
4.a – Concept of jail.

               Jail: Operating system level virtualization




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   39
4.b – How to create a basic jail
                         Hand to work!




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   40
I. – Compilation variables
 When can you use compilation variables?

 • When compiling a port.

 • When compiling the kernel.

 • When compiling the user-land.




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   41
I. – Compilation variables
 • FORCE_PKG_REGISTER: Force reinstallation, if binary
       is already installed.

 • PORT_DBDIR: location of database that manager
       what’s binaries are installed.

 • PREFIX: destination of compiled binaries.

 • DESTDIR: makes a chroot to indicated path, and
       install binaries in it.

Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   42
II. – Create a jail
 1. Creating root folder for our jail:

 2. Copying common system binaries:

 3. Copying system source code:                                                               Special command
                                                                                               that copy files,
                                                                                                permissions,
 4. Installing port system into jail:                                                         hadlinks, softlinks,
                                                                                                     etc


 5. Copying missing system configuration files:


Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel                  43
II. – Create a jail
 •         Add to host /etc/rc.conf:




                                            To allow to jail to access to outside of jail network,
                                           each jail must have an alias and the same IP of alias.
 •         Manually start jail system:

Daniel García García a.k.a cr0hn (@ggdaniel)        http://es.linkedin.com/in/garciagarciadaniel     44
II. – Create a jail
 •         Add to jail /home/j/test_jail/etc/rc.conf:




                                    This line allow to the jail outside connectivity




Daniel García García a.k.a cr0hn (@ggdaniel)      http://es.linkedin.com/in/garciagarciadaniel   45
III. – Installation of programs
 Installing nginx server into jail:




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   46
4.c – Maintainable Jail system




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   47
4.c – Maintainable Jail system
 I. Separating roles

 II. Block diagram

 III. Advantages

 IV. Real example: role separated web server


Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   48
I. – Separating roles

                                                  Isolated
                                                   system

Shared base                                                                                    Shared
                                               Skeletons
  binaries                                                                                    programs


Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel          49
I. – Separating roles
 Q: What’s shared base binaries?
 A: The user-land binaries. All jails have this in common.

 Q: What’s Skeletons?
 A: Collection of configuration files tuned for an specific
    task. We have one skel for each role: webservers,
    database servers, php, java… Also mush be called
    templates

 Q: What’s shared programs?
 A: Any program you want to run: apache, mysql, etc

Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   50
I. – Separating roles
 In other words…                                                                  Shared base binaries


                                                     Common commands:                             Resulting jail. E.g. ->
                                                     ls, sed, awk, sort,                          an jailed apache
                                                     uniq…                                        web server.




                                     Custom config files:
                                     - /etc/rc.conf                               Shared programs:
                                     -/etc/make.conf                              Apache, mysql,
                                     -/etc/pf.conf                                php…
                                     -….

                                                                                                 Shared programs
                             Skeletons
Daniel García García a.k.a cr0hn (@ggdaniel)      http://es.linkedin.com/in/garciagarciadaniel                       51
II. – Block diagram




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   52
III. – Advantages
Q: Why is maintainable jail system?
A: Because all binaries are shared between all virtual
   machines and jails in a shared storage.

Q: Why use skel templates?
A: Then you can deploy new jail only copying a template.
   i.e: copying skel of a web server.

Q: How can I update the system and/or any binary?
A: You only must update shared binaries folder and/or
   shared binaries folder. Updates will spread to all jails.
IV. – Role separated web server
 a) Create folders for each type of role

 b) Create shared base binaries container

 c) Create base skeleton

 d) Create shared web server

 e) Mount the jail

 f) Start the jail


Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   54
a) Create folders for each type of role
 • Skeletons:


 • Shared base binaries:


 • Shared binaries:

 • Mounted jails:
                                                                                   Working directory for a
                                                                                   concrete jail.


Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel                  55
b) Create shared base binaries container




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   56
c) Create base skeleton




                                          Move configuration and
                                             non-shared info
                                                 to skel

Daniel García García a.k.a cr0hn (@ggdaniel)       http://es.linkedin.com/in/garciagarciadaniel   57
c) Create base skeleton
                      Copy missing configuration files                                      Not necessary for a template




                                               Make relative links to
                                               essential directories

Daniel García García a.k.a cr0hn (@ggdaniel)            http://es.linkedin.com/in/garciagarciadaniel                       58
c) Create base skeleton

 Copy hardened configuration files, following
 steps of point 3.b, at jail:
        •         src.conf
        •         auth.conf
        •         login.conf
        •         make.conf
        •         sysctl.conf



Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   59
d) Create shared web server
 1. Create directory for binary:



 2. Install nginx, and all dependences, into folder:




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   60
e) Mount the jail                                                    Concrete skeleton of web server


 • Create mounting folder for our web server:
                                                                                          Common and
                                                                                         shared binaries

 • Like a puzzle, join roles in /etc/fstab:


 • Add jail to /etc/rc.conf of host:
                                                                                                           Shared of
                                                                                                              web
                                                                                                             server
                                                                                                            binaries


Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel                            61
f) Start the jail
 And the end, we start the jail system typing:




 Or, if is already started…




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   62
4.d – Jail deploys:
                                     Approaches




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   63
4.d – Jail deploys: Approaches

 a) Simple architecture I

 b) Simple architecture II

 c) Equilibrated architecture.

 d) Complex architecture.

Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   64
Deploy approaches
                                                              Maintainability                  Security level

a) Simple architecture II


b) Simple architecture II


c) Equilibrated architecture


d) Complex architecture:

 Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel                    65
a) Simple architecture I




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   66
a) Simple architecture I
 • One machine for all services.
 • Shared programs: nginx, php, MySQL,
   pureFTPd…
 • Separated type of storages: DB/web content.
 • Isolated communications between jails.
 • Isolated php runtime environment for each
   web site.
 • Shared web and ftp servers for all web sites.
Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   67
a) Simple architecture II




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   68
a) Simple architecture II
 •     One machine for all services.
 •     Shared programs: nginx, php, MySQL, pureFTPd…
 •     Separated type of storages: DB/web content.
 •     Isolated communications between jails.
 •     Isolated php runtime environment for each web site.
 •     Shared ftp servers for all web sites.
 • Isolated web server for each web site.

                                               Like Simple architecture I


Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   69
b) Equilibrated architecture




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   70
b) Equilibrated architecture
 • Separated backend and frontend in two virtual
   machines.
 • Shared programs in network storage: nginx,
   php, MySQL, pureFTPd…
 • Isolated communications between jails.
 • Isolated php runtime environment for each
   web site.
 • Shared ftp servers for all web sites.

Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   71
c) Complex architecture




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   72
c) Complex architecture
 • 3 level in 3 virtual machines: load balancer,
   business layer and backend.
 • Separated storage out ouf virtualization
   server.
 • Isolated communications between jails.
 • Isolated php runtime environment for each
   web site.
 • Isolated web server for each web site.
 • Shared ftp servers for all web sites.

Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   73
4.d – Deploying a web site using jails
                           Example: Deploy the WordPress Site
                              www.mytestsite.com




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   74
4.d – Deploy a web site using jails
 I.               Select a deploy model
 II.              Create system binaries
 III.             Create binaries
 IV.              Create user content info
 V.               Create mounting folder
 VI.              Configure PHP
 VII.             Configure web server
 VIII.            Create PHP for site
 IX.              Create web server for site
 X.               Create FTP server
 XI.              Create web balancer
 XII.             Create MySQL server
 XIII.            Install WordPress
 XIV.             Configure jail and enable jail.


Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   75
I. – Select deploy model
 This example follows mentioned model:
 Simple architecture II




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   76
II. – Create system binaries




                                 System binaries folder. Shared
                                          for all jails




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   77
III. – Create binaries
 • Install php                                                                                Don’t forget
                                                                                                compile it
                                                                                               without CLI
                                                                                                 option!
                                                                                              (for security)

 • Install mysql


 • Install nginx


 • Install ftp

Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel             78
IV. – Create user content info
 Directories that will contain site info.




                                                                                              For future
                                                                                                 use




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel                79
V. – Create mounting folder
 1. Create mount point directory:



 2. Create root directories:




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   80
VI. – Configure php
• Modifying: /php/mytestsite.com/conf/php-fpm.ini




 Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   81
VI. – Configure php
• Modifying:
  /home/js/mytestsite.com-php/usr/local/etc/php-fpm.conf




 Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   82
VII. – Configure web server
• Configuring: /home/j/mytestsite.com/usr/local/etc/nginx/nginx.conf




 Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   83
VIII. – Create PHP for site
• Create base folder and copy skeleton (or profile) for
  web server



• Create mount point for each site of isolated php server.

• Create mount point web content.



Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   84
VIII. – Create PHP for site

 • Configuration of init script for web server jail:
       /home/j/mytestsite.com-php/etc/rc.conf




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   85
IX. – Create web server for site
• Create base folder and copy skeleton (or profile) for
  web server



• Create mount point for each site of isolated web server.

• Create mount point web content.



Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   86
IX. – Create web server for site

 • Configuration of init script for web server jail:
       /home/j/mytestsite.com-wserver/etc/rc.conf




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   87
X. – Create FTP server
• Create base folder and copy skeleton (or profile) for FTP
  server


• Create mount point of FTP isolated server.


• Create mount point for web content.



 Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   88
X. – Create FTP server

 • Configuration of init script for FTP server jail:
       /home/j/ftpserver/etc/rc.conf




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   89
X. – Create FTP server

• Configuring: /home/j/ftpserver/usr/local/etc/pure-ftpd.conf




                           There is more configuration parameters, but this is the
                                              most important.



 Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   90
XI. – Create web balancer
• Create base folder and copy skeleton (or profile) for
  web balancer:



• Create mount point of web balancer isolated server.




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   91
XI. – Create web balancer

 • Configuration of init script for web balancer jail:
       /home/j/webbalancer/etc/rc.conf




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   92
XI. – Create web balancer

• Configuring: /home/j/webbalancer/usr/local/etc/nginx/nginx.conf




                                     Redirect to web server of isolated web site.



 Daniel García García a.k.a cr0hn (@ggdaniel)     http://es.linkedin.com/in/garciagarciadaniel   93
XII. – Create MySQL server
• Create base folder and copy skeleton (or profile) for
  mysql server:



• Create mount point of mysql isolated server.




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   94
XII. – Create MySQL server
 • Configuration of init script for web server jail:
       /home/j/mysql/etc/rc.conf




                          Change listen address.



Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   95
XIII. – Install WordPress
• Install WordPress from FreeBSD sources, into host
  system.

                                                                                          This method allows us to
                                                                                            easily install our own
                                                                                                   patches.

• Copy sources to our site:




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel                          96
XIII. – Install wordpress

• Configure our WordPress installation defining location
  of MySQL.


                                                                                              IP of our jail
                                                                                              with MySQL




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel                    97
XIV. – Configure and enable de jail
 Configure /etc/fstab.




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   98
XIV. – Configure and enable de jail
 Configure /etc/fstab (cont).




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   99
XIV. – Configure and enable de jail
 Enable jail in the system /etc/rc.conf:




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   100
XIV. – Configure and enable de jail
 Enable jail in the system /etc/rc.conf (cont):




Daniel García García a.k.a cr0hn (@ggdaniel)   http://es.linkedin.com/in/garciagarciadaniel   101
Questions?




Daniel García García a.k.a cr0hn (@ggdaniel)    http://es.linkedin.com/in/garciagarciadaniel   102

Contenu connexe

En vedette

Scapy: Crear un Frankenstein de red y hacerlo pasar por el príncipe azul
Scapy: Crear un Frankenstein de red y hacerlo pasar por el príncipe azulScapy: Crear un Frankenstein de red y hacerlo pasar por el príncipe azul
Scapy: Crear un Frankenstein de red y hacerlo pasar por el príncipe azulDaniel Garcia (a.k.a cr0hn)
 
Cisco Study: State of Web Security
Cisco Study: State of Web Security Cisco Study: State of Web Security
Cisco Study: State of Web Security Cisco Canada
 
Cybercamp 2015 - Python, hacking y sec-tools desde las trincheras
Cybercamp 2015 - Python, hacking y sec-tools desde las trincherasCybercamp 2015 - Python, hacking y sec-tools desde las trincheras
Cybercamp 2015 - Python, hacking y sec-tools desde las trincherasDaniel Garcia (a.k.a cr0hn)
 
Evolution Of Web Security
Evolution Of Web SecurityEvolution Of Web Security
Evolution Of Web SecurityChris Shiflett
 
Identificando y rompiendo servicios de las 4 capas de TCP/IP
Identificando y rompiendo servicios de las 4 capas de TCP/IPIdentificando y rompiendo servicios de las 4 capas de TCP/IP
Identificando y rompiendo servicios de las 4 capas de TCP/IPDaniel Garcia (a.k.a cr0hn)
 
Modern Web Security
Modern Web SecurityModern Web Security
Modern Web SecurityBill Condo
 
Top 10 Web App Security Risks
Top 10 Web App Security RisksTop 10 Web App Security Risks
Top 10 Web App Security RisksSperasoft
 
El poder de los reptiles: Hacer herramientas de hacking es fácil
El poder de los reptiles: Hacer herramientas de hacking es fácilEl poder de los reptiles: Hacer herramientas de hacking es fácil
El poder de los reptiles: Hacer herramientas de hacking es fácilDaniel Garcia (a.k.a cr0hn)
 
Introduction to Web security
Introduction to Web securityIntroduction to Web security
Introduction to Web securityjeyaselvir
 
Qué es el fingerprinting: Definición, peligros y medidas mitigadoras
Qué es el fingerprinting: Definición, peligros y medidas mitigadorasQué es el fingerprinting: Definición, peligros y medidas mitigadoras
Qué es el fingerprinting: Definición, peligros y medidas mitigadorasDaniel Garcia (a.k.a cr0hn)
 
Web Server Web Site Security
Web Server Web Site SecurityWeb Server Web Site Security
Web Server Web Site SecuritySteven Cahill
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application SecurityYnon Perek
 
DrupalCamp London 2017 - Web site insecurity
DrupalCamp London 2017 - Web site insecurity DrupalCamp London 2017 - Web site insecurity
DrupalCamp London 2017 - Web site insecurity George Boobyer
 

En vedette (20)

Topera: Evadiendo Snort con IPv6
Topera: Evadiendo Snort con IPv6Topera: Evadiendo Snort con IPv6
Topera: Evadiendo Snort con IPv6
 
Introduccion muy básica a Python
Introduccion muy básica a PythonIntroduccion muy básica a Python
Introduccion muy básica a Python
 
Scapy: Crear un Frankenstein de red y hacerlo pasar por el príncipe azul
Scapy: Crear un Frankenstein de red y hacerlo pasar por el príncipe azulScapy: Crear un Frankenstein de red y hacerlo pasar por el príncipe azul
Scapy: Crear un Frankenstein de red y hacerlo pasar por el príncipe azul
 
Web Security
Web SecurityWeb Security
Web Security
 
Cisco Study: State of Web Security
Cisco Study: State of Web Security Cisco Study: State of Web Security
Cisco Study: State of Web Security
 
Cybercamp 2015 - Python, hacking y sec-tools desde las trincheras
Cybercamp 2015 - Python, hacking y sec-tools desde las trincherasCybercamp 2015 - Python, hacking y sec-tools desde las trincheras
Cybercamp 2015 - Python, hacking y sec-tools desde las trincheras
 
Evolution Of Web Security
Evolution Of Web SecurityEvolution Of Web Security
Evolution Of Web Security
 
Identificando y rompiendo servicios de las 4 capas de TCP/IP
Identificando y rompiendo servicios de las 4 capas de TCP/IPIdentificando y rompiendo servicios de las 4 capas de TCP/IP
Identificando y rompiendo servicios de las 4 capas de TCP/IP
 
Modern Web Security
Modern Web SecurityModern Web Security
Modern Web Security
 
Hacking y python: Hacking de redes con Python
Hacking y python: Hacking de redes con PythonHacking y python: Hacking de redes con Python
Hacking y python: Hacking de redes con Python
 
Top 10 Web App Security Risks
Top 10 Web App Security RisksTop 10 Web App Security Risks
Top 10 Web App Security Risks
 
El poder de los reptiles: Hacer herramientas de hacking es fácil
El poder de los reptiles: Hacer herramientas de hacking es fácilEl poder de los reptiles: Hacer herramientas de hacking es fácil
El poder de los reptiles: Hacer herramientas de hacking es fácil
 
Security in NodeJS applications
Security in NodeJS applicationsSecurity in NodeJS applications
Security in NodeJS applications
 
RootedCON 2016 - Broker & MQ injection
RootedCON 2016 - Broker & MQ injectionRootedCON 2016 - Broker & MQ injection
RootedCON 2016 - Broker & MQ injection
 
Introduction to Web security
Introduction to Web securityIntroduction to Web security
Introduction to Web security
 
Web security
Web securityWeb security
Web security
 
Qué es el fingerprinting: Definición, peligros y medidas mitigadoras
Qué es el fingerprinting: Definición, peligros y medidas mitigadorasQué es el fingerprinting: Definición, peligros y medidas mitigadoras
Qué es el fingerprinting: Definición, peligros y medidas mitigadoras
 
Web Server Web Site Security
Web Server Web Site SecurityWeb Server Web Site Security
Web Server Web Site Security
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application Security
 
DrupalCamp London 2017 - Web site insecurity
DrupalCamp London 2017 - Web site insecurity DrupalCamp London 2017 - Web site insecurity
DrupalCamp London 2017 - Web site insecurity
 

Similaire à Extreme security in web servers

Puppet and your Metadata - PuppetCamp London 2015
Puppet and your Metadata - PuppetCamp London 2015Puppet and your Metadata - PuppetCamp London 2015
Puppet and your Metadata - PuppetCamp London 2015Marc Cluet
 
Securing the Socks Shop
Securing the Socks ShopSecuring the Socks Shop
Securing the Socks ShopJason Smith
 
Undefined Behavior and Compiler Optimizations (NDC Oslo 2018)
Undefined Behavior and Compiler Optimizations (NDC Oslo 2018)Undefined Behavior and Compiler Optimizations (NDC Oslo 2018)
Undefined Behavior and Compiler Optimizations (NDC Oslo 2018)Patricia Aas
 
Operating Docker
Operating DockerOperating Docker
Operating DockerJen Andre
 
#Interactive Session by Kirti Ranjan Satapathy and Nandini K, "Elements of Qu...
#Interactive Session by Kirti Ranjan Satapathy and Nandini K, "Elements of Qu...#Interactive Session by Kirti Ranjan Satapathy and Nandini K, "Elements of Qu...
#Interactive Session by Kirti Ranjan Satapathy and Nandini K, "Elements of Qu...Agile Testing Alliance
 
Creating Developer-Friendly Docker Containers with Chaperone
Creating Developer-Friendly Docker Containers with ChaperoneCreating Developer-Friendly Docker Containers with Chaperone
Creating Developer-Friendly Docker Containers with ChaperoneGary Wisniewski
 
Finding target for hacking on internet is now easier
Finding target for hacking on internet is now easierFinding target for hacking on internet is now easier
Finding target for hacking on internet is now easierDavid Thomas
 
Microsoft Power Point Best Practices For Scaling Heavily Adopted And Concur...
Microsoft Power Point   Best Practices For Scaling Heavily Adopted And Concur...Microsoft Power Point   Best Practices For Scaling Heavily Adopted And Concur...
Microsoft Power Point Best Practices For Scaling Heavily Adopted And Concur...Steve Feldman
 
Introduction to Big Data & Hadoop
Introduction to Big Data & Hadoop Introduction to Big Data & Hadoop
Introduction to Big Data & Hadoop iACT Global
 
DECK36 - Log everything! and Realtime Datastream Analytics with Storm
DECK36 - Log everything! and Realtime Datastream Analytics with StormDECK36 - Log everything! and Realtime Datastream Analytics with Storm
DECK36 - Log everything! and Realtime Datastream Analytics with StormMike Lohmann
 
MNSEC Conference 2023: Mining Bots
MNSEC Conference 2023: Mining BotsMNSEC Conference 2023: Mining Bots
MNSEC Conference 2023: Mining BotsAPNIC
 
Freeing the cloud, one service at a time
Freeing the cloud, one service at a timeFreeing the cloud, one service at a time
Freeing the cloud, one service at a timeFrancois Marier
 
Cassandra summit-2013
Cassandra summit-2013Cassandra summit-2013
Cassandra summit-2013dfilppi
 
idsecconf2023 - Satria Ady Pradana - Launch into the Stratus-phere Adversary ...
idsecconf2023 - Satria Ady Pradana - Launch into the Stratus-phere Adversary ...idsecconf2023 - Satria Ady Pradana - Launch into the Stratus-phere Adversary ...
idsecconf2023 - Satria Ady Pradana - Launch into the Stratus-phere Adversary ...idsecconf
 
Building Web Mobile App that don’t suck - FITC Web Unleashed - 2014-09-18
Building Web Mobile App that don’t suck - FITC Web Unleashed - 2014-09-18Building Web Mobile App that don’t suck - FITC Web Unleashed - 2014-09-18
Building Web Mobile App that don’t suck - FITC Web Unleashed - 2014-09-18Frédéric Harper
 
mago3D Technical Workshop Material
mago3D Technical Workshop Material mago3D Technical Workshop Material
mago3D Technical Workshop Material SANGHEE SHIN
 
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?ArangoDB Database
 
Secure container: Kata container and gVisor
Secure container: Kata container and gVisorSecure container: Kata container and gVisor
Secure container: Kata container and gVisorChing-Hsuan Yen
 

Similaire à Extreme security in web servers (20)

Secure your site
Secure your siteSecure your site
Secure your site
 
Puppet and your Metadata - PuppetCamp London 2015
Puppet and your Metadata - PuppetCamp London 2015Puppet and your Metadata - PuppetCamp London 2015
Puppet and your Metadata - PuppetCamp London 2015
 
Securing the Socks Shop
Securing the Socks ShopSecuring the Socks Shop
Securing the Socks Shop
 
Undefined Behavior and Compiler Optimizations (NDC Oslo 2018)
Undefined Behavior and Compiler Optimizations (NDC Oslo 2018)Undefined Behavior and Compiler Optimizations (NDC Oslo 2018)
Undefined Behavior and Compiler Optimizations (NDC Oslo 2018)
 
Operating Docker
Operating DockerOperating Docker
Operating Docker
 
#Interactive Session by Kirti Ranjan Satapathy and Nandini K, "Elements of Qu...
#Interactive Session by Kirti Ranjan Satapathy and Nandini K, "Elements of Qu...#Interactive Session by Kirti Ranjan Satapathy and Nandini K, "Elements of Qu...
#Interactive Session by Kirti Ranjan Satapathy and Nandini K, "Elements of Qu...
 
Creating Developer-Friendly Docker Containers with Chaperone
Creating Developer-Friendly Docker Containers with ChaperoneCreating Developer-Friendly Docker Containers with Chaperone
Creating Developer-Friendly Docker Containers with Chaperone
 
Finding target for hacking on internet is now easier
Finding target for hacking on internet is now easierFinding target for hacking on internet is now easier
Finding target for hacking on internet is now easier
 
Microsoft Power Point Best Practices For Scaling Heavily Adopted And Concur...
Microsoft Power Point   Best Practices For Scaling Heavily Adopted And Concur...Microsoft Power Point   Best Practices For Scaling Heavily Adopted And Concur...
Microsoft Power Point Best Practices For Scaling Heavily Adopted And Concur...
 
Introduction to Big Data & Hadoop
Introduction to Big Data & Hadoop Introduction to Big Data & Hadoop
Introduction to Big Data & Hadoop
 
DECK36 - Log everything! and Realtime Datastream Analytics with Storm
DECK36 - Log everything! and Realtime Datastream Analytics with StormDECK36 - Log everything! and Realtime Datastream Analytics with Storm
DECK36 - Log everything! and Realtime Datastream Analytics with Storm
 
MNSEC Conference 2023: Mining Bots
MNSEC Conference 2023: Mining BotsMNSEC Conference 2023: Mining Bots
MNSEC Conference 2023: Mining Bots
 
Freeing the cloud, one service at a time
Freeing the cloud, one service at a timeFreeing the cloud, one service at a time
Freeing the cloud, one service at a time
 
Encode
EncodeEncode
Encode
 
Cassandra summit-2013
Cassandra summit-2013Cassandra summit-2013
Cassandra summit-2013
 
idsecconf2023 - Satria Ady Pradana - Launch into the Stratus-phere Adversary ...
idsecconf2023 - Satria Ady Pradana - Launch into the Stratus-phere Adversary ...idsecconf2023 - Satria Ady Pradana - Launch into the Stratus-phere Adversary ...
idsecconf2023 - Satria Ady Pradana - Launch into the Stratus-phere Adversary ...
 
Building Web Mobile App that don’t suck - FITC Web Unleashed - 2014-09-18
Building Web Mobile App that don’t suck - FITC Web Unleashed - 2014-09-18Building Web Mobile App that don’t suck - FITC Web Unleashed - 2014-09-18
Building Web Mobile App that don’t suck - FITC Web Unleashed - 2014-09-18
 
mago3D Technical Workshop Material
mago3D Technical Workshop Material mago3D Technical Workshop Material
mago3D Technical Workshop Material
 
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
 
Secure container: Kata container and gVisor
Secure container: Kata container and gVisorSecure container: Kata container and gVisor
Secure container: Kata container and gVisor
 

Plus de Daniel Garcia (a.k.a cr0hn)

Rooted con 2020 - from the heaven to hell in the CI - CD
Rooted con 2020 - from the heaven to hell in the CI - CDRooted con 2020 - from the heaven to hell in the CI - CD
Rooted con 2020 - from the heaven to hell in the CI - CDDaniel Garcia (a.k.a cr0hn)
 
Rooted 2018 - Crawlino: The next level of crawling systems
Rooted 2018 - Crawlino: The next level of crawling systemsRooted 2018 - Crawlino: The next level of crawling systems
Rooted 2018 - Crawlino: The next level of crawling systemsDaniel Garcia (a.k.a cr0hn)
 
Ingenieria social aplicada: Mucho mas fácil de lo que parece
Ingenieria social aplicada: Mucho mas fácil de lo que pareceIngenieria social aplicada: Mucho mas fácil de lo que parece
Ingenieria social aplicada: Mucho mas fácil de lo que pareceDaniel Garcia (a.k.a cr0hn)
 
Ingeniería social aplicada: Mucho más fácil de lo que parece
Ingeniería social aplicada: Mucho más fácil de lo que pareceIngeniería social aplicada: Mucho más fácil de lo que parece
Ingeniería social aplicada: Mucho más fácil de lo que pareceDaniel Garcia (a.k.a cr0hn)
 
RootedCON 2017 - Docker might not be your friend. Trojanizing Docker images
RootedCON 2017 - Docker might not be your friend. Trojanizing Docker imagesRootedCON 2017 - Docker might not be your friend. Trojanizing Docker images
RootedCON 2017 - Docker might not be your friend. Trojanizing Docker imagesDaniel Garcia (a.k.a cr0hn)
 
Tu DevOp me da trabajo: Soy auditor de seguridad
Tu DevOp me da trabajo: Soy auditor de seguridadTu DevOp me da trabajo: Soy auditor de seguridad
Tu DevOp me da trabajo: Soy auditor de seguridadDaniel Garcia (a.k.a cr0hn)
 
III Hack and beers: evadiendo técnicas de fingerprinting en Linux y Wordpress
III Hack and beers: evadiendo técnicas de fingerprinting en Linux y WordpressIII Hack and beers: evadiendo técnicas de fingerprinting en Linux y Wordpress
III Hack and beers: evadiendo técnicas de fingerprinting en Linux y WordpressDaniel Garcia (a.k.a cr0hn)
 

Plus de Daniel Garcia (a.k.a cr0hn) (11)

Sonatype DevSecOps Leadership forum 2020
Sonatype DevSecOps Leadership forum 2020Sonatype DevSecOps Leadership forum 2020
Sonatype DevSecOps Leadership forum 2020
 
Rooted con 2020 - from the heaven to hell in the CI - CD
Rooted con 2020 - from the heaven to hell in the CI - CDRooted con 2020 - from the heaven to hell in the CI - CD
Rooted con 2020 - from the heaven to hell in the CI - CD
 
12 tricks to avoid hackers breaks your CI / CD
12 tricks to avoid hackers breaks your  CI / CD12 tricks to avoid hackers breaks your  CI / CD
12 tricks to avoid hackers breaks your CI / CD
 
Security in AWS Lambdas - NavajaNegra CON 2018
Security in AWS Lambdas - NavajaNegra CON 2018Security in AWS Lambdas - NavajaNegra CON 2018
Security in AWS Lambdas - NavajaNegra CON 2018
 
Rooted 2018 - Crawlino: The next level of crawling systems
Rooted 2018 - Crawlino: The next level of crawling systemsRooted 2018 - Crawlino: The next level of crawling systems
Rooted 2018 - Crawlino: The next level of crawling systems
 
Ingenieria social aplicada: Mucho mas fácil de lo que parece
Ingenieria social aplicada: Mucho mas fácil de lo que pareceIngenieria social aplicada: Mucho mas fácil de lo que parece
Ingenieria social aplicada: Mucho mas fácil de lo que parece
 
Ingeniería social aplicada: Mucho más fácil de lo que parece
Ingeniería social aplicada: Mucho más fácil de lo que pareceIngeniería social aplicada: Mucho más fácil de lo que parece
Ingeniería social aplicada: Mucho más fácil de lo que parece
 
RootedCON 2017 - Docker might not be your friend. Trojanizing Docker images
RootedCON 2017 - Docker might not be your friend. Trojanizing Docker imagesRootedCON 2017 - Docker might not be your friend. Trojanizing Docker images
RootedCON 2017 - Docker might not be your friend. Trojanizing Docker images
 
Tu DevOp me da trabajo: Soy auditor de seguridad
Tu DevOp me da trabajo: Soy auditor de seguridadTu DevOp me da trabajo: Soy auditor de seguridad
Tu DevOp me da trabajo: Soy auditor de seguridad
 
III Hack and beers: evadiendo técnicas de fingerprinting en Linux y Wordpress
III Hack and beers: evadiendo técnicas de fingerprinting en Linux y WordpressIII Hack and beers: evadiendo técnicas de fingerprinting en Linux y Wordpress
III Hack and beers: evadiendo técnicas de fingerprinting en Linux y Wordpress
 
GoLismero: The Web Knife
GoLismero: The Web KnifeGoLismero: The Web Knife
GoLismero: The Web Knife
 

Dernier

Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 

Dernier (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

Extreme security in web servers

  • 1. Extreme security in web servers Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 1
  • 2. Creative Commons License The art of disguise - Anti-fingerprinting techniques by Daniel García García a.k.a. cr0hn is licensed under a: Creative Commons Reconocimiento-NoComercial-SinObraDerivada 3.0 Unported License. Permissions beyond the scope of this license may be available at: dani@iniqua.com. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 2
  • 3. Acknowledgments • Manuel Trujillo <TooManySecrets> • Francisco Jesus Gomez Rodriguez (@ffranz) • @capi_x <capi_x@haibane.org> • Maikel Mayán <@AloneInTheShell> Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 3
  • 4. About what is this talk? 1. Infrastructure: virtualization vs physical. 2. Choosing OS base: FreeBSD. 3. Brief intro to configuration of FreeBSD. 4. Isolating process. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 4
  • 5. 1 - Infrastructure: Virtualization vs physical Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 5
  • 6. 1 – Infrastructure: Virtualization vs physical a) Virtualization advantages. b) Virtualization’s solutions. c) Why use server virtualization system? d) Organizing the virtual machines: approaches. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 6
  • 7. 1.a - Virtualization advantages • Less physical space. • Less energy costs. • More use of resources. • Scalability. • Simplicity of administration. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 7
  • 8. 1.b - Virtualization solutions Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 8
  • 9. 1.c - Why use server virtualization system? • Scalability • Centralized storage system. • Hot cloning. • Hot migrating of machines. • Modular architecture. • Simplicity management. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 9
  • 10. 1.c - Why use server virtualization system? Examples: • VMWare ESXi • Xen • Proxmox
  • 11. 1.d - Organizing the virtual machines: approaches I. One machine for all. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 11
  • 12. 1.d - Organizing the virtual machines: approaches II. Two machines: frontend and backend. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 12
  • 13. 1.d - Organizing the virtual machines: approaches III. Multilevel: Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 13
  • 14. 2 – Choosing OS base: Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 14
  • 15. 2 – Choosing OS base: FreeBSD a) Why use FreeBSD? b) Who use FreeBSD? Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 15
  • 16. 2.a – Why use FreeBSD? • Simplicity of kernel. • Simplicity of re-compile all system. • Build-in security features. • Isolating features, like jails. • Administration simplicity. • Can run Linux binaries Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 16
  • 17. 2.b – Who use FreeBSD? • JunOS • Citrix • Nokia’s firewalls • PlayStation 3 • Netflix • Netcraft • Some parts of Apple OS X • … Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 17
  • 18. 3 – Configuration of system Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 18
  • 19. 3 – Configuration of system. a) Adjust system binaries. b) Configuration files. c) Kernel and “user-land”. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 19
  • 20. 3.a – Adjust system binaries Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 20
  • 21. I. Install LLVM/clang Q: Why use LLVM/clang? A: Generate more optimized code than gcc. See a comparison: http://blog.buguroo.com/?tag=compilador-gcc-llvm-clang-benchmark&lang=en Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 21
  • 22. II. Patch and reinstall OpenSSH Q: Why path openSSH? A: Patch to evade fingerprinting techniques. See how to path it in: http://www.slideshare.net/cr0hn/the-art-of-disguise-antifingerprinting-techniques Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 22
  • 23. 3.b – Configuration files. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 23
  • 24. I. /etc/src.conf Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 24
  • 25. II. /etc/auth.conf Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 25
  • 26. III. /etc/login.conf Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 26
  • 27. IV. /etc/sysctl.conf Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 27
  • 28. V. /etc/make.conf Difficult the of execution exploits Prevent hooking Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 28
  • 29. VI. /etc/rc.conf Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 29
  • 30. 3.c – Kernel and “user-land” Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 30
  • 31. I. Update system source • First, we need cvsup tool. • Configure our repository config file: • Update system source (also include kernel). Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 31
  • 32. II. Configure kernel • Configuration file: • Adjust some basic parameters: Only if you don’t need fat/vfat support! Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 32
  • 33. III. Compile the kernel Our kernel configuration file Enable LLVM static analyzer Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 33
  • 34. IIII. The “user-land” Q: What’s “user-land”? A: The user-land is a way to naming all basic binaries and programs of system, like: syslog, common commands (sed, awk, sort…), gcc, clang… Q: How configure the “user-land”? A: You can customize what include the user-land with the file: “/etc/src.conf” Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 34
  • 35. IIII. Recompile the user-land Delete old compiled objects Make erasable all files Enable static optimizations of LLVM Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 35
  • 36. 4 – Isolating processes Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 36
  • 37. 4 – Isolating process a) Concept of jail. b) How to create basic a jail?. c) Maintainable jail system. d) Jail deploy: Approaches. e) How deploy a web site using jails. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 37
  • 38. 4.a – Concept of jail Jail ≠ chroot Jail chroot rules Resources Network tools Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 38
  • 39. 4.a – Concept of jail. Jail: Operating system level virtualization Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 39
  • 40. 4.b – How to create a basic jail Hand to work! Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 40
  • 41. I. – Compilation variables When can you use compilation variables? • When compiling a port. • When compiling the kernel. • When compiling the user-land. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 41
  • 42. I. – Compilation variables • FORCE_PKG_REGISTER: Force reinstallation, if binary is already installed. • PORT_DBDIR: location of database that manager what’s binaries are installed. • PREFIX: destination of compiled binaries. • DESTDIR: makes a chroot to indicated path, and install binaries in it. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 42
  • 43. II. – Create a jail 1. Creating root folder for our jail: 2. Copying common system binaries: 3. Copying system source code: Special command that copy files, permissions, 4. Installing port system into jail: hadlinks, softlinks, etc 5. Copying missing system configuration files: Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 43
  • 44. II. – Create a jail • Add to host /etc/rc.conf: To allow to jail to access to outside of jail network, each jail must have an alias and the same IP of alias. • Manually start jail system: Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 44
  • 45. II. – Create a jail • Add to jail /home/j/test_jail/etc/rc.conf: This line allow to the jail outside connectivity Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 45
  • 46. III. – Installation of programs Installing nginx server into jail: Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 46
  • 47. 4.c – Maintainable Jail system Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 47
  • 48. 4.c – Maintainable Jail system I. Separating roles II. Block diagram III. Advantages IV. Real example: role separated web server Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 48
  • 49. I. – Separating roles Isolated system Shared base Shared Skeletons binaries programs Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 49
  • 50. I. – Separating roles Q: What’s shared base binaries? A: The user-land binaries. All jails have this in common. Q: What’s Skeletons? A: Collection of configuration files tuned for an specific task. We have one skel for each role: webservers, database servers, php, java… Also mush be called templates Q: What’s shared programs? A: Any program you want to run: apache, mysql, etc Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 50
  • 51. I. – Separating roles In other words… Shared base binaries Common commands: Resulting jail. E.g. -> ls, sed, awk, sort, an jailed apache uniq… web server. Custom config files: - /etc/rc.conf Shared programs: -/etc/make.conf Apache, mysql, -/etc/pf.conf php… -…. Shared programs Skeletons Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 51
  • 52. II. – Block diagram Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 52
  • 53. III. – Advantages Q: Why is maintainable jail system? A: Because all binaries are shared between all virtual machines and jails in a shared storage. Q: Why use skel templates? A: Then you can deploy new jail only copying a template. i.e: copying skel of a web server. Q: How can I update the system and/or any binary? A: You only must update shared binaries folder and/or shared binaries folder. Updates will spread to all jails.
  • 54. IV. – Role separated web server a) Create folders for each type of role b) Create shared base binaries container c) Create base skeleton d) Create shared web server e) Mount the jail f) Start the jail Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 54
  • 55. a) Create folders for each type of role • Skeletons: • Shared base binaries: • Shared binaries: • Mounted jails: Working directory for a concrete jail. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 55
  • 56. b) Create shared base binaries container Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 56
  • 57. c) Create base skeleton Move configuration and non-shared info to skel Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 57
  • 58. c) Create base skeleton Copy missing configuration files Not necessary for a template Make relative links to essential directories Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 58
  • 59. c) Create base skeleton Copy hardened configuration files, following steps of point 3.b, at jail: • src.conf • auth.conf • login.conf • make.conf • sysctl.conf Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 59
  • 60. d) Create shared web server 1. Create directory for binary: 2. Install nginx, and all dependences, into folder: Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 60
  • 61. e) Mount the jail Concrete skeleton of web server • Create mounting folder for our web server: Common and shared binaries • Like a puzzle, join roles in /etc/fstab: • Add jail to /etc/rc.conf of host: Shared of web server binaries Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 61
  • 62. f) Start the jail And the end, we start the jail system typing: Or, if is already started… Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 62
  • 63. 4.d – Jail deploys: Approaches Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 63
  • 64. 4.d – Jail deploys: Approaches a) Simple architecture I b) Simple architecture II c) Equilibrated architecture. d) Complex architecture. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 64
  • 65. Deploy approaches Maintainability Security level a) Simple architecture II b) Simple architecture II c) Equilibrated architecture d) Complex architecture: Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 65
  • 66. a) Simple architecture I Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 66
  • 67. a) Simple architecture I • One machine for all services. • Shared programs: nginx, php, MySQL, pureFTPd… • Separated type of storages: DB/web content. • Isolated communications between jails. • Isolated php runtime environment for each web site. • Shared web and ftp servers for all web sites. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 67
  • 68. a) Simple architecture II Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 68
  • 69. a) Simple architecture II • One machine for all services. • Shared programs: nginx, php, MySQL, pureFTPd… • Separated type of storages: DB/web content. • Isolated communications between jails. • Isolated php runtime environment for each web site. • Shared ftp servers for all web sites. • Isolated web server for each web site. Like Simple architecture I Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 69
  • 70. b) Equilibrated architecture Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 70
  • 71. b) Equilibrated architecture • Separated backend and frontend in two virtual machines. • Shared programs in network storage: nginx, php, MySQL, pureFTPd… • Isolated communications between jails. • Isolated php runtime environment for each web site. • Shared ftp servers for all web sites. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 71
  • 72. c) Complex architecture Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 72
  • 73. c) Complex architecture • 3 level in 3 virtual machines: load balancer, business layer and backend. • Separated storage out ouf virtualization server. • Isolated communications between jails. • Isolated php runtime environment for each web site. • Isolated web server for each web site. • Shared ftp servers for all web sites. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 73
  • 74. 4.d – Deploying a web site using jails Example: Deploy the WordPress Site www.mytestsite.com Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 74
  • 75. 4.d – Deploy a web site using jails I. Select a deploy model II. Create system binaries III. Create binaries IV. Create user content info V. Create mounting folder VI. Configure PHP VII. Configure web server VIII. Create PHP for site IX. Create web server for site X. Create FTP server XI. Create web balancer XII. Create MySQL server XIII. Install WordPress XIV. Configure jail and enable jail. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 75
  • 76. I. – Select deploy model This example follows mentioned model: Simple architecture II Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 76
  • 77. II. – Create system binaries System binaries folder. Shared for all jails Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 77
  • 78. III. – Create binaries • Install php Don’t forget compile it without CLI option! (for security) • Install mysql • Install nginx • Install ftp Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 78
  • 79. IV. – Create user content info Directories that will contain site info. For future use Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 79
  • 80. V. – Create mounting folder 1. Create mount point directory: 2. Create root directories: Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 80
  • 81. VI. – Configure php • Modifying: /php/mytestsite.com/conf/php-fpm.ini Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 81
  • 82. VI. – Configure php • Modifying: /home/js/mytestsite.com-php/usr/local/etc/php-fpm.conf Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 82
  • 83. VII. – Configure web server • Configuring: /home/j/mytestsite.com/usr/local/etc/nginx/nginx.conf Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 83
  • 84. VIII. – Create PHP for site • Create base folder and copy skeleton (or profile) for web server • Create mount point for each site of isolated php server. • Create mount point web content. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 84
  • 85. VIII. – Create PHP for site • Configuration of init script for web server jail: /home/j/mytestsite.com-php/etc/rc.conf Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 85
  • 86. IX. – Create web server for site • Create base folder and copy skeleton (or profile) for web server • Create mount point for each site of isolated web server. • Create mount point web content. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 86
  • 87. IX. – Create web server for site • Configuration of init script for web server jail: /home/j/mytestsite.com-wserver/etc/rc.conf Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 87
  • 88. X. – Create FTP server • Create base folder and copy skeleton (or profile) for FTP server • Create mount point of FTP isolated server. • Create mount point for web content. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 88
  • 89. X. – Create FTP server • Configuration of init script for FTP server jail: /home/j/ftpserver/etc/rc.conf Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 89
  • 90. X. – Create FTP server • Configuring: /home/j/ftpserver/usr/local/etc/pure-ftpd.conf There is more configuration parameters, but this is the most important. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 90
  • 91. XI. – Create web balancer • Create base folder and copy skeleton (or profile) for web balancer: • Create mount point of web balancer isolated server. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 91
  • 92. XI. – Create web balancer • Configuration of init script for web balancer jail: /home/j/webbalancer/etc/rc.conf Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 92
  • 93. XI. – Create web balancer • Configuring: /home/j/webbalancer/usr/local/etc/nginx/nginx.conf Redirect to web server of isolated web site. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 93
  • 94. XII. – Create MySQL server • Create base folder and copy skeleton (or profile) for mysql server: • Create mount point of mysql isolated server. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 94
  • 95. XII. – Create MySQL server • Configuration of init script for web server jail: /home/j/mysql/etc/rc.conf Change listen address. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 95
  • 96. XIII. – Install WordPress • Install WordPress from FreeBSD sources, into host system. This method allows us to easily install our own patches. • Copy sources to our site: Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 96
  • 97. XIII. – Install wordpress • Configure our WordPress installation defining location of MySQL. IP of our jail with MySQL Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 97
  • 98. XIV. – Configure and enable de jail Configure /etc/fstab. Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 98
  • 99. XIV. – Configure and enable de jail Configure /etc/fstab (cont). Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 99
  • 100. XIV. – Configure and enable de jail Enable jail in the system /etc/rc.conf: Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 100
  • 101. XIV. – Configure and enable de jail Enable jail in the system /etc/rc.conf (cont): Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 101
  • 102. Questions? Daniel García García a.k.a cr0hn (@ggdaniel) http://es.linkedin.com/in/garciagarciadaniel 102