Difference between revisions of "Chroot Debian users"
Line 1: | Line 1: | ||
+ | <span data-link_translate_fr_title="Chrooter ses utilisateurs Debian" data-link_translate_fr_url="Chrooter ses utilisateurs Debian"></span>[[:fr:Chrooter ses utilisateurs Debian]][[fr:Chrooter ses utilisateurs Debian]] | ||
<br />This article has been created by an automatic translation software. You can view the article source [[:fr:Chrooter ses utilisateurs Debian|here]].<br /><span data-translate="fr"></span><br /> | <br />This article has been created by an automatic translation software. You can view the article source [[:fr:Chrooter ses utilisateurs Debian|here]].<br /><span data-translate="fr"></span><br /> | ||
<span data-link_translate_he_title="משתמשי דביאן Chroot" data-link_translate_he_url="%D7%9E%D7%A9%D7%AA%D7%9E%D7%A9%D7%99+%D7%93%D7%91%D7%99%D7%90%D7%9F+Chroot"></span>[[:he:משתמשי דביאן Chroot]][[he:משתמשי דביאן Chroot]] | <span data-link_translate_he_title="משתמשי דביאן Chroot" data-link_translate_he_url="%D7%9E%D7%A9%D7%AA%D7%9E%D7%A9%D7%99+%D7%93%D7%91%D7%99%D7%90%D7%9F+Chroot"></span>[[:he:משתמשי דביאן Chroot]][[he:משתמשי דביאן Chroot]] |
Revision as of 17:13, 8 February 2017
fr:Chrooter ses utilisateurs Debian
This article has been created by an automatic translation software. You can view the article source here.
he:משתמשי דביאן Chroot
ru:Пользователи Debian chroot
ja:Chroot Debian ユーザ
ar:مستخدمي ديبيان استجذار
zh:Chroot Debian 用户
ro:Utilizatorii Debian chroot
pl:Użytkownicy Debiana chroot
de:Debian-Chroot-Benutzer
nl:Chroot Debian gebruikers
it:Utenti Debian chroot
pt:Usuários Debian chroot
es:Usuarios de Debian chroot
en:Chroot Debian users
Introduction
Il peut être utile de chrooter ses utilisateurs afin de limiter leur liberté de mouvements au sein de son système.
Sur un Server de production, pensez à effectuer ces opérations pendant les heures creuses afin de minimiser l'impact de vos actions.
Prerequisites
One of the prerequisites essential is to keep its system as up-to-date as possible.
apt-get update apt-get upgrade
In order to keep your system up-to-date, make sure you have a list of the official repositories. You can find a list of the repositories available at Ikoula and installation instructions.[Quelles_sont_les_sources_des_d%C3%A9p%C3%B4ts_debian_chez_Ikoula| à cette adresse]].
Implementation
Create the chroot
One of the ways to set up a prison is to create a group that all imprisoned users depend on.
- Create the Group
groupadd chrootgrp
- Create our new user
adduser -g chrootgrp notre_utilisateur
Create directories
Nous devons maintenant mettre en place les répertoires de base de notre prison chroot afin de simuler la présence du répertoire racine /
- Create all directories
# la syntaxe { } nous permet de définir un répertoire et plusieurs sous-répertoires en une commande mkdir -p /var/jail/{dev,etc,lib,usr,bin} mkdir -p /var/jail/usr/bin
- Assigner les permissions aux répertoires créer afin de changer le propriétaire par root
chown root.root /var/jail
- Also create the file /dev/null
mknod -m 666 /var/jail/dev/null c 1 3
Configuration files /etc/
The configuration file /etc/ requires a few vital files in order to work properly, so we will copy them to our prison.
- Copy configuration files to the prison
# Se déplacer dans le dossier /etc/ de la prison cd /var/jail/etc # Copier les fichiers de configuration vers le répertoire courant . (/var/jail/etc/) cp /etc/ld.so.cache . cp /etc/ld.so.conf . cp /etc/nsswitch.conf . cp /etc/hosts .
Determine the available commands
We must now determine the commands that will be available to our user, for example the command ls, cat, and bash.
- We need to copy the executables to our prison
# Se déplacer dans le dossier /usr/bin de la prison cd /var/jail/usr/bin # Copier les exécutables souhaités vers le répertoire courant (/var/jail/usr/bin) cp /usr/bin/ls . cp /usr/bin/cat . cp /usr/bin/bash .
- Don't forget to add libraries shared for executables
# on cherche les bibliothèques de ls grâce à la commande ldd ldd /bin/ls # La commande retourne un résultat similaire: linux-gate.so.1 => (0xb7f2b000) librt.so.1 => /lib/librt.so.1 (0xb7f1d000) libacl.so.1 => /lib/libacl.so.1 (0xb7f16000) libc.so.6 => /lib/libc.so.6 (0xb7dcf000) libpthread.so.0 => /lib/libpthread.so.0 (0xb7db7000) /lib/ld-linux.so.2 (0xb7f2c000) libattr.so.1 => /lib/libattr.so.1 (0xb7db2000)
Configure the SSH service
Maintenant que notre prison est en place nous devons configurer le service SSH de façon à rediriger notre utilisateur appartenant au groupe chrooté vers son nouvel emplacement sécurisé.
- Edit the ssh configuration file
vi /etc/ssh/sshd_config
- Add the following content at the end of file
# Ajout du groupe chroot Match group chrootgrp ChrootDirectory /var/jail/ X11Forwarding no AllowTcpForwarding no
- Restart the ssh service
/etc/init.d/ssh restart
This configuration also disables the redirection X11 and the TCP port forwarding. In some cases, including the implementation of a secure tunnel, it may be necessary to review the configuration and remove the ban.
Option: Change the command prompt
This step is optional, if you test the connection to your prison you have the notice a prompt similar to this:
bash-2-5$
If you want to use a prompt less general simply to perform the following procedure:
# copier le contenu de /etc/skel vers /var/jail/home/votre_utilisateur cp /etc/skel/* /var/jail/home/notre_utilisateur/ # Vous avez à présent quelque chose comme ceci notre_utilisateur:->
Enable comment auto-refresher