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