Outils pour utilisateurs

Outils du site


tech:chroot

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
tech:chroot [2025/03/24 15:06] – créée - modification externe 127.0.0.1tech:chroot [2025/10/28 15:04] (Version actuelle) Jean-Baptiste
Ligne 1: Ligne 1:
 +<!DOCTYPE markdown>
 {{tag>Brouillon Debian Linux Sécurité Chroot}} {{tag>Brouillon Debian Linux Sécurité Chroot}}
  
-Chroot Linux+Chroot Linux
  
  
Ligne 7: Ligne 8:
 Voir : Voir :
 * https://wiki.debian.org/fr/DontBreakDebian * https://wiki.debian.org/fr/DontBreakDebian
-[[https://wiki.debian.org/fr/Chroot]] +* https://wiki.debian.org/fr/Chroot 
-[[https://www.debian.org/doc/manuals/securing-debian-howto/ap-chroot-ssh-env.fr.html]] +* https://www.debian.org/doc/manuals/securing-debian-howto/ap-chroot-ssh-env.fr.html 
-[[http://www.tldp.org/LDP/lfs/LFS-BOOK-6.1.1-HTML/chapter06/devices.html]] +* http://www.tldp.org/LDP/lfs/LFS-BOOK-6.1.1-HTML/chapter06/devices.html 
-[[https://wiki.archlinux.org/index.php/change_root]] +* https://wiki.archlinux.org/index.php/change_root 
-[[http://doc.ubuntu-fr.org/tutoriel/comment_restaurer_grub]] +* http://doc.ubuntu-fr.org/tutoriel/comment_restaurer_grub 
-[[http://proot.me/]] +* http://proot.me/ 
-[[http://dl.packetstormsecurity.net/papers/general/chroot_sshd_linux.pdf]] +* http://dl.packetstormsecurity.net/papers/general/chroot_sshd_linux.pdf 
-[[https://www.howtoforge.com/chroot_ssh_sftp_debian_etch]] +* https://www.howtoforge.com/chroot_ssh_sftp_debian_etch 
-[[http://www.kegel.com/crosstool/current/doc/chroot-login-howto.html]]+* http://www.kegel.com/crosstool/current/doc/chroot-login-howto.html 
 Chroot Infinite BusyBox with systemd Chroot Infinite BusyBox with systemd
-[[http://www.linuxjournal.com/content/infinite-busybox-systemd]]+* http://www.linuxjournal.com/content/infinite-busybox-systemd
 * switch_root * switch_root
  
 libpam-chroot: /lib/security/pam_chroot.so libpam-chroot: /lib/security/pam_chroot.so
  
-[[https://www.debian.org/doc/manuals/securing-debian-manual/sec-services.en.html#ssh-chroot]] +* https://www.debian.org/doc/manuals/securing-debian-manual/sec-services.en.html#ssh-chroot 
-[[http://singe.za.net/blog/archives/378-Linux-SSH-Jail-with-pam_chroot.html]]+* http://singe.za.net/blog/archives/378-Linux-SSH-Jail-with-pam_chroot.html
  
 Voir fakeroot et consorts Voir fakeroot et consorts
 * fakeroot * fakeroot
 +* fakeroot-ng
 +* proot
 +* become-root
 * rootlesskit (Linux-native "fake root" for rootless containers) * rootlesskit (Linux-native "fake root" for rootless containers)
 +and yet slow):
 +
 +
 +
  
 Voir aussi : Voir aussi :
-* pivot_root +* pivot_root & switch_root 
-* [[https://wiki.debian.org/fr/Debootstrap|Debootstrap]]+* [Debootstrap](https://wiki.debian.org/fr/Debootstrap)
 * Docker * Docker
 * bwrap * bwrap
-* [[https://wiki.archlinux.org/title/firejail|Firejail]] +* [Firejail](https://wiki.archlinux.org/title/firejail) 
-  ** ex : ''firejail --dns=8.8.8.8 firefox''+  * ex : ''firejail --dns=8.8.8.8 firefox''
 * Procenv * Procenv
  
- +''chrootont.sh'' 
-<code bash chrootont.sh>+~~~bash
 CHROOTDIR=/home/chroot CHROOTDIR=/home/chroot
  
Ligne 84: Ligne 93:
  
 exelist='ls mount ps bash dmesg vim tail' exelist='ls mount ps bash dmesg vim tail'
-</code>+~~~
  
-== Exemple avec bash 
  
-<code bash>+ 
 +## Exemple avec bash 
 + 
 +~~~bash
 ldd /bin/bash  ldd /bin/bash 
 mkdir ${CHROOTDIR}/lib/x86_64-linux-gnu/ -p mkdir ${CHROOTDIR}/lib/x86_64-linux-gnu/ -p
Ligne 118: Ligne 129:
  
 #cp -a /usr/share/zoneinfo /home/chroot/usr/share/ #cp -a /usr/share/zoneinfo /home/chroot/usr/share/
-</code>+~~~
  
 Pour top, atop Pour top, atop
-<code ->+~~~
 'xterm': unknown terminal type 'xterm': unknown terminal type
-</code>+~~~
  
-<code bash>+~~~bash
 cp -a /lib/terminfo /home/chroot/lib/ cp -a /lib/terminfo /home/chroot/lib/
  
Ligne 150: Ligne 161:
 #Pour les script init (services) #Pour les script init (services)
 cp -a /lib/lsb /home/chroot/lib/ cp -a /lib/lsb /home/chroot/lib/
-</code>+~~~
  
-Truc +Truc ? 
-<code - /etc/passwd>+ 
 +''/etc/passwd'' 
 +~~~
 chroot:x:1010:1015:,,,:/home/chroot:/usr/local/bin/chrootshell chroot:x:1010:1015:,,,:/home/chroot:/usr/local/bin/chrootshell
-</code>+~~~
  
-<code bash /usr/local/bin/chrootshell>+''/usr/local/bin/chrootshell'' 
 +~~~bash
 #! /bin/bash #! /bin/bash
  
Ligne 163: Ligne 177:
 #sudo /usr/sbin/chroot /home/$USER /bin/bash #sudo /usr/sbin/chroot /home/$USER /bin/bash
 sudo /usr/sbin/chroot /home/$USER /bin/bash -c "su - jibe" sudo /usr/sbin/chroot /home/$USER /bin/bash -c "su - jibe"
-</code> +~~~
-[[http://smhteam.info/wiki/index.linux.php5?wiki=ChrooterUnUtilisateur]]+
  
-<code ->+http://smhteam.info/wiki/index.linux.php5?wiki=ChrooterUnUtilisateur 
 + 
 +~~~
 chroot ALL=(root) NOPASSWD: /usr/sbin/chroot chroot ALL=(root) NOPASSWD: /usr/sbin/chroot
-</code>+~~~
  
 **ATTENTION** Grosse faille de sécurité que je n'explique pas (peut-être lié à PAM ou systemd) : **ATTENTION** Grosse faille de sécurité que je n'explique pas (peut-être lié à PAM ou systemd) :
Ligne 176: Ligne 191:
  
 Dans le chroot Dans le chroot
-<code bash>+~~~bash
 /sbin/getty 38400 tty8 /sbin/getty 38400 tty8
-</code>+~~~
  
-<code bash>+~~~bash
 umount ${CHROOTDIR}/{dev/pts,dev,sys,proc,run} umount ${CHROOTDIR}/{dev/pts,dev,sys,proc,run}
 umount ${CHROOTDIR} umount ${CHROOTDIR}
Ligne 189: Ligne 204:
 umount /chroot/* umount /chroot/*
 umount /chroot/* umount /chroot/*
-</code>+~~~
  
-=== Comment savoir si je suis dans un chroot ?+### Comment savoir si je suis dans un chroot ?
  
 Les numeros d'inodes peuvent être un indice Les numeros d'inodes peuvent être un indice
-<code bash>+~~~bash
 ls -id / ls -id /
-</code> +~~~ 
-Voir [[http://stackoverflow.com/questions/75182/detecting-a-chroot-jail-from-within]]+Voir http://stackoverflow.com/questions/75182/detecting-a-chroot-jail-from-within
  
-== Firejail+## Firejail
  
 Voir : https://firejail.wordpress.com/documentation-2/firefox-guide/ Voir : https://firejail.wordpress.com/documentation-2/firefox-guide/
  
-<code bash>+~~~bash
 firefail --seccomp --debug firefox firefail --seccomp --debug firefox
-</code>+~~~
  
  
-== Mount kernel virtual file systems+## Mount kernel virtual file systems
  
 Source : https://git.yoctoproject.org/poky/plain/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh Source : https://git.yoctoproject.org/poky/plain/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh
  
-<code bash sysfs.sh>+''sysfs.sh'' 
 +~~~bash
 #!/bin/sh #!/bin/sh
 # #
Ligne 253: Ligne 269:
 fi fi
  
-</code>+~~~ 
 + 
 + 
 + 
 +## Pb /etc/machine-id: No such file or directory 
 + 
 +~~~ 
 +-bash: /etc/machine-id: No such file or directory 
 +-bash: /proc/sys/kernel/random/boot_id: No such file or directory 
 +-bash: /proc/sys/kernel/random/uuid: No such file or directory 
 +~~~ 
 + 
 + 
 +## Autres 
 + 
 +~~~bash 
 +chroot --userspec=nobody 
 +~~~ 
  
tech/chroot.1742825205.txt.gz · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki