Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| elearning:workbooks:debian:11:sec:l109 [2025/12/04 09:27] – admin | elearning:workbooks:debian:11:sec:l109 [2025/12/07 16:38] (Version actuelle) – admin | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| ~~PDF: | ~~PDF: | ||
| - | |||
| - | OPENVPN | ||
| - | DNS et cryptographie : DNSSEC | ||
| Version : **2026.01** | Version : **2026.01** | ||
| Ligne 8: | Ligne 5: | ||
| Dernière mise-à-jour : ~~LASTMOD~~ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
| - | ======LDF407 | + | ======LDF409 |
| - | =====Contenu du module===== | + | =====Contenu du Module===== |
| - | * **LDF407 | + | * **LDF409 |
| - | * Contenu du module | + | * Contenu du Module |
| - | * Le Problématique | + | * LAB #1 - Utilisation |
| - | * LAB #1 - Utilisation | + | * LAB #2 - Création d'un Utilisateur de Confiance pour Contrôler le Daemon Docker |
| - | * 1.1 - Utilisation | + | * LAB #3 - Le Script docker-bench-security.sh |
| - | * L'option -i | + | * LAB #4 - Sécurisation de la Configuration de l'Hôte Docker |
| - | * L' | + | * LAB #5 - Sécurisation de la Configuration du daemon Docker |
| - | * L' | + | * 5.1 - Le Fichier / |
| - | * L' | + | * LAB #6 - Sécurisation des Images et les Fichiers |
| - | * L' | + | * LAB #7 - Sécurisation du Container Runtime |
| - | * 1.2 - Filtrage à l'écoute | + | * LAB #8 - Sécurisation des Images avec Docker Content Trust |
| - | * Les Contre-Mesures | + | * 8.1 - DOCKER_CONTENT_TRUST |
| - | * Introduction à la cryptologie | + | * 8.2 - DCT et la commande docker pull |
| - | * Définitions | + | * L' |
| - | * Algorithmes à clé secrète | + | * 8.3 - DCT et la commande docker push |
| - | * Le Chiffrement Symétrique | + | * 8.4 - DCT et la commande docker build |
| - | * Algorithmes à clef publique | + | * Créer |
| - | * Le Chiffrement Asymétrique | + | * Supprimer une Signature |
| - | * La Clef de Session | + | * LAB #9 - Sécurisation du Socket du Daemon Docker |
| - | * Fonctions de Hachage | + | * 9.1 - Création du Certificat de l'Autorité |
| - | * Signature Numérique | + | * 9.2 - Création du Certificat |
| - | * PKI | + | * 9.3 - Création du Certificat du Client |
| - | * Certificats X509 | + | * 9.4 - Démarrage du Daemon Docker avec une Invocation Directe |
| - | * LAB #2 - Utilisation de GnuPG | + | * 9.5 - Configuration du Client |
| - | * 2.1 - Présentation | + | |
| - | * 2.2 - Installation | + | |
| - | * 2.3 - Utilisation | + | |
| - | * Signer | + | |
| - | * Chiffrer un message | + | |
| - | * LAB #3 - Mise en place de SSH et SCP | + | |
| - | * 3.1 - Introduction | + | |
| - | * SSH-1 | + | |
| - | * SSH-2 | + | |
| - | * L'authentification par mot de passe | + | |
| - | * L' | + | |
| - | * 3.2 - Configuration | + | |
| - | * 3.3 - Utilisation | + | |
| - | * 3.4 - Mise en place des clefs | + | |
| - | * 3.5 - Tunnels SSH | + | |
| - | * 3.6 - SCP | + | |
| - | * Introduction | + | |
| - | * Utilisation | + | |
| - | * LAB #4 - Mise en place d'un VPN avec OpenVPN | + | |
| - | * Présentation | + | |
| - | * Configuration commune au client et au serveur | + | |
| - | * Configuration du client | + | |
| - | * Configuration du serveur | + | |
| - | * Tests | + | |
| - | * Du client vers le serveur | + | |
| - | * Du serveur vers le client | + | |
| - | =====Le Problématique===== | + | =====LAB #1 - Utilisation des Docker Secrets===== |
| - | Le **sniffing** des paquets de données est possible sur un réseau utilisant | + | Les secrets Docker sont une façon sécurisée |
| - | * Telnet, | + | Considérez l' |
| - | * Rlogin, | + | |
| - | * Ftp, | + | |
| - | * Pop3. | + | |
| - | Un // | + | < |
| + | version: ' | ||
| - | * Tcpdump. | + | services: |
| - | =====LAB #1 - Utilisation de tcpdump===== | + | db: |
| + | image: postgres | ||
| + | environment: | ||
| + | POSTGRES_USER: | ||
| + | POSTGRES_PASSWORD: | ||
| + | POSTGRES_DB: | ||
| + | |||
| + | adminer: | ||
| + | image: adminer | ||
| + | ports: | ||
| + | - 8080:8080 | ||
| + | </ | ||
| - | Le logiciel **tcpdump** sert à écouter le réseau | + | On peut constater dans ce fichier la présence des informations sensibles |
| - | ===1.1 - Utilisation=== | + | * POSTGRES_USER |
| + | * POSTGRES_PASSWORD | ||
| + | * POSTGRES_DB | ||
| - | Installez | + | Afin de sécuriser ces informations, |
| < | < | ||
| - | root@debian12:~# apt install tcpdump | + | root@manager:~# mkdir postgres |
| </ | </ | ||
| - | ==L' | + | Créez ensuite un Docker Secret appelé |
| - | + | ||
| - | Pour écouter sur une **interface spécifique**, | + | |
| < | < | ||
| - | root@debian12:~# tcpdump -i ens18 -c 10 | + | root@manager:~# cd postgres |
| - | tcpdump: verbose output suppressed, use -v[v]... for full protocol decode | + | root@manager:~/postgres# echo " |
| - | listening on ens18, link-type EN10MB (Ethernet), snapshot length 262144 bytes | + | lpk8eq80qvfiqw7z1686fmj5t |
| - | 17: | + | |
| - | 17: | + | |
| - | 17: | + | |
| - | 17: | + | |
| - | 17: | + | |
| - | 17: | + | |
| - | 17: | + | |
| - | 17: | + | |
| - | 17: | + | |
| - | 17: | + | |
| - | 10 packets captured | + | |
| - | 14 packets received by filter | + | |
| - | 0 packets dropped by kernel | + | |
| </ | </ | ||
| - | Notez qu'à la fin, un résumé vous est présenté, par exemple | + | <WRAP center round important 50%> |
| + | **Important** : Notez l'utilisation du caractère **-** à la fin de la ligne. Celui-ci indique à la commande **docker secret** de lire le contenu du secret pg_user à partir de l' | ||
| + | </ | ||
| + | |||
| + | Pour visualiser la liste des secrets, utilisez la commande docker secrets **ls** | ||
| < | < | ||
| - | ... | + | root@manager: |
| - | 10 packets captured | + | ID NAME DRIVER |
| - | 14 packets received by filter | + | lpk8eq80qvfiqw7z1686fmj5t |
| - | 0 packets dropped by kernel | + | |
| </ | </ | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| - | **Important** : L' | + | **Important** : Notez que la colonne |
| </ | </ | ||
| - | ==L' | + | Créez maintenant |
| - | + | ||
| - | Pour écouter sur une interface spécifique et voir le contenu en Hexadécimal, | + | |
| < | < | ||
| - | root@debian12:~# tcpdump | + | root@manager:~/postgres# echo " |
| - | tcpdump: verbose output suppressed, use -v[v]... for full protocol decode | + | h9tsfbfwz6o0sd35roklwpopi |
| - | listening on ens18, link-type EN10MB (Ethernet), snapshot length 262144 bytes | + | root@manager:~/postgres# echo " |
| - | 17:27: | + | 5lx4zydpfocwgpdto0yy1jod9 |
| - | 0x0000: | + | |
| - | 0x0010: | + | |
| - | 0x0020: | + | |
| - | 0x0030: | + | |
| - | 0x0040: | + | |
| - | 0x0050: | + | |
| - | 0x0060: | + | |
| - | 0x0070: | + | |
| - | 0x0080: | + | |
| - | 0x0090: | + | |
| - | 0x00a0: | + | |
| - | 0x00b0: | + | |
| - | 0x00c0: | + | |
| - | 0x00d0: | + | |
| - | 0x00e0: | + | |
| - | 17: | + | |
| - | 0x0000: | + | |
| - | 0x0010: | + | |
| - | 0x0020: | + | |
| - | 0x0030: | + | |
| - | 17: | + | |
| - | 0x0000: | + | |
| - | 0x0010: | + | |
| - | 0x0020: | + | |
| - | 0x0030: | + | |
| - | 0x0040: | + | |
| - | 3 packets captured | + | |
| - | 10 packets received by filter | + | |
| - | 0 packets dropped by kernel | + | |
| </ | </ | ||
| - | ==L'option -X== | + | <WRAP center round important 50%> |
| + | **Important** : Notez qu'un secret Docker est immuable. | ||
| + | </ | ||
| - | Pour écouter sur une interface spécifique et voir le contenu | + | Vérifiez la prise en compte de vos commandes |
| < | < | ||
| - | root@debian12:~# tcpdump -i ens18 -X -c 3 | + | root@manager:~/postgres# docker secret ls |
| - | tcpdump: verbose output suppressed, use -v[v]... for full protocol decode | + | ID NAME DRIVER |
| - | listening on ens18, link-type EN10MB (Ethernet), snapshot length 262144 bytes | + | 5lx4zydpfocwgpdto0yy1jod9 |
| - | 13: | + | h9tsfbfwz6o0sd35roklwpopi |
| - | 0x0000: | + | lpk8eq80qvfiqw7z1686fmj5t |
| - | 0x0010: | + | |
| - | 0x0020: | + | |
| - | 0x0030: | + | |
| - | 0x0040: | + | |
| - | 0x0050: | + | |
| - | 0x0060: | + | |
| - | 0x0070: | + | |
| - | 0x0080: | + | |
| - | 0x0090: | + | |
| - | 0x00a0: | + | |
| - | 0x00b0: | + | |
| - | 0x00c0: | + | |
| - | | + | |
| - | | + | |
| - | 13: | + | |
| - | | + | |
| - | | + | |
| - | 0x0020: | + | |
| - | 0x0030: | + | |
| - | 13: | + | |
| - | 0x0000: | + | |
| - | 0x0010: | + | |
| - | 0x0020: | + | |
| - | 0x0030: | + | |
| - | 0x0040: | + | |
| - | 3 packets captured | + | |
| - | 10 packets received by filter | + | |
| - | 0 packets dropped by kernel | + | |
| </ | </ | ||
| - | ==L' | + | Pour obtenir de l' |
| - | + | ||
| - | Pour écouter sur une interface spécifique et envoyer la sortie dans un fichier, utilisez les options -i et **-w** et patientez 5 minutes | + | |
| < | < | ||
| - | root@debian12:~# tcpdump -i ens18 -w log.dump | + | root@manager:~/postgres# docker secret inspect pg_database |
| - | tcpdump: listening on ens18, link-type EN10MB (Ethernet), snapshot length 262144 bytes | + | [ |
| - | ^C42 packets captured | + | { |
| - | 45 packets received by filter | + | " |
| - | 0 packets dropped by kernel | + | " |
| - | + | " | |
| - | root@debian12:~# ls -l log.dump | + | }, |
| - | -rw-r--r-- 1 tcpdump tcpdump 25555 Nov 28 13:11 log.dump | + | " |
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | } | ||
| + | ] | ||
| </ | </ | ||
| <WRAP center round important 50%> | <WRAP center round important 50%> | ||
| - | **Important** | + | **Important** |
| </ | </ | ||
| - | Notez que le fichier log.dump est au format | + | L' |
| < | < | ||
| - | root@debian12:~# file log.dump | + | root@manager:~/postgres# docker secret inspect --pretty pg_database |
| - | log.dump: pcap capture file, microsecond ts (little-endian) | + | ID: 5lx4zydpfocwgpdto0yy1jod9 |
| + | Name: pg_database | ||
| + | Driver: | ||
| + | Created at: 2021-04-15 03:49:36.344367554 +0000 utc | ||
| + | Updated at: 2021-04-15 03:49:36.344367554 +0000 utc | ||
| </ | </ | ||
| - | ==L' | + | Créez maintenant le fichier compose **postgres-secrets.yaml** : |
| - | Tcpdump peut être utilisé avec un de trois modes verbose. | + | < |
| + | root@manager: | ||
| + | root@manager: | ||
| + | version: ' | ||
| - | ^ Mode ^ Option ^ | + | services: |
| - | | Light verbose | -v | | + | |
| - | | Medium verbose | -vv | | + | |
| - | | Full verbose | -vvv | | + | |
| - | < | + | db: |
| - | root@debian12:~# tcpdump | + | image: postgres |
| - | tcpdump: listening on ens18, link-type EN10MB (Ethernet), snapshot length 262144 bytes | + | restart: always |
| - | 13:13: | + | environment: |
| - | | + | POSTGRES_USER_FILE: |
| - | 13:13:22.870085 IP (tos 0x10, ttl 64, id 17171, offset 0, flags [DF], proto TCP (6), length 52) | + | POSTGRES_PASSWORD_FILE: |
| - | | + | POSTGRES_DB_FILE: |
| - | 13:13:22.951837 IP (tos 0x10, ttl 64, id 34139, offset 0, flags [DF], proto TCP (6), length 176) | + | secrets: |
| - | | + | - pg_password |
| - | 3 packets captured | + | - pg_user |
| - | 10 packets received by filter | + | - pg_database |
| - | 0 packets dropped by kernel | + | |
| + | adminer: | ||
| + | image: adminer | ||
| + | ports: | ||
| + | - 8080:8080 | ||
| + | |||
| + | secrets: | ||
| + | pg_user: | ||
| + | | ||
| + | | ||
| + | | ||
| + | pg_database: | ||
| + | | ||
| </ | </ | ||
| - | ===1.2 | + | Notez que dans ce fichier les trois variables **POSTGRES_USER**, |
| - | Tcpdump peut effectuer du filtrage lors de l' | + | Deuxièmement la section suivantes spécifie les noms des secrets à utiliser avec le service : |
| - | Pour uniquement écouter les paquets en provenance de l' | + | < |
| + | secrets: | ||
| + | - pg_password | ||
| + | - pg_user | ||
| + | - pg_database | ||
| + | </ | ||
| - | # tcpdump src host 192.168.1.11 [Entrée] | + | La dernière section spécifie que les secrets sont **externes** : |
| - | Pour uniquement écouter les paquets en provenance de l' | + | < |
| + | secrets: | ||
| + | pg_user: | ||
| + | external: true | ||
| + | pg_password: | ||
| + | external: true | ||
| + | pg_database: | ||
| + | external: true | ||
| + | </ | ||
| - | # tcpdump src host 192.168.1.11 and dst host 192.168.1.2 [Entrée] | + | <WRAP center round important 50%> |
| + | **Important** : Le terme **externe** indique que les secrets ne seront pas stockés dans l' | ||
| + | </ | ||
| - | Pour uniquement écouter les paquets d'un port précis, utilisez | + | Déployez maintenant le service en utilisant |
| - | | + | < |
| + | root@manager: | ||
| + | Ignoring unsupported options: restart | ||
| - | Pour uniquement écouter les paquets d'un protocole précis, utilisez une condition telle **ip**, **icmp**, **arp**, **rarp**, **udp** ou **tcp**: | + | Creating network postgres_default |
| + | Creating service postgres_db | ||
| + | Creating service postgres_adminer | ||
| + | </ | ||
| - | # tcpdump | + | <WRAP center round important 50%> |
| + | **Important** : Notez a présence de l' | ||
| + | </ | ||
| - | Pour uniquement écouter les paquets d'une taille inférieure | + | Connectez-vous maintenant |
| - | # tcpdump | + | {{ : |
| - | Pour uniquement écouter | + | Validez le formulaire et vérifiez que les secrets ont été pris en compte |
| - | # tcpdump | + | {{ : |
| - | L' | + | Dernièrement, |
| - | | + | < |
| + | root@manager: | ||
| + | NAME SERVICES | ||
| + | postgres | ||
| + | root@manager: | ||
| + | Removing service postgres_adminer | ||
| + | Removing service postgres_db | ||
| + | Removing network postgres_default | ||
| + | </ | ||
| - | ===Options | + | =====LAB #2 - Création d'un Utilisateur |
| - | Les options | + | Au contraire des solutions classiques |
| < | < | ||
| - | root@debian12:~# tcpdump | + | root@manager:~# cat /etc/group | grep docker |
| - | tcpdump version 4.99.3 | + | docker: |
| - | libpcap version 1.10.3 (with TPACKET_V3) | + | root@manager: |
| - | OpenSSL 3.0.17 1 Jul 2025 | + | root@manager: |
| - | Usage: tcpdump [-AbdDefhHIJKlLnNOpqStuUvxX# | + | déconnexion |
| - | [ -C file_size ] [ -E algo:secret ] [ -F file ] [ -G seconds ] | + | trainee@manager: |
| - | [ -i interface ] [ --immediate-mode ] [ -j tstamptype ] | + | Got permission denied while trying to connect to the Docker daemon socket at unix:/// |
| - | | + | trainee@manager:~$ newgrp docker |
| - | [ -r file ] [ -s snaplen ] [ -T type ] [ --version ] | + | trainee@manager:~$ docker ps -a |
| - | | + | CONTAINER ID IMAGE |
| - | | + | d02c6115724c |
| - | [ -z postrotate-command ] [ -Z user ] [ expression ] | + | trainee@manager: |
| + | alpine1 | ||
| + | trainee@manager: | ||
| + | a214e2df0499c97e8da25a6c9ea751ac75344c9bcd7d238f8cb8d5c777510ab9 | ||
| + | trainee@manager: | ||
| + | CONTAINER ID IMAGE | ||
| + | a214e2df0499 | ||
| </ | </ | ||
| - | =====Les Contre-Mesures===== | + | =====LAB #3 - Le Script docker-bench-security.sh===== |
| - | Les contre-mesures incluent | + | Le **Center for Internet Security (CIS)** est une organisation indépendante à but non-lucratif qui publie des best practices dans de nombreux domaines de l'informatique. Le guide pour Docker peut être téléchargé à partir |
| - | ====Introduction à la cryptologie==== | + | Le guide est divisé en plusieurs sections : |
| - | ===Définitions=== | + | * La configuration de l' |
| + | * La configuration du daemon Docker, | ||
| + | * Les fichiers de configuration du daemon Docker, | ||
| + | * Les images ainsi que les fichiers servant à la construction des images, | ||
| + | * Le container runtime, | ||
| + | * Les opérations sécuritaires relatives à Docker, | ||
| + | * La configuration de Docker Swarm. | ||
| - | * **La Cryptologie** | + | Ce guide est à utiliser avec le script |
| - | * La science qui étudie les aspects scientifiques de ces techniques, c'est-à-dire qu' | + | |
| - | * **La Cryptanalyse** | + | |
| - | * Lorsque la clef de déchiffrement n'est pas connue de l' | + | |
| - | | + | |
| - | * Un terme générique désignant l' | + | |
| - | * **Le Décryptement ou Décryptage** | + | |
| - | * Est le fait d' | + | |
| - | {{ :redhat: | + | Clonez le script **docker-bench-security.sh** en utilisant **git** |
| - | **La Cryptographie** | + | < |
| + | trainee@manager: | ||
| + | Password: fenestros | ||
| - | La cryptographie apporte quatre points clefs: | + | root@manager:~# git clone https:// |
| + | Cloning in ' | ||
| + | remote: Enumerating objects: 18, done. | ||
| + | remote: Counting objects: 100% (18/18), done. | ||
| + | remote: Compressing objects: 100% (16/16), done. | ||
| + | remote: Total 1921 (delta 5), reused 6 (delta 2), pack-reused 1903 | ||
| + | Receiving objects: 100% (1921/ | ||
| + | Delta resolution: 100% (1339/ | ||
| + | </ | ||
| - | | + | Exécutez maintenant le script |
| - | | + | |
| - | | + | |
| - | | + | |
| - | * L' | + | |
| - | * consiste à assurer l' | + | |
| - | * La non-répudiation | + | |
| - | * est la garantie qu' | + | |
| - | La cryptographie est basée sur l' | + | < |
| + | root@manager:~# cd docker-bench-security/ | ||
| - | * Procéder au chiffrement | + | root@manager: |
| - | * Le résultat de cette modification (le message chiffré) est appelé cryptogramme (Ciphertext) par opposition au message initial, appelé message en clair (Plaintext) | + | # -------------------------------------------------------------------------------------------- |
| - | * Procéder au déchiffrement | + | # Docker Bench for Security v1.6.0 |
| + | # | ||
| + | # Docker, Inc. (c) 2015-2023 | ||
| + | # | ||
| + | # Checks for dozens of common best-practices around deploying Docker containers in production. | ||
| + | # Based on the CIS Docker Benchmark 1.6.0. | ||
| + | # -------------------------------------------------------------------------------------------- | ||
| - | Le chiffrement se fait à l'aide d'une clef de chiffrement. Le déchiffrement nécessite | + | Initializing 2023-12-17T14: |
| - | On distingue deux types de clefs: | ||
| - | * Les clés symétriques: | + | Section A - Check results |
| - | * des clés utilisées pour le chiffrement ainsi que pour le déchiffrement. On parle alors de chiffrement symétrique ou de chiffrement à clé secrète. | + | |
| - | * Les clés asymétriques: | + | |
| - | * des clés utilisées dans le cas du chiffrement asymétrique (aussi appelé chiffrement à clé publique). Dans ce cas, une clé différente est utilisée pour le chiffrement et pour le déchiffrement. | + | |
| - | **Le Chiffrement par Substitution** | + | [INFO] 1 - Host Configuration |
| - | + | [INFO] 1.1 - Linux Hosts Specific Configuration | |
| - | Le chiffrement par substitution consiste à remplacer dans un message une ou plusieurs entités | + | [WARN] 1.1.1 - Ensure a separate partition for containers has been created (Automated) |
| + | [INFO] 1.1.2 - Ensure only trusted users are allowed to control Docker daemon (Automated) | ||
| + | [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 (Manual) | ||
| + | [PASS] 1.2.2 - Ensure that the version of Docker is up to date (Manual) | ||
| + | [INFO] | ||
| - | * La substitution **monoalphabétique** | + | [INFO] 2 - Docker daemon configuration |
| - | * consiste à remplacer chaque lettre du message par une autre lettre de l'alphabet | + | [NOTE] 2.1 - Run the Docker daemon as a non-root user, if possible (Manual) |
| - | * La substitution **polyalphabétique** | + | [WARN] 2.2 - Ensure network traffic is restricted between containers on the default bridge (Scored) |
| - | * consiste à utiliser une suite de chiffres monoalphabétique réutilisée périodiquement | + | [PASS] 2.3 - Ensure the logging level is set to 'info' (Scored) |
| - | * La substitution **homophonique** | + | [PASS] 2.4 - Ensure Docker is allowed to make changes to iptables (Scored) |
| - | * permet de faire correspondre à chaque lettre du message en clair un ensemble possible d'autres caractères | + | [PASS] 2.5 - Ensure insecure registries are not used (Scored) |
| - | * La substitution de **polygrammes** | + | [PASS] 2.6 - Ensure aufs storage driver is not used (Scored) |
| - | * consiste à substituer un groupe de caractères | + | [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] 2.9 - Enable user namespace support (Scored) | ||
| + | [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 | ||
| - | ===Algorithmes à clé secrète=== | + | [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) | ||
| - | ==Le Chiffrement Symétrique== | + | [INFO] 4 - Container Images and Build File |
| + | [INFO] 4.1 - Ensure that a user for the container has been created (Automated) | ||
| + | [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) | ||
| - | Ce système est aussi appelé le système à **Clef Secrète** ou à **clef privée**. | + | [INFO] 5 - Container Runtime |
| + | [INFO] | ||
| - | Ce système consiste à effectuer une opération de chiffrement par algorithme mais comporte un inconvénient, | + | [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 | ||
| + | [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's secret management commands are used for managing secrets in a swarm cluster (Manual) (Swarm mode not enabled) | ||
| + | [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) | ||
| - | <WRAP center round important 50%> | ||
| - | **Important** - Le système de Méthode du Masque Jetable (One Time Pad) fût mis au point dans les années 1920. Il utilisait une clef générée aléatoirement à usage unique. | ||
| - | </ | ||
| - | Les algorithmes de chiffrement symétrique couramment utilisés en informatique sont: | + | Section C - Score |
| - | * **[[wpfr> | + | [INFO] Checks: 86 |
| - | * **[[wpfr> | + | [INFO] Score: 1 |
| - | * **[[wpfr>RC2]]**, | + | </code> |
| - | * **[[wpfr> | + | |
| - | * **[[wpfr> | + | |
| - | * **[[wpfr> | + | |
| - | ===Algorithmes | + | Ce script sert à automatiser le contrôle des points précédemment cités et produit un rapport contenant des annotations : |
| - | ==Le Chiffrement Asymétrique== | + | * **[PASS]** : Concerne les points qui n'ont pas besoin d' |
| + | * **[WARN]** : Concerne les points qui **doivent** être modifiés, | ||
| + | * **[INFO]** : Concerne les points qui doivent être passés en revue selon les besoins de votre configuration, | ||
| + | * **[NOTE]** : Vous informe d'un **best practice**. | ||
| - | Ce système est aussi appelé **Système à Clef Publique**. | + | =====LAB #4 - Sécurisation de la Configuration de l' |
| - | Ce système consiste | + | Lors de l' |
| - | | + | < |
| - | * Une clef **secrète** ou **privée** pour le déchiffrement | + | ... |
| + | [INFO] 1 - Host Configuration | ||
| + | [INFO] 1.1 - Linux Hosts Specific Configuration | ||
| + | [WARN] 1.1.1 - Ensure a separate partition for containers has been created (Automated) | ||
| + | [INFO] 1.1.2 - Ensure only trusted users are allowed to control Docker daemon (Automated) | ||
| + | [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 (Manual) | ||
| + | [PASS] 1.2.2 - Ensure that the version of Docker is up to date (Manual) | ||
| + | [INFO] | ||
| + | ... | ||
| + | </ | ||
| - | {{: | + | Les problèmes |
| - | * L' | + | ====[WARN] 1.1.1 - Ensure a separate partition for containers has been created |
| - | * A partir de cette clef il génère plusieurs clefs publiques grâce à un algorithme. | + | |
| - | * L' | + | |
| - | Ce système est basé sur ce que l'on appelle une **fonction à trappe à sens unique** ou **one-way trap door**. | + | Par défaut, tous les fichiers de Docker sont stockés dans le répertoire |
| - | Il existe toutefois un problème – s' | + | ====[WARN] 1.1.3 - Ensure auditing is configured for the Docker daemon (Automated)==== |
| - | Les algorithmes de chiffrement asymétrique couramment utilisés en informatique sont: | + | < |
| + | [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) | ||
| + | [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 - / | ||
| + | [WARN] 1.1.12 - Ensure auditing is configured for Dockerfiles and directories - / | ||
| + | [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 - / | ||
| + | [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. |
| - | * **[[wpfr> | + | |
| - | ==La Clef de Session== | + | Editez le fichier **/ |
| - | Ce système est un compromis entre le système symétrique et le système asymétrique. Il permet l' | + | < |
| + | root@manager: | ||
| - | {{:redhat:lx04:crypto4.gif|Cette image issue de Comment Ça Marche (www.commentcamarche.net) est mise à disposition sous les termes de la licence Creative Commons. Vous pouvez copier, modifier des copies de l' | + | root@manager:~/ |
| + | deb http:// | ||
| + | deb-src http://archive.debian.org/debian/ stretch main | ||
| + | deb http:// | ||
| + | deb-src http:// | ||
| + | deb [arch=amd64] https:// | ||
| + | </ | ||
| - | Ce système fonctionne de la façon suivante | + | Exécutez |
| - | * L' | + | < |
| - | * L' | + | root@manager: |
| - | * L'utilisateur B déchiffre la clef de session en utilisant sa propre clef privée. | + | Ign:1 http:// |
| - | * L'utilisateur B déchiffre les données en utilisant la clef de session. | + | Atteint:2 http:// |
| + | Atteint:3 http:// | ||
| + | Réception | ||
| + | 44,8 ko réceptionnés | ||
| + | Lecture | ||
| + | Construction | ||
| + | Lecture des informations d'état... Fait | ||
| + | 254 packages can be upgraded. Run 'apt list --upgradable' | ||
| + | </ | ||
| - | ===Fonctions de Hachage=== | + | Pour installer auditd, utilisez **apt-get** : |
| - | La fonction de **hachage**, | + | < |
| + | root@manager: | ||
| + | </ | ||
| - | {{: | + | Modifiez ensuite le fichier **/ |
| - | Les deux algorithmes de hachage utilisés sont: | + | < |
| + | root@manager:~/ | ||
| - | * **[[wpfr> | + | root@manager: |
| - | * **[[wpfr> | + | ## First rule - delete all |
| + | -D | ||
| - | Lors de son envoie, le message est accompagné de son haché et il est donc possible de garantir son intégrité: | + | ## Increase the buffers to survive stress events. |
| + | ## Make this bigger for busy systems | ||
| + | -b 8192 | ||
| - | {{: | + | ## This determine how long to wait in burst of events |
| - | + | --backlog_wait_time 0 | |
| - | * A la réception du message, le destinataire ou l’utilisateur B calcule le haché du message reçu et le compare avec le haché accompagnant le document. | + | |
| - | * Si le message ou le haché a été falsifié durant la communication, | + | ## Set failure mode to syslog |
| + | -f 1 | ||
| + | |||
| + | ##Docker | ||
| + | -w / | ||
| + | -w / | ||
| + | -w /etc/docker -p wa | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | </ | ||
| <WRAP center round important 50%> | <WRAP center round important 50%> | ||
| - | **Important** | + | **Important** |
| </ | </ | ||
| - | ===Signature Numérique=== | + | Re-démarrez ensuite auditd : |
| - | Pour garantir l' | + | < |
| + | root@manager: | ||
| + | </ | ||
| - | {{: | + | Vérifiez ensuite |
| - | * L’utilisateur A envoie le sceau au destinataire. | + | < |
| - | * A la réception du message L’utilisateur B déchiffre le sceau avec la clé publique de l’utilisateur A. | + | root@manager: |
| - | * Il compare le haché obtenu au haché reçu en pièce jointe. | + | ## This file is automatically generated from / |
| - | + | -D | |
| - | Ce mécanisme de création de sceau est appelé **scellement**. | + | -b 8192 |
| + | -f 1 | ||
| + | --backlog_wait_time 0 | ||
| + | -w / | ||
| + | -w / | ||
| + | -w /etc/docker -p wa | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | -w / | ||
| + | </ | ||
| - | Ce mécanisme est identique au procédé utilisé par SSH lors d'une connexion | + | <WRAP center round important 50%> |
| + | **Important** - Pour plus d'information concernant la création de règles personalisées avec auditd, consultez cette **[[https:// | ||
| + | </ | ||
| - | ===PKI=== | + | Ré-exécutez le script **Docker Benchmark Security** : |
| - | On appelle **[[wpfr> | + | < |
| + | root@manager: | ||
| + | ... | ||
| + | [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 - / | ||
| + | [PASS] 1.1.7 - Ensure auditing is configured for Docker files and directories - docker.service | ||
| + | [PASS] 1.1.9 - Ensure auditing is configured for Docker files and directories - docker.socket | ||
| + | [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 - Ensure auditing is configured for Docker files and directories - / | ||
| + | [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 - / | ||
| + | ... | ||
| + | </ | ||
| - | Les cryptosystèmes à clés publiques permettent de s' | + | =====LAB #5 - Sécurisation |
| - | * La clé publique est bien celle de son propriétaire ; | + | Exécutez |
| - | | + | |
| - | | + | |
| - | Ainsi, il est nécessaire d'associer au bi-clé (ensemble clé publique / clé privée) un certificat délivré par un **tiers de confiance** : l'infrastructure de gestion de clés. | + | < |
| + | ... | ||
| + | [INFO] 2 - Docker daemon configuration | ||
| + | [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 'info' (Scored) | ||
| + | [PASS] 2.4 - Ensure Docker is allowed to make changes to iptables | ||
| + | [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] 2.9 - Enable user namespace support (Scored) | ||
| + | [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) | ||
| + | ... | ||
| + | </ | ||
| - | Le tiers de confiance est une entité appelée communément autorité de certification (ou en anglais Certification authority, abrégé CA) chargée d'assurer la véracité des informations contenues dans le certificat de clé publique et de sa validité. | + | Les problèmes |
| - | Pour ce faire, l' | + | ====[WARN] 2.2 - Ensure network traffic is restricted between containers on the default bridge (Scored)==== |
| - | Le rôle de l' | + | Par défaut Docker permet un trafic réseau sans restrictions entre des conteneurs sur le même hôte. Il est cependant possible |
| - | * enregistrer des demandes de clés en vérifiant l'identité des demandeurs ; | + | Pour plus d'informations, |
| - | | + | |
| - | | + | |
| - | | + | |
| - | * révoquer des clés (en cas de perte par son propriétaire, | + | |
| - | Une infrastructure à clé publique est en règle générale composée de trois entités distinctes : | + | ====[WARN] 2.9 - Enable user namespace support (Scored)==== |
| - | * L' | + | Cet avertissement nous indique |
| - | | + | |
| - | | + | |
| - | ==Certificats X509== | + | Pour plus d' |
| - | Pour palier aux problèmes liés à des clefs publiques piratées, un système de certificats a été mis en place. | + | ====[WARN] 2.12 - Ensure that authorization for Docker client commands is enabled (Scored)==== |
| - | Le certificat | + | Par défaut, Docker |
| - | Les certificats sont des fichiers divisés en deux parties | + | Pour plus d' |
| - | * La partie contenant les informations | + | ====[WARN] 2.13 - Ensure centralized and remote logging is configured (Scored)==== |
| - | * La partie contenant la signature de l' | + | |
| - | La structure | + | Cet avertissement indique que la configuration de rsyslog ne permet pas l' |
| - | Elle contient | + | Pour plus d' |
| - | * Le nom de l' | + | ====[WARN] 2.14 - Ensure containers are restricted from acquiring new privileges (Scored)==== |
| - | * Le nom du propriétaire du certificat | + | |
| - | * La date de validité du certificat | + | |
| - | * L' | + | |
| - | * La clé publique du propriétaire | + | |
| - | Le Certificat est signé par l' | + | Par défaut un conteneur peut obtenir une escalade |
| - | {{:redhat: | + | Pour plus d' |
| - | La vérification se passe ainsi: | + | ====[WARN] 2.15 - Ensure live restore is enabled (Scored)==== |
| - | {{: | + | L' |
| - | =====LAB #2 - Utilisation de GnuPG===== | + | ====[WARN] |
| - | ====2.1 - Présentation==== | + | Il existe deux méthodes pour qu'un conteneur puisse router vers l' |
| - | **GNU Privacy Guard** permet aux utilisateurs de transférer des messages chiffrés et/ou signés. | + | |
| + | * **Userland Proxy**. | ||
| - | ====2.2 - Utilisation==== | + | Il est préférable d' |
| - | Pour initialiser %%GnuPG%%, saisissez la commande suivante | + | Pour plus d' |
| - | < | + | ====5.1 - Le Fichier |
| - | root@debian12: | + | |
| - | gpg: directory '/ | + | |
| - | gpg: keybox '/root/.gnupg/pubring.kbx' created | + | |
| - | gpg: WARNING: no command supplied. | + | |
| - | gpg: Go ahead and type your message ... | + | |
| - | ^C | + | |
| - | gpg: signal Interrupt caught ... exiting | + | |
| - | </ | + | |
| - | <WRAP center round important 50%> | + | Créez le fichier |
| - | **Important** - Notez l' | + | |
| - | </ | + | |
| - | + | ||
| - | Pour générer les clefs, saisissez la commande suivante | + | |
| - | + | ||
| - | <WRAP center round important 50%> | + | |
| - | **Important** - Lorsque le système vous demande une Passphrase, saisissez une valeur que n' | + | |
| - | </ | + | |
| < | < | ||
| - | root@debian12:~# gpg --full-generate-key | + | root@manager:~/docker-bench-security# vi / |
| - | gpg (GnuPG) 2.2.40; Copyright (C) 2022 g10 Code GmbH | + | |
| - | This is free software: you are free to change and redistribute it. | + | |
| - | There is NO WARRANTY, to the extent permitted by law. | + | |
| - | Please select what kind of key you want: | + | root@manager:~/ |
| - | (1) RSA and RSA (default) | + | { |
| - | (2) DSA and Elgamal | + | " |
| - | (3) DSA (sign only) | + | " |
| - | (4) RSA (sign only) | + | " |
| - | (14) Existing key from card | + | " |
| - | Your selection? 1 | + | " |
| - | RSA keys may be between 1024 and 4096 bits long. | + | " |
| - | What keysize do you want? (3072) | + | } |
| - | Requested keysize is 3072 bits | + | </code> |
| - | Please specify how long the key should be valid. | + | |
| - | 0 = key does not expire | + | |
| - | | + | |
| - | <n>w = key expires in n weeks | + | |
| - | <n>m = key expires in n months | + | |
| - | <n>y = key expires in n years | + | |
| - | Key is valid for? (0) | + | |
| - | Key does not expire at all | + | |
| - | Is this correct? (y/N) y | + | |
| - | GnuPG needs to construct a user ID to identify your key. | + | Re-démarrez le service Docker : |
| - | Real name: ITTRAINING | + | < |
| - | Email address: infos@ittraining.team | + | root@manager:~/docker-bench-security# |
| - | Comment: Test key | + | </code> |
| - | You selected this USER-ID: | + | |
| - | " | + | |
| - | Change (N)ame, (C)omment, (E)mail or (O)kay/ | + | Vérifiez la présence de l'utilisateur dénommé **dockremap** |
| - | We need to generate a lot of random bytes. It is a good idea to perform | + | |
| - | some other action (type on the keyboard, move the mouse, utilize the | + | |
| - | disks) during the prime generation; this gives the random number | + | |
| - | generator a better chance to gain enough entropy. | + | |
| - | We need to generate a lot of random bytes. It is a good idea to perform | + | |
| - | some other action (type on the keyboard, move the mouse, utilize the | + | |
| - | disks) during the prime generation; this gives the random number | + | |
| - | generator a better chance to gain enough entropy. | + | |
| - | gpg: / | + | |
| - | gpg: directory | + | |
| - | gpg: revocation certificate stored as '/ | + | |
| - | public and secret key created and signed. | + | |
| - | pub | + | < |
| - | B6022CC107539B4036A90FAEABAD13CD27F9E686 | + | root@manager: |
| - | uid | + | uid=116(dockremap) gid=121(dockremap) groupes=121(dockremap) |
| - | sub | + | |
| </ | </ | ||
| - | La liste de clefs peut être visualisée avec la commande suivante | + | Ré-exécutez le script **Docker Benchmark Security** |
| < | < | ||
| - | root@debian12:~# gpg --list-keys | + | root@manager:~/docker-bench-security# ./docker-bench-security.sh |
| - | gpg: checking | + | ... |
| - | gpg: marginals needed: | + | [PASS] 2.2 - Ensure network traffic is restricted between containers on the default bridge (Scored) |
| - | gpg: depth: 0 valid: | + | [PASS] 2.3 - Ensure the logging level is set to ' |
| - | /root/.gnupg/ | + | [PASS] 2.4 - Ensure Docker is allowed to make changes to iptables (Scored) |
| - | ------------------------ | + | [PASS] 2.5 - Ensure insecure registries are not used (Scored) |
| - | pub | + | [PASS] 2.6 - Ensure aufs storage driver is not used (Scored) |
| - | | + | [PASS] 2.9 - Enable user namespace support (Scored) |
| - | uid [ultimate] ITTRAINING | + | [PASS] 2.10 - Ensure the default cgroup usage has been confirmed (Scored) |
| - | sub | + | [PASS] 2.11 - Ensure base device size is not changed until needed (Scored) |
| + | [PASS] 2.13 - Ensure centralized and remote logging is configured (Scored) | ||
| + | [PASS] 2.14 - Ensure containers are restricted from acquiring new privileges (Scored) | ||
| + | [PASS] 2.15 - Ensure live restore is enabled | ||
| + | [PASS] 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) | ||
| + | ... | ||
| </ | </ | ||
| - | Pour importer la clef d'un correspondant dans sa trousse de clefs il convient d' | + | Pour plus d'informations, |
| - | <WRAP center round important 50%> | + | =====LAB |
| - | **Important** - La commande suivante est un exemple. Ne la saisissez **PAS**. | + | |
| - | </ | + | |
| - | + | ||
| - | | + | |
| - | Pour exporter sa clef publique, il convient d' | + | Créez le conteneur mysql : |
| < | < | ||
| - | root@debian12:~# gpg --export | + | 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@debian12:~# cat mykey.asc | + | root@manager:~/docker-bench-security# docker container run -d --name mysql -e MYSQL_ROOT_PASSWORD=password mysql |
| - | -----BEGIN PGP PUBLIC KEY BLOCK----- | + | Unable to find image ' |
| + | latest: Pulling from library/ | ||
| + | e9f2695d7e5b: | ||
| + | 80c6055edb33: | ||
| + | c646ab461d8b: | ||
| + | 012006c6a591: | ||
| + | 929d5fa34b95: | ||
| + | 17e0243877fa: | ||
| + | 1850b459cd2f: | ||
| + | 8dceaed53baf: | ||
| + | 197b834ea1cd: | ||
| + | 8df78c25b227: | ||
| + | Digest: sha256: | ||
| + | Status: Downloaded newer image for mysql: | ||
| + | e503dd98f88992ae6ed5ec4dcaa2e18982ade8ec74966869515a120763418f74 | ||
| - | mQGNBGkpk+gBDACq6M7rUNQFu/R6J+1p3RAB1+gwnszs/ | + | root@manager: |
| - | oV9JmFfRe4P2QG/ | + | CONTAINER ID IMAGE |
| - | MtIf4LlXRrTALGE5TclLWFz5a2iqRjtT8IjSPAu1M9TLUaMXtWXN6jQY1YOnjxPN | + | e503dd98f889 |
| - | 3HL8bwdaY0k8icKr8JRbmEijCWo2F4t2qTtdOXuRFAImxBpX49eJR0oC5bzXZPYx | + | |
| - | LbirNsEwSULIyQ71gdF5OUb0aOSiQLXLuTLAs2BnxAJ82tB/dM8qP0ez0lXLJvvF | + | |
| - | +t0eHdWzUHH4qlXuNtBXK7pEbvjqftO69PJLDp/PwjEfUsELcxDyUFpphhZDJ8zN | + | |
| - | qvRgll3fojjr91WWWqr8YTd4EiTvq9KfUyAiTOfKm8k4iRQRTJir267Fq8Mno8/ | + | |
| - | My1tNeHWzCXMs3k/ | + | |
| - | XTBUX/ | + | |
| - | dHRyYWluaW5nLnRlYW0+iQHOBBMBCgA4FiEEtgIswQdTm0A2qQ+uq60TzSf55oYF | + | |
| - | Amkpk+gCGwMFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQq60TzSf55oZEsAv+ | + | |
| - | Ky14vHWjMzU1ieE+XStqGYfjfAHhaNrpkWCz6miozuh+ESifNWpJd96bzwgNLGob | + | |
| - | E5mA9oja5jyAEQUGT+gEwgvkbYVe4sf4UcXPRrvDqKiEOkN5rra3kYYdhHhpiFes | + | |
| - | BmwQvW2dyElNO1ee/ | + | |
| - | C5kqTMRXdoWR2ZP2HLZjUstRX7d9BP/ | + | |
| - | TqtAMmtp5IXalT+vKwhMu0MwUfyXyvl7ery4kxfmFtEeJQyxrdK2gihDxr0ndxBH | + | |
| - | mowlIoBiGYMhUr/ | + | |
| - | VBlBdhX2SlE9XJOjLq9ppV5Vr9u6ZauwEI6kBLoagjWOF3t34Gnvel8zO+H5fhhq | + | |
| - | UKMOAbC0SYmLVIPNUauHYoKiJlWb+Dlr96NsPm0sYBbB047hr0evBUmkJNrulI3N | + | |
| - | uQGNBGkpk+gBDADZu1B0itmBIGzxjGmUjK9UagW3HNLNVX3jn2Jwe7yl3vL/ | + | |
| - | qBRydky32P4whbUSiJN71Tze9l+WOxeXGa0orKPPha/ | + | |
| - | xCrS131SYjFb5dcQXoqTtUk8Wu4qoMHu/ | + | |
| - | zs6azU/ | + | |
| - | FIpfm95Q+wtC224wckro/ | + | |
| - | IITHq92gQSAKFhwSauaPtJ++oQNRgz5vJhCg78XfyBGpwDS6P0NM5RVEz6LMhQzI | + | |
| - | 4LziGmYH/ | + | |
| - | CrtEjyAIQxCmEUF0vPa7X1KB+FxCpJ8mYXBZ5w1DwBN7qsOnnHZKFcaPGW8r1am6 | + | |
| - | Ab25ee028mua9RkAEQEAAYkBtgQYAQoAIBYhBLYCLMEHU5tANqkPrqutE80n+eaG | + | |
| - | BQJpKZPoAhsMAAoJEKutE80n+eaGCRgMAJiG7Q8oF6oMkn6Xh7kXVH2yF4CKN9/ | + | |
| - | / | + | |
| - | YoxDxegwlk9+gPiOMJ0+9R43IUs+jFrra1jcUpSg+1Nv2IijdPwape3HyPhYgDmZ | + | |
| - | VxORrNtqBCkhtLpJO5VTiThAny+rNBHk1t1vQg4tEkCLGcOD8bsdxhACZnM0DVYY | + | |
| - | rA6afeDnm7CTfVtc3QFAi2+ltYcDIrMxMF0b1VASlbU14TE6ep2Ic30ScpDJL8De | + | |
| - | skhWi2/ | + | |
| - | vh6kVR0MPTFjg+8khUjjrSYUzqiiK6iJDxn+m0XJvHzQTeCHQlgRrPj9HGp7isyK | + | |
| - | o9Wf8fVvnksR8xc/ | + | |
| - | DTh6aJal6iGcG4aXbTzwIFXHW9WipS5B4A== | + | |
| - | =rrxA | + | |
| - | -----END PGP PUBLIC KEY BLOCK----- | + | |
| </ | </ | ||
| - | Cette clef peut ensuite être jointe à des messages électroniques ou bien déposée sur un serveur | + | Exécutez |
| - | + | ||
| - | ===Signer | + | |
| - | + | ||
| - | Créez maintenant un message | + | |
| < | < | ||
| - | root@debian12:~# vi message.txt | + | root@manager:~/ |
| - | + | ... | |
| - | root@debian12:~# cat message.txt | + | [INFO] 4 - Container Images and Build File |
| - | # ~/message.txt | + | [WARN] 4.1 - Ensure that a user for the container has been created (Automated) |
| - | Ceci est un message de test pour GnuPG | + | [WARN] |
| + | [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] | ||
| + | [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) | ||
| + | ... | ||
| </ | </ | ||
| - | Pour signer ce message en format binaire, il convient d' | + | ====[WARN] 4.1 - Ensure that a user for the container has been created (Automated)==== |
| - | <WRAP center round important 50%> | + | Les processus dans le conteneur |
| - | **Important** - Entrez votre Passphrase quand gpg vous la demande. | + | |
| - | </ | + | |
| - | < | + | Pour plus d' |
| - | root@debian12:~# gpg --default-key ITTRAINING --detach-sign message.txt | + | |
| - | gpg: using " | + | |
| - | root@debian12: | + | ====[WARN] 4.5 - Ensure Content trust for Docker is Enabled (Automated)==== |
| - | -rw-r--r-- 1 root root 55 Nov 28 13:28 message.txt | + | |
| - | -rw-r--r-- 1 root root 461 Nov 28 13:28 message.txt.sig | + | |
| - | root@debian12: | + | Cette ligne indique que le support de Content trust n'a pas été activé. Content trust permet de s' |
| - | 4!, | + | Pour activer le Content trust, il faut positionner |
| - | '| | + | |
| - | M< | + | |
| - | </ | + | |
| - | + | ||
| - | Pour signer ce message en format ascii, il convient d' | + | |
| < | < | ||
| - | root@debian12:~# gpg --default-key ITTRAINING --armor --detach-sign message.txt | + | root@manager:~/docker-bench-security# echo " |
| + | DOCKER_CONTENT_TRUST=1 | ||
| - | gpg: using " | + | root@manager:~/ |
| + | </ | ||
| - | root@debian12: | + | Re-démarrez la machine virtuelle **Manager** et démarrez le conteneur **mysql** |
| - | -rw-r--r-- 1 root root 55 Nov 28 13:28 message.txt | + | |
| - | -rw-r--r-- 1 root root 691 Nov 28 13:31 message.txt.asc | + | |
| - | -rw-r--r-- 1 root root 461 Nov 28 13:28 message.txt.sig | + | |
| - | root@debian12:~# cat message.txt.asc | + | < |
| - | -----BEGIN PGP SIGNATURE----- | + | root@manager:~/ |
| + | Connection to 10.0.2.62 closed by remote host. | ||
| + | Connection to 10.0.2.62 closed. | ||
| - | iQHKBAABCgA0FiEEtgIswQdTm0A2qQ+uq60TzSf55oYFAmkplgkWHGluZm9zQGl0 | + | root@debian11: |
| - | dHJhaW5pbmcudGVhbQAKCRCrrRPNJ/ | + | trainee@10.0.2.62' |
| - | Ml72F9permfoLc83fj+zZfigUxZe4DHx0TslVtFhntkg+7wF1H3MmUyKOhwCXFO4 | + | Linux manager.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 |
| - | ccyE9/ | + | |
| - | MBVm2O4pFDXWu1+0S69YnAelElZrzoqCaqprkQCcJvekBSV2NUNPLcwcBGq966+q | + | |
| - | T9bGxPtW/ | + | |
| - | ZQsz2eby3oyv5KduA2emMnstQGCBq6zukYUpTgtzXB6jF1S71okiow11NsPra0m+ | + | |
| - | 9CAcg3tiylnkUJEgsvfZ45uctN+2UqBNAXMgVsHGUhJtugfPzfwWpfC/ | + | |
| - | g2nTttJexAGjjtw4Y0uFIYbNI0xXeH8ooh0AgQcXS5IOVH2zYs0GIdMxzRYFhRmc | + | |
| - | nVRd/ | + | |
| - | =2N1N | + | |
| - | -----END PGP SIGNATURE----- | + | |
| - | </ | + | |
| - | Pour signer ce message | + | 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 |
| - | root@debian12: | + | permitted by applicable law. |
| - | gpg: using " | + | Last login: Sun Dec 17 18:39:07 2023 from 10.0.2.46 |
| - | File ' | + | |
| - | root@debian12:~# ls -l | grep message | + | trainee@manager:~$ su - |
| - | -rw-r--r-- 1 root root 55 Nov 28 13:28 message.txt | + | Mot de passe : fenestros |
| - | -rw-r--r-- 1 root root 795 Nov 28 13:33 message.txt.asc | + | |
| - | -rw-r--r-- 1 root root 461 Nov 28 13:28 message.txt.sig | + | |
| - | root@debian12:~# cat message.txt.asc | + | root@manager:~# cd docker-bench-security/ |
| - | -----BEGIN PGP SIGNED MESSAGE----- | + | |
| - | Hash: SHA512 | + | |
| - | # ~/message.txt | + | root@manager: |
| - | Ceci est un message de test pour GnuPG | + | |
| - | -----BEGIN PGP SIGNATURE----- | + | |
| - | iQHKBAEBCgA0FiEEtgIswQdTm0A2qQ+uq60TzSf55oYFAmkplpsWHGluZm9zQGl0 | + | root@manager: |
| - | dHJhaW5pbmcudGVhbQAKCRCrrRPNJ/nmhopQC/ | + | mysql |
| - | QzcoDIIDMF71lizXIQ4DL2GCKhO3pelEWfyofUxd1sddT2qIHIsRTULaqHPRRjOU | + | |
| - | 9e/ | + | |
| - | qNPNlSZ4kzim3LyASyg8SYTGfft35S1S+7bjoY7LHfJUlGuSFRtlDMlhTbrrDqhI | + | |
| - | S3TL6EeNFCdEVoxCPamsAKvuk4BV8Fe2rCjQqm/ | + | |
| - | i7lQkZz+IjoTqwrjboL1mPWt6DMgiBX0IWas4kxKiBeZzyDZm6HGNeeMsqnReTcR | + | |
| - | TPNM9FdDmpcxYzrRbYAoWTmdhiPdD/ | + | |
| - | i3yOFw/ | + | |
| - | scYMCHrlrUfErpkLD1H6eFhSA4StmdZPmAA5DBA= | + | |
| - | =07RM | + | |
| - | -----END PGP SIGNATURE----- | + | |
| </ | </ | ||
| - | Pour vérifier | + | Exécutez de nouveau le script et notez le contenu de la section 4 : |
| < | < | ||
| - | root@debian12:~# gpg --verify message.txt.asc | + | root@manager:~/ |
| - | gpg: Signature made Fri 28 Nov 2025 01:33:31 PM CET | + | ... |
| - | gpg: using RSA key B6022CC107539B4036A90FAEABAD13CD27F9E686 | + | [INFO] 4 - Container Images and Build File |
| - | gpg: | + | [WARN] 4.1 - Ensure that a user for the container has been created (Automated) |
| - | gpg: Good signature from " | + | [WARN] |
| - | gpg: WARNING: not a detached signature; file ' | + | [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 | ||
| + | [NOTE] 4.4 - Ensure images are scanned and rebuilt to include security patches (Manual) | ||
| + | [PASS] 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] | ||
| + | [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 | ||
| + | [NOTE] 4.12 - Ensure all signed artifacts are validated (Manual) | ||
| + | ... | ||
| </ | </ | ||
| - | <WRAP center round important 50%> | + | Pour plus d'informations, consultez cette **[[https:// |
| - | **Important** - Pour vérifier la signature | + | |
| - | # gpg --verify message.txt.asc message.txt | + | ====[WARN] 4.6 - Ensure that HEALTHCHECK instructions have been added to container images==== |
| - | </ | + | |
| - | ===Chiffrer | + | Quand une image est construite il est possible d'y mettre |
| - | Pour chiffrer | + | Pour mettre en place un HEALTHCHECK, il conviendrait, par exemple, d'inclure la ligne suivante dans le fichier DOCKERFILE servant à construire l' |
| - | gpg --recipient | + | <file> |
| + | HEALTHCHECK --interval=20s --timeout=3s CMD curl -f http:// | ||
| + | </file> | ||
| - | * //< | + | Ce test permet |
| - | * //< | + | |
| - | Par exemple pour chiffrer un message en mode binaire, il convient de saisir la commande suivante | + | Pour plus d' |
| - | < | + | =====LAB |
| - | root@debian12: | + | |
| - | root@debian12: | + | Exécutez de nouveau le script **docker-bench-security.sh**, vous devez obtenir un résultat similaire à ceci en ce qui concerne la sécurité du Container Runtime |
| - | -rw-r--r-- 1 root root 55 Nov 28 13:28 message.txt | + | |
| - | -rw-r--r-- 1 root root 795 Nov 28 13:33 message.txt.asc | + | |
| - | -rw-r--r-- 1 root root 510 Nov 28 13:35 message.txt.gpg | + | |
| - | -rw-r--r-- 1 root root 461 Nov 28 13:28 message.txt.sig | + | |
| - | root@debian12:~# cat message.txt.gpg | + | < |
| - | ӛS4 | + | root@manager:~/ |
| - | t>25H@H:x+H n֩ˁ+B.^2Zھ~~~´4sd27J | + | ... |
| - | # | + | [INFO] 5 - Container Runtime |
| - | e^4, | + | [WARN] 5.1 - Ensure that, if applicable, an AppArmor Profile is enabled (Automated) |
| - | 5?" | + | [WARN] |
| - | | + | [WARN] 5.2 - Ensure that, if applicable, SELinux security options are set (Automated) |
| + | [WARN] | ||
| + | [PASS] 5.3 - Ensure that Linux kernel capabilities are restricted within containers (Automated) | ||
| + | [PASS] 5.4 - Ensure that privileged containers are not used (Automated) | ||
| + | [PASS] 5.5 - Ensure sensitive host system directories are not mounted on containers (Automated) | ||
| + | [PASS] 5.6 - Ensure sshd is not run within containers (Automated) | ||
| + | [PASS] 5.7 - Ensure privileged ports are not mapped within containers (Automated) | ||
| + | [PASS] 5.8 - Ensure that only needed ports are open on the container (Manual) | ||
| + | [PASS] 5.9 - Ensure that the host's network namespace is not shared (Automated) | ||
| + | [WARN] 5.10 - Ensure that the memory usage for containers is limited (Automated) | ||
| + | [WARN] | ||
| + | [WARN] 5.11 - Ensure that CPU priority is set appropriately on containers (Automated) | ||
| + | [WARN] | ||
| + | [WARN] 5.12 - Ensure that the container' | ||
| + | [WARN] | ||
| + | [PASS] 5.13 - Ensure that incoming container traffic is bound to a specific host interface | ||
| + | [WARN] 5.14 - Ensure that the ' | ||
| + | [WARN] * MaximumRetryCount is not set to 5: mysql | ||
| + | [PASS] | ||
| + | [PASS] 5.16 - Ensure that the host's IPC namespace is not shared (Automated) | ||
| + | [PASS] 5.17 - Ensure that host devices are not directly exposed to containers (Manual) | ||
| + | [INFO] 5.18 - Ensure that the default ulimit is overwritten at runtime if needed (Manual) | ||
| + | [INFO] | ||
| + | [PASS] 5.19 - Ensure mount propagation mode is not set to shared (Automated) | ||
| + | [PASS] 5.20 - Ensure that the host's UTS namespace is not shared (Automated) | ||
| + | [PASS] 5.21 - Ensure the default seccomp profile is not Disabled (Automated) | ||
| + | [NOTE] 5.22 - Ensure that docker exec commands are not used with the privileged option (Automated) | ||
| + | [NOTE] 5.23 - Ensure that docker exec commands are not used with the user=root option (Manual) | ||
| + | [PASS] 5.24 - Ensure that cgroup usage is confirmed (Automated) | ||
| + | [PASS] 5.25 - Ensure that the container is restricted from acquiring additional privileges (Automated) | ||
| + | [WARN] 5.26 - Ensure that container health is checked at runtime (Automated) | ||
| + | [WARN] | ||
| + | [INFO] 5.27 - Ensure that Docker commands always make use of the latest version of their image (Manual) | ||
| + | [WARN] 5.28 - Ensure that the PIDs cgroup limit is used (Automated) | ||
| + | [WARN] | ||
| + | [INFO] 5.29 - Ensure that Docker' | ||
| + | [INFO] | ||
| + | [PASS] 5.30 - Ensure that the host's user namespaces are not shared (Automated) | ||
| + | [PASS] 5.31 - Ensure that the Docker socket is not mounted inside any containers (Automated) | ||
| + | ... | ||
| </ | </ | ||
| - | Et pour chiffrer un message en mode ascii, | + | Les problèmes de sécurité qu'il convient |
| - | < | + | ====[WARN] 5.1 - Ensure that, if applicable, an AppArmor Profile is enabled |
| - | root@debian12: | + | |
| - | File ' | + | |
| - | root@debian12: | + | Cet avertissement est présent parce que le conteneur n' |
| - | -rw-r--r-- 1 root root 55 Nov 28 13:28 message.txt | + | |
| - | -rw-r--r-- 1 root root 752 Nov 28 13:38 message.txt.asc | + | |
| - | -rw-r--r-- 1 root root 510 Nov 28 13:36 message.txt.gpg | + | |
| - | -rw-r--r-- 1 root root 461 Nov 28 13:28 message.txt.sig | + | |
| - | root@debian12:~# cat message.txt.asc | + | Pour plus d' |
| - | -----BEGIN PGP MESSAGE----- | + | |
| - | hQGMA9ObUzTZ86GvAQwAxAGoxKHBMh53+bPqHs338vhWjxAZs19aItMm+CM2pKu5 | + | ====[WARN] 5.2 - Ensure that, if applicable, SELinux security options are set (Automated)==== |
| - | i4euJ36o+oVfbVTcqVNh4Q8I72QTOYTRTeXRWaUtVjp055A07BtlxGPbps9GXkVv | + | |
| - | 1faIs8viwHF1FHDC3Iz/ | + | |
| - | ylZxPngzTOR4RDbMbkZ5OvJKXNrOOiHUSDOMmI9o9nu7sxnMiPP3NUqilN/ | + | |
| - | xveV/ | + | |
| - | 21umlYbcIPtw87+h9twBj7vK5FUi7j8C5QWoDoM4XERf/ | + | |
| - | dTaZlgTtxM3CY7/ | + | |
| - | bIlrpLbs6yqtjant1bkZ5PuNhB1bRNxrSKZUZKdEMeY5M+C0GjKskjN84+OqgjRV | + | |
| - | 39GkfPDwqw/ | + | |
| - | PKDwHyTKCGN3NQKOIrw9LbIXehYEdrdFwGizGUXba1EWwVs+qMsmFueoQfcvA19N | + | |
| - | CJ2HPuO3qAVIDpYyX+vwdKQASbb8AMQIIksoQv7i | + | |
| - | =481C | + | |
| - | -----END PGP MESSAGE----- | + | |
| - | </ | + | |
| - | Pour décrypter un message il convient | + | Cet avertissement est présent parce que le conteneur n' |
| + | |||
| + | Pour plus d'informations, | ||
| + | |||
| + | ====[WARN] 5.10 - Ensure that the memory usage for containers is limited (Automated)==== | ||
| + | |||
| + | Cet avertissement est du au fait que les conteneurs ont automatiquement accès à la totalité de la RAM de l' | ||
| < | < | ||
| - | root@debian12:~# gpg --decrypt message.txt.asc | + | root@manager:~# docker run -d -p 8081:80 nginx |
| - | gpg: encrypted with 3072-bit RSA key, ID D39B5334D9F3A1AF, | + | b04b2a6f0dd93da21a8b7640afc319406e42868a141f90936dbcf52ab5bffb0d |
| - | " | + | root@manager:~# docker stats |
| - | # ~/message.txt | + | CONTAINER |
| - | Ceci est un message de test pour GnuPG | + | b04b2a6f0dd9 |
| + | ^C | ||
| </ | </ | ||
| - | =====LAB #3 - Mise en place de SSH et SCP===== | + | Supprimez le conteneur et re-créez le avec une limite |
| - | ====3.1 | + | < |
| + | root@manager: | ||
| + | Unable to find image ' | ||
| + | sha256: | ||
| + | 1f7ce2fa46ab: | ||
| + | 9b16c94bb686: | ||
| + | 9a59d19f9c5b: | ||
| + | 9ea27b074f71: | ||
| + | c6edf33e2524: | ||
| + | 84b1ff10387b: | ||
| + | 517357831967: | ||
| + | Digest: sha256: | ||
| + | Status: Downloaded newer image for nginx@sha256: | ||
| + | Tagging nginx@sha256: | ||
| + | e14d5112c2feb71e6f37252bcf99d03603d6b7a3e200bff0d55611a0e9a25e2b | ||
| - | La commande **[[wpfr> | + | root@manager: |
| + | CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O | ||
| + | e14d5112c2fe | ||
| + | e503dd98f889 | ||
| + | ^C | ||
| + | </ | ||
| - | * Le **serveur SSH** | + | Supprimez |
| - | * le démon sshd, qui s' | + | |
| - | * Le **client SSH** | + | |
| - | * ssh ou scp, qui assure la connexion | + | |
| - | * La **session** qui représente la connexion courante et qui commence juste après l' | + | |
| - | * Les **clefs** | + | |
| - | * **Couple de clef utilisateur asymétriques** et persistantes qui assurent l' | + | |
| - | * **Clef hôte asymétrique et persistante** garantissant l' | + | |
| - | * **Clef serveur asymétrique et temporaire** utilisée par le protocole SSH1 qui sert au chiffrement de la clé de session, | + | |
| - | * **Clef de session symétrique qui est générée aléatoirement** et qui permet le chiiffrement de la communication entre le client et le serveur. Elle est détruite en fin de session. SSH-1 utilise | + | |
| - | * La **base | + | |
| - | SSH fonctionne de la manière suivante pour la la mise en place d'un canal sécurisé: | + | < |
| + | root@manager:~/ | ||
| + | CONTAINER ID IMAGE | ||
| + | e14d5112c2fe | ||
| + | e503dd98f889 | ||
| - | * Le client contacte le serveur sur son port 22, | + | root@manager: |
| - | * Les client et le serveur échangent leur version de SSH. En cas de non-compatibilité de versions, l'un des deux met fin au processus, | + | e14 |
| - | * Le serveur SSH s' | + | |
| - | * Sa clé hôte, | + | |
| - | * Sa clé serveur, | + | |
| - | * Une séquence aléatoire de huit octets à inclure dans les futures réponses du client, | + | |
| - | * Une liste de méthodes de chiffrage, compression et authentification, | + | |
| - | * Le client et le serveur produisent un identifiant identique, un haché MD5 long de 128 bits contenant la clé hôte, la clé serveur et la séquence aléatoire, | + | |
| - | * Le client génère sa clé de session symétrique et la chiffre deux fois de suite, une fois avec la clé hôte du serveur et la deuxième fois avec la clé serveur. Le client envoie cette clé au serveur accompagnée de la séquence aléatoire et un choix d' | + | |
| - | * Le serveur déchiffre la clé de session, | + | |
| - | * Le client et le serveur mettent en place le canal sécurisé. | + | |
| - | ===SSH-1=== | + | root@manager: |
| + | 38e91e096c83f7cbe78089617a4d70110bd273f53339f8fed8df2503d3cd65ca | ||
| - | SSH-1 utilise une paire de clefs de type RSA1. Il assure l' | + | root@manager: |
| + | CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O | ||
| + | 38e91e096c83 | ||
| + | e503dd98f889 | ||
| + | ^C | ||
| + | </ | ||
| - | Afin de s'identifier, le client essaie chacune des six méthodes suivantes | + | Pour plus d'informations, consultez cette **[[https:// |
| - | * **Kerberos**, | + | ====[WARN] 5.11 - Ensure that CPU priority is set appropriately on containers (Automated)==== |
| - | * **Rhosts**, | + | |
| - | * **%%RhostsRSA%%**, | + | |
| - | * Par **clef asymétrique**, | + | |
| - | * **TIS**, | + | |
| - | * Par **mot de passe**. | + | |
| - | ===SSH-2=== | + | Cet avertissement est du au fait que les conteneurs ont automatiquement accès à tous les CPU de l' |
| - | SSH-2 utilise | + | La valeur de cpu-shares est relative à la valeur par défaut de **1024**. Un valeur de 512 permet au conteneur d'accéder à 50% des cycles du CPU mais uniquement quand les cycles sont limités. Quand les cycles de CPU ne sont par restreints, chaque conteneur utilise autant qu'il en a besoin. |
| - | * **SSH-TRANS** – Transport Layer Protocol, | + | Pour plus d' |
| - | * **SSH-AUTH** – Authentification Protocol, | + | |
| - | * **SSH-CONN** – Connection Protocol. | + | |
| - | SSH-2 diffère de SSH-1 essentiellement dans la phase authentification. | + | ====[WARN] 5.12 - Ensure that the container' |
| - | Trois méthodes d' | + | 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/ |
| - | | + | Créez le fichier |
| - | | + | |
| - | * **%%RhostsRSA%%**, | + | |
| - | * Par **mot de passe**. | + | |
| - | ===L' | + | < |
| + | root@manager: | ||
| + | </ | ||
| - | L' | + | La Commande **docker container diff** indique les différences apportées |
| - | Avantage: | + | < |
| - | * Aucune configuration de clef asymétrique n'est nécessaire. | + | root@manager:~/ |
| + | C /run | ||
| + | C / | ||
| + | A / | ||
| + | A / | ||
| + | A / | ||
| + | A / | ||
| + | A / | ||
| + | A / | ||
| + | </ | ||
| - | Inconvénients: | + | <WRAP center round important 50%> |
| - | * L' | + | **Important** : Notez que la sortie indique les changements apportés au conteneur. |
| - | | + | </ |
| - | ===L' | + | Arrêtez et supprimez le conteneur : |
| - | * Le **client** envoie au serveur une requête d' | + | < |
| - | * Le **serveur** recherche une correspondance pour ce module dans le fichier des clés autorisés **~/.ssh/ | + | root@manager: |
| - | * Dans le cas où une correspondance n'est pas trouvée, le serveur met fin à la communication, | + | mysql |
| - | * Dans le cas contraire le serveur génère une chaîne aléatoire de 256 bits appelée un **challenge** et la chiffre avec la **clé publique du client**, | + | |
| - | * Le **client** reçoit le challenge et le décrypte avec la partie privée de sa clé. Il combine le challenge avec l' | + | |
| - | * Le **serveur** génère le même haché et le compare avec celui reçu du client. Si les deux hachés sont identiques, l' | + | |
| - | ====3.2 | + | root@manager: |
| + | mysql | ||
| + | </ | ||
| - | La configuration du serveur s' | + | Lancez un conteneur mysql en lecture seule : |
| < | < | ||
| - | root@debian12:~# cat /etc/ssh/sshd_config | + | root@manager:~/ |
| + | 711ab28bdfb41220c84246c1658bcde398681a78291bbbe7d3bbfd9bc317d41b | ||
| + | </code> | ||
| - | # This is the sshd server system-wide configuration file. See | + | Créez le fichier **write_a_file** dans le conteneur **mysql** : |
| - | # sshd_config(5) for more information. | + | |
| - | # This sshd was compiled with PATH=/ | + | < |
| + | root@manager:~/docker-bench-security# | ||
| + | touch: cannot touch '/write_a_file' | ||
| + | </code> | ||
| - | # The strategy used for options in the default sshd_config shipped with | + | <WRAP center round important 50%> |
| - | # OpenSSH is to specify options with their default value where | + | **Important** : Notez l' |
| - | # possible, but leave them commented. | + | </ |
| - | # default value. | + | |
| - | Include / | + | Exécutez la commande |
| - | #Port 22 | + | < |
| - | #AddressFamily any | + | root@manager: |
| - | #ListenAddress 0.0.0.0 | + | root@manager: |
| - | # | + | </ |
| - | #HostKey / | + | <WRAP center round important 50%> |
| - | #HostKey / | + | **Important** : Notez que la commande ne retourne aucune sortie. En effet le conteneur étant en lecture seule, aucun changement ne peut intervenir. |
| - | #HostKey /etc/ssh/ssh_host_ed25519_key | + | </WRAP> |
| - | # Ciphers and keying | + | ====[WARN] 5.14 - Ensure that the ' |
| - | #RekeyLimit default none | + | |
| - | # Logging | + | Cet avertissement concerne la politique de re-démarrage du conteneur. La politique **on-failure[: |
| - | # | + | |
| - | #LogLevel INFO | + | |
| - | # Authentication: | + | |
| - | # | + | Pour plus d' |
| - | # | + | |
| - | # | + | |
| - | # | + | |
| - | # | + | |
| - | # | + | ====[WARN] 5.26 - Ensure that container health is checked at runtime (Automated)==== |
| - | # Expect | + | Voir l' |
| - | # | + | |
| - | # | + | ====[WARN] 5.28 - Ensure that the PIDs cgroup limit is used (Automated)==== |
| - | # | + | Sans l' |
| - | # | + | |
| - | # For this to work you will also need host keys in / | + | < |
| - | # | + | root@manager: |
| - | # Change to yes if you don't trust ~/.ssh/ | + | </code> |
| - | # HostbasedAuthentication | + | |
| - | # | + | |
| - | # Don't read the user's ~/.rhosts and ~/.shosts files | + | |
| - | # | + | |
| - | # To disable tunneled clear text passwords, change to no here! | + | L' |
| - | # | + | |
| - | # | + | |
| - | # Change to yes to enable challenge-response passwords | + | < |
| - | # some PAM modules and threads) | + | root@manager: |
| - | KbdInteractiveAuthentication no | + | Unable to find image ' |
| + | sha256: | ||
| + | a48641193673: | ||
| + | Digest: sha256: | ||
| + | Status: Downloaded newer image for ubuntu@sha256: | ||
| + | Tagging ubuntu@sha256: | ||
| + | environment: | ||
| + | environment: | ||
| + | environment: | ||
| + | environment: | ||
| + | environment: | ||
| + | environment: | ||
| + | environment: | ||
| + | environment: | ||
| + | environment: | ||
| + | environment: | ||
| + | environment: | ||
| + | environment: | ||
| + | ^P^Q | ||
| + | </ | ||
| - | # Kerberos | + | Pour plus d' |
| - | # | + | |
| - | # | + | |
| - | # | + | |
| - | # | + | |
| - | # GSSAPI options | + | Supprimez maintenant tous les conteneurs déjà créées : |
| - | # | + | |
| - | # | + | |
| - | # | + | |
| - | # | + | |
| - | # Set this to ' | + | < |
| - | # and session processing. If this is enabled, PAM authentication will | + | root@manager: |
| - | # be allowed through the KbdInteractiveAuthentication and | + | db5ae43c3e55 |
| - | # PasswordAuthentication. | + | f3b2528fbac0 |
| - | # PAM authentication via KbdInteractiveAuthentication may bypass | + | 711ab28bdfb4 |
| - | # the setting of " | + | |
| - | # If you just want the PAM account and session checks to run without | + | |
| - | # PAM authentication, | + | |
| - | # and KbdInteractiveAuthentication to ' | + | |
| - | UsePAM yes | + | |
| - | #AllowAgentForwarding yes | + | root@manager: |
| - | # | + | CONTAINER ID IMAGE |
| - | # | + | </code> |
| - | X11Forwarding yes | + | |
| - | # | + | |
| - | # | + | |
| - | #PermitTTY yes | + | |
| - | PrintMotd no | + | |
| - | # | + | |
| - | # | + | |
| - | # | + | |
| - | # | + | |
| - | # | + | |
| - | # | + | |
| - | #UseDNS no | + | |
| - | # | + | |
| - | # | + | |
| - | # | + | |
| - | # | + | |
| - | # | + | |
| - | # no default banner path | + | Re-créez le conteneur mysql en intégrant les points vus ci-dessus : |
| - | #Banner none | + | |
| - | # Allow client to pass locale environment variables | + | < |
| - | AcceptEnv LANG LC_* | + | root@manager: |
| - | + | f49d1ffdeae2e83435e8cc3a2e03fb2e0b33e5609d266e5a3403ff8859e5d122 | |
| - | # override default of no subsystems | + | |
| - | Subsystem | + | |
| - | # Example of overriding settings on a per-user basis | + | root@manager: |
| - | #Match User anoncvs | + | CONTAINER ID IMAGE |
| - | # | + | f49d1ffdeae2 |
| - | # | + | |
| - | # | + | |
| - | # | + | |
| </ | </ | ||
| - | Pour ôter les lignes | + | Exécutez |
| < | < | ||
| - | root@debian12:~# cd /tmp ; grep -E -v '^(#|$)' | + | root@manager:~/docker-bench-security# ./docker-bench-security.sh |
| - | + | ... | |
| - | root@debian12:/ | + | [PASS] 5.2 - Ensure that, if applicable, SELinux security options are set (Automated) |
| - | Include / | + | [PASS] 5.10 - Ensure that the memory usage for containers is limited (Automated) |
| - | KbdInteractiveAuthentication no | + | [PASS] 5.11 - Ensure that CPU priority is set appropriately on containers (Automated) |
| - | UsePAM yes | + | [PASS] 5.12 - Ensure that the container' |
| - | X11Forwarding yes | + | [PASS] 5.14 - Ensure that the ' |
| - | PrintMotd no | + | [PASS] 5.28 - Ensure that the PIDs cgroup limit is used (Automated) |
| - | AcceptEnv LANG LC_* | + | ... |
| - | Subsystem | + | |
| </ | </ | ||
| - | Pour sécuriser le serveur ssh, ajoutez ou modifiez les directives suivantes : | + | =====LAB #8 - Sécurisation des Images avec Docker Content Trust===== |
| - | < | + | **Docker Content Trust (DCT)** a été introduit avec Docker Engine 1.8 et Docker CS Engine 1.9.0. DCT permet la vérification de l' |
| - | AllowGroups adm | + | |
| - | Banner /etc/issue.net | + | |
| - | HostbasedAuthentication no | + | |
| - | IgnoreRhosts yes | + | |
| - | LoginGraceTime 60 | + | |
| - | LogLevel INFO | + | |
| - | PermitEmptyPasswords no | + | |
| - | PermitRootLogin no | + | |
| - | PrintLastLog yes | + | |
| - | Protocol 2 | + | |
| - | StrictModes yes | + | |
| - | X11Forwarding no | + | |
| - | </ | + | |
| - | Votre fichier ressemblera | + | DCT est utilisé par le **Docker Hub Registry** mais peut aussi être mis en place dans des Registry privés, notamment grâce |
| - | < | + | DCT est basé sur l' |
| - | root@debian12:/tmp# cat sshd_config | + | |
| - | Include | + | |
| - | KbdInteractiveAuthentication no | + | |
| - | UsePAM yes | + | |
| - | PrintMotd no | + | |
| - | AcceptEnv LANG LC_* | + | |
| - | AllowGroups adm | + | |
| - | HostbasedAuthentication no | + | |
| - | IgnoreRhosts yes | + | |
| - | LoginGraceTime 60 | + | |
| - | LogLevel INFO | + | |
| - | PermitEmptyPasswords no | + | |
| - | PermitRootLogin no | + | |
| - | PrintLastLog yes | + | |
| - | Protocol 2 | + | |
| - | StrictModes yes | + | |
| - | X11Forwarding no | + | |
| - | Subsystem | + | |
| - | </ | + | |
| - | Mettez l'utilisateur | + | Pour plus d'information concernant DCT, consultez cette **[[https:// |
| - | < | + | ====8.1 - DOCKER_CONTENT_TRUST==== |
| - | root@debian12:/ | + | |
| - | trainee : trainee cdrom floppy audio dip video plugdev netdev lpadmin scanner vboxusers | + | |
| - | root@debian12:/tmp# usermod -a -G adm trainee | + | Pour utiliser **Docker Content Trust (DCT)**, il convient de vérifier que la valeur de la variable **DOCKER_CONTENT_TRUST** est **1** : |
| - | root@debian12:/tmp# groups trainee | + | < |
| - | trainee : trainee adm cdrom floppy audio dip video plugdev netdev lpadmin scanner vboxusers | + | root@manager:~# echo $DOCKER_CONTENT_TRUST |
| + | 1 | ||
| </ | </ | ||
| - | Renommez | + | Dans le cas contraire, il faut fixer la valeur de la variable à 1 : |
| < | < | ||
| - | root@debian12:/tmp# mv / | + | root@manager:~# export DOCKER_CONTENT_TRUST=1 |
| - | + | root@manager:~# echo $DOCKER_CONTENT_TRUST | |
| - | root@debian12:/tmp# cp sshd_config /etc/ssh | + | 1 |
| </ | </ | ||
| - | Redémarrez ensuite le serveur ssh : | + | ====8.2 - DCT et la commande docker pull==== |
| + | |||
| + | Afin d' | ||
| < | < | ||
| - | root@debian12:/tmp# systemctl restart ssh | + | 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://hub.docker.com to create one. | |
| - | root@debian12:/ | + | Username: < |
| - | ● ssh.service - OpenBSD Secure Shell server | + | Password: < |
| - | | + | WARNING! Your password will be stored unencrypted in /root/.docker/config.json. |
| - | Active: active (running) since Fri 2025-11-28 15:18:55 CET; 7s ago | + | Configure a credential helper to remove this warning. See |
| - | Docs: man:sshd(8) | + | https://docs.docker.com/engine/reference/commandline/ |
| - | man: | + | |
| - | Process: 10882 ExecStartPre=/usr/sbin/sshd -t (code=exited, | + | |
| - | Main PID: 10883 (sshd) | + | |
| - | Tasks: 1 (limit: 19123) | + | |
| - | | + | |
| - | CPU: 28ms | + | |
| - | CGroup: /system.slice/ssh.service | + | |
| - | | + | |
| - | Nov 28 15:18:55 debian12 systemd[1]: Starting ssh.service - OpenBSD Secure Shell server... | + | Login Succeeded |
| - | Nov 28 15:18:55 debian12 sshd[10883]: | + | |
| - | Nov 28 15:18:55 debian12 sshd[10883]: | + | |
| - | Nov 28 15:18:55 debian12 systemd[1]: Started ssh.service - OpenBSD Secure Shell server. | + | |
| </ | </ | ||
| - | Pour générer les clefs sur le serveur saisissez la commande suivante en tant que **root**: | + | Pour constater l' |
| - | + | ||
| - | <WRAP center round important 50%> | + | |
| - | **Important** - Lors de la génération | + | |
| - | </ | + | |
| < | < | ||
| - | root@debian12:/tmp# ssh-keygen -t dsa | + | root@manager:~# docker image pull i2tch/docker: |
| - | Generating public/private dsa key pair. | + | Error: remote trust data does not exist for docker.io/i2tch/docker: notary.docker.io does not have trust data for docker.io/ |
| - | Enter file in which to save the key (/ | + | |
| - | Enter passphrase (empty | + | |
| - | Enter same passphrase again: | + | |
| - | Your identification has been saved in /etc/ssh/ | + | |
| - | Your public key has been saved in / | + | |
| - | The key fingerprint is: | + | |
| - | SHA256: | + | |
| - | The key's randomart image is: | + | |
| - | +---[DSA 1024]----+ | + | |
| - | | o++o.. | | + | |
| - | | ..o+*o | | + | |
| - | | .o++=.o | + | |
| - | | o. o.+=. .| | + | |
| - | | o.S+ +.=.o | | + | |
| - | | .= + =oB | | + | |
| - | | .+ +.* + | | + | |
| - | | .. .+o E| | + | |
| - | | ..o .o | | + | |
| - | +----[SHA256]-----+ | + | |
| </ | </ | ||
| <WRAP center round important 50%> | <WRAP center round important 50%> | ||
| - | **Important** | + | **Important** |
| </ | </ | ||
| - | Les clefs publiques générées possèdent l' | + | Par contre, toutes les images de type **official** sont signées |
| < | < | ||
| - | root@debian12:/tmp# ls /etc/ssh | + | root@manager:~# docker image pull centos |
| - | moduli | + | Using default tag: latest |
| - | ssh_config | + | Pull (1 of 1): centos: |
| + | sha256: | ||
| + | 729ec3a6ada3: | ||
| + | Digest: sha256: | ||
| + | Status: Downloaded newer image for centos@sha256: | ||
| + | Tagging centos@sha256: | ||
| + | docker.io/ | ||
| </ | </ | ||
| - | Re-démarrez ensuite le service sshd : | + | Cette image est maintenant présente sur **manager.i2tch.loc** |
| < | < | ||
| - | root@debian12:/tmp# systemctl restart ssh | + | root@manager:~# docker images |
| + | REPOSITORY | ||
| + | ubuntu | ||
| + | nginx | ||
| + | alpine | ||
| + | mysql | ||
| + | centos | ||
| </ | </ | ||
| - | Saisissez maintenant les commandes suivantes en tant que **trainee** : | + | ===L' |
| - | <WRAP center round important 50%> | + | Il est aussi possible d' |
| - | **Important** - Lors de la génération | + | |
| - | </ | + | |
| < | < | ||
| - | root@debian12:/tmp# exit | + | root@manager:~# docker image pull --disable-content-trust=true i2tch/ |
| - | logout | + | unsigned: Pulling from i2tch/ |
| + | 10d70a43a9f9: | ||
| + | 4f4fb700ef54: | ||
| + | 8951e3a91277: | ||
| + | d1814ff35b8b: | ||
| + | ff2a2bbf6141: | ||
| + | b7205da5c3c9: | ||
| + | 458ea241cc75: | ||
| + | 74d1c0702786: | ||
| + | c66f3692932d: | ||
| + | 9224bd1b9757: | ||
| + | Digest: sha256: | ||
| + | Status: Downloaded newer image for i2tch/ | ||
| + | docker.io/ | ||
| - | trainee@debian12:~$ ssh-keygen -t dsa | + | root@manager:~# docker |
| - | Generating public/ | + | REPOSITORY |
| - | Enter file in which to save the key (/ | + | ubuntu |
| - | Created directory '/ | + | nginx |
| - | Enter passphrase (empty for no passphrase): | + | alpine |
| - | Enter same passphrase again: | + | mysql |
| - | Your identification has been saved in / | + | centos |
| - | Your public key has been saved in / | + | i2tch/ |
| - | The key fingerprint is: | + | |
| - | SHA256: | + | |
| - | The key's randomart | + | |
| - | +---[DSA 1024]----+ | + | |
| - | | o=o**| | + | |
| - | | | + | |
| - | | + =+.| | + | |
| - | | + o *o| | + | |
| - | | S = * o =| | + | |
| - | | | + | |
| - | | = * =.=| | + | |
| - | | o o *+| | + | |
| - | | ..o *| | + | |
| - | +----[SHA256]-----+ | + | |
| - | trainee@debian12:~$ ssh-keygen -t rsa | + | root@manager:~# docker rmi i2tch/docker:unsigned |
| - | Generating public/private rsa key pair. | + | Untagged: i2tch/docker:unsigned |
| - | Enter file in which to save the key (/ | + | Untagged: i2tch/docker@sha256: |
| - | Enter passphrase (empty for no passphrase): | + | Deleted: sha256: |
| - | Enter same passphrase again: | + | Deleted: sha256: |
| - | Your identification has been saved in /home/ | + | Deleted: sha256: |
| - | Your public key has been saved in / | + | Deleted: sha256: |
| - | The key fingerprint is: | + | Deleted: sha256: |
| - | SHA256:p2xPZdoPCICy/D5x0g+nHilsV6Ar4UMwmHeRnHDnBQw trainee@debian12 | + | Deleted: sha256: |
| - | The key's randomart image is: | + | Deleted: sha256:27074774f844bdeba18e786585604c8b6352e925a7bd560deb66252bc8ccb861 |
| - | +---[RSA 3072]----+ | + | Deleted: sha256: |
| - | | .oE=o.. | + | Deleted: sha256: |
| - | |.. .+=.. | | + | Deleted: sha256:149690c37bdc8680ec66b0e2cc138f6d63caad74b091acf86a2a18111b90ea79 |
| - | |= o o + | | + | Deleted: sha256: |
| - | | = + . o | | + | Deleted: sha256: |
| - | | = .. S . o | | + | Deleted: sha256: |
| - | | o +o.++.+ * | | + | Deleted: sha256: |
| - | | + *++=+ + o | | + | Deleted: sha256: |
| - | | | + | Deleted: sha256:0f3637356bb908638dda037c9c6aa4a2be8a19dbcf452a00cd733a8a456077ac |
| - | | .o. | + | Deleted: sha256: |
| - | +----[SHA256]-----+ | + | Deleted: sha256: |
| - | + | Deleted: sha256: | |
| - | trainee@debian12:~$ ssh-keygen -t ecdsa | + | |
| - | Generating public/ | + | |
| - | Enter file in which to save the key (/ | + | |
| - | Enter passphrase (empty for no passphrase): | + | |
| - | Enter same passphrase again: | + | |
| - | Your identification has been saved in / | + | |
| - | Your public key has been saved in / | + | |
| - | The key fingerprint is: | + | |
| - | SHA256:zA3muePCJZ7SCIvuKe+X5veMqWpP0UTr6HAVv+LPBCo trainee@debian12 | + | |
| - | The key's randomart image is: | + | |
| - | +---[ECDSA 256]---+ | + | |
| - | | o | | + | |
| - | | . + | | + | |
| - | | + + | | + | |
| - | | * = = | | + | |
| - | | . + = S . | | + | |
| - | | .+ +.o.. | | + | |
| - | | .Eo+*.++ | + | |
| - | |o +o* BO . | | + | |
| - | |+B+*++oo* | + | |
| - | +----[SHA256]-----+ | + | |
| - | + | ||
| - | trainee@debian12:~$ ssh-keygen -t ed25519 | + | |
| - | Generating public/ | + | |
| - | Enter file in which to save the key (/ | + | |
| - | Enter passphrase (empty for no passphrase): | + | |
| - | Enter same passphrase again: | + | |
| - | Your identification has been saved in / | + | |
| - | Your public key has been saved in / | + | |
| - | The key fingerprint is: | + | |
| - | SHA256:f5GzguZoS5SN2EQDyj7zAqES+7PDOBSJRg+lD+vpn3Q trainee@debian12 | + | |
| - | The key's randomart image is: | + | |
| - | +--[ED25519 256]--+ | + | |
| - | | ....o | | + | |
| - | | +.. . . | | + | |
| - | |=o* | + | |
| - | |oO+. + + | + | |
| - | |*.=.. = S | + | |
| - | |o+.+ . | + | |
| - | |.=+..E. o o o | | + | |
| - | |+ ++o..+ | + | |
| - | | oo+ .o.. | | + | |
| - | +----[SHA256]-----+ | + | |
| </ | </ | ||
| - | <WRAP center round important 50%> | + | ====8.3 - DCT et la commande docker push==== |
| - | **Important** - Les clés générées seront placées dans le répertoire **~/ | + | |
| - | </ | + | |
| - | + | ||
| - | ====3.3 - Utilisation==== | + | |
| - | + | ||
| - | La commande ssh prend la forme suivante: | + | |
| - | ssh -l nom_de_compte numero_ip (nom_de_machine) | + | Pour envoyer |
| - | + | ||
| - | En saisissant cette commande sur votre propre machine, vous obtiendrez un résultat similaire à celle-ci | + | |
| < | < | ||
| - | trainee@debian12: | + | root@manager:~# docker image tag alpine:latest < |
| - | Password: fenestros | + | |
| - | root@debian12:~# | + | |
| - | + | ||
| - | root@debian12:~# ssh -l trainee localhost | + | |
| - | The authenticity of host ' | + | |
| - | ED25519 key fingerprint is SHA256: | + | |
| - | This key is not known by any other names. | + | |
| - | Are you sure you want to continue connecting (yes/ | + | |
| - | Warning: Permanently added ' | + | |
| - | trainee@localhost' | + | |
| - | Linux debian12 6.1.0-41-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.158-1 (2025-11-09) 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: Thu Nov 27 17:21:12 2025 from 10.0.2.1 | + | |
| </ | </ | ||
| - | ====3.4 - Mise en place des clefs==== | + | L' |
| - | + | ||
| - | Il convient | + | |
| - | + | ||
| - | En saisissant cette commande, vous obtiendrez une fenêtre similaire à celle-ci | + | |
| < | < | ||
| - | root@debian12:~# exit | + | root@manager:~# docker image ls |
| - | logout | + | REPOSITORY |
| - | + | ubuntu | |
| - | trainee@debian12: | + | nginx latest |
| - | trainee@127.0.0.1' | + | < |
| - | Linux debian12 6.1.0-41-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.158-1 (2025-11-09) x86_64 | + | alpine |
| - | + | mysql latest | |
| - | The programs included with the Debian GNU/Linux system are free software; | + | centos |
| - | 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: Fri Nov 28 15:31:58 2025 from 10.0.2.46 | + | |
| - | + | ||
| - | trainee@debian12: | + | |
| - | drwx------ | + | |
| - | + | ||
| - | trainee@debian12: | + | |
| - | logout | + | |
| - | Connection to 127.0.0.1 closed. | + | |
| </ | </ | ||
| - | <WRAP center round important 50%> | + | Lors du push vers le registry privé, il faut créer des passphrases pour **deux** clefs : |
| - | **Important** - Si le dossier distant .ssh n' | + | |
| - | </ | + | |
| - | Ensuite, il convient | + | * la **root** key aussi connue sous le nom **offline** key (ID 192fc7e), qui est uniquement demandée la **première** fois après la mise en place de DCT lors de la création d' |
| + | * la **repository** key aussi connue sous le nom **tagging** key (ID 168c754), utilisée pour signer l' | ||
| < | < | ||
| - | trainee@debian12:~$ scp .ssh/id_ecdsa.pub trainee@127.0.0.1:/home/trainee/.ssh/ | + | root@manager:~# docker push < |
| - | trainee@127.0.0.1' | + | The push refers to repository [docker.io/< |
| - | id_ecdsa.pub 100% 178 399.6KB/s 00:00 | + | 77cae8ab23bf: |
| + | alpine: digest: sha256: | ||
| + | Signing and pushing trust metadata | ||
| + | You are about to create a new root signing key passphrase. This passphrase | ||
| + | will be used to protect the most sensitive key in your signing system. Please | ||
| + | choose a long, complex passphrase and be careful to keep the password and the | ||
| + | key file itself secure and backed up. It is highly recommended that you use a | ||
| + | password | ||
| + | way to recover this key. You can find the key in your config directory. | ||
| + | Enter passphrase for new root key with ID 192fc7e: fenestros | ||
| + | Repeat passphrase for new root key with ID 192fc7e: fenestros | ||
| + | Enter passphrase for new repository key with ID 168c754: fenestros | ||
| + | Repeat passphrase for new repository key with ID 168c754: fenestros | ||
| + | Finished initializing " | ||
| + | Successfully signed docker.io/< | ||
| </ | </ | ||
| - | Connectez-vous via ssh et insérer les clefs publiques restantes | + | Les clefs sont stockées |
| < | < | ||
| - | trainee@debian12:~$ ssh -l trainee localhost | + | root@manager:~# ls -l ~/.docker/ |
| - | Linux debian12 6.1.0-41-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.158-1 (2025-11-09) x86_64 | + | total 8 |
| + | drwx------ 2 root root 4096 nov. 10 14:49 private | ||
| + | drwx------ 3 root root 4096 nov. 8 13:48 tuf | ||
| - | The programs included with the Debian GNU/Linux system are free software; | + | root@manager: |
| - | the exact distribution terms for each program are described in the | + | total 8 |
| - | individual files in /usr/share/doc/*/copyright. | + | -rw------- 1 root root 447 nov. 10 14:49 168c754ea8f36ce7fbcbe2299b6d91fc0f4d594c9ed9b86916687b618d8438ac.key |
| + | -rw------- 1 root root 416 nov. 10 14:49 192fc7ed9543ad4bceec58886ab1d605b7433c35f7462d7343d0780d8fddf1db.key | ||
| + | root@manager: | ||
| + | -----BEGIN ENCRYPTED PRIVATE KEY----- | ||
| + | gun: docker.io/ | ||
| + | role: targets | ||
| - | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | + | MIHuMEkGCSqGSIb3DQEFDTA8MBsGCSqGSIb3DQEFDDAOBAhm7HwR0y8FFAICCAAw |
| - | permitted by applicable law. | + | HQYJYIZIAWUDBAEqBBC729tU73wKHFQSbmZ1EVZaBIGgmGiFSs4lM5tElSGukl1B |
| - | Last login: Fri Nov 28 15:57:32 2025 from 127.0.0.1 | + | HrELT9aFooFgW7oSXNLM8aFfF/vJ+BSjsgfqWLdvuH+DUXXdUidxcoGMEWnVZNIC |
| + | 3m40g3MywHilW4rUcjoHVTTUXABGXUQ3f7h+nI15CXcZ11qRLyWbf2uywE9yYH9O | ||
| + | M7GLUcE+pTENJKfZAhRGBEL+LgXNfGI1aAVqaEbBDcDnKKf4Uj1Xu4oLJ7je8+nT | ||
| + | dg== | ||
| + | -----END ENCRYPTED PRIVATE KEY----- | ||
| - | trainee@debian12:~$ cat .ssh/id_rsa.pub >> .ssh/authorized_keys | + | root@manager:~# cat ~/.docker/trust/ |
| + | -----BEGIN ENCRYPTED PRIVATE KEY----- | ||
| + | role: root | ||
| - | trainee@debian12: | + | MIHuMEkGCSqGSIb3DQEFDTA8MBsGCSqGSIb3DQEFDDAOBAiAtCzEar3AhgICCAAw |
| - | + | HQYJYIZIAWUDBAEqBBAO7hHWVoqOo6xcETQQDXRdBIGgPUoLzTz07Ajx8K3D8+Vv | |
| - | trainee@debian12: | + | 2NUiflMYhH/0I9PL6iA2JJCmD0l+8Ueljy+vHRCu7UAIyWXyIHFN5Aab40mk9/Pg |
| - | + | V2BwSlXp7t1Cnqp/ah7g0T40+OnT64JkTS+l3cS0CaCf2E4l6nY8g4cl40hZIFJz | |
| - | trainee@debian12: | + | KREO8uEq3v7HcSBBqFm0+TU+92d7hVuDApPaj0lZYP+3f7H6AjUOqu6hUoK8Ck/Y |
| - | ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBwIXLMYJtWVgqSTqJfsFjS2ubtP+mHkC7XRU1rBWTBLYoJp8VOwtpKK1NTFSaeJhnjCvFuhYm8egqHI0gp3oBA= trainee@debian12 | + | Ig== |
| - | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDcV1OmeHZlWhLumCozdg7snul5MrkzhZjiUKWNJmGBBOauOq2CgMGYWYIhjyeVeaeiezq+wSe0jO09p8a1EbvYUibJsY9FOi8JcXTpxvlcqpuawudErjSsOf6JaIlbGpwDIMzmjeubfQx9jMZzfQIW9zfTDUi2tGquR/1TQPocGmmI9JFtoMqylk4+KsIHpriMBEVD/ | + | -----END ENCRYPTED PRIVATE KEY----- |
| - | ssh-dss AAAAB3NzaC1kc3MAAACBAMbFW6WkZFJ/ | + | |
| - | ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILP736HSOOTZBe6+CHy8PINQ4gb9kKB4xj0JWWZy1Wgl trainee@debian12 | + | |
| </ | </ | ||
| - | <WRAP center round important 50%> | + | ====8.4 - DCT et la commande |
| - | **Important** - Notez que lors de la connexion au serveur, l' | + | |
| - | </ | + | |
| - | + | ||
| - | ===Options de la commande=== | + | |
| - | Les options de cette commande sont : | + | L' |
| < | < | ||
| - | trainee@debian12:~$ ssh --help | + | root@manager:~# mkdir nottrusted |
| - | unknown option -- - | + | |
| - | usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface] | + | |
| - | [-b bind_address] [-c cipher_spec] [-D [bind_address: | + | |
| - | [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11] | + | |
| - | [-i identity_file] [-J [user@]host[: | + | |
| - | [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port] | + | |
| - | [-Q query_option] [-R address] [-S ctl_path] [-W host: | + | |
| - | [-w local_tun[: | + | |
| - | </ | + | |
| - | ====3.5 - Tunnels SSH==== | + | root@manager: |
| - | Le protocole SSH peut être utilisé pour sécuriser les protocoles tels telnet, pop3 etc.. En effet, on peut créer un //tunnel// SSH dans lequel passe les communications du protocole non-sécurisé. | + | root@manager: |
| - | La commande pour créer un tunnel ssh prend la forme suivante | + | root@manager:~/ |
| + | FROM docker/ | ||
| + | RUN echo | ||
| + | </ | ||
| - | ssh -N -f compte@<hôte_local> | + | Lors du build de l' |
| - | + | ||
| - | Dans votre cas, vous allez créer un tunnel entre Debian 12 et CentOS 8 entre le port 15023 et le port 23 : | + | |
| < | < | ||
| - | trainee@debian12:~$ su - | + | root@manager:~/ |
| - | Password: fenestros | + | Sending build context to Docker daemon |
| - | root@debian12:~# ssh -N -f trainee@localhost -L15023:10.0.2.45:23 | + | error during connect: Post http:// |
| </ | </ | ||
| - | Installez maintenant le client et le serveur telnet dans la VM CentOS 8: | + | L' |
| < | < | ||
| - | root@debian12:~# ssh -l trainee 10.0.2.45 | + | root@manager:~/nottrusted# docker build --disable-content-trust -t < |
| - | The authenticity of host '10.0.2.45 (10.0.2.45)' | + | Sending build context to Docker daemon |
| - | ED25519 key fingerprint is SHA256:YRt3r4qD/pZ8PoJ2irS3bH2miZj6/ | + | Step 1/2 : FROM docker/ |
| - | This key is not known by any other names. | + | latest: Pulling from docker/trusttest |
| - | Are you sure you want to continue connecting (yes/no/[fingerprint])? | + | Image docker.io/docker/trusttest:latest uses outdated schema1 manifest format. Please upgrade |
| - | Warning: Permanently added '10.0.2.45' | + | aac0c133338d: Pull complete |
| - | trainee@10.0.2.45's password: trainee | + | a3ed95caeb02: Pull complete |
| - | Activate the web console with: systemctl enable | + | Digest: sha256: |
| + | Status: Downloaded newer image for docker/ | ||
| + | ---> cc7629d1331a | ||
| + | Step 2/2 : RUN echo | ||
| + | | ||
| - | Last login: Thu Nov 6 04:13:03 2025 from 10.0.2.45 | + | Removing intermediate container 694e79d3cd88 |
| - | + | ---> 686e85ee76b8 | |
| - | [trainee@centos8 ~]$ su - | + | Successfully built 686e85ee76b8 |
| - | Password: fenestros | + | Successfully tagged < |
| - | + | ||
| - | [root@centos8 ~]# dnf install telnet-server | + | |
| </ | </ | ||
| - | Telnet n'est ni démarré ni activé. Il convient donc de le démarrer et de l'activer | + | Lors du push de l'image **< |
| < | < | ||
| - | [root@centos8 | + | root@manager:~/nottrusted# docker push < |
| - | ● telnet.socket - Telnet Server Activation Socket | + | The push refers to repository [docker.io/< |
| - | | + | 5f70bf18a086: Layer already exists |
| - | Active: inactive (dead) | + | c22f7bc058a9: Mounted from docker/ |
| - | Docs: man: | + | nottrusted: digest: sha256:1183c62a5d31e202b5f5f528e9e7cdc36140aa3212c938e1d471c6b3b59f01bc size: 734 |
| - | Listen: [::]:23 (Stream) | + | Signing and pushing trust metadata |
| - | Accepted: 0; Connected: 0; | + | Enter passphrase for repository key with ID 168c754: fenestros |
| + | Successfully signed docker.io/< | ||
| + | </ | ||
| - | [root@centos8 ~]# systemctl start telnet.socket | + | <WRAP center round important 50%> |
| + | **Important** : Notez l' | ||
| + | </ | ||
| - | [root@centos8 ~]# systemctl status telnet.socket | + | ===Créer un deuxième Repositry=== |
| - | ● telnet.socket - Telnet Server Activation Socket | + | |
| - | | + | |
| - | | + | |
| - | Docs: man: | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | Nov 28 09:42:52 centos8.ittraining.loc systemd[1]: Listening on Telnet Server Activation Socket. | + | Par contre en modifiant le tag de l' |
| - | [root@centos8 | + | < |
| - | Created symlink / | + | root@manager:~/nottrusted# docker tag < |
| - | [root@centos8 | + | root@manager:~/nottrusted# docker images |
| - | ● telnet.socket - Telnet Server Activation Socket | + | REPOSITORY |
| - | Loaded: loaded (/usr/ | + | < |
| - | Active: active (listening) since Fri 2025-11-28 09:42:52 EST; 43s ago | + | < |
| - | Docs: man: | + | ubuntu |
| - | Listen: [::]:23 (Stream) | + | nginx latest |
| - | Accepted: 0; Connected: 0; | + | < |
| - | | + | alpine |
| + | mysql latest | ||
| + | centos | ||
| + | docker/trusttest | ||
| - | Nov 28 09:42:52 centos8.ittraining.loc systemd[1]: Listening on Telnet Server Activation Socket. | + | root@manager:~/ |
| + | The push refers to repository | ||
| + | 5f70bf18a086: Mounted from < | ||
| + | c22f7bc058a9: | ||
| + | latest: digest: sha256: | ||
| + | Signing and pushing trust metadata | ||
| + | Enter passphrase for root key with ID 192fc7e: fenestros | ||
| + | Enter passphrase for new repository key with ID 7b13d02: fenestros | ||
| + | Repeat passphrase for new repository key with ID 7b13d02: fenestros | ||
| + | Finished initializing " | ||
| + | Successfully signed docker.io/< | ||
| </ | </ | ||
| - | Arrêtez | + | <WRAP center round important 50%> |
| + | **Important** : Notez la création d'une deuxième repositry key (ID 7b13d02 au lieu de ID 168c754) lors du push de l' | ||
| + | </ | ||
| + | |||
| + | La présence de cette deuxième repositry key (**7b13d02d74264624fb201e7ae13ae694286b9f761aa86adddefd0408c7234a58.key**) peut être constatée dans le répertoire **~/ | ||
| < | < | ||
| - | [root@centos8 | + | root@manager:~/nottrusted# ls -l ~/ |
| + | total 12 | ||
| + | -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 451 nov. 10 17:37 7b13d02d74264624fb201e7ae13ae694286b9f761aa86adddefd0408c7234a58.key | ||
| + | </ | ||
| - | [root@centos8 ~]# iptables -L | + | En inspectant les clefs des images créées, l' |
| - | Chain INPUT (policy ACCEPT) | + | |
| - | target | + | |
| - | Chain FORWARD (policy ACCEPT) | + | < |
| - | target | + | root@manager: |
| - | + | [ | |
| - | Chain OUTPUT (policy ACCEPT) | + | { |
| - | target | + | " |
| + | " | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | "Repo Admin" | ||
| + | ] | ||
| + | } | ||
| + | ], | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | } | ||
| + | ] | ||
| + | }, | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | ] | ||
| + | root@manager: | ||
| + | [ | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | "Repo Admin" | ||
| + | ] | ||
| + | } | ||
| + | ], | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | } | ||
| + | ] | ||
| + | }, | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | ] | ||
| </ | </ | ||
| - | Connectez-vous ensuite via telnet sur CentOS 8 en utilisant le port 15023 de votre VM Debian 12 : | + | <WRAP center round important 50%> |
| + | **Important** | ||
| + | </ | ||
| < | < | ||
| - | root@debian12:~# telnet localhost 15023 | + | root@manager:~/nottrusted# docker trust inspect < |
| - | Trying | + | [ |
| - | Connected to localhost. | + | { |
| - | Escape character is '^]'. | + | " |
| + | " | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | "Repo Admin" | ||
| + | | ||
| + | } | ||
| + | ], | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | } | ||
| + | ] | ||
| + | }, | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | ] | ||
| + | </ | ||
| - | Kernel 4.18.0-348.7.1.el8_5.x86_64 on an x86_64 | + | <WRAP center round important 50%> |
| - | centos8 login: trainee | + | **Important** |
| - | Password: | + | </ |
| - | Last login: Fri Nov 28 09:45:22 from 10.0.2.46 | + | |
| - | [trainee@centos8 ~]$ pwd | + | ===Supprimer une Signature=== |
| - | / | + | |
| - | [trainee@centos8 | + | Dernièrement il est possible de supprimer la signature d'une image avec la commande **docker trust revoke** : |
| - | logout | + | |
| - | Connection closed by foreign host. | + | < |
| - | root@debian12:~# | + | root@manager:~# docker trust revoke < |
| + | Enter passphrase for repository key with ID 168c754: | ||
| + | Successfully deleted signature for < | ||
| + | root@manager:~# docker trust inspect < | ||
| + | [ | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | } | ||
| + | ] | ||
| + | }, | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | ] | ||
| </ | </ | ||
| <WRAP center round important 50%> | <WRAP center round important 50%> | ||
| - | **Important** | + | **Important** |
| </ | </ | ||
| - | ====3.6 - SCP==== | + | =====LAB #9 - Sécurisation du Socket du Daemon Docker===== |
| - | ===Introduction=== | + | 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' |
| - | La commande **scp** est le successeur | + | Pour pouvoir contacter de daemon Docker via le réseau d'une manière sécurisée il faut installer, configurer |
| - | $ scp compte@numero_ip(nom_de_machine):/ | + | La configuration implique que : |
| - | ou vers une machine distante | + | * 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. | ||
| - | $ scp / | + | La mise en place nécessite **openssl** |
| - | ===Utilisation=== | + | < |
| + | root@manager: | ||
| + | / | ||
| + | </ | ||
| - | Nous allons maintenant utiliser **scp** pour chercher un fichier sur le << | + | ====9.1 - Création du Certificat de l' |
| - | Créez le fichier | + | Commencez par créer une clef privée |
| < | < | ||
| - | trainee@debian12:~$ touch / | + | root@manager:~# openssl genrsa -aes256 -out ca-key.pem 4096 |
| + | 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: | ||
| </ | </ | ||
| - | Récupérez | + | Ensuite, créez |
| < | < | ||
| - | + | root@manager:~# openssl req -new -x509 -days 365 -key ca-key.pem -sha256 -out ca.pem | |
| - | trainee@debian12:~$ scp trainee@127.0.0.1:/ | + | Enter pass phrase for ca-key.pem:fenestros |
| - | + | You are about to be asked to enter information that will be incorporated | |
| - | trainee@debian12:~$ ls / | + | 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) []: | ||
| + | Common Name (e.g. server FQDN or YOUR name) []: | ||
| + | Email Address []: | ||
| </ | </ | ||
| - | =====LAB #4 - Mise en place d'un VPN avec OpenVPN===== | + | ====9.2 - Création du Certificat du Serveur Hôte du Daemon Docker==== |
| - | ====4.1 | + | Les clefs du CA ayant été créées, créez une clef **server-key.pem** pour le serveur hôte du daemon Docker : |
| - | **%%OpenVPN%%** | + | < |
| + | root@manager:~# openssl genrsa -out server-key.pem 4096 | ||
| + | Generating RSA private key, 4096 bit long modulus | ||
| + | .................................................................................................................................++++ | ||
| + | ...........................++++ | ||
| + | e is 65537 (0x010001) | ||
| + | </ | ||
| - | * permet à des pairs de s' | + | Créez ensuite |
| - | * d'une **clé privée partagée** à l' | + | |
| - | * de **certificats** ou, | + | |
| - | * à partir de la version 2.0 et à condition que le serveur possède | + | |
| - | | + | |
| - | * n'est pas compatible avec IPsec ou d' | + | |
| - | ====Configuration commune au client et au serveur==== | + | < |
| + | root@manager: | ||
| + | manager.i2tch.loc | ||
| + | root@manager: | ||
| + | </ | ||
| - | Installez | + | Une connexion TLS peut être effectuée en utilisant un FQDN ou une adresse IP. Pour cette raison, créez |
| < | < | ||
| - | root@debian12:~# apt install openvpn | + | root@manager:~# echo subjectAltName = DNS:`echo $HOSTNAME`, |
| </ | </ | ||
| - | Naviguez au répertoire | + | Fixez l' |
| < | < | ||
| - | [root@centos7 | + | root@manager:~# echo extendedKeyUsage = serverAuth >> extfile.cnf |
| + | </code> | ||
| - | root@debian12:/ | + | Vérifiez que votre fichier a été correctement créé |
| - | root@debian12:/ | + | < |
| - | # | + | root@manager:~# cat extfile.cnf |
| - | # 2048 bit OpenVPN static key | + | subjectAltName = DNS: |
| - | # | + | extendedKeyUsage = serverAuth |
| - | -----BEGIN OpenVPN Static key V1----- | + | |
| - | 77b47829a9d17aacc71b05a2bfa9bcba | + | |
| - | e90370cc07238a5adb74ef479e87547d | + | |
| - | fc18a69c3c5307bdc1ca27c7aa6f3a35 | + | |
| - | e09e815a27f50c28699be3af28decd3c | + | |
| - | b319923c2fe3826c2afb41d2e0239229 | + | |
| - | fee9bc33566941e09e2f905f1bcbb59a | + | |
| - | 55cf8d535334ac46eda3f35be0b7e22b | + | |
| - | c3261de182f7cde5cc7d756420907514 | + | |
| - | 0399672d104cebee31a44ca6d89663c7 | + | |
| - | 784b928e893c4d3a6e7d294e94266e1b | + | |
| - | 5a98f80f797651199069902be01d2bbd | + | |
| - | 94765d310f8d0466484a0e7cbf10bb98 | + | |
| - | d247127aa53a6c18a6def6ed73a28b69 | + | |
| - | b7d052209318057e2ccb9660fc42543b | + | |
| - | d79dab314ecbc19a6b8936255c17d673 | + | |
| - | fb0bdc3856a034ffc3931a7d645d6d96 | + | |
| - | -----END OpenVPN Static key V1----- | + | |
| </ | </ | ||
| + | |||
| + | 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@debian12:~# scp / | + | root@manager:~# openssl x509 -req -days 365 -sha256 -in server.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out server-cert.pem -extfile extfile.cnf |
| - | trainee@10.0.2.45's password: | + | Signature ok |
| - | static.key | + | subject=CN = manager.i2tch.loc |
| + | Getting CA Private Key | ||
| + | Enter pass phrase for ca-key.pem:fenestros | ||
| </ | </ | ||
| - | ====Configuration | + | ====9.3 - Création |
| + | |||
| + | Créez ensuite la clef privée **key.pem** du client qui se connectera au daemon à partir du réseau : | ||
| < | < | ||
| - | root@debian12:/ | + | root@manager:~# openssl genrsa |
| - | trainee@10.0.2.45's password: trainee | + | Generating RSA private key, 4096 bit long modulus |
| - | Activate the web console with: systemctl enable --now cockpit.socket | + | ...................................................................................................................................++++ |
| + | ...............++++ | ||
| + | e is 65537 (0x010001) | ||
| + | </ | ||
| - | Last login: Fri Nov 28 09:47:05 2025 from ::ffff:10.0.2.46 | + | Modifiez l' |
| - | [trainee@centos8 | + | < |
| - | Password: fenestros | + | root@manager:~# vi / |
| + | 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@centos8 | + | root@manager:~# openssl req -subj '/ |
| </ | </ | ||
| + | |||
| + | Fixez l' | ||
| < | < | ||
| - | [root@centos8 | + | root@manager:~# echo extendedKeyUsage = clientAuth > extfile-client.cnf |
| </ | </ | ||
| + | |||
| + | 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@centos8 | + | root@manager:~# openssl x509 -req -days 365 -sha256 -in client.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out cert.pem -extfile extfile-client.cnf |
| - | [root@centos8 ~]# ls / | + | Signature ok |
| - | client | + | subject=CN = myregistry.i2tch.loc |
| + | Getting CA Private Key | ||
| + | Enter pass phrase for ca-key.pem: | ||
| </ | </ | ||
| - | Créez le fichier **/ | + | Vérifiez la présence des fichiers générés |
| < | < | ||
| - | [root@centos8 | + | root@manager:~# ls -l |
| - | [root@centos8 ~]# cat / | + | total 60 |
| - | remote | + | -rw------- 1 root root 3326 nov. 11 10:53 ca-key.pem |
| - | dev tun | + | -rw-r--r-- 1 root root 2163 nov. 11 10:57 ca.pem |
| - | port 1194 | + | -rw-r--r-- 1 root root 17 nov. 11 11:15 ca.srl |
| - | proto udp | + | -rw-r--r-- 1 root root 1907 nov. 11 11:15 cert.pem |
| - | comp-lzo | + | -rw-r--r-- 1 root root 1594 nov. 11 11:12 client.csr |
| - | ifconfig 10.0.0.2 10.0.0.1 | + | drwxr-xr-x 5 root root 4096 nov. 8 12:58 docker-bench-security |
| - | secret / | + | -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-- | ||
| + | -rw------- 1 root root 3243 nov. 11 10:59 server-key.pem | ||
| + | -rw-r--r-- 1 root root 882 oct. 27 15:46 stats | ||
| </ | </ | ||
| - | Lancez openvpn en ligne de commande | + | Supprimez les fichiers ayant déjà été utilisés, à savoir les deux CSR et les deux fichiers des extensions |
| < | < | ||
| - | [root@centos8 | + | root@manager:~# rm -v client.csr server.csr extfile.cnf extfile-client.cnf |
| - | [1] 14598 | + | 'client.csr' supprimé |
| + | ' | ||
| + | ' | ||
| + | ' | ||
| </ | </ | ||
| - | Vérifiez ensuite que le **socket** d' | + | Modifiez les permissions des clefs privées |
| < | < | ||
| - | [root@centos8 | + | root@manager:~# chmod -v 0400 ca-key.pem key.pem server-key.pem |
| - | udp 0 0 0.0.0.0: | + | le mode de ' |
| + | le mode de 'key.pem' a été modifié de 0600 (rw-------) en 0400 (r--------) | ||
| + | le mode de ' | ||
| </ | </ | ||
| - | Constatez ensuite la table de routage | + | Ainsi que les permissions des certificats |
| - | < | + | < |
| - | [root@centos8 | + | root@manager:~# chmod -v 0444 ca.pem server-cert.pem cert.pem |
| - | Kernel IP routing table | + | le mode de 'ca.pem' a été modifié de 0644 (rw-r--r--) en 0444 (r--r--r--) |
| - | Destination | + | le mode de ' |
| - | default | + | le mode de 'cert.pem' a été modifié de 0644 (rw-r--r--) en 0444 (r--r--r--) |
| - | 10.0.0.1 0.0.0.0 | + | |
| - | 10.0.2.0 0.0.0.0 | + | |
| - | 192.168.122.0 | + | |
| </ | </ | ||
| - | Notez la présence de la route via **tun0**. | + | Arrêtez et supprimez |
| - | + | ||
| - | Constatez ensuite le montage du tunnel en regardant | + | |
| < | < | ||
| - | [root@centos7 | + | root@manager:~# docker stop mysql |
| + | mysql | ||
| + | root@manager: | ||
| + | mysql | ||
| </ | </ | ||
| - | L' | + | ====9.4 - Démarrage du Daemon Docker avec une Invocation Directe==== |
| - | < | + | Arrêtez et désactivez le service Docker : |
| - | | + | |
| - | | | | + | |
| - | | | | + | |
| - | eth0@ifxxx | + | |
| - | 172.yy.0.3 | + | |
| - | </ | + | |
| - | ====Configuration du serveur==== | + | < |
| + | root@manager: | ||
| + | Warning: Stopping docker.service, | ||
| + | docker.socket | ||
| + | root@manager: | ||
| + | Synchronizing state of docker.service with SysV service script with / | ||
| + | Executing: / | ||
| + | </ | ||
| - | Créez le fichier | + | Lancez un invocation directe de **dockerd** afin que le daemon n' |
| < | < | ||
| - | root@debian12:~# vi / | + | root@manager:~# dockerd --tlsverify --tlscacert=ca.pem --tlscert=server-cert.pem --tlskey=server-key.pem -H=0.0.0.0: |
| - | + | [1] 1868 | |
| - | root@debian12:~# cat /etc/openvpn/ | + | root@manager:~# INFO[2019-11-11T12: |
| - | dev tun | + | INFO[2019-11-11T12: |
| - | ifconfig 10.0.0.1 10.0.0.2 | + | INFO[2019-11-11T12: |
| - | secret | + | INFO[2019-11-11T12: |
| - | port 1194 | + | INFO[2019-11-11T12: |
| - | proto udp | + | INFO[2019-11-11T12: |
| - | user nobody | + | INFO[2019-11-11T12: |
| - | group nobody | + | INFO[2019-11-11T12: |
| - | daemon | + | INFO[2019-11-11T12: |
| - | comp-lzo | + | INFO[2019-11-11T12: |
| - | keepalive 10 60 | + | INFO[2019-11-11T12: |
| - | ping-timer-rem | + | INFO[2019-11-11T12: |
| - | persist-tun | + | WARN[2019-11-11T12: |
| - | persist-key | + | WARN[2019-11-11T12: |
| - | log / | + | INFO[2019-11-11T12: |
| - | verb 1 | + | INFO[2019-11-11T12: |
| + | INFO[2019-11-11T12: | ||
| + | INFO[2019-11-11T12: | ||
| + | INFO[2019-11-11T12: | ||
| + | INFO[2019-11-11T12: | ||
| + | [Entrée] | ||
| + | root@manager: | ||
| </ | </ | ||
| - | Arrêtez | + | Vérifiez que le processus tourne |
| < | < | ||
| - | root@debian12:~# systemctl stop firewalld | + | root@manager:~# ps aux | grep docker |
| + | root 1868 0.2 4.0 421876 82236 pts/0 Sl | ||
| + | root 1995 0.0 0.0 12780 964 pts/0 S+ | ||
| + | </ | ||
| - | root@debian12: | + | Installez le paquet **net-tools** qui contient le binaire **netstat** : |
| - | Chain INPUT (policy ACCEPT) | + | |
| - | target | + | |
| - | Chain FORWARD (policy ACCEPT) | + | < |
| - | target | + | root@manager: |
| - | + | ||
| - | Chain OUTPUT (policy ACCEPT) | + | |
| - | target | + | |
| </ | </ | ||
| - | Lancez openvpn en ligne de commande et en arrière plan en spécifiant une journalisation | + | Vérifiez que le port **2376** est à l' |
| < | < | ||
| - | root@debian12:~# openvpn | + | root@manager:~# netstat |
| - | [1] 11644 | + | tcp6 |
| </ | </ | ||
| - | Vérifiez | + | ====9.5 - Configuration du Client==== |
| + | |||
| + | Transférez | ||
| < | < | ||
| - | [root@centos7 | + | root@manager:~# scp ca.pem key.pem cert.pem trainee@10.0.2.45:/ |
| - | udp 0 0 0.0.0.0:1194 | + | The authenticity of host '10.0.2.45 (10.0.2.45)' |
| + | ECDSA key fingerprint is SHA256: | ||
| + | Are you sure you want to continue connecting (yes/no)? yes | ||
| + | Warning: Permanently added '10.0.2.45' (ECDSA) to the list of known hosts. | ||
| + | trainee@10.0.2.45' | ||
| + | ca.pem | ||
| + | key.pem | ||
| + | cert.pem | ||
| </ | </ | ||
| - | Constatez ensuite | + | Lancez |
| + | |||
| + | < | ||
| + | trainee@myregistry: | ||
| + | Client: Docker Engine - Community | ||
| + | | ||
| + | API version: | ||
| + | Go version: | ||
| + | Git commit: | ||
| + | | ||
| + | | ||
| + | | ||
| - | < | + | Server: Docker Engine |
| - | [root@centos7 ~]# netstat | + | Engine: |
| - | Kernel IP routing table | + | |
| - | Destination | + | API version: |
| - | 0.0.0.0 10.0.2.2 0.0.0.0 | + | Go version: |
| - | 10.0.0.1 0.0.0.0 | + | Git commit: |
| - | 10.0.2.0 | + | Built: |
| + | OS/ | ||
| + | Experimental: | ||
| + | | ||
| + | Version: | ||
| + | GitCommit: | ||
| + | | ||
| + | Version: | ||
| + | GitCommit: | ||
| + | | ||
| + | Version: | ||
| + | GitCommit: | ||
| </ | </ | ||
| - | Constatez ensuite | + | Afin de faciliter l' |
| < | < | ||
| - | [root@centos7 | + | trainee@myregistry:~$ mkdir -pv ~/.docker |
| + | mkdir: création du répertoire '/home/trainee/.docker' | ||
| </ | </ | ||
| - | ====Tests==== | + | Copiez ensuite les fichiers *.pem dans le répertoire **~/ |
| - | ===Du client vers le serveur=== | + | < |
| + | trainee@myregistry: | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | </ | ||
| - | Sur le client, utilisez la commande ping pour envoyer des paquets dans le tunnel | + | Créez les deux variables **DOCKER_HOST** et **DOCKER_TLS_VERIFY** |
| < | < | ||
| - | [root@centos6 | + | trainee@myregistry:~$ export DOCKER_HOST=tcp://manager.i2tch.loc:2376 DOCKER_TLS_VERIFY=1 |
| - | PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. | + | |
| - | 64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=7.62 ms | + | |
| - | 64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=1.35 ms | + | |
| - | 64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=0.000 ms | + | |
| - | + | ||
| - | --- 10.0.0.1 ping statistics --- | + | |
| - | 3 packets transmitted, | + | |
| - | rtt min/ | + | |
| </ | </ | ||
| - | ===Du serveur vers le client=== | + | Maintenant |
| - | + | ||
| - | Sur le serveur, utilisez | + | |
| < | < | ||
| - | [root@centos7 | + | trainee@myregistry:~$ docker image ls |
| - | PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data. | + | REPOSITORY |
| - | 64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=2.59 ms | + | i2tch/ |
| - | 64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=9.08 ms | + | i2tch/ |
| - | 64 bytes from 10.0.0.2: icmp_seq=3 ttl=64 time=7.24 ms | + | ubuntu |
| - | 64 bytes from 10.0.0.2: icmp_seq=4 ttl=64 time=7.03 ms | + | nginx |
| - | 64 bytes from 10.0.0.2: icmp_seq=5 ttl=64 time=4.08 ms | + | alpine |
| - | + | i2tch/ | |
| - | --- 10.0.0.2 ping statistics --- | + | mysql |
| - | 5 packets transmitted, | + | centos |
| - | rtt min/avg/ | + | docker/trusttest |
| </ | </ | ||
| ----- | ----- | ||
| - | Copyright © 2025 Hugh Norris. | + | Copyright © 2025 Hugh NORRIS |