Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédente | |||
| elearning:workbooks:debian:11:sec:l109 [2025/12/04 09:32] – admin | elearning:workbooks:debian:11:sec:l109 [2025/12/07 16:38] (Version actuelle) – admin | ||
|---|---|---|---|
| Ligne 11: | Ligne 11: | ||
| * **LDF409 - Gestion de la Sécurité de Docker** | * **LDF409 - Gestion de la Sécurité de Docker** | ||
| * Contenu du Module | * Contenu du Module | ||
| - | | + | * LAB #1 - Utilisation des Docker |
| - | | + | |
| - | * 1.1 - Installer docker | + | |
| - | * 1.2 - Démarrer un Conteneur | + | |
| - | * 1.3 - Consulter la Liste des Conteneurs et Images | + | |
| - | * 1.4 - Rechercher une Image dans un Dépôt | + | |
| - | * 1.5 - Supprimer un Conteneur d'une Image | + | |
| - | * 1.6 - Créer une Image à partir d'un Conteneur Modifié | + | |
| - | * 1.7 - Supprimer une Image | + | |
| - | * 1.8 - Créer un Conteneur avec un Nom Spécifique | + | |
| - | * 1.9 - Exécuter une Commande dans un Conteneur | + | |
| - | * 1.10 - Injecter des Variables d' | + | |
| - | * 1.11 - Modifier le Nom d' | + | |
| - | * 1.12 - Mapper des Ports d'un Conteneur | + | |
| - | * 1.13 - Démarrer un Conteneur en mode Détaché | + | |
| - | * 1.14 - Accéder aux Services d'un Conteneur de l' | + | |
| - | * 1.15 - Arrêter et Démarrer un Conteneur | + | |
| - | * 1.16 - Utiliser des Signaux avec un Conteneur | + | |
| - | * 1.17 - Forcer la Suppression d'un Conteneur en cours d' | + | |
| - | * 1.18 - Utilisation Simple d'un Volume | + | |
| - | * 1.19 - Télécharger une image sans créer un conteneur | + | |
| - | * 1.20 - S' | + | |
| - | * 1.21 - Installer un logiciel dans le conteneur | + | |
| - | * 1.22 - Utilisation de la commande docker commit | + | |
| - | * 1.23 - Se connecter au serveur du conteneur de l' | + | |
| * LAB #2 - Création d'un Utilisateur de Confiance pour Contrôler le Daemon Docker | * LAB #2 - Création d'un Utilisateur de Confiance pour Contrôler le Daemon Docker | ||
| * LAB #3 - Le Script docker-bench-security.sh | * LAB #3 - Le Script docker-bench-security.sh | ||
| * LAB #4 - Sécurisation de la Configuration de l' | * LAB #4 - Sécurisation de la Configuration de l' | ||
| - | * 4.1 - [WARN] 1.2.1 - Ensure a separate partition for containers has been created | ||
| - | * 4.2 - [WARN] 1.2.3 - Ensure auditing is configured for the Docker daemon | ||
| * LAB #5 - Sécurisation de la Configuration du daemon Docker | * LAB #5 - Sécurisation de la Configuration du daemon Docker | ||
| - | * 5.1 - [WARN] 2.1 - Ensure network traffic is restricted between containers on the default bridge | + | * 5.1 - Le Fichier / |
| - | * 5.2 - [WARN] 2.8 - Enable user namespace support | + | |
| - | * 5.3 - [WARN] 2.11 - Ensure that authorization for Docker client commands is enabled | + | |
| - | * 5.4 - [WARN] 2.12 - Ensure centralized and remote logging is configured | + | |
| - | * 5.5 - [WARN] 2.14 - Ensure Userland Proxy is Disabled | + | |
| - | * 5.6 - [WARN] 2.17 - Ensure containers are restricted from acquiring new privileges | + | |
| - | * 5.7 - Le Fichier / | + | |
| * LAB #6 - Sécurisation des Images et les Fichiers de Construction | * LAB #6 - Sécurisation des Images et les Fichiers de Construction | ||
| - | * 6.1 - [WARN] 4.1 - Ensure a user for the container has been created | ||
| - | * 6.2 - [WARN] 4.5 - Ensure Content trust for Docker is Enabled | ||
| - | * 6.3 - [WARN] 4.6 - Ensure that HEALTHCHECK instructions have been added to container images | ||
| * LAB #7 - Sécurisation du Container Runtime | * LAB #7 - Sécurisation du Container Runtime | ||
| - | * 7.1 - [WARN] 5.1 - Ensure AppArmor Profile is Enabled | ||
| - | * 7.2 - [WARN] 5.2 - Ensure SELinux security options are set, if applicable | ||
| - | * 7.3 - [WARN] 5.10 - Ensure memory usage for container is limited | ||
| - | * 7.4 - [WARN] 5.11 - Ensure CPU priority is set appropriately on the container | ||
| - | * 7.5 - [WARN] 5.12 - Ensure the container' | ||
| - | * 7.6 - [WARN] 5.14 - Ensure ' | ||
| - | * 7.7 - [WARN] 5.25 - Ensure the container is restricted from acquiring additional privileges | ||
| - | * 7.8 - [WARN] 5.26 - Ensure container health is checked at runtime | ||
| - | * 7.9 - [WARN] 5.28 - Ensure PIDs cgroup limit is used | ||
| * LAB #8 - Sécurisation des Images avec Docker Content Trust | * LAB #8 - Sécurisation des Images avec Docker Content Trust | ||
| * 8.1 - DOCKER_CONTENT_TRUST | * 8.1 - DOCKER_CONTENT_TRUST | ||
| Ligne 71: | Ligne 27: | ||
| * Créer un deuxième Repositry | * Créer un deuxième Repositry | ||
| * Supprimer une Signature | * Supprimer une Signature | ||
| + | * LAB #9 - Sécurisation du Socket du Daemon Docker | ||
| + | * 9.1 - Création du Certificat de l' | ||
| + | * 9.2 - Création du Certificat du Serveur Hôte du Daemon Docker | ||
| + | * 9.3 - Création du Certificat du Client | ||
| + | * 9.4 - Démarrage du Daemon Docker avec une Invocation Directe | ||
| + | * 9.5 - Configuration du Client | ||
| - | =====Présentation de Docker===== | + | =====LAB #1 - Utilisation des Docker |
| - | Docker | + | Les secrets |
| - | Une **image** est un paquet exécutable contenant tout ce qu'il est necessaire afin d'exécuter | + | Considérez l'exemple suivant |
| - | * le code | + | < |
| - | * un runtime | + | version: '3.1' |
| - | * des bibliothèques, | + | |
| - | * des variables d'environnement | + | |
| - | * des fichiers de configuration | + | |
| - | Un **conteneur** est une instance de l' | + | services: |
| - | Les conteneurs exécutent des applications nativement en utilisant le noyau de la machine hôte. De ce fait les performances d'un conteneur sont supérieures à celles d'une machine virtuelle qui doit passer par un hyperviseur pour accéder aux ressources de la machine hôte. | + | db: |
| + | image: postgres | ||
| + | environment: | ||
| + | POSTGRES_USER: | ||
| + | POSTGRES_PASSWORD: | ||
| + | POSTGRES_DB: | ||
| - | Docker existe en deux versions **Docker-CE** (Docker Community Edition) et **Docker-EE** (Docker Enterprise Edition). Pour consulter les différences entre les deux versions, consultez le lien **[[https:// | + | adminer: |
| + | image: adminer | ||
| + | ports: | ||
| + | - 8080:8080 | ||
| + | </file> | ||
| - | =====LAB #1 - Travailler avec Docker===== | + | On peut constater dans ce fichier la présence des informations sensibles en non-sécurisées : |
| - | ====1.1 - Installer docker==== | + | * POSTGRES_USER |
| + | * POSTGRES_PASSWORD | ||
| + | * POSTGRES_DB | ||
| - | Installer Docker-CE sur **votre** ordinateur : | + | Afin de sécuriser ces informations, commencez par créer le contexte |
| - | + | ||
| - | ==Mac== | + | |
| - | + | ||
| - | * Voir le lien **[[https:// | + | |
| - | + | ||
| - | ==Linux== | + | |
| - | + | ||
| - | * Ubuntu - voir le lien **[[https:// | + | |
| - | * Debian - voir le lien **[[https:// | + | |
| - | * CentOS - voir le lien **[[https:// | + | |
| - | * Fedora - voir le lien **[[https:// | + | |
| - | + | ||
| - | ==Windows 7, 8== | + | |
| - | + | ||
| - | * Téléchargez Docker Toolbox à partir | + | |
| - | * Fermez toutes les machines virtuelles ainsi que VirtualBox, | + | |
| - | * Installez **DockerToolBox.exe** (décochez VirtualBox dans la liste de produits à installer), | + | |
| - | * Exécutez Docker Toolbox et laissez l' | + | |
| - | * Ouvrez VirtualBox. Vous verrez une machine virtuelle Default, | + | |
| - | * Ouvrez **cmd**. | + | |
| - | + | ||
| - | ==Windows 10== | + | |
| - | + | ||
| - | * Voir le lien **[[https:// | + | |
| - | + | ||
| - | + | ||
| - | ====1.2 - Démarrer un Conteneur==== | + | |
| - | + | ||
| - | Démarrez un conteneur de l' | + | |
| < | < | ||
| - | root@debian9:~# docker run hello-world | + | root@manager:~# mkdir postgres |
| - | Unable to find image ' | + | |
| - | latest: Pulling from library/ | + | |
| - | 1b930d010525: | + | |
| - | Digest: sha256: | + | |
| - | Status: Downloaded newer image for hello-world: | + | |
| - | + | ||
| - | Hello from Docker! | + | |
| - | This message shows that your installation appears to be working correctly. | + | |
| - | + | ||
| - | To generate this message, Docker took the following steps: | + | |
| - | 1. The Docker client contacted the Docker daemon. | + | |
| - | 2. The Docker daemon pulled the " | + | |
| - | (amd64) | + | |
| - | 3. The Docker daemon created a new container from that image which runs the | + | |
| - | executable that produces the output you are currently reading. | + | |
| - | 4. The Docker daemon streamed that output to the Docker client, which sent it | + | |
| - | to your terminal. | + | |
| - | + | ||
| - | To try something more ambitious, you can run an Ubuntu container with: | + | |
| - | $ docker run -it ubuntu bash | + | |
| - | + | ||
| - | Share images, automate workflows, and more with a free Docker ID: | + | |
| - | | + | |
| - | + | ||
| - | For more examples and ideas, visit: | + | |
| - | | + | |
| </ | </ | ||
| - | <WRAP center round important> | + | Créez ensuite |
| - | **Important** - Notez que si l' | + | |
| - | </ | + | |
| - | + | ||
| - | Démarrez un conteneur de l' | + | |
| < | < | ||
| - | root@debian9:~# docker run -it ubuntu bash | + | root@manager:~# cd postgres |
| - | Unable to find image ' | + | root@manager:~/postgres# echo " |
| - | latest: Pulling from library/ | + | lpk8eq80qvfiqw7z1686fmj5t |
| - | 898c46f3b1a1: | + | |
| - | 63366dfa0a50: | + | |
| - | 041d4cd74a92: | + | |
| - | 6e1bee0f8701: | + | |
| - | Digest: sha256: | + | |
| - | Status: Downloaded newer image for ubuntu: | + | |
| - | root@3a3f9bda6cbd:/# ls | + | |
| - | bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var | + | |
| - | root@3a3f9bda6cbd:/# | + | |
| - | DISTRIB_ID=Ubuntu | + | |
| - | DISTRIB_RELEASE=18.04 | + | |
| - | DISTRIB_CODENAME=bionic | + | |
| - | DISTRIB_DESCRIPTION=" | + | |
| </ | </ | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| - | **Important** | + | **Important** |
| </ | </ | ||
| - | Consulter | + | Pour visualiser |
| < | < | ||
| - | root@835001339e79:/# | + | root@manager: |
| - | Desired=Unknown/ | + | ID |
| - | | Status=Not/ | + | lpk8eq80qvfiqw7z1686fmj5t |
| - | |/ Err? | + | |
| - | ||/ Name | + | |
| - | +++-====================================-=======================-=======================-============================================================================= | + | |
| - | ii adduser | + | |
| - | ii apt 1.6.8 | + | |
| - | ii base-files | + | |
| - | ii base-passwd | + | |
| - | ii bash | + | |
| - | ii bsdutils | + | |
| - | ii bzip2 1.0.6-8.1 | + | |
| - | ii coreutils | + | |
| - | ii dash | + | |
| - | ii debconf | + | |
| - | ii debianutils | + | |
| - | ii diffutils | + | |
| - | ii dpkg | + | |
| - | ii e2fsprogs | + | |
| - | ii fdisk 2.31.1-0.4ubuntu3.3 | + | |
| - | ii findutils | + | |
| - | ii gcc-8-base:amd64 | + | |
| - | ii gpgv | + | |
| - | ii grep | + | |
| - | ii gzip | + | |
| - | ii hostname | + | |
| - | ii init-system-helpers | + | |
| - | ii libacl1: | + | |
| - | ii libapt-pkg5.0: | + | |
| - | ii libattr1: | + | |
| - | ii libaudit-common | + | |
| - | ii libaudit1: | + | |
| - | ii libblkid1: | + | |
| - | ii libbz2-1.0: | + | |
| - | ii libc-bin | + | |
| - | ii libc6: | + | |
| - | ii libcap-ng0: | + | |
| - | ii libcom-err2: | + | |
| - | ii libdb5.3: | + | |
| - | ii libdebconfclient0: | + | |
| - | ii libext2fs2: | + | |
| - | ii libfdisk1: | + | |
| - | ii libffi6: | + | |
| - | ii libgcc1: | + | |
| - | ii libgcrypt20: | + | |
| - | ii libgmp10: | + | |
| - | ii libgnutls30: | + | |
| - | ii libgpg-error0: | + | |
| - | ii libhogweed4: | + | |
| - | ii libidn2-0: | + | |
| - | ii liblz4-1: | + | |
| - | ii liblzma5: | + | |
| - | ii libmount1: | + | |
| - | ii libncurses5: | + | |
| - | ii libncursesw5: | + | |
| - | ii libnettle6: | + | |
| - | ii libp11-kit0: | + | |
| - | ii libpam-modules: | + | |
| - | ii libpam-modules-bin | + | |
| - | ii libpam-runtime | + | |
| - | ii libpam0g: | + | |
| - | ii libpcre3: | + | |
| - | ii libprocps6: | + | |
| - | ii libseccomp2: | + | |
| - | ii libselinux1: | + | |
| - | ii libsemanage-common | + | |
| - | ii libsemanage1: | + | |
| - | ii libsepol1: | + | |
| - | ii libsmartcols1: | + | |
| - | ii libss2: | + | |
| - | ii libstdc++6: | + | |
| - | ii libsystemd0: | + | |
| - | ii libtasn1-6: | + | |
| - | ii libtinfo5: | + | |
| - | ii libudev1: | + | |
| - | ii libunistring2: | + | |
| - | ii libuuid1: | + | |
| - | ii libzstd1: | + | |
| - | ii login 1: | + | |
| - | ii lsb-base | + | |
| - | ii mawk | + | |
| - | ii mount 2.31.1-0.4ubuntu3.3 | + | |
| - | ii ncurses-base | + | |
| - | ii ncurses-bin | + | |
| - | ii passwd | + | |
| - | ii perl-base | + | |
| - | ii procps | + | |
| - | ii sed 4.4-2 | + | |
| - | ii sensible-utils | + | |
| - | ii sysvinit-utils | + | |
| - | ii tar 1.29b-2ubuntu0.1 | + | |
| - | ii ubuntu-keyring | + | |
| - | ii util-linux | + | |
| - | ii zlib1g: | + | |
| - | root@835001339e79:/# | + | |
| - | exit | + | |
| - | root@debian9: | + | |
| </ | </ | ||
| - | Les options de la commande docker run peuvent être visualisées avec la commande : | + | <WRAP center round important |
| - | + | **Important** | |
| - | < | + | |
| - | root@debian9: | + | |
| - | + | ||
| - | Usage: | + | |
| - | + | ||
| - | Run a command in a new container | + | |
| - | + | ||
| - | Options: | + | |
| - | --add-host list Add a custom host-to-IP mapping (host:ip) | + | |
| - | -a, --attach list Attach to STDIN, STDOUT or STDERR | + | |
| - | --blkio-weight uint16 | + | |
| - | --blkio-weight-device list Block IO weight (relative device weight) (default []) | + | |
| - | --cap-add list Add Linux capabilities | + | |
| - | --cap-drop list Drop Linux capabilities | + | |
| - | --cgroup-parent string | + | |
| - | --cidfile string | + | |
| - | --cpu-period int Limit CPU CFS (Completely Fair Scheduler) period | + | |
| - | --cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota | + | |
| - | --cpu-rt-period int Limit CPU real-time period in microseconds | + | |
| - | --cpu-rt-runtime int Limit CPU real-time runtime in microseconds | + | |
| - | -c, --cpu-shares int CPU shares (relative weight) | + | |
| - | --cpus decimal | + | |
| - | --cpuset-cpus string | + | |
| - | --cpuset-mems string | + | |
| - | -d, --detach | + | |
| - | --detach-keys string | + | |
| - | --device list Add a host device to the container | + | |
| - | --device-cgroup-rule list Add a rule to the cgroup allowed devices list | + | |
| - | --device-read-bps list Limit read rate (bytes per second) from a device (default []) | + | |
| - | --device-read-iops list Limit read rate (IO per second) from a device (default []) | + | |
| - | --device-write-bps list Limit write rate (bytes per second) to a device (default []) | + | |
| - | --device-write-iops list Limit write rate (IO per second) to a device (default []) | + | |
| - | --disable-content-trust | + | |
| - | --dns list Set custom DNS servers | + | |
| - | --dns-option list Set DNS options | + | |
| - | --dns-search list Set custom DNS search domains | + | |
| - | --entrypoint string | + | |
| - | -e, --env list Set environment variables | + | |
| - | --env-file list Read in a file of environment variables | + | |
| - | --expose list Expose a port or a range of ports | + | |
| - | --group-add list Add additional groups to join | + | |
| - | --health-cmd string | + | |
| - | --health-interval duration | + | |
| - | --health-retries int | + | |
| - | --health-start-period duration | + | |
| - | --health-timeout duration | + | |
| - | --help | + | |
| - | -h, --hostname string | + | |
| - | --init | + | |
| - | -i, --interactive | + | |
| - | --ip string | + | |
| - | --ip6 string | + | |
| - | --ipc string | + | |
| - | --isolation string | + | |
| - | --kernel-memory bytes Kernel memory limit | + | |
| - | -l, --label list Set meta data on a container | + | |
| - | --label-file list Read in a line delimited file of labels | + | |
| - | --link list Add link to another container | + | |
| - | --link-local-ip list | + | |
| - | --log-driver string | + | |
| - | --log-opt list Log driver options | + | |
| - | --mac-address string | + | |
| - | -m, --memory bytes | + | |
| - | --memory-reservation bytes | + | |
| - | --memory-swap bytes Swap limit equal to memory plus swap: ' | + | |
| - | --memory-swappiness int Tune container memory swappiness (0 to 100) (default -1) | + | |
| - | --mount mount Attach a filesystem mount to the container | + | |
| - | --name string | + | |
| - | --network string | + | |
| - | --network-alias list Add network-scoped alias for the container | + | |
| - | --no-healthcheck | + | |
| - | --oom-kill-disable | + | |
| - | --oom-score-adj int Tune host's OOM preferences (-1000 to 1000) | + | |
| - | --pid string | + | |
| - | --pids-limit int Tune container pids limit (set -1 for unlimited) | + | |
| - | --privileged | + | |
| - | -p, --publish list | + | |
| - | -P, --publish-all | + | |
| - | --read-only | + | |
| - | --restart string | + | |
| - | --rm | + | |
| - | --runtime string | + | |
| - | --security-opt list Security Options | + | |
| - | --shm-size bytes Size of /dev/shm | + | |
| - | --sig-proxy | + | |
| - | --stop-signal string | + | |
| - | --stop-timeout int | + | |
| - | --storage-opt list | + | |
| - | --sysctl map | + | |
| - | --tmpfs list Mount a tmpfs directory | + | |
| - | -t, --tty Allocate a pseudo-TTY | + | |
| - | --ulimit ulimit | + | |
| - | -u, --user string | + | |
| - | --userns string | + | |
| - | --uts string | + | |
| - | -v, --volume list Bind mount a volume | + | |
| - | --volume-driver string | + | |
| - | --volumes-from list Mount volumes from the specified container(s) | + | |
| - | -w, --workdir string | + | |
| - | </ | + | |
| - | + | ||
| - | ====1.3 - Consulter la Liste des Conteneurs et Images==== | + | |
| - | + | ||
| - | Pour consulter tous les conteneurs, utilisez la commande **docker ps** avec l' | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | 3a3f9bda6cbd | + | |
| - | 26ef17bd115d | + | |
| - | </ | + | |
| - | + | ||
| - | <WRAP center round important> | + | |
| - | **Important** | + | |
| </ | </ | ||
| - | Pour consulter la liste des images, utilisez la commande | + | Créez maintenant les secrets |
| < | < | ||
| - | root@debian9:~# docker | + | root@manager:~/postgres# echo " |
| - | REPOSITORY | + | h9tsfbfwz6o0sd35roklwpopi |
| - | ubuntu | + | root@manager: |
| - | hello-world | + | 5lx4zydpfocwgpdto0yy1jod9 |
| </ | </ | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| - | **Important** | + | **Important** |
| </ | </ | ||
| - | ====1.4 - Rechercher une Image dans un Dépôt==== | + | Vérifiez |
| - | + | ||
| - | Pour rechercher une image docker dans le dépôt par défaut, utilisez | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | NAME DESCRIPTION | + | |
| - | centos | + | |
| - | ansible/ | + | |
| - | jdeathe/ | + | |
| - | consol/ | + | |
| - | imagine10255/ | + | |
| - | centos/ | + | |
| - | tutum/ | + | |
| - | gluster/ | + | |
| - | openshift/ | + | |
| - | centos/ | + | |
| - | centos/ | + | |
| - | kinogmt/ | + | |
| - | centos/ | + | |
| - | centos/ | + | |
| - | openshift/ | + | |
| - | pivotaldata/ | + | |
| - | openshift/ | + | |
| - | </ | + | |
| - | + | ||
| - | <WRAP center round important> | + | |
| - | **Important** - Notez que chaque image est référencée par la colonne NAME. Le NAME est sous le format **repository/ | + | |
| - | </ | + | |
| - | + | ||
| - | ====1.5 - Supprimer un Conteneur d'une Image==== | + | |
| - | + | ||
| - | Pour supprimer un conteneur d'une image, il convient d' | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | 3a3f9bda6cbd | + | |
| - | 26ef17bd115d | + | |
| - | root@debian9: | + | |
| - | wizardly_buck | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | 26ef17bd115d | + | |
| - | root@debian9: | + | |
| - | REPOSITORY | + | |
| - | ubuntu | + | |
| - | hello-world | + | |
| - | </ | + | |
| - | + | ||
| - | <WRAP center round important> | + | |
| - | **Important** - Notez que dans le cas de l' | + | |
| - | </ | + | |
| - | + | ||
| - | ====1.6 -Créer une Image à partir d'un Conteneur Modifié=== | + | |
| - | + | ||
| - | Modifier un conteneur d'une image : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | root@54b0dae2f3a9:/# | + | |
| - | bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var | + | |
| - | root@54b0dae2f3a9:/# | + | |
| - | root@54b0dae2f3a9:/# | + | |
| - | bin boot dev etc lib lib64 media mnt opt proc root run sbin srv sys tmp usr var | + | |
| - | root@54b0dae2f3a9:/# | + | |
| - | exit | + | |
| - | root@debian9: | + | |
| - | </ | + | |
| - | + | ||
| - | <WRAP center round important> | + | |
| - | **Important** - Notez ici la suppression du répertoire **home** dans le conteneur **54b0dae2f3a9**. | + | |
| - | </ | + | |
| - | + | ||
| - | Consultez la différence entre le conteneur et l' | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | 54b0dae2f3a9 | + | |
| - | 26ef17bd115d | + | |
| - | root@debian9: | + | |
| - | C /root | + | |
| - | A / | + | |
| - | D /home | + | |
| - | </ | + | |
| - | + | ||
| - | <WRAP center round important> | + | |
| - | **Important** - La sortie de la commande **docker diff** comporte des lettres dont les significations sont les suivantes : C = Create, D = Delete, A = Add. | + | |
| - | </ | + | |
| - | + | ||
| - | Créez un autre conteneur à partir de l' | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | root@92f0d4bb7967:/# | + | |
| - | bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var | + | |
| - | root@92f0d4bb7967:/# | + | |
| - | exit | + | |
| - | root@debian9: | + | |
| - | </ | + | |
| - | + | ||
| - | <WRAP center round important> | + | |
| - | **Important** - Dans ce nouveau conteneur, le répertoire **/home** est présent | + | |
| - | </ | + | |
| - | + | ||
| - | Créez maintenant l' | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | 92f0d4bb7967 | + | |
| - | 54b0dae2f3a9 | + | |
| - | 26ef17bd115d | + | |
| - | root@debian9: | + | |
| - | sha256: | + | |
| - | root@debian9: | + | |
| - | REPOSITORY | + | |
| - | ubuntu_1 | + | |
| - | ubuntu | + | |
| - | hello-world | + | |
| - | </ | + | |
| - | + | ||
| - | ====1.7 - Supprimer une Image==== | + | |
| - | + | ||
| - | Créez maintenant un conteneur à partir de la nouvelle image **ubuntu_1** : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | root@904215fb79b4:/# | + | |
| - | bin boot dev etc lib lib64 media mnt opt proc root run sbin srv sys tmp usr var | + | |
| - | root@904215fb79b4:/# | + | |
| - | exit | + | |
| - | root@debian9: | + | |
| - | </ | + | |
| - | + | ||
| - | <WRAP center round important> | + | |
| - | **Important** - Notez l' | + | |
| - | </ | + | |
| - | + | ||
| - | Essayez de supprimer l' | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | Error response from daemon: conflict: unable to remove repository reference " | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | 904215fb79b4 | + | |
| - | 92f0d4bb7967 | + | |
| - | 54b0dae2f3a9 | + | |
| - | 26ef17bd115d | + | |
| - | </ | + | |
| - | + | ||
| - | <WRAP center round important> | + | |
| - | **Important** - Notez qu'il n'est pas possible de supprimer l' | + | |
| - | </ | + | |
| - | + | ||
| - | Supprimez donc le conteneur **priceless_swirles** ainsi que l' | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | priceless_swirles | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | 92f0d4bb7967 | + | |
| - | 54b0dae2f3a9 | + | |
| - | 26ef17bd115d | + | |
| - | root@debian9: | + | |
| - | Untagged: ubuntu_1: | + | |
| - | Deleted: sha256: | + | |
| - | Deleted: sha256: | + | |
| - | root@debian9: | + | |
| - | REPOSITORY | + | |
| - | ubuntu | + | |
| - | hello-world | + | |
| - | </ | + | |
| - | + | ||
| - | Pour pouvoir supprimer tous les conteneurs, listez-les par leur **Container ID** : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | 92f0d4bb7967 | + | |
| - | 54b0dae2f3a9 | + | |
| - | 26ef17bd115d | + | |
| - | </ | + | |
| - | + | ||
| - | Supprimer toutes les conteneurs : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | 92f0d4bb7967 | + | |
| - | 54b0dae2f3a9 | + | |
| - | 26ef17bd115d | + | |
| - | root@debian9: | + | |
| - | root@debian9: | + | |
| - | </ | + | |
| - | + | ||
| - | Pour supprimer un conteneur dès la fin de son exécution, utilisez l' | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | root@d123b0112fc2:/# | + | |
| - | bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var | + | |
| - | root@d123b0112fc2:/# | + | |
| - | exit | + | |
| - | root@debian9: | + | |
| - | root@debian9: | + | |
| - | </ | + | |
| - | + | ||
| - | ====1.8 - Créer un Conteneur avec un Nom Spécifique==== | + | |
| - | + | ||
| - | Créez maintenant un conteneur avec un nom spécifique | + | |
| < | < | ||
| - | root@debian9:~# docker | + | root@manager:~/postgres# docker |
| - | root@04b5ab87539a:/# | + | ID |
| - | bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var | + | 5lx4zydpfocwgpdto0yy1jod9 |
| - | root@04b5ab87539a:/# | + | h9tsfbfwz6o0sd35roklwpopi |
| - | exit | + | lpk8eq80qvfiqw7z1686fmj5t |
| - | root@debian9: | + | |
| - | CONTAINER | + | |
| - | 04b5ab87539a | + | |
| </ | </ | ||
| - | Pour obtenir de l' | + | Pour obtenir de l' |
| < | < | ||
| - | root@debian9:~# docker inspect | + | root@manager:~/postgres# docker |
| [ | [ | ||
| { | { | ||
| - | "Id": "04b5ab87539aed114cbfc3ba15d10be61cd88b9cffc88c6de9bd26e203b363b5", | + | "ID": "5lx4zydpfocwgpdto0yy1jod9", |
| - | "Created": | + | "Version": { |
| - | " | + | "Index": |
| - | " | + | |
| - | "State": { | + | |
| - | "Status": | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| }, | }, | ||
| - | "Image": "sha256:94e814e2efa8845d95b2112d54497fbad173e45121ce9255b93401392f538499", | + | "CreatedAt": "2021-04-15T03:49:36.344367554Z", |
| - | " | + | "UpdatedAt": "2021-04-15T03:49:36.344367554Z", |
| - | "HostnamePath": "/ | + | "Spec": { |
| - | " | + | " |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | 0, | + | |
| - | 0 | + | |
| - | ], | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | "/ | + | |
| - | "/ | + | |
| - | "/ | + | |
| - | "/ | + | |
| - | "/ | + | |
| - | "/ | + | |
| - | "/ | + | |
| - | "/ | + | |
| - | "/ | + | |
| - | "/ | + | |
| - | ], | + | |
| - | " | + | |
| - | "/ | + | |
| - | "/ | + | |
| - | "/ | + | |
| - | "/ | + | |
| - | "/ | + | |
| - | ] | + | |
| - | }, | + | |
| - | "GraphDriver": { | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | ], | + | |
| - | " | + | |
| - | "/ | + | |
| - | ], | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| " | " | ||
| - | }, | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | } | ||
| - | } | ||
| } | } | ||
| } | } | ||
| Ligne 843: | Ligne 137: | ||
| </ | </ | ||
| - | ====1.9 - Exécuter une Commande | + | <WRAP center round important 50%> |
| + | **Important** : On peut constater | ||
| + | </ | ||
| - | Pour exécuter une commande spécifique dans un conteneur, passez | + | L' |
| < | < | ||
| - | root@debian9:~# docker | + | root@manager:~/postgres# docker |
| - | PATH=/ | + | ID: |
| - | HOSTNAME=77bb110031aa | + | Name: |
| - | HOME=/ | + | Driver: |
| - | root@debian9:~# | + | Created at: |
| + | Updated at: | ||
| </ | </ | ||
| - | ====1.10 - Injecter des Variables d' | + | Créez maintenant le fichier |
| - | + | ||
| - | Pour injecter une ou des variables d' | + | |
| < | < | ||
| - | root@debian9:~# vi env.list | + | root@manager:~/postgres# vi postgres-secrets.yaml |
| - | root@debian9:~# cat env.list | + | root@manager:~/postgres# cat postgres-secrets.yaml |
| - | EDITOR=vim | + | version: ' |
| - | HOSTNAME=ubuntudocker | + | |
| - | </ | + | |
| - | < | + | services: |
| - | root@debian9:~# docker run --rm --env-file=env.list ubuntu env | + | |
| - | PATH=/ | + | |
| - | HOSTNAME=ubuntudocker | + | |
| - | EDITOR=vim | + | |
| - | HOME=/ | + | |
| - | root@debian9: | + | |
| - | </ | + | |
| - | ====1.11 | + | db: |
| + | image: postgres | ||
| + | restart: always | ||
| + | environment: | ||
| + | POSTGRES_USER_FILE: | ||
| + | POSTGRES_PASSWORD_FILE: | ||
| + | POSTGRES_DB_FILE: | ||
| + | secrets: | ||
| + | - pg_password | ||
| + | - pg_user | ||
| + | - pg_database | ||
| - | Pour modifier le nom d' | + | adminer: |
| + | image: adminer | ||
| + | ports: | ||
| + | - 8080:8080 | ||
| - | < | + | secrets: |
| - | root@debian9:~# docker run -it --rm -h ubuntudocker ubuntu | + | |
| - | root@ubuntudocker:/# hostname | + | |
| - | ubuntudocker | + | |
| - | root@ubuntudocker:/# exit | + | |
| - | exit | + | |
| - | root@debian9:~# | + | |
| </ | </ | ||
| - | ====1.12 - Mapper des Ports d'un Conteneur===== | + | Notez que dans ce fichier les trois variables **POSTGRES_USER**, |
| - | Démarrer un conteneur de nginx sur le port localhost 81 : | + | Deuxièmement la section suivantes spécifie les noms des secrets à utiliser avec le service |
| - | <code> | + | <file> |
| - | root@debian9:~# docker run -it -p 81:80 nginx | + | |
| - | Unable to find image ' | + | - pg_password |
| - | latest: Pulling from library/ | + | - pg_user |
| - | 27833a3ba0a5: | + | - pg_database |
| - | e83729dd399a: | + | </file> |
| - | ebc6a67df66d: | + | |
| - | Digest: sha256: | + | |
| - | Status: Downloaded newer image for nginx: | + | |
| - | ^Croot@debian9: | + | |
| - | </code> | + | |
| - | Notez que c'est bloquant. Le fait d' | + | La dernière section spécifie |
| - | <code> | + | <file> |
| - | ^Croot@debian9:~# docker ps -a | + | secrets: |
| - | CONTAINER ID IMAGE | + | |
| - | 4f157e179134 | + | |
| - | 04b5ab87539a | + | |
| - | </code> | + | external: true |
| + | pg_database: | ||
| + | external: true | ||
| + | </file> | ||
| - | ====1.13 - Démarrer un Conteneur en mode Détaché==== | + | <WRAP center round important 50%> |
| + | **Important** : Le terme **externe** indique que les secrets ne seront pas stockés dans l' | ||
| + | </ | ||
| - | Démarrez | + | Déployez |
| < | < | ||
| - | root@debian9:~# docker run -d -p 81:80 nginx | + | root@manager:~/postgres# docker |
| - | aabb064d4b0ade1f19216b6174631fa32a2053f6aa9d59bd724ea90ce534b004 | + | Ignoring unsupported options: restart |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | aabb064d4b0a | + | |
| - | 4f157e179134 | + | |
| - | 04b5ab87539a | + | |
| - | </ | + | |
| - | + | ||
| - | ====1.14 - Accèder aux Services d'un Conteneur de l' | + | |
| - | + | ||
| - | Installez le navigateur texte **lynx** : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | Lecture des listes de paquets... Fait | + | |
| - | Construction de l' | + | |
| - | Lecture des informations d' | + | |
| - | The following additional packages will be installed: | + | |
| - | lynx-common | + | |
| - | Les NOUVEAUX paquets suivants seront installés : | + | |
| - | lynx lynx-common | + | |
| - | 0 mis à jour, 2 nouvellement installés, 0 à enlever et 94 non mis à jour. | + | |
| - | Il est nécessaire de prendre 1 730 ko dans les archives. | + | |
| - | Après cette opération, 5 590 ko d' | + | |
| - | Souhaitez-vous continuer ? [O/n] o | + | |
| - | Réception de:1 http:// | + | |
| - | Réception de:2 http:// | + | |
| - | 1 730 ko réceptionnés en 6s (283 ko/s) | + | |
| - | Sélection du paquet lynx-common précédemment désélectionné. | + | |
| - | (Lecture de la base de données... 113082 fichiers et répertoires déjà installés.) | + | |
| - | Préparation du dépaquetage de .../ | + | |
| - | Dépaquetage de lynx-common (2.8.9dev11-1) ... | + | |
| - | Sélection du paquet lynx précédemment désélectionné. | + | |
| - | Préparation du dépaquetage de .../ | + | |
| - | Dépaquetage de lynx (2.8.9dev11-1) ... | + | |
| - | Traitement des actions différées (« triggers ») pour mime-support (3.60) ... | + | |
| - | Traitement des actions différées (« triggers ») pour man-db (2.7.6.1-2) ... | + | |
| - | Paramétrage de lynx-common (2.8.9dev11-1) ... | + | |
| - | Paramétrage de lynx (2.8.9dev11-1) ... | + | |
| - | update-alternatives: | + | |
| - | </ | + | |
| - | + | ||
| - | Vérifiez que nginx répond aux requetes : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | | + | |
| - | + | ||
| - | If you see this page, the nginx web server is successfully installed | + | |
| - | and working. Further configuration is required. | + | |
| - | + | ||
| - | For online documentation and support please refer to [1]nginx.org. | + | |
| - | | + | |
| - | + | ||
| - | Thank you for using nginx. | + | |
| - | + | ||
| - | Références | + | |
| - | + | ||
| - | 1. http:// | + | |
| - | 2. http:// | + | |
| - | </ | + | |
| - | + | ||
| - | ====1.15 - Arrêter et Démarrer un Conteneur==== | + | |
| - | + | ||
| - | Arrêtez le conteneur nginx : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | aabb064d4b0a | + | |
| - | 4f157e179134 | + | |
| - | 04b5ab87539a | + | |
| - | root@debian9:~# docker stop aabb | + | |
| - | aabb | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | aabb064d4b0a | + | |
| - | 4f157e179134 | + | |
| - | 04b5ab87539a | + | |
| - | </ | + | |
| - | + | ||
| - | Démarrez de nouveau le conteneur de nginx : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | aabb | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | aabb064d4b0a | + | |
| - | 4f157e179134 | + | |
| - | 04b5ab87539a | + | |
| - | </ | + | |
| - | + | ||
| - | ====1.16 - Utiliser des Signaux avec un Conteneur==== | + | |
| - | + | ||
| - | Utilisez un signal pour tuer le processus du conteneur de nginx : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | aabb | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | aabb064d4b0a | + | |
| - | 4f157e179134 | + | |
| - | 04b5ab87539a | + | |
| - | </ | + | |
| - | + | ||
| - | Redémarrez un conteneur en cours : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | aabb | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | aabb064d4b0a | + | |
| - | 4f157e179134 | + | |
| - | 04b5ab87539a | + | |
| - | root@debian9: | + | |
| - | aabb | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | aabb064d4b0a | + | |
| - | 4f157e179134 | + | |
| - | 04b5ab87539a | + | |
| - | </ | + | |
| - | + | ||
| - | ====1.17 - Forcer la Suppression d'un Conteneur en cours d' | + | |
| - | + | ||
| - | Supprimez un conteneur en cours d' | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | Error response from daemon: You cannot remove a running container aabb064d4b0ade1f19216b6174631fa32a2053f6aa9d59bd724ea90ce534b004. Stop the container before attempting removal or force remove | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | aabb064d4b0a | + | |
| - | 4f157e179134 | + | |
| - | 04b5ab87539a | + | |
| - | root@debian9: | + | |
| - | aabb | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | 4f157e179134 | + | |
| - | 04b5ab87539a | + | |
| - | </ | + | |
| - | + | ||
| - | ===1.18 - Utilisation Simple d'un Volume=== | + | |
| - | + | ||
| - | Créez le fichier index.html et placez-le dans le répertoire /root/www : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | root@debian9: | + | |
| - | root@debian9: | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | </ | + | |
| - | </ | + | |
| - | root@debian9: | + | |
| - | </ | + | |
| - | + | ||
| - | Indiquez au conteneur que son répertoire **/ | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | c080793965de8a6a60db212d7e4d96de84b55352c224c054dced75b409e39bf2 | + | |
| - | root@debian9: | + | |
| - | Accueil du site nginx | + | |
| - | root@debian9: | + | Creating network postgres_default |
| + | Creating service postgres_db | ||
| + | Creating service postgres_adminer | ||
| </ | </ | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| - | **Important** | + | **Important** |
| </ | </ | ||
| - | ====1.19 | + | Connectez-vous maintenant à Apache Guacamole et ouvrez |
| - | Téléchargez l' | + | {{ :elearning: |
| - | < | + | Validez le formulaire et vérifiez que les secrets ont été pris en compte |
| - | root@debian9:~# docker pull centos | + | |
| - | Using default tag: latest | + | |
| - | latest: Pulling from library/ | + | |
| - | 8ba884070f61: | + | |
| - | Digest: sha256: | + | |
| - | Status: Downloaded newer image for centos: | + | |
| - | </ | + | |
| - | Vérifiez le contenu de l' | + | {{ :elearning:workbooks:docker2:2021-04-15_1_.png?direct&600 |}} |
| - | + | ||
| - | < | + | |
| - | root@debian9:~# docker run -it centos bash | + | |
| - | [root@86252a3f00f4 /]# cat / | + | |
| - | CentOS Linux release 7.6.1810 (Core) | + | |
| - | [root@86252a3f00f4 /]# rpm -qa | more | + | |
| - | bind-license-9.9.4-73.el7_6.noarch | + | |
| - | bash-4.2.46-31.el7.x86_64 | + | |
| - | glibc-common-2.17-260.el7_6.3.x86_64 | + | |
| - | nss-softokn-freebl-3.36.0-5.el7_5.x86_64 | + | |
| - | filesystem-3.2-25.el7.x86_64 | + | |
| - | glibc-2.17-260.el7_6.3.x86_64 | + | |
| - | nspr-4.19.0-1.el7_5.x86_64 | + | |
| - | popt-1.13-16.el7.x86_64 | + | |
| - | libcom_err-1.42.9-13.el7.x86_64 | + | |
| - | libcap-2.22-9.el7.x86_64 | + | |
| - | libstdc++-4.8.5-36.el7.x86_64 | + | |
| - | info-5.1-5.el7.x86_64 | + | |
| - | gawk-4.0.2-4.el7_3.1.x86_64 | + | |
| - | libselinux-2.5-14.1.el7.x86_64 | + | |
| - | grep-2.20-3.el7.x86_64 | + | |
| - | keyutils-libs-1.5.8-3.el7.x86_64 | + | |
| - | libverto-0.2.5-4.el7.x86_64 | + | |
| - | p11-kit-trust-0.23.5-3.el7.x86_64 | + | |
| - | openssl-libs-1.0.2k-16.el7.x86_64 | + | |
| - | krb5-libs-1.15.1-37.el7_6.x86_64 | + | |
| - | xz-libs-5.2.2-1.el7.x86_64 | + | |
| - | libdb-5.3.21-24.el7.x86_64 | + | |
| - | libgpg-error-1.12-3.el7.x86_64 | + | |
| - | libgcrypt-1.5.3-14.el7.x86_64 | + | |
| - | lua-5.1.4-15.el7.x86_64 | + | |
| - | libuuid-2.23.2-59.el7.x86_64 | + | |
| - | libmount-2.23.2-59.el7.x86_64 | + | |
| - | shared-mime-info-1.8-4.el7.x86_64 | + | |
| - | gzip-1.5-10.el7.x86_64 | + | |
| - | findutils-4.5.11-6.el7.x86_64 | + | |
| - | diffutils-3.3-4.el7.x86_64 | + | |
| - | expat-2.1.0-10.el7_3.x86_64 | + | |
| - | audit-libs-2.8.4-4.el7.x86_64 | + | |
| - | pam-1.1.8-22.el7.x86_64 | + | |
| - | nss-softokn-3.36.0-5.el7_5.x86_64 | + | |
| - | nss-3.36.0-7.1.el7_6.x86_64 | + | |
| - | libassuan-2.1.0-3.el7.x86_64 | + | |
| - | nss-tools-3.36.0-7.1.el7_6.x86_64 | + | |
| - | gobject-introspection-1.56.1-1.el7.x86_64 | + | |
| - | --More-- | + | |
| - | </ | + | |
| - | + | ||
| - | ====1.20 - S' | + | |
| - | + | ||
| - | Arretez le conteneur. Démarrez le conteneur puis rattachez-vous au conteneur | + | |
| - | + | ||
| - | < | + | |
| - | [root@86252a3f00f4 /]# exit | + | |
| - | exit | + | |
| - | root@debian9:~# docker ps -a | + | |
| - | CONTAINER ID IMAGE | + | |
| - | 86252a3f00f4 | + | |
| - | c080793965de | + | |
| - | 4f157e179134 | + | |
| - | 04b5ab87539a | + | |
| - | root@debian9: | + | |
| - | 8625 | + | |
| - | root@debian9: | + | |
| - | [root@86252a3f00f4 /]# ls | + | |
| - | anaconda-post.log | + | |
| - | [root@86252a3f00f4 /]# | + | |
| - | </ | + | |
| - | + | ||
| - | ====1.21 - Installer un logiciel dans le conteneur=== | + | |
| - | + | ||
| - | Créez le fichier **/ | + | |
| - | + | ||
| - | < | + | |
| - | [root@86252a3f00f4 /]# vi / | + | |
| - | [root@86252a3f00f4 /]# cat / | + | |
| - | [mongodb-org-4.2] | + | |
| - | name=MongoDB Repository | + | |
| - | baseurl=https:// | + | |
| - | gpgcheck=1 | + | |
| - | enabled=1 | + | |
| - | gpgkey=https:// | + | |
| - | [root@86252a3f00f4 /]# | + | |
| - | </ | + | |
| - | + | ||
| - | Installez mongo : | + | |
| - | + | ||
| - | < | + | |
| - | [root@86252a3f00f4 /]# yum install -y mongodb-org | + | |
| - | </ | + | |
| - | + | ||
| - | Démarrez mongod : | + | |
| - | + | ||
| - | < | + | |
| - | [root@86252a3f00f4 /]# mongod --config / | + | |
| - | [1] 82 | + | |
| - | [root@86252a3f00f4 /]# about to fork child process, waiting until server is ready for connections. | + | |
| - | forked process: 84 | + | |
| - | child process started successfully, | + | |
| - | + | ||
| - | [1]+ Done mongod --config / | + | |
| - | [root@86252a3f00f4 /]# | + | |
| - | </ | + | |
| - | + | ||
| - | Vérifiez que mongod est démarré : | + | |
| - | + | ||
| - | < | + | |
| - | [root@86252a3f00f4 /]# ps aux | + | |
| - | USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND | + | |
| - | root | + | |
| - | root 84 1.2 2.2 294692 46716 ? | + | |
| - | root | + | |
| - | </ | + | |
| - | + | ||
| - | Utilisez le client mongo pour se connecter au serveur : | + | |
| - | + | ||
| - | < | + | |
| - | [root@86252a3f00f4 /]# mongo | + | |
| - | MongoDB shell version: 4.2.2 | + | |
| - | connecting to: test | + | |
| - | Welcome to the MongoDB shell. | + | |
| - | For interactive help, type " | + | |
| - | For more comprehensive documentation, | + | |
| - | http:// | + | |
| - | Questions? Try the support group | + | |
| - | http:// | + | |
| - | Server has startup warnings: | + | |
| - | 2019-04-09T17: | + | |
| - | 2019-04-09T17: | + | |
| - | > | + | |
| - | </ | + | |
| - | + | ||
| - | Sortez de mongo et du conteneur : | + | |
| - | + | ||
| - | < | + | |
| - | > exit | + | |
| - | bye | + | |
| - | [root@86252a3f00f4 /]# exit | + | |
| - | exit | + | |
| - | root@debian9: | + | |
| - | </ | + | |
| - | + | ||
| - | ====1.22 - Utilisation de la commande docker commit==== | + | |
| - | + | ||
| - | Créez maintenant une nouvelle image à partir de votre conteneur : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | 86252a3f00f4 | + | |
| - | c080793965de | + | |
| - | 4f157e179134 | + | |
| - | 04b5ab87539a | + | |
| - | root@debian9: | + | |
| - | sha256: | + | |
| - | </ | + | |
| - | + | ||
| - | Supprimez le conteneur utilisé pour créer l' | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | 8625 | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | c080793965de | + | |
| - | 4f157e179134 | + | |
| - | 04b5ab87539a | + | |
| - | </ | + | |
| - | + | ||
| - | Utilisez la nouvelle image pour lancer un conteneur nommé **mongo** : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | [root@d20fb56a38b0 /]# ls / | + | |
| - | / | + | |
| - | / | + | |
| - | [root@d20fb56a38b0 /]# ps aux | + | |
| - | USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND | + | |
| - | root | + | |
| - | root 15 0.0 0.1 51748 3468 pts/0 R+ | + | |
| - | </ | + | |
| - | + | ||
| - | Editez le fichier /etc/bashrc : | + | |
| - | + | ||
| - | < | + | |
| - | [root@d20fb56a38b0 /]# echo "/ | + | |
| - | [root@d20fb56a38b0 /]# tail / | + | |
| - | . " | + | |
| - | fi | + | |
| - | fi | + | |
| - | done | + | |
| - | + | ||
| - | unset i | + | |
| - | unset -f pathmunge | + | |
| - | fi | + | |
| - | # vim: | + | |
| - | / | + | |
| - | </ | + | |
| - | + | ||
| - | Consultez la liste des conteneurs et relevez le CONTAINER ID du conteneur **mongo** : | + | |
| - | + | ||
| - | < | + | |
| - | [root@d20fb56a38b0 /]# exit | + | |
| - | exit | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | d20fb56a38b0 | + | |
| - | c080793965de | + | |
| - | 4f157e179134 | + | |
| - | 04b5ab87539a | + | |
| - | </ | + | |
| - | + | ||
| - | Utilisez la commande commit pour " | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | sha256: | + | |
| - | </ | + | |
| - | + | ||
| - | Démarrez de nouveau le conteneur pour vérifier que mongod fonctionne : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | d20f | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | c080793965de | + | |
| - | 4f157e179134 | + | |
| - | 04b5ab87539a | + | |
| - | root@debian9: | + | |
| - | [root@bcec3f27ed58 /]# about to fork child process, waiting until server is ready for connections. | + | |
| - | forked process: 16 | + | |
| - | child process started successfully, | + | |
| - | + | ||
| - | [1]+ Done / | + | |
| - | [root@bcec3f27ed58 /]# ps aux | + | |
| - | USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND | + | |
| - | root | + | |
| - | root 16 2.0 2.4 298788 49276 ? Sl | + | |
| - | root 39 0.0 0.1 51748 3476 pts/0 R+ | + | |
| - | [root@bcec3f27ed58 /]# | + | |
| - | </ | + | |
| - | + | ||
| - | ====1.23 - Se connecter au serveur du conteneur de l' | + | |
| - | + | ||
| - | Pour pouvoir se connecter à mongodb depuis la machine hôte, il convient d' | + | |
| - | + | ||
| - | < | + | |
| - | [root@bcec3f27ed58 /]# vi / | + | |
| - | [root@bcec3f27ed58 /]# cat / | + | |
| - | | + | |
| - | </ | + | |
| - | + | ||
| - | Sortez du conteneur, re-créez une image, supprimez le conteneur utilisé et relancez de nouveau le conteneur : | + | |
| - | + | ||
| - | < | + | |
| - | [root@bcec3f27ed58 /]# exit | + | |
| - | exit | + | |
| - | root@debian9: | + | |
| - | sha256: | + | |
| - | root@debian9: | + | |
| - | mongo | + | |
| - | root@debian9: | + | |
| - | [root@d2ddb4f8ca8a /]# about to fork child process, waiting until server is ready for connections. | + | |
| - | forked process: 16 | + | |
| - | [root@d2ddb4f8ca8a /]# child process started successfully, | + | |
| - | + | ||
| - | [1]+ Done / | + | |
| - | [root@d2ddb4f8ca8a /]# | + | |
| - | </ | + | |
| - | + | ||
| - | Dans votre machine hôte, configurez le dépôt de mongodb : | + | |
| - | + | ||
| - | < | + | |
| - | [root@f5b45072b831 /]# exit | + | |
| - | root@debian9: | + | |
| - | root@debian9: | + | |
| - | root@debian9: | + | |
| - | root@debian9: | + | |
| - | Executing: / | + | |
| - | gpg: key 68818C72E52529D4: | + | |
| - | gpg: Total number processed: 1 | + | |
| - | gpg: | + | |
| - | root@debian9: | + | |
| - | root@debian9: | + | |
| - | deb http:// | + | |
| - | root@debian9: | + | |
| - | root@debian9: | + | |
| - | </ | + | |
| - | + | ||
| - | Cette fois, installez uniquement le client de mongodb : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | Lecture des listes de paquets... Fait | + | |
| - | Construction de l' | + | |
| - | Lecture des informations d' | + | |
| - | Les NOUVEAUX paquets suivants seront installés : | + | |
| - | mongodb-org-shell | + | |
| - | 0 mis à jour, 1 nouvellement installés, 0 à enlever et 95 non mis à jour. | + | |
| - | Il est nécessaire de prendre 9 809 ko dans les archives. | + | |
| - | Après cette opération, 39,8 Mo d' | + | |
| - | Réception de:1 http:// | + | |
| - | 9 809 ko réceptionnés en 7s (1 245 ko/s) | + | |
| - | Sélection du paquet mongodb-org-shell précédemment désélectionné. | + | |
| - | (Lecture de la base de données... 91513 fichiers et répertoires déjà installés.) | + | |
| - | Préparation du dépaquetage de .../ | + | |
| - | Dépaquetage de mongodb-org-shell (4.0.8) ... | + | |
| - | Paramétrage de mongodb-org-shell (4.0.8) ... | + | |
| - | Traitement des actions différées (« triggers ») pour man-db (2.7.6.1-2) ... | + | |
| - | </ | + | |
| - | + | ||
| - | Notez qu'à ce stade le conteneur ne possède pas d' | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | </ | + | |
| - | + | ||
| - | Démarrez donc le conteneur et cherchez l' | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | mongo | + | |
| - | root@debian9: | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | </ | + | |
| - | Connectez-vous maintenant à votre mongodb à partir de la machine hôte : | + | Dernièrement, |
| < | < | ||
| - | root@debian9:~# mongo --host 172.17.0.3 | + | root@manager:~/postgres# docker stack ls |
| - | MongoDB shell version v4.0.8 | + | NAME SERVICES |
| - | connecting to: mongodb:// | + | postgres |
| - | WARNING: No implicit session: Logical Sessions are only supported on server versions 3.6 and greater. | + | root@manager:~/postgres# docker stack rm postgres |
| - | Implicit session: dummy session | + | Removing service postgres_adminer |
| - | MongoDB server version: 4.2.2 | + | Removing service postgres_db |
| - | WARNING: shell and server versions do not match | + | Removing network postgres_default |
| - | Welcome to the MongoDB shell. | + | |
| - | For interactive help, type " | + | |
| - | For more comprehensive documentation, | + | |
| - | http:// | + | |
| - | Questions? Try the support group | + | |
| - | http:// | + | |
| - | Server has startup warnings: | + | |
| - | 2019-04-09T17: | + | |
| - | 2019-04-09T17: | + | |
| - | > | + | |
| </ | </ | ||
| Ligne 1494: | Ligne 254: | ||
| < | < | ||
| - | root@debian9:~# cat /etc/group | grep docker | + | root@manager:~# cat /etc/group | grep docker |
| docker: | docker: | ||
| - | root@debian9:~# usermod -aG docker trainee | + | root@manager:~# usermod -aG docker trainee |
| - | root@debian9:~# exit | + | root@manager:~# exit |
| déconnexion | déconnexion | ||
| trainee@manager: | trainee@manager: | ||
| Ligne 1534: | Ligne 294: | ||
| < | < | ||
| trainee@manager: | trainee@manager: | ||
| - | Mot de passe : fenestros | + | Password: fenestros |
| - | root@debian9:~# git clone https:// | + | |
| - | Clonage dans ' | + | root@manager:~# git clone https:// |
| + | Cloning in ' | ||
| remote: Enumerating objects: 18, done. | remote: Enumerating objects: 18, done. | ||
| remote: Counting objects: 100% (18/18), done. | remote: Counting objects: 100% (18/18), done. | ||
| remote: Compressing objects: 100% (16/16), done. | remote: Compressing objects: 100% (16/16), done. | ||
| remote: Total 1921 (delta 5), reused 6 (delta 2), pack-reused 1903 | remote: Total 1921 (delta 5), reused 6 (delta 2), pack-reused 1903 | ||
| - | Réception d' | + | Receiving objects: 100% (1921/ |
| - | Résolution des deltas: 100% (1339/ | + | Delta resolution: 100% (1339/ |
| </ | </ | ||
| Ligne 1548: | Ligne 309: | ||
| < | < | ||
| - | root@debian9:~# cd docker-bench-security/ | + | root@manager:~# cd docker-bench-security/ |
| - | root@debian9: | + | |
| - | # ------------------------------------------------------------------------------ | + | root@manager: |
| - | # Docker Bench for Security v1.3.5 | + | # -------------------------------------------------------------------------------------------- |
| + | # Docker Bench for Security v1.6.0 | ||
| # | # | ||
| - | # Docker, Inc. (c) 2015- | + | # Docker, Inc. (c) 2015-2023 |
| # | # | ||
| # Checks for dozens of common best-practices around deploying Docker containers in production. | # Checks for dozens of common best-practices around deploying Docker containers in production. | ||
| - | # Inspired by the CIS Docker Benchmark | + | # Based on the CIS Docker Benchmark |
| - | # ------------------------------------------------------------------------------ | + | # -------------------------------------------------------------------------------------------- |
| - | Initializing | + | Initializing |
| + | |||
| + | Section A - Check results | ||
| [INFO] 1 - Host Configuration | [INFO] 1 - Host Configuration | ||
| - | + | [INFO] 1.1 - Linux Hosts Specific Configuration | |
| - | [INFO] 1.1 - General Configuration | + | [WARN] 1.1.1 - Ensure a separate partition for containers has been created (Automated) |
| - | [NOTE] 1.1.1 - Ensure the container host has been Hardened | + | [INFO] 1.1.2 - Ensure only trusted users are allowed to control Docker daemon (Automated) |
| - | [INFO] 1.1.2 - Ensure Docker is up to date | + | [INFO] |
| + | [WARN] 1.1.3 - Ensure auditing is configured for the Docker daemon (Automated) | ||
| + | [WARN] 1.1.4 - Ensure auditing is configured for Docker files and directories -/ | ||
| + | [WARN] 1.1.5 - Ensure auditing is configured for Docker files and directories - / | ||
| + | [WARN] 1.1.6 - Ensure auditing is configured for Docker files and directories - /etc/docker (Automated) | ||
| + | [WARN] 1.1.7 - Ensure auditing is configured for Docker files and directories - docker.service (Automated) | ||
| + | [INFO] 1.1.8 - Ensure auditing is configured for Docker files and directories - containerd.sock (Automated) | ||
| + | [INFO] | ||
| + | [WARN] 1.1.9 - Ensure auditing is configured for Docker files and directories - docker.socket (Automated) | ||
| + | [WARN] 1.1.10 - Ensure auditing is configured for Docker files and directories - / | ||
| + | [INFO] 1.1.11 - Ensure auditing is configured for Dockerfiles and directories - / | ||
| + | [INFO] | ||
| + | [WARN] 1.1.12 - 1.1.12 Ensure auditing is configured for Dockerfiles and directories - / | ||
| + | [INFO] 1.1.13 - Ensure auditing is configured for Docker files and directories - / | ||
| + | [INFO] | ||
| + | [WARN] 1.1.14 - Ensure auditing is configured for Docker files and directories - / | ||
| + | [WARN] 1.1.15 - Ensure auditing is configured for Docker files and directories - / | ||
| + | [INFO] 1.1.16 - Ensure auditing is configured for Docker files and directories - / | ||
| + | [INFO] | ||
| + | [INFO] 1.1.17 - Ensure auditing is configured for Docker files and directories - / | ||
| + | [INFO] | ||
| + | [WARN] 1.1.18 - Ensure auditing is configured for Docker files and directories - / | ||
| + | [INFO] 1.2 - General Configuration | ||
| + | [NOTE] 1.2.1 - Ensure the container host has been Hardened | ||
| + | [PASS] 1.2.2 - Ensure | ||
| [INFO] | [INFO] | ||
| - | [INFO] | ||
| - | [INFO] 1.2 - Linux Hosts Specific Configuration | + | [INFO] |
| - | [WARN] 1.2.1 - Ensure a separate partition | + | [NOTE] 2.1 - Run the Docker daemon as a non-root user, if possible (Manual) |
| - | ... | + | [WARN] 2.2 - Ensure network traffic is restricted between containers on the default bridge (Scored) |
| + | [PASS] 2.3 - Ensure the logging level is set to ' | ||
| + | [PASS] 2.4 - Ensure Docker is allowed to make changes to iptables (Scored) | ||
| + | [PASS] 2.5 - Ensure insecure registries are not used (Scored) | ||
| + | [PASS] 2.6 - Ensure aufs storage driver is not used (Scored) | ||
| + | [INFO] 2.7 - Ensure TLS authentication for Docker daemon is configured (Scored) | ||
| + | [INFO] | ||
| + | [INFO] 2.8 - Ensure the default ulimit is configured appropriately (Manual) | ||
| + | [INFO] | ||
| + | [WARN] | ||
| + | [PASS] 2.10 - Ensure the default cgroup usage has been confirmed (Scored) | ||
| + | [PASS] 2.11 - Ensure base device size is not changed until needed (Scored) | ||
| + | [WARN] 2.12 - Ensure that authorization for Docker client commands is enabled (Scored) | ||
| + | [WARN] 2.13 - Ensure centralized and remote logging is configured (Scored) | ||
| + | [WARN] 2.14 - Ensure containers are restricted from acquiring new privileges (Scored) | ||
| + | [WARN] 2.15 - Ensure live restore is enabled (Scored) | ||
| + | [WARN] 2.16 - Ensure Userland Proxy is Disabled (Scored) | ||
| + | [PASS] 2.17 - Ensure that a daemon-wide custom seccomp profile is applied if appropriate (Manual) | ||
| + | [PASS] 2.18 - Ensure that experimental features are not implemented in production (Scored) | ||
| + | |||
| + | [INFO] 3 - Docker daemon configuration files | ||
| + | [PASS] 3.1 - Ensure that the docker.service file ownership is set to root:root (Automated) | ||
| + | [PASS] 3.2 - Ensure that docker.service file permissions are appropriately set (Automated) | ||
| + | [PASS] 3.3 - Ensure that docker.socket file ownership is set to root:root (Automated) | ||
| + | [PASS] 3.4 - Ensure that docker.socket file permissions are set to 644 or more restrictive (Automated) | ||
| + | [PASS] 3.5 - Ensure that the /etc/docker directory ownership is set to root:root (Automated) | ||
| + | [PASS] 3.6 - Ensure that /etc/docker directory permissions are set to 755 or more restrictively (Automated) | ||
| + | [INFO] 3.7 - Ensure that registry certificate file ownership is set to root:root (Automated) | ||
| + | [INFO] | ||
| + | [INFO] 3.8 - Ensure that registry certificate file permissions are set to 444 or more restrictively (Automated) | ||
| + | [INFO] | ||
| + | [INFO] 3.9 - Ensure that TLS CA certificate file ownership is set to root:root (Automated) | ||
| + | [INFO] | ||
| + | [INFO] 3.10 - Ensure that TLS CA certificate file permissions are set to 444 or more restrictively (Automated) | ||
| + | [INFO] | ||
| + | [INFO] 3.11 - Ensure that Docker server certificate file ownership is set to root:root (Automated) | ||
| + | [INFO] | ||
| + | [INFO] 3.12 - Ensure that the Docker server certificate file permissions are set to 444 or more restrictively (Automated) | ||
| + | [INFO] | ||
| + | [INFO] 3.13 - Ensure that the Docker server certificate key file ownership is set to root:root (Automated) | ||
| + | [INFO] | ||
| + | [INFO] 3.14 - Ensure that the Docker server certificate key file permissions are set to 400 (Automated) | ||
| + | [INFO] | ||
| + | [PASS] 3.15 - Ensure that the Docker socket file ownership is set to root:docker (Automated) | ||
| + | [PASS] 3.16 - Ensure that the Docker socket file permissions are set to 660 or more restrictively (Automated) | ||
| + | [INFO] 3.17 - Ensure that the daemon.json file ownership is set to root:root (Automated) | ||
| + | [INFO] | ||
| + | [INFO] 3.18 - Ensure that daemon.json file permissions are set to 644 or more restrictive (Automated) | ||
| + | [INFO] | ||
| + | [PASS] 3.19 - Ensure that the / | ||
| + | [PASS] 3.20 - Ensure that the / | ||
| + | [INFO] 3.21 - Ensure that the / | ||
| + | [INFO] | ||
| + | [INFO] 3.22 - Ensure that the / | ||
| + | [INFO] | ||
| + | [PASS] 3.23 - Ensure that the Containerd socket file ownership is set to root:root (Automated) | ||
| + | [PASS] 3.24 - Ensure that the Containerd socket file permissions are set to 660 or more restrictively (Automated) | ||
| + | |||
| + | [INFO] 4 - Container Images and Build File | ||
| + | [INFO] 4.1 - Ensure | ||
| + | [INFO] | ||
| + | [NOTE] 4.2 - Ensure that containers use only trusted base images (Manual) | ||
| + | [NOTE] 4.3 - Ensure that unnecessary packages are not installed in the container (Manual) | ||
| + | [NOTE] 4.4 - Ensure images are scanned and rebuilt to include security patches (Manual) | ||
| + | [WARN] 4.5 - Ensure Content trust for Docker is Enabled (Automated) | ||
| + | [WARN] 4.6 - Ensure that HEALTHCHECK instructions have been added to container images (Automated) | ||
| + | [WARN] | ||
| + | [WARN] | ||
| + | [WARN] | ||
| + | [WARN] | ||
| + | [PASS] 4.7 - Ensure update instructions are not used alone in the Dockerfile (Manual) | ||
| + | [NOTE] 4.8 - Ensure setuid and setgid permissions are removed (Manual) | ||
| + | [PASS] 4.9 - Ensure that COPY is used instead of ADD in Dockerfiles (Manual) | ||
| + | [NOTE] 4.10 - Ensure secrets are not stored in Dockerfiles (Manual) | ||
| + | [NOTE] 4.11 - Ensure only verified packages are installed (Manual) | ||
| + | [NOTE] 4.12 - Ensure all signed artifacts are validated (Manual) | ||
| + | |||
| + | [INFO] 5 - Container Runtime | ||
| + | [INFO] | ||
| + | |||
| + | [INFO] 6 - Docker Security Operations | ||
| + | [INFO] 6.1 - Ensure that image sprawl is avoided (Manual) | ||
| + | [INFO] | ||
| + | [INFO] | ||
| + | [INFO] 6.2 - Ensure that container sprawl is avoided (Manual) | ||
| + | [INFO] | ||
| + | |||
| + | [INFO] 7 - Docker Swarm Configuration | ||
| + | [WARN] 7.1 - Ensure swarm mode is not Enabled, if not needed (Automated) | ||
| + | [PASS] 7.2 - Ensure that the minimum number of manager nodes have been created in a swarm (Automated) (Swarm mode not enabled) | ||
| + | [PASS] 7.3 - Ensure that swarm services are bound to a specific host interface (Automated) (Swarm mode not enabled) | ||
| + | [PASS] 7.4 - Ensure that all Docker swarm overlay networks are encrypted (Automated) | ||
| + | [PASS] 7.5 - Ensure that Docker' | ||
| + | [PASS] 7.6 - Ensure that swarm manager is run in auto-lock mode (Automated) (Swarm mode not enabled) | ||
| + | [PASS] 7.7 - Ensure that the swarm manager auto-lock key is rotated periodically (Manual) (Swarm mode not enabled) | ||
| + | [PASS] 7.8 - Ensure that node certificates are rotated as appropriate (Manual) (Swarm mode not enabled) | ||
| + | [PASS] 7.9 - Ensure that CA certificates are rotated as appropriate (Manual) (Swarm mode not enabled) | ||
| + | [PASS] 7.10 - Ensure that management plane traffic is separated from data plane traffic (Manual) (Swarm mode not enabled) | ||
| + | |||
| + | |||
| + | Section C - Score | ||
| + | |||
| + | [INFO] Checks: 86 | ||
| + | [INFO] Score: 1 | ||
| </ | </ | ||
| Ligne 1589: | Ligne 479: | ||
| ... | ... | ||
| [INFO] 1 - Host Configuration | [INFO] 1 - Host Configuration | ||
| - | + | [INFO] 1.1 - Linux Hosts Specific Configuration | |
| - | [INFO] 1.1 - General Configuration | + | [WARN] 1.1.1 - Ensure a separate partition for containers has been created |
| - | [NOTE] 1.1.1 - Ensure the container host has been Hardened | + | [INFO] 1.1.2 - Ensure only trusted users are allowed to control Docker daemon |
| - | [INFO] 1.1.2 - Ensure Docker is up to date | + | [INFO] |
| - | [INFO] | + | [WARN] 1.1.3 - Ensure auditing is configured for the Docker daemon |
| - | [INFO] | + | [WARN] 1.1.4 - Ensure auditing is configured for Docker files and directories -/run/containerd (Automated) |
| - | + | [WARN] 1.1.5 - Ensure auditing is configured for Docker files and directories - /var/lib/ | |
| - | [INFO] 1.2 - Linux Hosts Specific Configuration | + | [WARN] 1.1.6 - Ensure auditing is configured for Docker files and directories - /etc/docker |
| - | [WARN] 1.2.1 - Ensure a separate partition for containers has been created | + | [WARN] 1.1.7 - Ensure auditing is configured for Docker files and directories - docker.service (Automated) |
| - | [INFO] 1.2.2 - Ensure only trusted users are allowed to control Docker daemon | + | [INFO] 1.1.8 - Ensure auditing is configured for Docker files and directories - containerd.sock (Automated) |
| - | [INFO] | + | |
| - | [WARN] 1.2.3 - Ensure auditing is configured for the Docker daemon | + | |
| - | [WARN] 1.2.4 - Ensure auditing is configured for Docker files and directories - /var/lib/docker | + | |
| - | [WARN] 1.2.5 - Ensure auditing is configured for Docker files and directories - /etc/docker | + | |
| - | [WARN] 1.2.6 - Ensure auditing is configured for Docker files and directories - docker.service | + | |
| - | [WARN] 1.2.7 - Ensure auditing is configured for Docker files and directories - docker.socket | + | |
| - | [WARN] 1.2.8 - Ensure auditing is configured for Docker files and directories - / | + | |
| - | [INFO] 1.2.9 - Ensure auditing is configured for Docker files and directories - / | + | |
| [INFO] | [INFO] | ||
| - | [INFO] 1.2.10 - Ensure auditing is configured for Docker files and directories - / | + | [WARN] 1.1.9 - Ensure auditing is configured for Docker files and directories - docker.socket (Automated) |
| + | [WARN] 1.1.10 - Ensure auditing is configured for Docker files and directories - / | ||
| + | [INFO] 1.1.11 - Ensure auditing is configured for Dockerfiles | ||
| + | [INFO] | ||
| + | [WARN] 1.1.12 - 1.1.12 Ensure auditing is configured for Dockerfiles and directories - / | ||
| + | [INFO] 1.1.13 - Ensure auditing is configured for Docker files and directories - / | ||
| + | [INFO] | ||
| + | [WARN] 1.1.14 - Ensure auditing is configured for Docker files and directories - / | ||
| + | [WARN] 1.1.15 - Ensure auditing is configured for Docker files and directories - / | ||
| + | [INFO] 1.1.16 - Ensure auditing is configured for Docker files and directories - / | ||
| [INFO] | [INFO] | ||
| - | [WARN] 1.2.11 | + | [INFO] 1.1.17 - Ensure auditing is configured for Docker files and directories - / |
| - | [INFO] 1.2.12 | + | |
| [INFO] | [INFO] | ||
| + | [WARN] 1.1.18 - Ensure auditing is configured for Docker files and directories - / | ||
| + | [INFO] 1.2 - General Configuration | ||
| + | [NOTE] 1.2.1 - Ensure the container host has been Hardened (Manual) | ||
| + | [PASS] 1.2.2 - Ensure that the version of Docker is up to date (Manual) | ||
| + | [INFO] | ||
| ... | ... | ||
| </ | </ | ||
| Ligne 1618: | Ligne 513: | ||
| Les problèmes de sécurité qu'il convient à résoudre sont indiqués par les annotations **[WARN]**. | Les problèmes de sécurité qu'il convient à résoudre sont indiqués par les annotations **[WARN]**. | ||
| - | ====4.1 - [WARN] 1.2.1 - Ensure a separate partition for containers has been created==== | + | ====[WARN] 1.1.1 - Ensure a separate partition for containers has been created |
| Par défaut, tous les fichiers de Docker sont stockés dans le répertoire **/ | Par défaut, tous les fichiers de Docker sont stockés dans le répertoire **/ | ||
| - | ====4.2 - [WARN] 1.2.3 - Ensure auditing is configured for the Docker daemon==== | + | ====[WARN] 1.1.3 - Ensure auditing is configured for the Docker daemon |
| < | < | ||
| - | [WARN] 1.2.4 - Ensure auditing is configured for Docker files and directories - / | + | [WARN] 1.1.4 - Ensure auditing is configured for Docker files and directories -/ |
| - | [WARN] 1.2.5 | + | [WARN] 1.1.5 - Ensure auditing is configured for Docker files and directories - / |
| - | [WARN] 1.2.6 | + | [WARN] 1.1.6 - Ensure auditing is configured for Docker files and directories - / |
| - | [WARN] 1.2.7 | + | [WARN] 1.1.7 - Ensure auditing is configured for Docker files and directories - docker.service |
| - | [WARN] 1.2.8 | + | [WARN] 1.1.9 - Ensure auditing is configured for Docker files and directories - docker.socket |
| - | [WARN] 1.2.11 | + | [WARN] 1.1.10 - Ensure auditing is configured for Docker files and directories - / |
| + | [WARN] 1.1.12 - Ensure auditing is configured for Dockerfiles and directories - / | ||
| + | [WARN] 1.1.14 | ||
| + | [WARN] 1.1.15 - Ensure auditing is configured for Docker files and directories - / | ||
| + | [WARN] 1.1.18 - Ensure auditing is configured for Docker files and directories - / | ||
| </ | </ | ||
| Ces avertissements sont présents parce que **auditd** n'est pas installé et parce qu'il n'y a pas de règles spécifiques au daemon Docker et ses répertoires et fichiers associés. | Ces avertissements sont présents parce que **auditd** n'est pas installé et parce qu'il n'y a pas de règles spécifiques au daemon Docker et ses répertoires et fichiers associés. | ||
| + | |||
| + | Editez le fichier **/ | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | |||
| + | root@manager: | ||
| + | deb http:// | ||
| + | deb-src http:// | ||
| + | deb http:// | ||
| + | deb-src http:// | ||
| + | deb [arch=amd64] https:// | ||
| + | </ | ||
| + | |||
| + | Exécutez la commande **apt-update** : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | Ign:1 http:// | ||
| + | Atteint:2 http:// | ||
| + | Atteint:3 http:// | ||
| + | Réception de:4 https:// | ||
| + | 44,8 ko réceptionnés en 0s (107 ko/s) | ||
| + | Lecture des listes de paquets... Fait | ||
| + | Construction de l' | ||
| + | Lecture des informations d' | ||
| + | 254 packages can be upgraded. Run 'apt list --upgradable' | ||
| + | </ | ||
| Pour installer auditd, utilisez **apt-get** : | Pour installer auditd, utilisez **apt-get** : | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| </ | </ | ||
| Ligne 1644: | Ligne 571: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| - | root@debian9: | + | |
| + | root@manager: | ||
| ## First rule - delete all | ## First rule - delete all | ||
| -D | -D | ||
| Ligne 1670: | Ligne 598: | ||
| -w / | -w / | ||
| -w / | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| </ | </ | ||
| - | <WRAP center round important | + | <WRAP center round important |
| **Important** : L' | **Important** : L' | ||
| </ | </ | ||
| Ligne 1679: | Ligne 611: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| </ | </ | ||
| Ligne 1685: | Ligne 617: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| ## This file is automatically generated from / | ## This file is automatically generated from / | ||
| -D | -D | ||
| Ligne 1701: | Ligne 633: | ||
| -w / | -w / | ||
| -w / | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| </ | </ | ||
| - | <WRAP center round important | + | <WRAP center round important |
| **Important** - Pour plus d' | **Important** - Pour plus d' | ||
| </ | </ | ||
| Ligne 1710: | Ligne 646: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| - | ... | + | |
| - | [PASS] 1.2.4 - Ensure auditing is configured for Docker files and directories - / | + | |
| - | [PASS] 1.2.5 - Ensure auditing is configured for Docker files and directories - / | + | |
| - | [PASS] 1.2.6 - Ensure auditing is configured for Docker files and directories - docker.service | + | |
| - | [PASS] 1.2.7 - Ensure auditing is configured for Docker files and directories - docker.socket | + | |
| - | [PASS] 1.2.8 - Ensure auditing is configured for Docker files and directories - / | + | |
| ... | ... | ||
| - | [PASS] 1.2.11 | + | [PASS] 1.1.4 - Ensure auditing is configured for Docker files and directories -/ |
| + | [PASS] 1.1.5 - Ensure auditing is configured for Docker files and directories - / | ||
| + | [PASS] 1.1.6 - Ensure auditing is configured for Docker files and directories - /etc/docker (Automated) | ||
| + | [PASS] 1.1.7 - Ensure auditing is configured for Docker files and directories - docker.service (Automated) | ||
| + | [PASS] 1.1.9 - Ensure auditing is configured for Docker files and directories - docker.socket (Automated) | ||
| + | [PASS] 1.1.10 - Ensure auditing is configured for Docker files and directories - / | ||
| + | [PASS] 1.1.12 - Ensure auditing is configured for Dockerfiles and directories - / | ||
| + | [PASS] 1.1.14 | ||
| + | [PASS] 1.1.15 - Ensure auditing is configured for Docker files and directories - / | ||
| + | [PASS] 1.1.18 - Ensure auditing is configured for Docker files and directories - / | ||
| ... | ... | ||
| </ | </ | ||
| Ligne 1729: | Ligne 668: | ||
| ... | ... | ||
| [INFO] 2 - Docker daemon configuration | [INFO] 2 - Docker daemon configuration | ||
| - | [WARN] 2.1 - Ensure network traffic is restricted between containers on the default bridge | + | [NOTE] 2.1 - Run the Docker daemon as a non-root user, if possible (Manual) |
| - | [PASS] 2.2 | + | [WARN] 2.2 - Ensure network traffic is restricted between containers on the default bridge |
| - | [PASS] 2.3 | + | [PASS] 2.3 - Ensure the logging level is set to ' |
| - | [PASS] 2.4 | + | [PASS] 2.4 - Ensure Docker is allowed to make changes to iptables |
| - | [PASS] 2.5 | + | [PASS] 2.5 - Ensure insecure registries are not used (Scored) |
| - | [INFO] 2.6 | + | [PASS] 2.6 - Ensure aufs storage driver is not used (Scored) |
| + | [INFO] 2.7 - Ensure TLS authentication for Docker daemon is configured | ||
| [INFO] | [INFO] | ||
| - | [INFO] 2.7 | + | [INFO] 2.8 - Ensure the default ulimit is configured appropriately |
| [INFO] | [INFO] | ||
| - | [WARN] 2.8 | + | [WARN] 2.9 - Enable user namespace support |
| - | [PASS] 2.9 | + | [PASS] 2.10 - Ensure the default cgroup usage has been confirmed |
| - | [PASS] 2.10 | + | [PASS] 2.11 - Ensure base device size is not changed until needed |
| - | [WARN] 2.11 | + | [WARN] 2.12 - Ensure that authorization for Docker client commands is enabled |
| - | [WARN] 2.12 | + | [WARN] 2.13 - Ensure centralized and remote logging is configured |
| - | [PASS] 2.13 | + | [WARN] 2.14 - Ensure containers are restricted from acquiring new privileges (Scored) |
| - | [WARN] 2.14 | + | [WARN] 2.15 - Ensure live restore is enabled |
| - | [PASS] 2.15 | + | [WARN] 2.16 - Ensure Userland Proxy is Disabled |
| - | [PASS] 2.16 | + | [PASS] 2.17 - Ensure that a daemon-wide custom seccomp profile is applied if appropriate |
| - | [WARN] 2.17 - Ensure containers are restricted from acquiring new privileges | + | [PASS] 2.18 - Ensure that experimental features are not implemented in production |
| ... | ... | ||
| </ | </ | ||
| Ligne 1753: | Ligne 693: | ||
| Les problèmes de sécurité qu'il convient à résoudre sont indiqués par les annotations **[WARN]**. | Les problèmes de sécurité qu'il convient à résoudre sont indiqués par les annotations **[WARN]**. | ||
| - | ====5.1 - [WARN] 2.1 | + | ====[WARN] 2.2 - Ensure network traffic is restricted between containers on the default bridge |
| Par défaut Docker permet un trafic réseau sans restrictions entre des conteneurs sur le même hôte. Il est cependant possible de modifier la configuration par défaut. Pour empêcher ceci, il faut fixer la valeur de **icc** à **false**. De cette façon, docker crée des conteneurs qui peuvent communiquer entre eux **uniquement** s'il existe un lien. | Par défaut Docker permet un trafic réseau sans restrictions entre des conteneurs sur le même hôte. Il est cependant possible de modifier la configuration par défaut. Pour empêcher ceci, il faut fixer la valeur de **icc** à **false**. De cette façon, docker crée des conteneurs qui peuvent communiquer entre eux **uniquement** s'il existe un lien. | ||
| Ligne 1759: | Ligne 699: | ||
| Pour plus d' | Pour plus d' | ||
| - | ====5.2 - [WARN] 2.8 | + | ====[WARN] 2.9 - Enable user namespace support |
| Cet avertissement nous indique que l' | Cet avertissement nous indique que l' | ||
| Ligne 1765: | Ligne 705: | ||
| Pour plus d' | Pour plus d' | ||
| - | ====5.3 - [WARN] 2.11 | + | ====[WARN] 2.12 - Ensure that authorization for Docker client commands is enabled |
| Par défaut, Docker permet un accès sans restrictions aux daemon Docker. Il est possible de restreindre l' | Par défaut, Docker permet un accès sans restrictions aux daemon Docker. Il est possible de restreindre l' | ||
| Ligne 1771: | Ligne 711: | ||
| Pour plus d' | Pour plus d' | ||
| - | ====5.4 - [WARN] 2.12 | + | ====[WARN] 2.13 - Ensure centralized and remote logging is configured |
| Cet avertissement indique que la configuration de rsyslog ne permet pas l' | Cet avertissement indique que la configuration de rsyslog ne permet pas l' | ||
| Ligne 1777: | Ligne 717: | ||
| Pour plus d' | Pour plus d' | ||
| - | ====5.5 - [WARN] 2.14 | + | ====[WARN] 2.14 - Ensure containers are restricted from acquiring new privileges (Scored)==== |
| + | |||
| + | Par défaut un conteneur peut obtenir une escalade de privilèges en utilisant les binaires setuid ou setgid. Pour interdire ceci il faut fixer la valeur de **no-new-privileges** à **true**. | ||
| + | |||
| + | Pour plus d' | ||
| + | |||
| + | ====[WARN] 2.15 - Ensure live restore is enabled (Scored)==== | ||
| + | |||
| + | L' | ||
| + | |||
| + | ====[WARN] 2.16 - Ensure Userland Proxy is Disabled | ||
| Il existe deux méthodes pour qu'un conteneur puisse router vers l' | Il existe deux méthodes pour qu'un conteneur puisse router vers l' | ||
| Ligne 1788: | Ligne 738: | ||
| Pour plus d' | Pour plus d' | ||
| - | ====5.6 - [WARN] 2.17 - Ensure containers are restricted from acquiring new privileges==== | + | ====5.1 - Le Fichier / |
| - | + | ||
| - | Par défaut un conteneur peut obtenir une escalade de privilèges en utilisant les binaires setuid ou setgid. Pour interdire ceci il faut fixer la valeur de **no-new-privileges** à **true**. | + | |
| - | + | ||
| - | Pour plus d' | + | |
| - | + | ||
| - | ====5.7 | + | |
| Créez le fichier **/ | Créez le fichier **/ | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| - | root@debian9: | + | |
| + | root@manager: | ||
| { | { | ||
| " | " | ||
| Ligne 1810: | Ligne 755: | ||
| } | } | ||
| </ | </ | ||
| - | |||
| - | Notez ici que **live-restore** est fixé à **true**. Ceci permet aux conteneurs de continuer à fonctionner même quand le daemon Docker ne fonctionne pas. Ceci est utile pendant la mise-à-jour de Docker. | ||
| Re-démarrez le service Docker : | Re-démarrez le service Docker : | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| </ | </ | ||
| Ligne 1822: | Ligne 765: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| uid=116(dockremap) gid=121(dockremap) groupes=121(dockremap) | uid=116(dockremap) gid=121(dockremap) groupes=121(dockremap) | ||
| </ | </ | ||
| Ligne 1829: | Ligne 772: | ||
| < | < | ||
| - | root@debian9:~# cd docker-bench-security/ | + | root@manager: |
| - | root@debian9: | + | |
| ... | ... | ||
| - | [PASS] 2.1 | + | [PASS] 2.2 - Ensure network traffic is restricted between containers on the default bridge |
| - | ... | + | [PASS] 2.3 - Ensure the logging level is set to ' |
| - | [PASS] 2.8 | + | [PASS] 2.4 - Ensure Docker is allowed to make changes to iptables (Scored) |
| - | ... | + | [PASS] 2.5 - Ensure insecure registries are not used (Scored) |
| - | [WARN] 2.11 - Ensure | + | [PASS] 2.6 - Ensure aufs storage driver is not used (Scored) |
| - | [PASS] 2.12 | + | [PASS] 2.9 - Enable user namespace support |
| - | ... | + | [PASS] 2.10 - Ensure the default cgroup usage has been confirmed (Scored) |
| - | [PASS] 2.14 | + | [PASS] 2.11 - Ensure |
| - | ... | + | [PASS] 2.13 - Ensure centralized and remote logging is configured |
| - | [PASS] 2.17 | + | [PASS] 2.14 - Ensure containers are restricted from acquiring new privileges (Scored) |
| + | [PASS] 2.15 - Ensure live restore is enabled (Scored) | ||
| + | [PASS] 2.16 - Ensure Userland Proxy is Disabled | ||
| + | [PASS] 2.17 - Ensure that a daemon-wide custom seccomp profile is applied if appropriate (Manual) | ||
| + | [PASS] 2.18 - Ensure | ||
| ... | ... | ||
| </ | </ | ||
| Ligne 1852: | Ligne 798: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| + | Lecture des listes de paquets... Fait | ||
| + | Construction de l' | ||
| + | Lecture des informations d' | ||
| + | Le paquet suivant a été installé automatiquement et n'est plus nécessaire : | ||
| + | libsasl2-modules | ||
| + | Veuillez utiliser « apt autoremove » pour le supprimer. | ||
| + | Les paquets suivants seront mis à jour : | ||
| + | docker-ce | ||
| + | 1 mis à jour, 0 nouvellement installés, 0 à enlever et 252 non mis à jour. | ||
| + | Il est nécessaire de prendre 22,7 Mo dans les archives. | ||
| + | Après cette opération, 497 ko d' | ||
| + | Réception de:1 https:// | ||
| + | 22,7 Mo réceptionnés en 0s (26,0 Mo/s) | ||
| + | Lecture des fichiers de modifications (« changelog »)... Terminé | ||
| + | (Lecture de la base de données... 112865 fichiers et répertoires déjà installés.) | ||
| + | Préparation du dépaquetage de .../ | ||
| + | Dépaquetage de docker-ce (5: | ||
| + | Paramétrage de docker-ce (5: | ||
| + | Traitement des actions différées (« triggers ») pour systemd (232-25+deb9u14) ... | ||
| + | |||
| + | root@manager: | ||
| Unable to find image ' | Unable to find image ' | ||
| latest: Pulling from library/ | latest: Pulling from library/ | ||
| - | 80369df48736: Pull complete | + | e9f2695d7e5b: Pull complete |
| - | e8f52315cb10: Pull complete | + | 80c6055edb33: Pull complete |
| - | cf2189b391fc: Pull complete | + | c646ab461d8b: Pull complete |
| - | cc98f645c682: Pull complete | + | 012006c6a591: Pull complete |
| - | 27a27ac83f74: Pull complete | + | 929d5fa34b95: Pull complete |
| - | fa1f04453414: Pull complete | + | 17e0243877fa: Pull complete |
| - | d45bf7d22d33: Pull complete | + | 1850b459cd2f: Pull complete |
| - | 3dbac26e409c: Pull complete | + | 8dceaed53baf: Pull complete |
| - | 9017140fb8c1: Pull complete | + | 197b834ea1cd: Pull complete |
| - | b76dda2673ae: | + | 8df78c25b227: Pull complete |
| - | bea9eb46d12a: | + | Digest: sha256:ceb98918916bd5261b3e9866ac8271d75d276b8a4db56f1dc190770342a77a9b |
| - | e1f050a38d0f: Pull complete | + | |
| - | Digest: sha256:7345ce4ce6f0c1771d01fa333b8edb2c606ca59d385f69575f8e3e2ec6695eee | + | |
| Status: Downloaded newer image for mysql: | Status: Downloaded newer image for mysql: | ||
| - | 54606c03c52c5e3ec0328029d69b869d4b285fb433015576dedc8b8dd4ad0494 | + | e503dd98f88992ae6ed5ec4dcaa2e18982ade8ec74966869515a120763418f74 |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | root@manager: |
| - | 54606c03c52c | + | CONTAINER ID IMAGE |
| + | e503dd98f889 | ||
| </ | </ | ||
| Ligne 1878: | Ligne 844: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| ... | ... | ||
| [INFO] 4 - Container Images and Build File | [INFO] 4 - Container Images and Build File | ||
| - | [WARN] 4.1 - Ensure a user for the container has been created | + | [WARN] 4.1 - Ensure |
| [WARN] | [WARN] | ||
| - | [NOTE] 4.2 - Ensure that containers use only trusted base images | + | [NOTE] 4.2 - Ensure that containers use only trusted base images |
| - | [NOTE] 4.3 - Ensure that unnecessary packages are not installed in the container | + | [NOTE] 4.3 - Ensure that unnecessary packages are not installed in the container |
| - | [NOTE] 4.4 - Ensure images are scanned and rebuilt to include security patches | + | [NOTE] 4.4 - Ensure images are scanned and rebuilt to include security patches |
| - | [WARN] 4.5 - Ensure Content trust for Docker is Enabled | + | [WARN] 4.5 - Ensure Content trust for Docker is Enabled |
| - | [WARN] 4.6 - Ensure that HEALTHCHECK instructions have been added to container images | + | [WARN] 4.6 - Ensure that HEALTHCHECK instructions have been added to container images |
| - | [WARN] | + | |
| [WARN] | [WARN] | ||
| - | [INFO] 4.7 - Ensure update instructions are not use alone in the Dockerfile | + | [PASS] 4.7 - Ensure update instructions are not used alone in the Dockerfile |
| - | [INFO] | + | [NOTE] 4.8 - Ensure setuid and setgid permissions are removed |
| - | [NOTE] 4.8 - Ensure setuid and setgid permissions are removed | + | [PASS] 4.9 - Ensure that COPY is used instead of ADD in Dockerfiles |
| - | [PASS] 4.9 - Ensure that COPY is used instead of ADD in Dockerfiles | + | [NOTE] 4.10 - Ensure secrets are not stored in Dockerfiles |
| - | [NOTE] 4.10 - Ensure secrets are not stored in Dockerfiles | + | [NOTE] 4.11 - Ensure only verified packages are installed |
| - | [NOTE] 4.11 - Ensure only verified packages are installed | + | [NOTE] 4.12 - Ensure all signed artifacts are validated (Manual) |
| ... | ... | ||
| </ | </ | ||
| - | ====6.1 - [WARN] 4.1 - Ensure a user for the container has been created==== | + | ====[WARN] 4.1 - Ensure |
| - | Les processus dans le conteneur **root-nginx** tourne sous l'UID de root. Ceci est l' | + | Les processus dans le conteneur **mysql** tourne sous l'UID de root. Ceci est l' |
| Pour plus d' | Pour plus d' | ||
| - | ====6.2 - [WARN] 4.5 - Ensure Content trust for Docker is Enabled==== | + | ====[WARN] 4.5 - Ensure Content trust for Docker is Enabled |
| Cette ligne indique que le support de Content trust n'a pas été activé. Content trust permet de s' | Cette ligne indique que le support de Content trust n'a pas été activé. Content trust permet de s' | ||
| Ligne 1912: | Ligne 877: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| DOCKER_CONTENT_TRUST=1 | DOCKER_CONTENT_TRUST=1 | ||
| - | root@debian9: | + | |
| + | root@manager: | ||
| </ | </ | ||
| Ligne 1920: | Ligne 886: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| + | Connection to 10.0.2.62 closed by remote host. | ||
| + | Connection to 10.0.2.62 closed. | ||
| + | |||
| + | root@debian11: | ||
| + | trainee@10.0.2.62' | ||
| + | Linux manager.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
| + | |||
| + | The programs included with the Debian GNU/Linux system are free software; | ||
| + | the exact distribution terms for each program are described in the | ||
| + | individual files in / | ||
| + | |||
| + | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
| + | permitted by applicable law. | ||
| + | Last login: Sun Dec 17 18:39:07 2023 from 10.0.2.46 | ||
| + | |||
| + | trainee@manager: | ||
| + | Mot de passe : fenestros | ||
| + | |||
| + | root@manager: | ||
| + | |||
| + | root@manager: | ||
| + | |||
| + | root@manager: | ||
| mysql | mysql | ||
| - | root@debian9: | ||
| - | CONTAINER ID IMAGE | ||
| - | 54606c03c52c | ||
| </ | </ | ||
| Ligne 1930: | Ligne 916: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| ... | ... | ||
| [INFO] 4 - Container Images and Build File | [INFO] 4 - Container Images and Build File | ||
| - | [WARN] 4.1 - Ensure a user for the container has been created | + | [WARN] 4.1 - Ensure |
| [WARN] | [WARN] | ||
| - | [NOTE] 4.2 - Ensure that containers use only trusted base images | + | [NOTE] 4.2 - Ensure that containers use only trusted base images |
| - | [NOTE] 4.3 - Ensure that unnecessary packages are not installed in the container | + | [NOTE] 4.3 - Ensure that unnecessary packages are not installed in the container |
| - | [NOTE] 4.4 - Ensure images are scanned and rebuilt to include security patches | + | [NOTE] 4.4 - Ensure images are scanned and rebuilt to include security patches |
| - | [PASS] 4.5 - Ensure Content trust for Docker is Enabled | + | [PASS] 4.5 - Ensure Content trust for Docker is Enabled |
| - | [WARN] 4.6 - Ensure that HEALTHCHECK instructions have been added to container images | + | [WARN] 4.6 - Ensure that HEALTHCHECK instructions have been added to container images |
| - | [WARN] | + | |
| [WARN] | [WARN] | ||
| - | [INFO] 4.7 - Ensure update instructions are not use alone in the Dockerfile | + | [PASS] 4.7 - Ensure update instructions are not used alone in the Dockerfile |
| - | [INFO] | + | [NOTE] 4.8 - Ensure setuid and setgid permissions are removed |
| - | [NOTE] 4.8 - Ensure setuid and setgid permissions are removed | + | [PASS] 4.9 - Ensure that COPY is used instead of ADD in Dockerfiles |
| - | [PASS] 4.9 - Ensure that COPY is used instead of ADD in Dockerfiles | + | [NOTE] 4.10 - Ensure secrets are not stored in Dockerfiles |
| - | [NOTE] 4.10 - Ensure secrets are not stored in Dockerfiles | + | [NOTE] 4.11 - Ensure only verified packages are installed |
| - | [NOTE] 4.11 - Ensure only verified packages are installed | + | [NOTE] 4.12 - Ensure all signed artifacts are validated (Manual) |
| ... | ... | ||
| </ | </ | ||
| Ligne 1953: | Ligne 938: | ||
| Pour plus d' | Pour plus d' | ||
| - | ====6.3 - [WARN] 4.6 - Ensure that HEALTHCHECK instructions have been added to container images==== | + | ====[WARN] 4.6 - Ensure that HEALTHCHECK instructions have been added to container images==== |
| - | Quand une image est construite, il est possible d'y mettre un **HEALTHCHECK** dont le statut peut être vérifié par Docker afin de relancer le conteneur si nécessaire. | + | Quand une image est construite il est possible d'y mettre un **HEALTHCHECK** dont le statut peut être vérifié par Docker afin de relancer le conteneur si nécessaire. |
| Pour mettre en place un HEALTHCHECK, | Pour mettre en place un HEALTHCHECK, | ||
| Ligne 1972: | Ligne 957: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| ... | ... | ||
| [INFO] 5 - Container Runtime | [INFO] 5 - Container Runtime | ||
| - | [WARN] 5.1 - Ensure that, if applicable, an AppArmor Profile is enabled | + | [WARN] 5.1 - Ensure that, if applicable, an AppArmor Profile is enabled |
| [WARN] | [WARN] | ||
| - | [WARN] 5.2 - Ensure that, if applicable, SELinux security options are set | + | [WARN] 5.2 - Ensure that, if applicable, SELinux security options are set (Automated) |
| [WARN] | [WARN] | ||
| - | [PASS] 5.3 - Ensure Linux Kernel Capabilities | + | [PASS] 5.3 - Ensure |
| - | [PASS] 5.4 - Ensure that privileged containers are not used | + | [PASS] 5.4 - Ensure that privileged containers are not used (Automated) |
| - | [PASS] 5.5 - Ensure sensitive host system directories are not mounted on containers | + | [PASS] 5.5 - Ensure sensitive host system directories are not mounted on containers |
| - | [PASS] 5.6 - Ensure sshd is not run within containers | + | [PASS] 5.6 - Ensure sshd is not run within containers |
| - | [PASS] 5.7 - Ensure privileged ports are not mapped within containers | + | [PASS] 5.7 - Ensure privileged ports are not mapped within containers |
| - | [NOTE] 5.8 - Ensure that only needed ports are open on the container | + | [PASS] 5.8 - Ensure that only needed ports are open on the container |
| - | [PASS] 5.9 - Ensure the host's network namespace is not shared | + | [PASS] 5.9 - Ensure |
| - | [WARN] 5.10 - Ensure that the memory usage for containers is limited | + | [WARN] 5.10 - Ensure that the memory usage for containers is limited |
| - | [WARN] | + | [WARN] |
| - | [WARN] 5.11 - Ensure CPU priority is set appropriately on the container | + | [WARN] 5.11 - Ensure |
| - | [WARN] | + | [WARN] |
| - | [WARN] 5.12 - Ensure that the container' | + | [WARN] 5.12 - Ensure that the container' |
| - | [WARN] | + | [WARN] |
| - | [PASS] 5.13 - Ensure that incoming container traffic is bound to a specific host interface | + | [PASS] 5.13 - Ensure that incoming container traffic is bound to a specific host interface |
| - | [WARN] 5.14 - Ensure that the ' | + | [WARN] 5.14 - Ensure that the ' |
| - | [WARN] | + | [WARN] |
| - | [PASS] 5.15 - Ensure the host's process namespace is not shared | + | [PASS] 5.15 - Ensure |
| - | [PASS] 5.16 - Ensure the host's IPC namespace is not shared | + | [PASS] 5.16 - Ensure |
| - | [PASS] 5.17 - Ensure that host devices are not directly exposed to containers | + | [PASS] 5.17 - Ensure that host devices are not directly exposed to containers |
| - | [INFO] 5.18 - Ensure that the default ulimit is overwritten at runtime if needed | + | [INFO] 5.18 - Ensure that the default ulimit is overwritten at runtime if needed |
| - | [INFO] | + | [INFO] |
| - | [PASS] 5.19 - Ensure mount propagation mode is not set to shared | + | [PASS] 5.19 - Ensure mount propagation mode is not set to shared |
| - | [PASS] 5.20 - Ensure the host's UTS namespace is not shared | + | [PASS] 5.20 - Ensure |
| - | [PASS] 5.21 - Ensure the default seccomp profile is not Disabled | + | [PASS] 5.21 - Ensure the default seccomp profile is not Disabled |
| - | [NOTE] 5.22 - Ensure docker exec commands are not used with privileged option | + | [NOTE] 5.22 - Ensure |
| - | [NOTE] 5.23 - Ensure that docker exec commands are not used with the user=root option | + | [NOTE] 5.23 - Ensure that docker exec commands are not used with the user=root option |
| - | [PASS] 5.24 - Ensure that cgroup usage is confirmed | + | [PASS] 5.24 - Ensure that cgroup usage is confirmed |
| - | [WARN] 5.25 - Ensure that the container is restricted from acquiring additional privileges | + | [PASS] 5.25 - Ensure that the container is restricted from acquiring additional privileges |
| - | [WARN] | + | [WARN] 5.26 - Ensure that container health is checked at runtime |
| - | [WARN] 5.26 - Ensure that container health is checked at runtime | + | [WARN] |
| - | [WARN] | + | [INFO] 5.27 - Ensure that Docker commands always make use of the latest version of their image (Manual) |
| - | [INFO] 5.27 - Ensure that Docker commands always make use of the latest version of their image | + | [WARN] 5.28 - Ensure that the PIDs cgroup limit is used (Automated) |
| - | [WARN] 5.28 - Ensure that the PIDs cgroup limit is used | + | [WARN] |
| - | [WARN] | + | [INFO] 5.29 - Ensure that Docker' |
| - | [INFO] 5.29 - Ensure that Docker' | + | [INFO] |
| - | [INFO] | + | [PASS] 5.30 - Ensure that the host's user namespaces are not shared |
| - | [PASS] 5.30 - Ensure that the host's user namespaces are not shared | + | [PASS] 5.31 - Ensure that the Docker socket is not mounted inside any containers |
| - | [PASS] 5.31 - Ensure that the Docker socket is not mounted inside any containers | + | |
| ... | ... | ||
| </ | </ | ||
| Ligne 2022: | Ligne 1006: | ||
| Les problèmes de sécurité qu'il convient à résoudre sont indiqués par les annotations **[WARN]**. | Les problèmes de sécurité qu'il convient à résoudre sont indiqués par les annotations **[WARN]**. | ||
| - | ====7.1 - [WARN] 5.1 - Ensure AppArmor Profile is Enabled==== | + | ====[WARN] 5.1 - Ensure |
| Cet avertissement est présent parce que le conteneur n' | Cet avertissement est présent parce que le conteneur n' | ||
| Ligne 2028: | Ligne 1012: | ||
| Pour plus d' | Pour plus d' | ||
| - | ====7.2 - [WARN] 5.2 - Ensure SELinux security options are set, if applicable==== | + | ====[WARN] 5.2 - Ensure |
| Cet avertissement est présent parce que le conteneur n' | Cet avertissement est présent parce que le conteneur n' | ||
| Ligne 2034: | Ligne 1018: | ||
| Pour plus d' | Pour plus d' | ||
| - | ====7.3 - [WARN] 5.10 - Ensure memory usage for container | + | ====[WARN] 5.10 - Ensure |
| Cet avertissement est du au fait que les conteneurs ont automatiquement accès à la totalité de la RAM de l' | Cet avertissement est du au fait que les conteneurs ont automatiquement accès à la totalité de la RAM de l' | ||
| < | < | ||
| - | root@debian9:~# docker run -d -p 8081:80 nginx | + | root@manager:~# docker run -d -p 8081:80 nginx |
| b04b2a6f0dd93da21a8b7640afc319406e42868a141f90936dbcf52ab5bffb0d | b04b2a6f0dd93da21a8b7640afc319406e42868a141f90936dbcf52ab5bffb0d | ||
| - | root@debian9:~# docker stats | + | root@manager:~# docker stats |
| CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS | CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS | ||
| b04b2a6f0dd9 | b04b2a6f0dd9 | ||
| Ligne 2050: | Ligne 1034: | ||
| < | < | ||
| - | root@debian9:~# docker ps -a | + | root@manager:~/ |
| - | CONTAINER ID IMAGE | + | Unable to find image ' |
| - | b04b2a6f0dd9 | + | sha256: |
| - | 5b31fe1e13bc | + | 1f7ce2fa46ab: |
| - | 7788c67c3b69 | + | 9b16c94bb686: |
| - | root@debian9:~# docker rm -f b0 | + | 9a59d19f9c5b: |
| - | b0 | + | 9ea27b074f71: |
| - | root@debian9:~# docker run -d -p 8081:80 --memory=" | + | c6edf33e2524: |
| - | 095472e5096a57277230ff94822d9bd0ad479ad26a33cbf83ec381cdb02910e1 | + | 84b1ff10387b: |
| - | root@debian9:~# docker stats | + | 517357831967: |
| - | CONTAINER ID NAME | + | Digest: sha256: |
| - | 095472e5096a | + | Status: Downloaded newer image for nginx@sha256: |
| + | Tagging nginx@sha256: | ||
| + | e14d5112c2feb71e6f37252bcf99d03603d6b7a3e200bff0d55611a0e9a25e2b | ||
| + | |||
| + | root@manager: | ||
| + | CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O | ||
| + | e14d5112c2fe | ||
| + | e503dd98f889 | ||
| + | ^C | ||
| + | </ | ||
| + | |||
| + | Supprimez le conteneur et re-créez-le avec une limite de mémoire : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | CONTAINER ID IMAGE | ||
| + | e14d5112c2fe | ||
| + | e503dd98f889 | ||
| + | |||
| + | root@manager:~/ | ||
| + | e14 | ||
| + | |||
| + | root@manager:~/ | ||
| + | 38e91e096c83f7cbe78089617a4d70110bd273f53339f8fed8df2503d3cd65ca | ||
| + | |||
| + | root@manager:~/ | ||
| + | CONTAINER ID NAME CPU % MEM USAGE / LIMIT | ||
| + | 38e91e096c83 | ||
| + | e503dd98f889 | ||
| ^C | ^C | ||
| </ | </ | ||
| Ligne 2067: | Ligne 1079: | ||
| Pour plus d' | Pour plus d' | ||
| - | ====7.4 - [WARN] 5.11 - Ensure CPU priority is set appropriately on the container==== | + | ====[WARN] 5.11 - Ensure |
| Cet avertissement est du au fait que les conteneurs ont automatiquement accès à tous les CPU de l' | Cet avertissement est du au fait que les conteneurs ont automatiquement accès à tous les CPU de l' | ||
| Ligne 2075: | Ligne 1087: | ||
| Pour plus d' | Pour plus d' | ||
| - | ====7.5 - [WARN] 5.12 - Ensure the container' | + | ====[WARN] 5.12 - Ensure |
| Afin de minimiser le risque de compromettre un conteneur par la présence de code malicieux, il est conseillé de démarrer les conteneurs en lecture seule, sauf pour les volumes qui nécessitent un accès en écriture/ | Afin de minimiser le risque de compromettre un conteneur par la présence de code malicieux, il est conseillé de démarrer les conteneurs en lecture seule, sauf pour les volumes qui nécessitent un accès en écriture/ | ||
| Ligne 2082: | Ligne 1094: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| </ | </ | ||
| Ligne 2088: | Ligne 1100: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| - | A / | + | |
| C /run | C /run | ||
| C /run/mysqld | C /run/mysqld | ||
| + | A / | ||
| A / | A / | ||
| A / | A / | ||
| A / | A / | ||
| A / | A / | ||
| - | A /run/ | + | A /write_a_file |
| </ | </ | ||
| - | <WRAP center round important | + | <WRAP center round important |
| **Important** : Notez que la sortie indique les changements apportés au conteneur. | **Important** : Notez que la sortie indique les changements apportés au conteneur. | ||
| </ | </ | ||
| Ligne 2106: | Ligne 1118: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| mysql | mysql | ||
| - | root@debian9: | + | |
| + | root@manager: | ||
| mysql | mysql | ||
| </ | </ | ||
| Ligne 2115: | Ligne 1128: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| - | 7788c67c3b692515f63f4659a8f40af397bfbde97485e2e40c500c16b158045b | + | 711ab28bdfb41220c84246c1658bcde398681a78291bbbe7d3bbfd9bc317d41b |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | 7788c67c3b69 | + | |
| </ | </ | ||
| Ligne 2125: | Ligne 1135: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| touch: cannot touch '/ | touch: cannot touch '/ | ||
| </ | </ | ||
| - | <WRAP center round important | + | <WRAP center round important |
| **Important** : Notez l' | **Important** : Notez l' | ||
| </ | </ | ||
| Ligne 2136: | Ligne 1146: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| - | root@debian9: | + | root@manager: |
| </ | </ | ||
| - | <WRAP center round important | + | <WRAP center round important |
| **Important** : Notez que la commande ne retourne aucune sortie. En effet le conteneur étant en lecture seule, aucun changement ne peut intervenir. | **Important** : Notez que la commande ne retourne aucune sortie. En effet le conteneur étant en lecture seule, aucun changement ne peut intervenir. | ||
| </ | </ | ||
| - | ====7.6 - [WARN] 5.14 - Ensure ' | + | ====[WARN] 5.14 - Ensure |
| Cet avertissement concerne la politique de re-démarrage du conteneur. La politique **on-failure[: | Cet avertissement concerne la politique de re-démarrage du conteneur. La politique **on-failure[: | ||
| Ligne 2152: | Ligne 1162: | ||
| Pour plus d' | Pour plus d' | ||
| - | ====7.7 - [WARN] 5.25 - Ensure the container is restricted from acquiring additional privileges==== | + | ====[WARN] 5.26 - Ensure |
| - | + | ||
| - | Pour complémenter la configuration précédemment mise en place, il convient de lancer le conteneur en utilisant l' | + | |
| - | + | ||
| - | # docker container run -d --name mysql --read-only --restart on-failure: | + | |
| - | + | ||
| - | Pour plus d' | + | |
| - | + | ||
| - | ====7.8 - [WARN] 5.26 - Ensure container health is checked at runtime==== | + | |
| Voir l' | Voir l' | ||
| - | ====7.9 - [WARN] 5.28 - Ensure PIDs cgroup limit is used==== | + | ====[WARN] 5.28 - Ensure |
| Sans l' | Sans l' | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| </ | </ | ||
| Ligne 2175: | Ligne 1177: | ||
| < | < | ||
| - | root@debian9:~# docker | + | root@manager:~/docker-bench-security# docker run -u 1000 --pids-limit 100 ubuntu bash -c ":() { : | : & }; :; while [[ true ]]; do sleep 1; done" |
| - | CONTAINER ID IMAGE | + | Unable to find image ' |
| - | 05b11e44e595 | + | sha256: |
| - | ... | + | a48641193673: |
| - | root@debian9: | + | Digest: sha256: |
| - | 05 | + | Status: Downloaded newer image for ubuntu@sha256: |
| - | root@debian9: | + | Tagging ubuntu@sha256: |
| environment: | environment: | ||
| environment: | environment: | ||
| Ligne 2188: | Ligne 1190: | ||
| environment: | environment: | ||
| environment: | environment: | ||
| - | ^C | + | environment: |
| + | environment: | ||
| + | environment: | ||
| + | environment: | ||
| + | environment: | ||
| + | environment: | ||
| + | ^P^Q | ||
| </ | </ | ||
| Ligne 2196: | Ligne 1204: | ||
| < | < | ||
| - | root@debian9:~# docker | + | root@manager:~/docker-bench-security# docker rm -f `docker ps -aq` |
| - | CONTAINER ID IMAGE | + | db5ae43c3e55 |
| - | 095472e5096a | + | f3b2528fbac0 |
| - | 5b31fe1e13bc | + | 711ab28bdfb4 |
| - | 7788c67c3b69 | + | |
| - | root@debian9: | + | root@manager:~/ |
| - | 095 | + | CONTAINER ID IMAGE |
| - | root@debian9: | + | |
| - | 5b31fe1e13bc | + | |
| - | 7788c67c3b69 | + | |
| - | 095472e5096a | + | |
| - | root@debian9:~# docker ps -a | + | |
| - | CONTAINER ID IMAGE | + | |
| </ | </ | ||
| Ligne 2214: | Ligne 1216: | ||
| < | < | ||
| - | root@debian9:~# cd docker-bench-security/ | + | root@manager: |
| - | root@debian9: | + | f49d1ffdeae2e83435e8cc3a2e03fb2e0b33e5609d266e5a3403ff8859e5d122 |
| - | df54974ebc11fe357f6e8e9b0f8499aee2658af435e32a45058a1e49fcd3dc24 | + | |
| - | root@debian9: | + | root@manager: |
| CONTAINER ID IMAGE | CONTAINER ID IMAGE | ||
| - | df54974ebc11 | + | f49d1ffdeae2 |
| </ | </ | ||
| Ligne 2225: | Ligne 1227: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| ... | ... | ||
| - | [INFO] 5 - Container Runtime | + | [PASS] 5.2 - Ensure that, if applicable, SELinux security options are set (Automated) |
| - | [WARN] 5.1 - Ensure that, if applicable, an AppArmor Profile is enabled | + | [PASS] 5.10 - Ensure that the memory usage for containers is limited |
| - | [WARN] | + | [PASS] 5.11 - Ensure |
| - | [PASS] 5.2 - Ensure that, if applicable, SELinux security options are set | + | [PASS] 5.12 - Ensure that the container' |
| - | [PASS] 5.3 - Ensure Linux Kernel Capabilities are restricted within containers | + | [PASS] 5.14 - Ensure that the ' |
| - | [PASS] 5.4 - Ensure that privileged containers are not used | + | [PASS] 5.28 - Ensure that the PIDs cgroup limit is used (Automated) |
| - | [PASS] 5.5 - Ensure sensitive host system directories are not mounted on containers | + | |
| - | [PASS] 5.6 - Ensure sshd is not run within containers | + | |
| - | [PASS] 5.7 - Ensure privileged ports are not mapped within containers | + | |
| - | [NOTE] 5.8 - Ensure that only needed ports are open on the container | + | |
| - | [PASS] 5.9 - Ensure the host's network namespace is not shared | + | |
| - | [PASS] 5.10 - Ensure that the memory usage for containers is limited | + | |
| - | [PASS] 5.11 - Ensure CPU priority is set appropriately on the container | + | |
| - | [PASS] 5.12 - Ensure that the container' | + | |
| - | [PASS] 5.13 - Ensure that incoming container traffic is bound to a specific host interface | + | |
| - | [PASS] 5.14 - Ensure that the ' | + | |
| - | [PASS] 5.15 - Ensure the host's process namespace is not shared | + | |
| - | [PASS] 5.16 - Ensure the host's IPC namespace is not shared | + | |
| - | [PASS] 5.17 - Ensure that host devices are not directly exposed to containers | + | |
| - | [INFO] 5.18 - Ensure that the default ulimit is overwritten at runtime if needed | + | |
| - | [INFO] | + | |
| - | [PASS] 5.19 - Ensure mount propagation mode is not set to shared | + | |
| - | [PASS] 5.20 - Ensure the host's UTS namespace is not shared | + | |
| - | [PASS] 5.21 - Ensure the default seccomp profile is not Disabled | + | |
| - | [NOTE] 5.22 - Ensure docker exec commands are not used with privileged option | + | |
| - | [NOTE] 5.23 - Ensure that docker exec commands are not used with the user=root option | + | |
| - | [PASS] 5.24 - Ensure that cgroup usage is confirmed | + | |
| - | [PASS] 5.25 - Ensure that the container is restricted from acquiring additional privileges | + | |
| - | [WARN] 5.26 - Ensure that container health is checked at runtime | + | |
| - | [WARN] | + | |
| - | [INFO] 5.27 - Ensure that Docker commands always make use of the latest version of their image | + | |
| - | [PASS] 5.28 - Ensure that the PIDs cgroup limit is used | + | |
| - | [INFO] 5.29 - Ensure that Docker' | + | |
| - | [INFO] | + | |
| - | [PASS] 5.30 - Ensure that the host's user namespaces are not shared | + | |
| - | [PASS] 5.31 - Ensure that the Docker socket is not mounted inside any containers | + | |
| ... | ... | ||
| </ | </ | ||
| Ligne 2281: | Ligne 1253: | ||
| < | < | ||
| - | root@debian9:~# echo $DOCKER_CONTENT_TRUST | + | root@manager:~# echo $DOCKER_CONTENT_TRUST |
| 1 | 1 | ||
| </ | </ | ||
| Ligne 2288: | Ligne 1260: | ||
| < | < | ||
| - | root@debian9:~# export DOCKER_CONTENT_TRUST=1 | + | root@manager:~# export DOCKER_CONTENT_TRUST=1 |
| - | root@debian9:~# echo $DOCKER_CONTENT_TRUST | + | root@manager:~# echo $DOCKER_CONTENT_TRUST |
| 1 | 1 | ||
| </ | </ | ||
| Ligne 2298: | Ligne 1270: | ||
| < | < | ||
| - | root@debian9:~# docker login | + | root@manager:~# docker login |
| Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https:// | Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https:// | ||
| Username: < | Username: < | ||
| Ligne 2312: | Ligne 1284: | ||
| < | < | ||
| - | root@debian9:~# docker image pull i2tch/ | + | root@manager:~# docker image pull i2tch/ |
| Error: remote trust data does not exist for docker.io/ | Error: remote trust data does not exist for docker.io/ | ||
| </ | </ | ||
| - | <WRAP center round important | + | <WRAP center round important |
| **Important** : Notez l' | **Important** : Notez l' | ||
| </ | </ | ||
| Ligne 2323: | Ligne 1295: | ||
| < | < | ||
| - | root@debian9:~# docker image pull centos | + | root@manager:~# docker image pull centos |
| Using default tag: latest | Using default tag: latest | ||
| Pull (1 of 1): centos: | Pull (1 of 1): centos: | ||
| Ligne 2337: | Ligne 1309: | ||
| < | < | ||
| - | root@debian9:~# docker images | + | root@manager:~# docker images |
| REPOSITORY | REPOSITORY | ||
| ubuntu | ubuntu | ||
| Ligne 2351: | Ligne 1323: | ||
| < | < | ||
| - | root@debian9:~# docker image pull --disable-content-trust=true i2tch/ | + | root@manager:~# docker image pull --disable-content-trust=true i2tch/ |
| unsigned: Pulling from i2tch/ | unsigned: Pulling from i2tch/ | ||
| 10d70a43a9f9: | 10d70a43a9f9: | ||
| Ligne 2367: | Ligne 1339: | ||
| docker.io/ | docker.io/ | ||
| - | root@debian9:~# docker image ls | + | root@manager:~# docker image ls |
| REPOSITORY | REPOSITORY | ||
| ubuntu | ubuntu | ||
| Ligne 2376: | Ligne 1348: | ||
| i2tch/ | i2tch/ | ||
| - | root@debian9:~# docker rmi i2tch/ | + | root@manager:~# docker rmi i2tch/ |
| Untagged: i2tch/ | Untagged: i2tch/ | ||
| Untagged: i2tch/ | Untagged: i2tch/ | ||
| Ligne 2405: | Ligne 1377: | ||
| < | < | ||
| - | root@debian9:~# docker image tag alpine: | + | root@manager:~# docker image tag alpine: |
| </ | </ | ||
| Ligne 2411: | Ligne 1383: | ||
| < | < | ||
| - | root@debian9:~# docker image ls | + | root@manager:~# docker image ls |
| REPOSITORY | REPOSITORY | ||
| ubuntu | ubuntu | ||
| Ligne 2427: | Ligne 1399: | ||
| < | < | ||
| - | root@debian9:~# docker push < | + | root@manager:~# docker push < |
| The push refers to repository [docker.io/< | The push refers to repository [docker.io/< | ||
| 77cae8ab23bf: | 77cae8ab23bf: | ||
| Ligne 2449: | Ligne 1421: | ||
| < | < | ||
| - | root@debian9:~# ls -l ~/ | + | root@manager:~# ls -l ~/ |
| total 8 | total 8 | ||
| drwx------ 2 root root 4096 nov. 10 14:49 private | drwx------ 2 root root 4096 nov. 10 14:49 private | ||
| drwx------ 3 root root 4096 nov. 8 13:48 tuf | drwx------ 3 root root 4096 nov. 8 13:48 tuf | ||
| - | root@debian9:~# ls -l ~/ | + | root@manager:~# ls -l ~/ |
| total 8 | total 8 | ||
| -rw------- 1 root root 447 nov. 10 14:49 168c754ea8f36ce7fbcbe2299b6d91fc0f4d594c9ed9b86916687b618d8438ac.key | -rw------- 1 root root 447 nov. 10 14:49 168c754ea8f36ce7fbcbe2299b6d91fc0f4d594c9ed9b86916687b618d8438ac.key | ||
| -rw------- 1 root root 416 nov. 10 14:49 192fc7ed9543ad4bceec58886ab1d605b7433c35f7462d7343d0780d8fddf1db.key | -rw------- 1 root root 416 nov. 10 14:49 192fc7ed9543ad4bceec58886ab1d605b7433c35f7462d7343d0780d8fddf1db.key | ||
| - | root@debian9:~# cat ~/ | + | root@manager:~# cat ~/ |
| -----BEGIN ENCRYPTED PRIVATE KEY----- | -----BEGIN ENCRYPTED PRIVATE KEY----- | ||
| gun: docker.io/ | gun: docker.io/ | ||
| Ligne 2471: | Ligne 1443: | ||
| -----END ENCRYPTED PRIVATE KEY----- | -----END ENCRYPTED PRIVATE KEY----- | ||
| - | root@debian9:~# cat ~/ | + | root@manager:~# cat ~/ |
| -----BEGIN ENCRYPTED PRIVATE KEY----- | -----BEGIN ENCRYPTED PRIVATE KEY----- | ||
| role: root | role: root | ||
| Ligne 2489: | Ligne 1461: | ||
| < | < | ||
| - | root@debian9:~# mkdir nottrusted | + | root@manager:~# mkdir nottrusted |
| - | root@debian9:~# cd nottrusted/ | + | |
| - | root@debian9: | + | root@manager:~# cd nottrusted/ |
| - | root@debian9: | + | |
| + | root@manager: | ||
| + | |||
| + | root@manager: | ||
| FROM docker/ | FROM docker/ | ||
| RUN echo | RUN echo | ||
| Ligne 2500: | Ligne 1475: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| Sending build context to Docker daemon | Sending build context to Docker daemon | ||
| Ligne 2509: | Ligne 1484: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| Sending build context to Docker daemon | Sending build context to Docker daemon | ||
| Step 1/2 : FROM docker/ | Step 1/2 : FROM docker/ | ||
| Ligne 2531: | Ligne 1506: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| The push refers to repository [docker.io/< | The push refers to repository [docker.io/< | ||
| 5f70bf18a086: | 5f70bf18a086: | ||
| Ligne 2541: | Ligne 1516: | ||
| </ | </ | ||
| - | <WRAP center round important | + | <WRAP center round important |
| **Important** : Notez l' | **Important** : Notez l' | ||
| </ | </ | ||
| Ligne 2550: | Ligne 1525: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| - | root@debian9: | + | |
| + | root@manager: | ||
| REPOSITORY | REPOSITORY | ||
| < | < | ||
| Ligne 2563: | Ligne 1539: | ||
| docker/ | docker/ | ||
| - | root@debian9: | + | root@manager: |
| The push refers to repository [docker.io/< | The push refers to repository [docker.io/< | ||
| 5f70bf18a086: | 5f70bf18a086: | ||
| Ligne 2576: | Ligne 1552: | ||
| </ | </ | ||
| - | <WRAP center round important | + | <WRAP center round important |
| **Important** : Notez la création d'une deuxième repositry key (ID 7b13d02 au lieu de ID 168c754) lors du push de l' | **Important** : Notez la création d'une deuxième repositry key (ID 7b13d02 au lieu de ID 168c754) lors du push de l' | ||
| </ | </ | ||
| Ligne 2583: | Ligne 1559: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| total 12 | total 12 | ||
| -rw------- 1 root root 447 nov. 10 14:49 168c754ea8f36ce7fbcbe2299b6d91fc0f4d594c9ed9b86916687b618d8438ac.key | -rw------- 1 root root 447 nov. 10 14:49 168c754ea8f36ce7fbcbe2299b6d91fc0f4d594c9ed9b86916687b618d8438ac.key | ||
| Ligne 2593: | Ligne 1569: | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| [ | [ | ||
| { | { | ||
| Ligne 2627: | Ligne 1603: | ||
| } | } | ||
| ] | ] | ||
| - | root@debian9: | + | root@manager: |
| [ | [ | ||
| { | { | ||
| Ligne 2663: | Ligne 1639: | ||
| </ | </ | ||
| - | <WRAP center round important | + | <WRAP center round important |
| **Important** : Notez que les clefs utilisées sont les mêmes pour les deux images. | **Important** : Notez que les clefs utilisées sont les mêmes pour les deux images. | ||
| </ | </ | ||
| < | < | ||
| - | root@debian9: | + | root@manager: |
| [ | [ | ||
| { | { | ||
| Ligne 2704: | Ligne 1680: | ||
| </ | </ | ||
| - | <WRAP center round important | + | <WRAP center round important |
| **Important** : Notez que les clefs utilisées sont différentes. | **Important** : Notez que les clefs utilisées sont différentes. | ||
| </ | </ | ||
| Ligne 2713: | Ligne 1689: | ||
| < | < | ||
| - | root@debian9:~# docker trust revoke < | + | root@manager:~# docker trust revoke < |
| Enter passphrase for repository key with ID 168c754: | Enter passphrase for repository key with ID 168c754: | ||
| Successfully deleted signature for < | Successfully deleted signature for < | ||
| - | root@debian9:~# docker trust inspect < | + | root@manager:~# docker trust inspect < |
| [ | [ | ||
| { | { | ||
| Ligne 2744: | Ligne 1720: | ||
| </ | </ | ||
| + | <WRAP center round important 50%> | ||
| + | **Important** : Il existe un autre mécanisme de signatures cryptographiques qui permet de certifier le contenu des images mises à disposition sur une Registry. Appelé **Notary**, ce système a été développé par la communauté Docker et intègre une partie de la spécification de **[[https:// | ||
| + | </ | ||
| + | |||
| + | =====LAB #9 - Sécurisation du Socket du Daemon Docker===== | ||
| + | |||
| + | Par défaut le daemon Docker peut être contacté en utilisant un socket Unix local ce qui implique qu'il faut une connexion SSH vers l' | ||
| + | |||
| + | Pour pouvoir contacter de daemon Docker via le réseau d'une manière sécurisée il faut installer, configurer et activer le support TLS grâce aux options **tlsverify** et **tlscacert**. | ||
| + | |||
| + | La configuration implique que : | ||
| + | |||
| + | * pour le daemon Docker, seules les connections en provenance de clients authentifiés par un certificat signé par l' | ||
| + | * pour le client, il ne peut que connecter aux serveurs ayant un certificat signé par le CA du serveur. | ||
| + | |||
| + | La mise en place nécessite **openssl** : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | ====9.1 - Création du Certificat de l' | ||
| + | |||
| + | Commencez par créer une clef privée **ca-key.pem** pour le CA : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | Generating RSA private key, 4096 bit long modulus | ||
| + | ......................................................................................................................++++ | ||
| + | ...............................................................................................................................................................++++ | ||
| + | e is 65537 (0x010001) | ||
| + | Enter pass phrase for ca-key.pem: | ||
| + | Verifying - Enter pass phrase for ca-key.pem: | ||
| + | </ | ||
| + | |||
| + | Ensuite, créez le certificat **ca.pem** du CA : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | Enter pass phrase for ca-key.pem: | ||
| + | You are about to be asked to enter information that will be incorporated | ||
| + | into your certificate request. | ||
| + | What you are about to enter is what is called a Distinguished Name or a DN. | ||
| + | There are quite a few fields but you can leave some blank | ||
| + | For some fields there will be a default value, | ||
| + | If you enter ' | ||
| + | ----- | ||
| + | Country Name (2 letter code) [AU]:GB | ||
| + | State or Province Name (full name) [Some-State]: | ||
| + | Locality Name (eg, city) []: | ||
| + | Organization Name (eg, company) [Internet Widgits Pty Ltd]:I2TCH LIMITED | ||
| + | Organizational Unit Name (eg, section) []:TRAINING | ||
| + | Common Name (e.g. server FQDN or YOUR name) []: | ||
| + | Email Address []: | ||
| + | </ | ||
| + | |||
| + | ====9.2 - Création du Certificat du Serveur Hôte du Daemon Docker==== | ||
| + | |||
| + | Les clefs du CA ayant été créées, créez une clef **server-key.pem** pour le serveur hôte du daemon Docker : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | Generating RSA private key, 4096 bit long modulus | ||
| + | .................................................................................................................................++++ | ||
| + | ...........................++++ | ||
| + | e is 65537 (0x010001) | ||
| + | </ | ||
| + | |||
| + | Créez ensuite un **[[https:// | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | manager.i2tch.loc | ||
| + | root@manager: | ||
| + | </ | ||
| + | |||
| + | Une connexion TLS peut être effectuée en utilisant un FQDN ou une adresse IP. Pour cette raison, créez le fichier **extfile.cnf** : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | </ | ||
| + | |||
| + | Fixez l' | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | </ | ||
| + | |||
| + | Vérifiez que votre fichier a été correctement créé : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | subjectAltName = DNS: | ||
| + | extendedKeyUsage = serverAuth | ||
| + | </ | ||
| + | |||
| + | Signez maintenant le CSR du serveur **server.csr** avec la clef privée du CA **ca-key.pem** afin de produire le certificat du serveur **server-cert.pem** : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | Signature ok | ||
| + | subject=CN = manager.i2tch.loc | ||
| + | Getting CA Private Key | ||
| + | Enter pass phrase for ca-key.pem: | ||
| + | </ | ||
| + | |||
| + | ====9.3 - Création du Certificat du Client==== | ||
| + | |||
| + | Créez ensuite la clef privée **key.pem** du client qui se connectera au daemon à partir du réseau : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | Generating RSA private key, 4096 bit long modulus | ||
| + | ...................................................................................................................................++++ | ||
| + | ...............++++ | ||
| + | e is 65537 (0x010001) | ||
| + | </ | ||
| + | |||
| + | Modifiez l' | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | root@manager: | ||
| + | 127.0.0.1 localhost | ||
| + | 10.0.2.46 debian11.i2tch.loc debian11 | ||
| + | 10.0.2.45 myregistry.i2tch.loc | ||
| + | 10.0.2.62 manager.i2tch.loc manager | ||
| + | 10.0.2.63 worker1.i2tch.loc worker1 | ||
| + | 10.0.2.64 worker2.i2tch.loc worker2 | ||
| + | |||
| + | # The following lines are desirable for IPv6 capable hosts | ||
| + | ::1 | ||
| + | ff02::1 ip6-allnodes | ||
| + | ff02::2 ip6-allrouters | ||
| + | </ | ||
| + | |||
| + | Créez ensuite le CSR du client **client.csr** : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | </ | ||
| + | |||
| + | Fixez l' | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | </ | ||
| + | |||
| + | Signez le CSR du client **client.csr** avec la clef privée du CA **ca-key.pem** afin de créer le certificat du client **cert.pem** : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | Signature ok | ||
| + | subject=CN = myregistry.i2tch.loc | ||
| + | Getting CA Private Key | ||
| + | Enter pass phrase for ca-key.pem: | ||
| + | </ | ||
| + | |||
| + | Vérifiez la présence des fichiers générés : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | total 60 | ||
| + | -rw------- 1 root root 3326 nov. 11 10:53 ca-key.pem | ||
| + | -rw-r--r-- 1 root root 2163 nov. 11 10:57 ca.pem | ||
| + | -rw-r--r-- 1 root root 17 nov. 11 11:15 ca.srl | ||
| + | -rw-r--r-- 1 root root 1907 nov. 11 11:15 cert.pem | ||
| + | -rw-r--r-- 1 root root 1594 nov. 11 11:12 client.csr | ||
| + | drwxr-xr-x 5 root root 4096 nov. 8 12:58 docker-bench-security | ||
| + | -rw-r--r-- 1 root root 1707 nov. 8 12:35 docker-stack.yml | ||
| + | -rw-r--r-- 1 root root 30 nov. 11 11:13 extfile-client.cnf | ||
| + | -rw-r--r-- 1 root root 95 nov. 11 11:06 extfile.cnf | ||
| + | -rw------- 1 root root 3243 nov. 11 11:10 key.pem | ||
| + | drwxr-xr-x 2 root root 4096 nov. 10 17:21 nottrusted | ||
| + | -rw-r--r-- 1 root root 1964 nov. 11 11:08 server-cert.pem | ||
| + | -rw-r--r-- 1 root root 1594 nov. 11 11:01 server.csr | ||
| + | -rw------- 1 root root 3243 nov. 11 10:59 server-key.pem | ||
| + | -rw-r--r-- 1 root root 882 oct. 27 15:46 stats | ||
| + | </ | ||
| + | |||
| + | Supprimez les fichiers ayant déjà été utilisés, à savoir les deux CSR et les deux fichiers des extensions : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | </ | ||
| + | |||
| + | Modifiez les permissions des clefs privées : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | le mode de ' | ||
| + | le mode de ' | ||
| + | le mode de ' | ||
| + | </ | ||
| + | |||
| + | Ainsi que les permissions des certificats : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | le mode de ' | ||
| + | le mode de ' | ||
| + | le mode de ' | ||
| + | </ | ||
| + | |||
| + | Arrêtez et supprimez le conteneur **mysql** : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | mysql | ||
| + | root@manager: | ||
| + | mysql | ||
| + | </ | ||
| + | |||
| + | ====9.4 - Démarrage du Daemon Docker avec une Invocation Directe==== | ||
| + | |||
| + | Arrêtez et désactivez le service Docker : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | Warning: Stopping docker.service, | ||
| + | docker.socket | ||
| + | root@manager: | ||
| + | Synchronizing state of docker.service with SysV service script with / | ||
| + | Executing: / | ||
| + | </ | ||
| + | |||
| + | Lancez un invocation directe de **dockerd** afin que le daemon n' | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | [1] 1868 | ||
| + | root@manager: | ||
| + | INFO[2019-11-11T12: | ||
| + | INFO[2019-11-11T12: | ||
| + | INFO[2019-11-11T12: | ||
| + | INFO[2019-11-11T12: | ||
| + | INFO[2019-11-11T12: | ||
| + | INFO[2019-11-11T12: | ||
| + | INFO[2019-11-11T12: | ||
| + | INFO[2019-11-11T12: | ||
| + | INFO[2019-11-11T12: | ||
| + | INFO[2019-11-11T12: | ||
| + | INFO[2019-11-11T12: | ||
| + | WARN[2019-11-11T12: | ||
| + | WARN[2019-11-11T12: | ||
| + | INFO[2019-11-11T12: | ||
| + | INFO[2019-11-11T12: | ||
| + | INFO[2019-11-11T12: | ||
| + | INFO[2019-11-11T12: | ||
| + | INFO[2019-11-11T12: | ||
| + | INFO[2019-11-11T12: | ||
| + | [Entrée] | ||
| + | root@manager: | ||
| + | </ | ||
| + | |||
| + | Vérifiez que le processus tourne : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | root 1868 0.2 4.0 421876 82236 pts/0 Sl | ||
| + | root 1995 0.0 0.0 12780 964 pts/0 S+ | ||
| + | </ | ||
| + | |||
| + | Installez le paquet **net-tools** qui contient le binaire **netstat** : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | </ | ||
| + | |||
| + | Vérifiez que le port **2376** est à l' | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | tcp6 | ||
| + | </ | ||
| + | |||
| + | ====9.5 - Configuration du Client==== | ||
| + | |||
| + | Transférez ensuite le certificat du CA ainsi que le certificat et la clef privée du client vers la VM **10.0.2.45** : | ||
| + | |||
| + | < | ||
| + | root@manager: | ||
| + | The authenticity of host ' | ||
| + | ECDSA key fingerprint is SHA256: | ||
| + | Are you sure you want to continue connecting (yes/no)? yes | ||
| + | Warning: Permanently added ' | ||
| + | trainee@10.0.2.45' | ||
| + | ca.pem | ||
| + | key.pem | ||
| + | cert.pem | ||
| + | </ | ||
| + | |||
| + | Lancez la commande **docker version** sur la VM **10.0.2.45** : | ||
| + | |||
| + | < | ||
| + | trainee@myregistry: | ||
| + | Client: Docker Engine - Community | ||
| + | | ||
| + | API version: | ||
| + | Go version: | ||
| + | Git commit: | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | Server: Docker Engine - Community | ||
| + | | ||
| + | Version: | ||
| + | API version: | ||
| + | Go version: | ||
| + | Git commit: | ||
| + | Built: | ||
| + | OS/ | ||
| + | Experimental: | ||
| + | | ||
| + | Version: | ||
| + | GitCommit: | ||
| + | runc: | ||
| + | Version: | ||
| + | GitCommit: | ||
| + | | ||
| + | Version: | ||
| + | GitCommit: | ||
| + | </ | ||
| + | |||
| + | Afin de faciliter l' | ||
| + | |||
| + | < | ||
| + | trainee@myregistry: | ||
| + | mkdir: création du répertoire '/ | ||
| + | </ | ||
| + | |||
| + | Copiez ensuite les fichiers *.pem dans le répertoire **~/ | ||
| + | |||
| + | < | ||
| + | trainee@myregistry: | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | </ | ||
| + | |||
| + | Créez les deux variables **DOCKER_HOST** et **DOCKER_TLS_VERIFY** : | ||
| + | |||
| + | < | ||
| + | trainee@myregistry: | ||
| + | </ | ||
| + | |||
| + | Maintenant la connexion est sécurisée par défaut : | ||
| + | |||
| + | < | ||
| + | trainee@myregistry: | ||
| + | REPOSITORY | ||
| + | i2tch/ | ||
| + | i2tch/ | ||
| + | ubuntu | ||
| + | nginx | ||
| + | alpine | ||
| + | i2tch/ | ||
| + | mysql | ||
| + | centos | ||
| + | docker/ | ||
| + | </ | ||
| ----- | ----- | ||
| Copyright © 2025 Hugh NORRIS | Copyright © 2025 Hugh NORRIS | ||