Serwer Apache w

Konfiguracja serwerów, usług, itp.
Lesiex
Posty: 33
Rejestracja: 07 listopada 2007, 23:21
Lokalizacja: Poznañ

Serwer Apache w środowisku jail

Post autor: Lesiex »

Witam mam postawić server www apacha w wlasnym srodowsku "jail" tzn. tak serwer apache umiem zrobic i dziala spokojnie, ale co to dokladnie znaczy "jail"?
Jak by ktoś potrafił mi objasnic to byl bym bardzo wdzieczny i moze jak to zrobic?
.
arvath
Posty: 11
Rejestracja: 02 marca 2008, 13:28

Post autor: arvath »

Jail oznacza zamknięte środowisko pracy usługi. Bardzo dobrze jest to rozwiązane we FreeBSD, tam zamknięcie usługi w Jailu sprowadza się do kilku poleceń. Ogólnie działa to w ten sposób, że tworzysz kopie katalogów systemowych w podkatalogu wydzielonym dla usługi, ale oczywiście tylko tych, których potrzebuje.
Struktura katalogów prezentuje się mniej więcej tak:
/home/jail/apache (katalog główny Jaila (/ dla apache'a))

Kod: Zaznacz cały

/home/jail/apache/etc/apache2/
/home/jail/apache/etc/init.d
/home/jail/apache/var/lock
/home/jail/apache/var/log
Rozumiesz chyba co mam na myśli, jednak po szczegółowe informacje odsyłam Cie do manuali :) Z tego co wiem to Debian nie ma wbudowanego wsparcia dla jaili.
Rad
Member
Posty: 1208
Rejestracja: 28 czerwca 2006, 15:05

Post autor: Rad »

Jest jail w Debianie (makejail etc.). Do Apache'a jest to średnio potrzebne, ponieważ istnieje mod_chroot.
Lesiex
Posty: 33
Rejestracja: 07 listopada 2007, 23:21
Lokalizacja: Poznañ

Post autor: Lesiex »

RAD pisze:Jest jail w Debianie (makejail etc.). Do Apache'a jest to średnio potrzebne, ponieważ istnieje mod_chroot.
a cos wiecej z tym makejail??
pozdrawiam
Rad
Member
Posty: 1208
Rejestracja: 28 czerwca 2006, 15:05

Post autor: Rad »

Lesiex
Posty: 33
Rejestracja: 07 listopada 2007, 23:21
Lokalizacja: Poznañ

Post autor: Lesiex »

Tak wiec zacząłem to robic:

Kod: Zaznacz cały

*

      Log in as root and create a new jail directory:

           $ mkdir -p /var/chroot/apache
wiadomo robie ] *

Create a new user and a new group. The chrooted Apache server will run as this user/group, which isn't used for anything else on the system. In this example, both user and group are called chrapach.


$ adduser --home /var/chroot/apache --shell /bin/false \
--no-create-home --system --group chrapach

FIXME: is a new user needed? (Apache already runs as the apache user)[/code]
Wiadomo to tez sie udaje

Kod: Zaznacz cały

Set up Apache (e.g. define your subdomains, etc.). In the /etc/apache/httpd.conf configuration file, set the Group and User options to chrapach. Restart Apache and make sure the server is working correctly. Now, stop the Apache daemon. 
Wszystko niby ok ale ja edytuje plik /etc/apache2/apache.conf bo bo httpd.conf nie mam a w tym moim confie eytuje tylko 2 pola user i group

Kod: Zaznacz cały

*

      Copy the sample configuration file for Apache to the /etc/makejail directory:

            
            # cp /usr/share/doc/makejail/examples/apache.py /etc/makejail/
To wiadomo kopiuje
no i tu zaczynaja sie schody

Kod: Zaznacz cały

*

      Edit /etc/makejail/apache.py. You need to change the chroot, users and groups options. To run this version of makejail, you can also add a packages option. See the makejail documentation. A sample is shown here:

           chroot="/var/chroot/apache"
           testCommandsInsideJail=["/usr/sbin/apachectl start"]
           processNames=["apache"]
           testCommandsOutsideJail=["wget -r --spider http://localhost/",
                                    "lynx --source https://localhost/"]
           preserve=["/var/www",
                     "/var/log/apache",
                     "/dev/log"]
           users=["chrapach"]
           groups=["chrapach"]
           packages=["apache", "apache-common"]
           userFiles=["/etc/password",
                      "/etc/shadow"]
           groupFiles=["/etc/group",
                       "/etc/gshadow"]
           forceCopy=["/etc/hosts",
                      "/etc/mime.types"]

      FIXME: some options do not seem to work properly. For instance, /etc/shadow and /etc/gshadow are not copied, whereas /etc/password and /etc/group are fully copied instead of being filtered.

    *

      Create the chroot tree: makejail /etc/makejail/apache.py
pacages musze zakomentowac # bo inaczej wywyala mi error ze zle paczki

A jak zakomentuje to pokazuje cos takiego:

Kod: Zaznacz cały

Loading configuration file /etc/makejail/apache.py
   Defining testCommandsInsideJail = ['/usr/sbin/apachectl start']
   Defining preserve = ['/var/www', '/var/log/apache2', '/dev/log']
   Defining chroot = '/var/chroot/apache'
   Defining testCommandsOutsideJail = ['wget -r --spider http://localhost/', 'lynx --source https://localhost/']
   Defining users = ['chrapach']
   Defining forceCopy = ['/etc/hosts', '/etc/mime.types']
   Defining groupFiles = ['/etc/group', '/etc/gshadow']
   Defining processNames = ['apache2']
   Defining groups = ['chrapach']
   Defining userFiles = ['/etc/password', '/etc/shadow']
Chroot directory is /var/chroot/apache
Initializing list of running processes
  Executing : ps -e
Killing processes named 'apache2' ... :   Executing : ps -e
no process found
Adding files matching '/etc/hosts'
   Checking path '/etc/hosts'
      File /var/chroot/apache/etc/hosts already exists
Adding files matching '/etc/mime.types'
   Checking path '/etc/mime.types'
      File /var/chroot/apache/etc/mime.types already exists
Running strace on commands from inside jail
   Killing processes named 'apache2' ... :      Executing : ps -e
   no process found
   Execution #1
      Tracing command chroot /var/chroot/apache /usr/sbin/apachectl start
      Sleeping for 2.00 seconds
      Stopping tracing ...         Executing : killall -9 strace
        WARNING: exit code 256
      
      Looking for missing files in the trace file
      No missing file found
      Killing processes named 'apache2' ... :         Executing : ps -e
      no process found
Executing command 'chroot /var/chroot/apache /usr/sbin/apachectl start' (pwd=/tmp/makejail_logs)   return code is 0 
Running tests from outside the jail
   Execution #1
      Sleeping for 2.00 seconds
        Executing : ps -e
   No running process found, cannot run tests
   Executing command 'chroot /var/chroot/apache /usr/sbin/apachectl start' (pwd=/tmp/makejail_logs)      return code is 0 
   Sleeping for 2.00 seconds
   Killing processes named 'apache2' ... :      Executing : ps -e
   no process found
Apach dziala jako servis "apache2".

Prosze o pomoc bo nie jestem ze tak powiem zaawansowanym userem linuxa powiem inaczej jestem poczatkujacy a mam poprotu zrobic cos takiego na zajecia.

pozdrawiam
Rad
Member
Posty: 1208
Rejestracja: 28 czerwca 2006, 15:05

Post autor: Rad »

Nie możesz skorzystać z mod_chroot?
Lesiex
Posty: 33
Rejestracja: 07 listopada 2007, 23:21
Lokalizacja: Poznañ

Post autor: Lesiex »

no niestety nie musi byc Jail:/
Awatar użytkownika
Yampress
Administrator
Posty: 6416
Rejestracja: 09 sierpnia 2007, 21:41
Lokalizacja: PL

Post autor: Yampress »

Lesiex
Posty: 33
Rejestracja: 07 listopada 2007, 23:21
Lokalizacja: Poznañ

Post autor: Lesiex »

tylko kurde ja mam inne katlogi inne nazwy.
chyba ze zainstalowac recznie apacha albo jaks starsza wersje zeby nazewnictwo bylo takie same i wtedy by bylo dobrze:/
ma ktos opis recznej isntalki apche a nie przez apt-get....

pozdrawiam
ODPOWIEDZ