Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
elearning:workbooks:centos:8:lcf1000:l1005 [2023/11/08 08:50] – created admin | elearning:workbooks:centos:8:lcf1000:l1005 [2023/11/12 11:48] (Version actuelle) – admin | ||
---|---|---|---|
Ligne 25: | Ligne 25: | ||
L' | L' | ||
- | |||
- | Stagiaires **11**, **12**, **14**, **15**, **16** et **17** : | ||
^ Type Machine ^ FQDN ^ IP ^ OS ^ Version | ^ Type Machine ^ FQDN ^ IP ^ OS ^ Version | ||
Ligne 34: | Ligne 32: | ||
| VM | targetb.i2tch.loc | 10.0.2.53 | CentOS | | VM | targetb.i2tch.loc | 10.0.2.53 | CentOS | ||
- | Stagiaires **18**, **19**, **20**, **21**, **22** | + | =====LAB #1 - OHAI et Attributs Automatiques===== |
- | ^ Type Machine ^ FQDN ^ IP ^ OS ^ Version | + | ====1.1 - Création du Cookbook==== |
- | | VM | workstation.ittraining.loc | 10.0.3.111 | Ubuntu | + | |
- | | VM | client.ittraining.loc | 10.0.3.112 | Ubuntu | + | |
- | | VM | targeta.i2tch.loc | 10.0.3.52 | Debian | + | |
- | | VM | targetb.i2tch.loc | 10.0.3.53 | CentOS | + | |
- | Commencez | + | Commencez par modifier le fichier **/ |
- | + | ||
- | Stagiaires **11**, **12**, **14**, **15**, **16** et **17** : | + | |
< | < | ||
Ligne 64: | Ligne 56: | ||
ff02::2 ip6-allrouters | ff02::2 ip6-allrouters | ||
</ | </ | ||
- | |||
- | Stagiaires **18**, **19**, **20**, **21**, **22** et **23** : | ||
- | |||
- | < | ||
- | root@workstation: | ||
- | root@workstation: | ||
- | 127.0.0.1 | ||
- | 127.0.1.1 | ||
- | 10.0.3.110 | ||
- | 10.0.3.111 | ||
- | 10.0.3.112 | ||
- | 10.0.3.52 | ||
- | 10.0.3.53 | ||
- | |||
- | # The following lines are desirable for IPv6 capable hosts | ||
- | ::1 | ||
- | fe00::0 ip6-localnet | ||
- | ff00::0 ip6-mcastprefix | ||
- | ff02::1 ip6-allnodes | ||
- | ff02::2 ip6-allrouters | ||
- | </ | ||
- | |||
- | =====LAB #1 - OHAI et Attributs Automatiques===== | ||
- | |||
- | ====1.1 - Création du Cookbook==== | ||
Créez un Cookbook nommé **apache** : | Créez un Cookbook nommé **apache** : | ||
Ligne 240: | Ligne 207: | ||
====1.2 - Préparer les Noeuds targeta et targetb==== | ====1.2 - Préparer les Noeuds targeta et targetb==== | ||
- | |||
- | ===Stagiaires **11**, **12**, **14**, **15**, **16** et **17**=== | ||
Configurez les deux nouveaux clients **targeta** et **targetb**. | Configurez les deux nouveaux clients **targeta** et **targetb**. | ||
Ligne 447: | Ligne 412: | ||
10.0.2.52 | 10.0.2.52 | ||
10.0.2.53 | 10.0.2.53 | ||
- | </ | ||
- | |||
- | Consultez la liste des **Attributs Automatiques** : | ||
- | |||
- | < | ||
- | [root@targetb ~]# ohai | more | ||
- | { | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | }, | ||
- | " | ||
- | " | ||
- | " | ||
- | }, | ||
- | " | ||
- | " | ||
- | " | ||
- | }, | ||
- | " | ||
- | " | ||
- | " | ||
- | }, | ||
- | " | ||
- | " | ||
- | " | ||
- | }, | ||
- | " | ||
- | " | ||
- | " | ||
- | }, | ||
- | " | ||
- | " | ||
- | " | ||
- | }, | ||
- | " | ||
- | " | ||
- | " | ||
- | }, | ||
- | " | ||
- | " | ||
- | " | ||
- | }, | ||
- | " | ||
- | " | ||
- | " | ||
- | }, | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | }, | ||
- | " | ||
- | --More-- | ||
- | </ | ||
- | |||
- | Déconnectez-vous de la VM : | ||
- | |||
- | < | ||
- | [root@targetb ~]# exit | ||
- | déconnexion | ||
- | |||
- | trainee@targetb: | ||
- | déconnexion | ||
- | </ | ||
- | |||
- | ===Stagiaires **18**, **19**, **20**, **21**, **22** et **23**=== | ||
- | |||
- | Configurez les deux nouveaux clients **targeta** et **targetb**. | ||
- | |||
- | < | ||
- | root@workstation: | ||
- | Debian GNU/Linux 9 | ||
- | trainee@10.0.3.52' | ||
- | Linux targeta.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
- | |||
- | The programs included with the Debian GNU/Linux system are free software; | ||
- | the exact distribution terms for each program are described in the | ||
- | individual files in / | ||
- | |||
- | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
- | permitted by applicable law. | ||
- | Last login: Sun Mar 21 08:47:45 2021 from 10.0.3.10 | ||
- | trainee@targeta: | ||
- | Mot de passe : fenestros | ||
- | root@targeta: | ||
- | Unit apache2.service could not be found. | ||
- | root@targeta: | ||
- | </ | ||
- | |||
- | Editez la directive **PermitRootLogin** du fichier **/ | ||
- | |||
- | < | ||
- | root@targeta: | ||
- | |||
- | root@targeta: | ||
- | ... | ||
- | PermitRootLogin yes | ||
- | ... | ||
- | |||
- | root@targeta: | ||
- | </ | ||
- | |||
- | Editez ensuite le fichier **/ | ||
- | |||
- | < | ||
- | root@targeta: | ||
- | |||
- | root@targeta: | ||
- | 127.0.0.1 | ||
- | 10.0.3.110 | ||
- | 10.0.3.111 | ||
- | 10.0.3.52 | ||
- | 10.0.3.53 | ||
- | |||
- | # The following lines are desirable for IPv6 capable hosts | ||
- | ::1 | ||
- | ff02::1 ip6-allnodes | ||
- | ff02::2 ip6-allrouters | ||
- | </ | ||
- | |||
- | Mettez à jour les dépôts des paquets : | ||
- | |||
- | < | ||
- | root@targeta: | ||
- | |||
- | root@targeta: | ||
- | |||
- | root@targeta: | ||
- | |||
- | root@targeta: | ||
- | Ign:1 http:// | ||
- | Réception de:2 http:// | ||
- | Réception de:3 http:// | ||
- | Réception de:4 http:// | ||
- | Réception de:5 http:// | ||
- | Réception de:6 http:// | ||
- | Réception de:7 http:// | ||
- | 21,2 Mo réceptionnés en 6s (3 302 ko/s) | ||
- | Lecture des listes de paquets... Fait | ||
- | Construction de l' | ||
- | Lecture des informations d' | ||
- | 226 packages can be upgraded. Run 'apt list --upgradable' | ||
- | </ | ||
- | |||
- | Consultez la liste des **Attributs Automatiques** : | ||
- | |||
- | < | ||
- | root@targeta: | ||
- | { | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | PduyiRFInMEBv62BYqpxS9DBaz40oH0bif+WgrIO01Led/ | ||
- | " | ||
- | " | ||
- | " | ||
- | } | ||
- | }, | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | }, | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | }, | ||
- | " | ||
- | " | ||
- | " | ||
- | }, | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | }, | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | --Plus-- | ||
- | </ | ||
- | |||
- | Quittez la VM **targeta** : | ||
- | |||
- | < | ||
- | root@targeta: | ||
- | déconnexion | ||
- | trainee@targeta: | ||
- | déconnexion | ||
- | Connection to 10.0.3.52 closed. | ||
- | </ | ||
- | |||
- | Connectez-vous à la VM **targetb** : | ||
- | |||
- | < | ||
- | root@workstation: | ||
- | The authenticity of host ' | ||
- | ECDSA key fingerprint is SHA256: | ||
- | Are you sure you want to continue connecting (yes/no)? yes | ||
- | Warning: Permanently added ' | ||
- | trainee@10.0.3.53' | ||
- | Last login: Sun Mar 21 08:53:18 2021 from 10.0.3.10 | ||
- | [trainee@targetb ~]$ su - | ||
- | Password: fenestros | ||
- | Last login: dim. mars 21 08:53:25 CET 2021 on pts/0 | ||
- | </ | ||
- | |||
- | Modifiez la directive **PermitRootLogin** du fichier **/ | ||
- | |||
- | < | ||
- | [root@targetb ~]# vi / | ||
- | |||
- | [root@targetb ~]# cat / | ||
- | # | ||
- | |||
- | # This is the sshd server system-wide configuration file. See | ||
- | # sshd_config(5) for more information. | ||
- | |||
- | # This sshd was compiled with PATH=/ | ||
- | |||
- | # The strategy used for options in the default sshd_config shipped with | ||
- | # OpenSSH is to specify options with their default value where | ||
- | # possible, but leave them commented. | ||
- | # default value. | ||
- | |||
- | # If you want to change the port on a SELinux system, you have to tell | ||
- | # SELinux about this change. | ||
- | # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER | ||
- | ... | ||
- | PermitRootLogin yes | ||
- | ... | ||
- | |||
- | [root@targetb ~]# systemctl restart sshd | ||
- | </ | ||
- | |||
- | Editez ensuite le fichier **/ | ||
- | |||
- | < | ||
- | [root@targetb ~]# vi /etc/hosts | ||
- | |||
- | [root@targetb ~]# cat /etc/hosts | ||
- | 127.0.0.1 | ||
- | ::1 | ||
- | 10.0.3.110 | ||
- | 10.0.3.111 | ||
- | 10.0.3.52 | ||
- | 10.0.3.53 | ||
</ | </ | ||
Ligne 802: | Ligne 487: | ||
====1.3 - Bootstraper les Clients==== | ====1.3 - Bootstraper les Clients==== | ||
- | |||
- | ===Stagiaires **11**, **12**, **14**, **15**, **16** et **17**=== | ||
Commmencez avec la VM **targeta** : | Commmencez avec la VM **targeta** : | ||
Ligne 1129: | Ligne 812: | ||
logout | logout | ||
Connection to 10.0.2.53 closed. | Connection to 10.0.2.53 closed. | ||
- | </ | ||
- | |||
- | ===Stagiaires **18**, **19**, **20**, **21**, **22** et **23**=== | ||
- | |||
- | Commmencez avec la VM **targeta** : | ||
- | |||
- | < | ||
- | root@workstation: | ||
- | --ssh-user: This flag is deprecated. Use -U/ | ||
- | --ssh-password: | ||
- | Connecting to 10.0.3.52 | ||
- | The authenticity of host ' | ||
- | fingerprint is SHA256: | ||
- | |||
- | Are you sure you want to continue connecting | ||
- | ? (Y/N) y | ||
- | Connecting to 10.0.3.52 | ||
- | Creating new client for targeta | ||
- | Creating new node for targeta | ||
- | Bootstrapping 10.0.3.52 | ||
- | | ||
- | downloading https:// | ||
- | to file / | ||
- | trying wget... | ||
- | | ||
- | Getting information for chef stable 15 for debian... | ||
- | downloading https:// | ||
- | to file / | ||
- | | ||
- | | ||
- | sha256 | ||
- | url | ||
- | version 15.17.4 | ||
- | | ||
- | | ||
- | | ||
- | to file / | ||
- | | ||
- | | ||
- | | ||
- | installing with dpkg... | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | ✔ 2 product licenses accepted. | ||
- | +---------------------------------------------+ | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | Compiling Cookbooks... | ||
- | [2023-11-07T12: | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | | ||
- | | ||
- | | ||
- | </ | ||
- | |||
- | <WRAP center round important 50%> | ||
- | **Important** - Notez l' | ||
- | </ | ||
- | |||
- | Ré-exéctuez la commande **knife bootstrap** en y ajoutant **-r ' | ||
- | |||
- | < | ||
- | root@workstation: | ||
- | --ssh-user: This flag is deprecated. Use -U/ | ||
- | --ssh-password: | ||
- | Connecting to 10.0.3.52 | ||
- | The authenticity of host ' | ||
- | fingerprint is SHA256: | ||
- | |||
- | Are you sure you want to continue connecting | ||
- | ? (Y/N) Y | ||
- | Connecting to 10.0.3.52 | ||
- | Node targeta exists, overwrite it? (Y/N) Y | ||
- | Client targeta exists, overwrite it? (Y/N) Y | ||
- | Creating new client for targeta | ||
- | Creating new node for targeta | ||
- | Bootstrapping 10.0.3.52 | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | - install version 2.4.25-3+deb9u9 of package apache2 | ||
- | * service[apache2] action start | ||
- | | ||
- | * service[apache2] action enable | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | | ||
- | | ||
- | | ||
- | </ | ||
- | |||
- | Connectez-vous à la VM **targeta** et vérifiez l' | ||
- | |||
- | < | ||
- | root@workstation: | ||
- | Debian GNU/Linux 9 | ||
- | trainee@10.0.3.52' | ||
- | Linux targeta.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
- | |||
- | The programs included with the Debian GNU/Linux system are free software; | ||
- | the exact distribution terms for each program are described in the | ||
- | individual files in / | ||
- | |||
- | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
- | permitted by applicable law. | ||
- | Last login: Tue Nov 7 13:25:32 2023 from 10.0.3.111 | ||
- | trainee@targeta: | ||
- | Mot de passe : fenestros | ||
- | |||
- | root@targeta: | ||
- | ● apache2.service - The Apache HTTP Server | ||
- | | ||
- | | ||
- | Main PID: 2717 (apache2) | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | nov. 07 13:13:00 targeta.i2tch.loc systemd[1]: Starting The Apache HTTP Server... | ||
- | nov. 07 13:13:00 targeta.i2tch.loc systemd[1]: Started The Apache HTTP Server. | ||
- | |||
- | root@targeta: | ||
- | déconnexion | ||
- | |||
- | trainee@targeta: | ||
- | déconnexion | ||
- | Connection to 10.0.3.52 closed. | ||
- | </ | ||
- | |||
- | Procédez ensuite avec la VM **targetb** : | ||
- | |||
- | < | ||
- | root@workstation: | ||
- | --ssh-user: This flag is deprecated. Use -U/ | ||
- | --ssh-password: | ||
- | Connecting to 10.0.3.53 | ||
- | The authenticity of host ' | ||
- | fingerprint is SHA256: | ||
- | |||
- | Are you sure you want to continue connecting | ||
- | ? (Y/N) Y | ||
- | Connecting to 10.0.3.53 | ||
- | Creating new client for targetb | ||
- | Creating new node for targetb | ||
- | Bootstrapping 10.0.3.53 | ||
- | | ||
- | downloading https:// | ||
- | to file / | ||
- | trying wget... | ||
- | | ||
- | Getting information for chef stable 15 for el... | ||
- | downloading https:// | ||
- | to file / | ||
- | | ||
- | | ||
- | sha256 | ||
- | url | ||
- | version 15.17.4 | ||
- | | ||
- | | ||
- | | ||
- | to file / | ||
- | | ||
- | | ||
- | | ||
- | installing with rpm... | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | chef-15.17.4-1.el7 | ||
- | | ||
- | ... | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | ✔ 2 product licenses accepted. | ||
- | +---------------------------------------------+ | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | Compiling Cookbooks... | ||
- | | ||
- | Recipe: apache:: | ||
- | * yum_package[httpd] action install | ||
- | | ||
- | - install version 0: | ||
- | * service[httpd] action start | ||
- | | ||
- | - start service service[httpd] | ||
- | * service[httpd] action enable | ||
- | | ||
- | - enable service service[httpd] | ||
- | * cookbook_file[/ | ||
- | | ||
- | - create new file / | ||
- | - update content in file / | ||
- | --- / | ||
- | +++ / | ||
- | @@ -1 +1,5 @@ | ||
- | +< | ||
- | +< | ||
- | +< | ||
- | +</ | ||
- | - change mode from '' | ||
- | | ||
- | - restore selinux security context | ||
- | |||
- | | ||
- | Running handlers: | ||
- | Running handlers complete | ||
- | Chef Infra Client finished, 4/4 resources updated in 32 seconds | ||
- | | ||
- | </ | ||
- | |||
- | Connectez-vous à la VM **targetb** et vérifiez l' | ||
- | |||
- | < | ||
- | root@workstation: | ||
- | trainee@10.0.3.53' | ||
- | Last login: Tue Nov 7 13:22:36 2023 from workstation.ittraining.loc | ||
- | [trainee@targetb ~]$ su - | ||
- | Password: fenestros | ||
- | Last login: mar. nov. 7 13:22:46 CET 2023 on pts/0 | ||
- | |||
- | [root@targetb ~]# systemctl status httpd | ||
- | ● httpd.service - The Apache HTTP Server | ||
- | | ||
- | | ||
- | Docs: man: | ||
- | | ||
- | Main PID: 24003 (httpd) | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | Nov 07 13:09:33 targetb.i2tch.loc systemd[1]: Starting The Apache HTTP Server... | ||
- | Nov 07 13:09:33 targetb.i2tch.loc systemd[1]: Started The Apache HTTP Server. | ||
- | |||
- | [root@targetb ~]# exit | ||
- | logout | ||
- | |||
- | [trainee@targetb ~]$ exit | ||
- | logout | ||
- | Connection to 10.0.3.53 closed. | ||
</ | </ | ||
Ligne 1463: | Ligne 818: | ||
====2.1 - Présentation==== | ====2.1 - Présentation==== | ||
+ | Les Data Bags regroupent des informations sous la forme de fichiers au format JSON. Ces informations peuvent être ensuite ré-utilisées dans des Recettes. Les Data Bags sont manipulés par la commande **knige data bag**. | ||
+ | ====2.2 - Création de Data Bags==== | ||
- | + | Commencez par créer le répertoire **data_bags** et **data_bags/ | |
- | ====2.2 - Création de Data Bags==== | + | |
< | < | ||
root@workstation: | root@workstation: | ||
</ | </ | ||
+ | |||
+ | L' | ||
< | < | ||
Ligne 1485: | Ligne 843: | ||
knife data bag show BAG [ITEM] (options) | knife data bag show BAG [ITEM] (options) | ||
</ | </ | ||
+ | |||
+ | Actuellement, | ||
< | < | ||
Ligne 1490: | Ligne 850: | ||
</ | </ | ||
+ | |||
+ | Créez donc un Data Bag dénommé **users** sur le Chef Infra Server : | ||
< | < | ||
Ligne 1495: | Ligne 857: | ||
Created data_bag[users] | Created data_bag[users] | ||
</ | </ | ||
+ | |||
+ | Créez ensuite les fichiers **user1.json** et **user2.json** contenant des informations concernant **user1** et **user2** respectivement : | ||
< | < | ||
Ligne 1523: | Ligne 887: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | Pour téléverser les informations, | ||
< | < | ||
Ligne 1529: | Ligne 895: | ||
Updated data_bag_item[users:: | Updated data_bag_item[users:: | ||
</ | </ | ||
+ | |||
+ | Listez maintenant les Data Bags disponibles : | ||
< | < | ||
Ligne 1534: | Ligne 902: | ||
users | users | ||
</ | </ | ||
+ | |||
+ | Pour voir le contenu du Data Bag, utilisez la commande **knife data bag show < | ||
< | < | ||
Ligne 1540: | Ligne 910: | ||
user2 | user2 | ||
</ | </ | ||
+ | |||
+ | Pour voir les informations du Data Bag, utilisez la commande **knife data bag show < | ||
< | < | ||
Ligne 1551: | Ligne 923: | ||
uid | uid | ||
</ | </ | ||
+ | |||
+ | Vous pouvez rechercher des informations dans un Data Bag avec la commande **knife seearch < | ||
< | < | ||
Ligne 1601: | Ligne 975: | ||
uid: 1002 | uid: 1002 | ||
</ | </ | ||
+ | |||
+ | Pour isoler une seule information, | ||
< | < | ||
Ligne 1612: | Ligne 988: | ||
comment: This is user2 | comment: This is user2 | ||
</ | </ | ||
+ | |||
+ | Dans le cas où, le groupe affecté aux utilisateurs ne soit pas présent sur les noeuds, il faudarit créer un Data Bag **groups** : | ||
< | < | ||
Ligne 1653: | Ligne 1031: | ||
====2.3 - Utilisation de Data Bags==== | ====2.3 - Utilisation de Data Bags==== | ||
+ | |||
+ | Créez un Cookbook dénommé **users** : | ||
< | < | ||
Ligne 1672: | Ligne 1052: | ||
recipes/ | recipes/ | ||
</ | </ | ||
+ | |||
+ | Installez le paquet **tree** : | ||
< | < | ||
Ligne 1695: | Ligne 1077: | ||
Processing triggers for man-db (2.8.3-2ubuntu0.1) ... | Processing triggers for man-db (2.8.3-2ubuntu0.1) ... | ||
</ | </ | ||
+ | |||
+ | Utilisez la commande **tree** pour visualiser l' | ||
< | < | ||
Ligne 1720: | Ligne 1104: | ||
7 directories, | 7 directories, | ||
</ | </ | ||
+ | |||
+ | Créez une recette pour extraire les informations du Data Bag **users** pour chaque instance de la valeur de l' | ||
< | < | ||
Ligne 1740: | Ligne 1126: | ||
</ | </ | ||
- | Stagiaires | + | Connectez-vous à **targeta.i2tch.loc** et exécutez la commande |
< | < | ||
Ligne 1757: | Ligne 1143: | ||
trainee@targeta: | trainee@targeta: | ||
Mot de passe : fenestros | Mot de passe : fenestros | ||
+ | |||
root@targeta: | root@targeta: | ||
Starting Chef Infra Client, version 15.17.4 | Starting Chef Infra Client, version 15.17.4 | ||
Ligne 1782: | Ligne 1169: | ||
[2023-11-07T16: | [2023-11-07T16: | ||
+ | Vérifiez le contenu du fichier **/ | ||
+ | |||
+ | < | ||
root@targeta: | root@targeta: | ||
root: | root: | ||
Ligne 1821: | Ligne 1211: | ||
user1: | user1: | ||
user2: | user2: | ||
+ | </ | ||
+ | Sortez de la machine : | ||
+ | |||
+ | < | ||
root@targeta: | root@targeta: | ||
déconnexion | déconnexion | ||
Ligne 1829: | Ligne 1223: | ||
Connection to 10.0.2.52 closed. | Connection to 10.0.2.52 closed. | ||
</ | </ | ||
+ | |||
+ | Connectez-vous à **targetb.i2tch.loc** et exécutez la commande **chef-client** : | ||
< | < | ||
Ligne 1862: | Ligne 1258: | ||
Chef Infra Client finished, 2/6 resources updated in 05 seconds | Chef Infra Client finished, 2/6 resources updated in 05 seconds | ||
[2023-11-07T16: | [2023-11-07T16: | ||
+ | </ | ||
+ | Vérifiez le contenu du fichier **/ | ||
+ | |||
+ | < | ||
[root@targetb ~]# cat /etc/passwd | [root@targetb ~]# cat /etc/passwd | ||
root: | root: | ||
Ligne 1911: | Ligne 1311: | ||
user1: | user1: | ||
user2: | user2: | ||
- | |||
- | [root@targetb ~]# exit | ||
- | logout | ||
- | [trainee@targetb ~]$ exit | ||
- | logout | ||
- | Connection to 10.0.2.53 closed. | ||
</ | </ | ||
- | Stagiaires **18**, **19**, **20**, **21**, **22** et **23** | + | Sortez de la machine |
< | < | ||
- | root@workstation: | ||
- | Debian GNU/Linux 9 | ||
- | trainee@10.0.3.52' | ||
- | Linux targeta.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
- | |||
- | The programs included with the Debian GNU/Linux system are free software; | ||
- | the exact distribution terms for each program are described in the | ||
- | individual files in / | ||
- | |||
- | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
- | permitted by applicable law. | ||
- | Last login: Tue Nov 7 16:34:29 2023 from 10.0.3.111 | ||
- | trainee@targeta: | ||
- | Mot de passe : fenestros | ||
- | root@targeta: | ||
- | Starting Chef Infra Client, version 15.17.4 | ||
- | resolving cookbooks for run list: [" | ||
- | Synchronizing Cookbooks: | ||
- | - apache (0.1.0) | ||
- | - users (0.1.0) | ||
- | Installing Cookbook Gems: | ||
- | Compiling Cookbooks... | ||
- | Converging 5 resources | ||
- | Recipe: apache:: | ||
- | * apt_package[apache2] action install (up to date) | ||
- | * service[apache2] action start (up to date) | ||
- | * service[apache2] action enable (up to date) | ||
- | * cookbook_file[/ | ||
- | Recipe: users:: | ||
- | * linux_user[user1] action create | ||
- | - create user user1 | ||
- | * linux_user[user2] action create | ||
- | - create user user2 | ||
- | |||
- | Running handlers: | ||
- | Running handlers complete | ||
- | Chef Infra Client finished, 2/6 resources updated in 02 seconds | ||
- | [2023-11-07T16: | ||
- | |||
- | root@targeta: | ||
- | root: | ||
- | daemon: | ||
- | bin: | ||
- | sys: | ||
- | sync: | ||
- | games: | ||
- | man: | ||
- | lp: | ||
- | mail: | ||
- | news: | ||
- | uucp: | ||
- | proxy: | ||
- | www-data: | ||
- | backup: | ||
- | list: | ||
- | irc: | ||
- | gnats: | ||
- | nobody: | ||
- | systemd-timesync: | ||
- | systemd-network: | ||
- | systemd-resolve: | ||
- | systemd-bus-proxy: | ||
- | _apt: | ||
- | rtkit: | ||
- | dnsmasq: | ||
- | avahi-autoipd: | ||
- | messagebus: | ||
- | usbmux: | ||
- | speech-dispatcher: | ||
- | sshd: | ||
- | lightdm: | ||
- | pulse: | ||
- | avahi: | ||
- | saned: | ||
- | trainee: | ||
- | ntp: | ||
- | user1: | ||
- | user2: | ||
- | |||
- | root@targeta: | ||
- | déconnexion | ||
- | |||
- | trainee@targeta: | ||
- | déconnexion | ||
- | Connection to 10.0.3.52 closed. | ||
- | </ | ||
- | |||
- | < | ||
- | root@workstation: | ||
- | trainee@10.0.3.53' | ||
- | Last login: Tue Nov 7 16:35:22 2023 from workstation.ittraining.loc | ||
- | [trainee@targetb ~]$ su - | ||
- | Password: fenestros | ||
- | Last login: mar. nov. 7 13:37:44 CET 2023 on pts/0 | ||
- | |||
- | [root@targetb ~]# chef-client | ||
- | Starting Chef Infra Client, version 15.17.4 | ||
- | resolving cookbooks for run list: [" | ||
- | Synchronizing Cookbooks: | ||
- | - apache (0.1.0) | ||
- | - users (0.1.0) | ||
- | Installing Cookbook Gems: | ||
- | Compiling Cookbooks... | ||
- | Converging 5 resources | ||
- | Recipe: apache:: | ||
- | * yum_package[httpd] action install (up to date) | ||
- | * service[httpd] action start (up to date) | ||
- | * service[httpd] action enable (up to date) | ||
- | * cookbook_file[/ | ||
- | Recipe: users:: | ||
- | * linux_user[user1] action create | ||
- | - create user user1 | ||
- | * linux_user[user2] action create | ||
- | - create user user2 | ||
- | |||
- | Running handlers: | ||
- | Running handlers complete | ||
- | Chef Infra Client finished, 2/6 resources updated in 05 seconds | ||
- | [2023-11-07T16: | ||
- | |||
- | [root@targetb ~]# cat /etc/passwd | ||
- | root: | ||
- | bin: | ||
- | daemon: | ||
- | adm: | ||
- | lp: | ||
- | sync: | ||
- | shutdown: | ||
- | halt: | ||
- | mail: | ||
- | operator: | ||
- | games: | ||
- | ftp: | ||
- | nobody: | ||
- | avahi-autoipd: | ||
- | systemd-bus-proxy: | ||
- | systemd-network: | ||
- | dbus: | ||
- | polkitd: | ||
- | abrt: | ||
- | usbmuxd: | ||
- | colord: | ||
- | libstoragemgmt: | ||
- | setroubleshoot: | ||
- | rpc: | ||
- | rtkit: | ||
- | chrony: | ||
- | unbound: | ||
- | tss: | ||
- | geoclue: | ||
- | ntp: | ||
- | sssd: | ||
- | rpcuser: | ||
- | nfsnobody: | ||
- | pulse: | ||
- | gdm: | ||
- | gnome-initial-setup: | ||
- | avahi: | ||
- | postfix: | ||
- | sshd: | ||
- | tcpdump: | ||
- | trainee: | ||
- | vboxadd: | ||
- | saned: | ||
- | gluster: | ||
- | apache: | ||
- | user1: | ||
- | user2: | ||
- | |||
[root@targetb ~]# exit | [root@targetb ~]# exit | ||
logout | logout | ||
[trainee@targetb ~]$ exit | [trainee@targetb ~]$ exit | ||
logout | logout | ||
- | Connection to 10.0.3.53 closed. | + | Connection to 10.0.2.53 closed. |
</ | </ | ||
====2.4 - Data Bags Cryptés==== | ====2.4 - Data Bags Cryptés==== | ||
+ | |||
+ | Pour chiffrer le contenu d'un Data Bag, commencez par créer une clef : | ||
< | < | ||
Ligne 2105: | Ligne 1332: | ||
cookbooks | cookbooks | ||
</ | </ | ||
+ | |||
+ | Créez maintenant le Data Bag **secret-users** en spécifiant le fichier de la clef : | ||
< | < | ||
Ligne 2110: | Ligne 1339: | ||
Created data_bag[secret-users] | Created data_bag[secret-users] | ||
</ | </ | ||
+ | |||
+ | Listez les Dta Bags présents sur le Chef Infra Server : | ||
< | < | ||
Ligne 2117: | Ligne 1348: | ||
users | users | ||
</ | </ | ||
+ | |||
+ | Chiffrez maintenant le fichier **user1.json** : | ||
< | < | ||
Ligne 2122: | Ligne 1355: | ||
Updated data_bag_item[secret-users:: | Updated data_bag_item[secret-users:: | ||
</ | </ | ||
+ | |||
+ | Listez le contenu du Data Bag **secret-users** : | ||
< | < | ||
Ligne 2127: | Ligne 1362: | ||
user1 | user1 | ||
</ | </ | ||
+ | |||
+ | Essayez de voir les informations concernant **user1** : | ||
< | < | ||
Ligne 2187: | Ligne 1424: | ||
version: | version: | ||
</ | </ | ||
+ | |||
+ | Pour pouvoir consulter les informations en clair, il est nécessaire d' | ||
< | < |