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:6:avance:l130:part1 [2020/04/13 12:31] – admin | elearning:workbooks:debian:6:avance:l130:part1 [2023/08/25 01:25] (Version actuelle) – admin | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| ~~PDF: | ~~PDF: | ||
| - | Version : **2020.02**. | + | Version : **2023.02**. |
| Dernière mise-à-jour : ~~LASTMOD~~ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
| - | ====== | + | ====== |
| + | |||
| + | =====Contenu du Module===== | ||
| + | |||
| + | * **LCF801 - Installation d' | ||
| + | * Contenu du Module | ||
| + | * Qu' | ||
| + | * LAB #1 - Installation d' | ||
| + | * LAB #2 - Configuration de ssh et de sudo | ||
| + | * 2.1 - ssh | ||
| + | * 2.2 - sudo | ||
| =====Qu' | =====Qu' | ||
| Ligne 17: | Ligne 27: | ||
| * utilise le langage **YAML** (**Y**et **A**other **M**arkup **L**anguage), | * utilise le langage **YAML** (**Y**et **A**other **M**arkup **L**anguage), | ||
| - | =====LAB #1 - Importation de vos Machines Virtuelles===== | + | {{ : |
| - | ====Formations en Face-à-Face Pédagogique (FFP) ==== | + | =====LAB #1 - Installation d' |
| - | Si vous suivez cette formation en Centre | + | Connectez-vous à la à **centos8** à partir |
| - | Ouvrez VirtualBox et importez les machines virtuelles **Ansible**, | + | < |
| + | trainee@traineeXX:~$ ssh -l trainee 10.0.2.45 | ||
| + | The authenticity of host ' | ||
| + | ECDSA key fingerprint is SHA256: | ||
| + | Are you sure you want to continue connecting (yes/no)? yes | ||
| + | Warning: Permanently added ' | ||
| + | trainee@10.0.2.45' | ||
| + | Activate the web console with: systemctl enable --now cockpit.socket | ||
| - | Fichier > Importer un appareil virtuel ... | + | Last login: Sun Mar 6 12:00:35 2022 from 10.0.2.1 |
| - | + | [trainee@centos8 ~]$ | |
| - | ^ Machine ^ Nom d' | + | |
| - | | Ansible | ansible.i2tch.loc | 10.0.2.9 | | + | |
| - | | TargetA | targeta.i2tch.loc | 10.0.2.10 | | + | |
| - | | Web01 | web01.i2tch.loc | 10.0.2.11 | | + | |
| - | | Web02 | web02.i2tch.loc | 10.0.2.12 | | + | |
| - | | Web03 | web03.i2tch.loc | 10.0.2.13 | | + | |
| - | | Web04 | web04.i2tch.loc | 10.0.2.14 | | + | |
| - | | TargetB | targetb.i2tch.loc | 10.0.2.15 | | + | |
| - | | Windows10 | windows10 | 10.0.2.15 | | + | |
| - | + | ||
| - | Toutes les machines virtuelles sont dans un réseau NAT appelé **NatNetwork**. Créez donc une redirection de port dans le réseau NAT **NatNetwork** de VirtualBox (Fichier > Paramètres > Réseau > NatNetwork > Redirection de ports) pour la machine Ansible : | + | |
| - | + | ||
| - | ^ Nom ^ Protocole ^ IP hôte ^ Port hôte ^ IP invité ^ Port invité ^ | + | |
| - | | Ansible | TCP | 127.0.0.1 | 2222 | 10.0.2.9 | 22 | | + | |
| - | + | ||
| - | Démarrez ensuite les machines virtuelles **Ansible** et **TargetA**. | + | |
| - | + | ||
| - | ====Formations à Distance (FAD) ==== | + | |
| - | + | ||
| - | Vous disposez d'un serveur dédié, pré-installé et pré-configuré, | + | |
| - | + | ||
| - | Connectez-vous en ssh à votre serveur dédié : | + | |
| - | + | ||
| - | ===Linux, MacOS et Windows 10 muni du client ssh=== | + | |
| - | + | ||
| - | Ouvrez un terminal ou CMD et tapez la commande suivante : | + | |
| - | + | ||
| - | < | + | |
| - | $ ssh -l desktop serverXX.ittraining.network | + | |
| </ | </ | ||
| - | où **XX** représente le numéro de votre serveur dédié. Entrez ensuite le mot de passe qui vous a été fourni. | + | Pour obtenir la dernière version d' |
| - | ===Windows 7 et Windows 10 sans client ssh=== | + | < |
| + | [trainee@centos8 ~]$ su - | ||
| + | Password: fenestros | ||
| - | Ouvrez **putty** et utilisez les informations suivantes pour vous connecter à votre serveur dédié | + | [root@centos8 ~]# dnf update |
| + | Last metadata expiration check: 0:19:03 ago on Tue 08 Mar 2022 10:30:01 EST. | ||
| + | Dependencies resolved. | ||
| + | Nothing to do. | ||
| + | Complete! | ||
| - | * Host Name --> serverXX.ittraining.network | + | [root@centos8 ~]# dnf -y install python3-pip |
| - | * Port --> 22 | + | Last metadata expiration check: 0:19:29 ago on Tue 08 Mar 2022 10:30:01 EST. |
| + | Package python3-pip-9.0.3-20.el8.noarch is already installed. | ||
| + | Dependencies resolved. | ||
| + | Nothing to do. | ||
| + | Complete! | ||
| - | Au prompt, connectez-vous en tant que **desktop** avec le mot de passe qui vous a été fourni. | + | [root@centos8 ~]# pip3 -V |
| + | pip 9.0.3 from / | ||
| - | ===Lancement des Machines Virtuelles Ansible et TargetA=== | + | [root@centos8 ~]# pip3 list |
| + | DEPRECATION: | ||
| + | blivet (3.4.0) | ||
| + | Brlapi (0.6.7) | ||
| + | chardet (3.0.4) | ||
| + | chrome-gnome-shell (0.0.0) | ||
| + | configobj (5.0.6) | ||
| + | cupshelpers (1.0) | ||
| + | dasbus (1.2) | ||
| + | dbus-python (1.2.4) | ||
| + | decorator (4.2.1) | ||
| + | docutils (0.14) | ||
| + | ethtool (0.14) | ||
| + | gpg (1.13.1) | ||
| + | html5lib (0.999999999) | ||
| + | idna (2.5) | ||
| + | iniparse (0.4) | ||
| + | initial-setup (0.3.81.7) | ||
| + | isc (2.0) | ||
| + | langtable (0.0.51) | ||
| + | libcomps (0.1.16) | ||
| + | lxml (4.2.3) | ||
| + | nftables (0.1) | ||
| + | ntplib (0.3.3) | ||
| + | ordered-set (2.0.2) | ||
| + | perf (0.1) | ||
| + | pexpect (4.3.1) | ||
| + | pid (2.1.1) | ||
| + | pip (9.0.3) | ||
| + | ply (3.9) | ||
| + | productmd (1.11) | ||
| + | psutil (5.4.3) | ||
| + | ptyprocess (0.5.2) | ||
| + | pwquality (1.4.4) | ||
| + | pycairo (1.16.3) | ||
| + | pycups (1.9.72) | ||
| + | pycurl (7.43.0.2) | ||
| + | pydbus (0.6.0) | ||
| + | pyenchant (2.0.0) | ||
| + | pygobject (3.28.3) | ||
| + | pyinotify (0.9.6) | ||
| + | pykickstart (3.16.14) | ||
| + | pyparsing (2.1.10) | ||
| + | pyparted (3.11.7) | ||
| + | PySocks (1.6.8) | ||
| + | python-dateutil (2.6.1) | ||
| + | python-dmidecode (3.12.2) | ||
| + | python-linux-procfs (0.6.3) | ||
| + | python-meh (0.47.2) | ||
| + | pytz (2017.2) | ||
| + | pyudev (0.21.0) | ||
| + | pyxdg (0.25) | ||
| + | PyYAML (3.12) | ||
| + | requests (2.20.0) | ||
| + | requests-file (1.4.3) | ||
| + | requests-ftp (0.3.1) | ||
| + | rpm (4.14.3) | ||
| + | schedutils (0.6) | ||
| + | selinux (2.9) | ||
| + | sepolicy (1.1) | ||
| + | setools (4.3.0) | ||
| + | setroubleshoot (1.1) | ||
| + | setuptools (39.2.0) | ||
| + | simpleline (1.1.1) | ||
| + | six (1.11.0) | ||
| + | slip (0.6.4) | ||
| + | slip.dbus (0.6.4) | ||
| + | sos (4.1) | ||
| + | SSSDConfig (2.5.2) | ||
| + | subscription-manager (1.28.21) | ||
| + | syspurpose (1.28.21) | ||
| + | systemd-python (234) | ||
| + | urllib3 (1.24.2) | ||
| + | webencodings (0.5.1) | ||
| - | Pour lancer les deux machines **Ansible** et **TargetA**, | + | [root@centos8 |
| - | + | WARNING: Running pip install with root privileges is generally not a good idea. Try `__main__.py install --user` instead. | |
| - | < | + | Collecting pip |
| - | desktop@server16:~$ VBoxManage startvm Ansible | + | |
| - | Waiting for VM " | + | 100% |████████████████████████████████| 1.7MB 747kB/ |
| - | VM " | + | Installing collected packages: pip |
| - | desktop@server16:~$ VBoxManage startvm TargetA | + | Successfully installed pip-21.3.1 |
| - | Waiting for VM " | + | |
| - | VM " | + | |
| </ | </ | ||
| - | =====LAB #2 - Connexion | + | Dernièrement, |
| - | + | ||
| - | Les noms d' | + | |
| - | + | ||
| - | ^ Utilisateur ^ Mot de Passe ^ | + | |
| - | | trainee | trainee | | + | |
| - | | root | fenestros | | + | |
| - | + | ||
| - | Vous devez vous connecter à la machine virtuelle Ansible de la façon suivante : | + | |
| - | + | ||
| - | ====Linux, MacOS, Windows 10 muni du client ssh et FAD==== | + | |
| - | + | ||
| - | Ouvrez un terminal et tapez la commande suivante pour la machine **Ansible** | + | |
| < | < | ||
| - | $ ssh -l trainee localhost -p 2222 | + | [root@centos8 ~]# dnf module |
| </ | </ | ||
| - | ====Windows 7 et Windows 10 sans client ssh en FFP==== | + | <WRAP center round important> |
| - | + | ||
| - | Ouvrez **putty** et utilisez les informations suivantes pour vous connecter à **Ansible** : | + | |
| - | + | ||
| - | * Host Name --> localhost | + | |
| - | * Port --> 2222 | + | |
| - | + | ||
| - | =====LAB #3 - Installation d' | + | |
| - | + | ||
| - | Pour obtenir la dernière version d' | + | |
| - | + | ||
| - | < | + | |
| - | trainee@ansible: | + | |
| - | Mot de passe : fenestros | + | |
| - | root@ansible: | + | |
| - | ... | + | |
| - | root@ansible: | + | |
| - | ... | + | |
| - | root@ansible: | + | |
| - | pip 9.0.1 from / | + | |
| - | root@ansible: | + | |
| - | DEPRECATION: | + | |
| - | ansible (2.7.6) | + | |
| - | bcrypt (3.1.6) | + | |
| - | Brlapi (0.6.5) | + | |
| - | cffi (1.11.5) | + | |
| - | chardet (2.3.0) | + | |
| - | cryptography (1.7.1) | + | |
| - | cupshelpers (1.0) | + | |
| - | httplib2 (0.9.2) | + | |
| - | idna (2.2) | + | |
| - | Jinja2 (2.10) | + | |
| - | keyring (10.1) | + | |
| - | keyrings.alt (1.3) | + | |
| - | louis (3.0.0) | + | |
| - | MarkupSafe (1.1.0) | + | |
| - | paramiko (2.4.2) | + | |
| - | pip (9.0.1) | + | |
| - | pyasn1 (0.1.9) | + | |
| - | pycparser (2.19) | + | |
| - | pycrypto (2.6.1) | + | |
| - | pycups (1.9.73) | + | |
| - | pycurl (7.43.0) | + | |
| - | pygobject (3.22.0) | + | |
| - | PyNaCl (1.3.0) | + | |
| - | pysmbc (1.0.15.6) | + | |
| - | python-apt (1.4.0b3) | + | |
| - | python-debian (0.1.30) | + | |
| - | python-debianbts (2.6.1) | + | |
| - | pyxdg (0.25) | + | |
| - | PyYAML (3.13) | + | |
| - | reportbug (7.1.7) | + | |
| - | requests (2.12.4) | + | |
| - | SecretStorage (2.3.1) | + | |
| - | setuptools (33.1.1) | + | |
| - | six (1.10.0) | + | |
| - | urllib3 (1.19.1) | + | |
| - | wheel (0.29.0) | + | |
| - | </ | + | |
| - | + | ||
| - | <WRAP center round important | + | |
| **Important** : Pip3 est le gestionnaire des paquets pour Python 3.5. La commande est disponible en tant que pip3 ou pip sous Linux, Mac et Windows(r). | **Important** : Pip3 est le gestionnaire des paquets pour Python 3.5. La commande est disponible en tant que pip3 ou pip sous Linux, Mac et Windows(r). | ||
| </ | </ | ||
| - | <WRAP center round important | + | <WRAP center round important> |
| **Important** : Notez que le mot de passe **fenestros** ne sera pas en clair. | **Important** : Notez que le mot de passe **fenestros** ne sera pas en clair. | ||
| </ | </ | ||
| - | Utilisez ensuite | + | Utilisez ensuite |
| < | < | ||
| - | root@ansible:~# pip3 install ansible | + | [trainee@centos8 |
| - | Collecting ansible | + | |
| - | Downloading https:// | + | |
| - | 100% |████████████████████████████████| 11.8MB 115kB/s | + | |
| - | Collecting PyYAML (from ansible) | + | |
| - | Downloading https:// | + | |
| - | 100% |████████████████████████████████| 276kB 2.8MB/s | + | |
| - | Requirement already satisfied: cryptography in / | + | |
| - | Collecting jinja2 (from ansible) | + | |
| - | Downloading https:// | + | |
| - | 100% |████████████████████████████████| 133kB 3.0MB/s | + | |
| - | Collecting paramiko (from ansible) | + | |
| - | Downloading https:// | + | |
| - | 100% |████████████████████████████████| 194kB 3.0MB/s | + | |
| - | Requirement already satisfied: setuptools in / | + | |
| - | Collecting MarkupSafe> | + | |
| - | Downloading https:// | + | |
| - | Collecting bcrypt> | + | |
| - | Downloading https:// | + | |
| - | 100% |████████████████████████████████| 61kB 5.0MB/s | + | |
| - | Requirement already satisfied: pyasn1> | + | |
| - | Collecting pynacl> | + | |
| - | Downloading https:// | + | |
| - | 100% |████████████████████████████████| 768kB 1.5MB/s | + | |
| - | Requirement already satisfied: six> | + | |
| - | Collecting cffi> | + | |
| - | Downloading https:// | + | |
| - | 100% |████████████████████████████████| 430kB 2.5MB/s | + | |
| - | Collecting pycparser (from cffi> | + | |
| - | Downloading https:// | + | |
| - | 100% |████████████████████████████████| 163kB 5.5MB/s | + | |
| - | Building wheels for collected packages: ansible, PyYAML, pycparser | + | |
| - | Running setup.py bdist_wheel for ansible ... done | + | |
| - | Stored in directory: / | + | |
| - | Running setup.py bdist_wheel for PyYAML ... done | + | |
| - | Stored in directory: / | + | |
| - | Running setup.py bdist_wheel for pycparser ... done | + | |
| - | Stored in directory: / | + | |
| - | Successfully built ansible PyYAML pycparser | + | |
| - | Installing collected packages: PyYAML, MarkupSafe, jinja2, pycparser, cffi, bcrypt, pynacl, paramiko, ansible | + | |
| - | Successfully installed MarkupSafe-1.1.0 PyYAML-3.13 ansible-2.7.6 bcrypt-3.1.6 cffi-1.11.5 jinja2-2.10 paramiko-2.4.2 pycparser-2.19 pynacl-1.3.0 | + | |
| </ | </ | ||
| Ligne 217: | Ligne 175: | ||
| < | < | ||
| - | root@ansible:~# ansible --version | + | [trainee@centos8 |
| - | ansible 2.9.6 | + | ansible |
| config file = None | config file = None | ||
| - | configured module search path = ['/root/ | + | configured module search path = ['/home/ |
| - | ansible python module location = / | + | ansible python module location = / |
| + | ansible collection location = / | ||
| executable location = / | executable location = / | ||
| - | python version = 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516] | + | python version = 3.6.8 (default, Sep 10 2021, 09:13:53) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)] |
| + | jinja version = 3.0.3 | ||
| + | libyaml = True | ||
| </ | </ | ||
| - | Il existe un bug dans la version 3.5.3 de Python sous Debian 9. Ceci peut être corrigé en modifiant les lignes 109 et 117 dans le fichier **/ | + | =====LAB #2 - Configuration |
| - | < | + | ====2.1 - ssh==== |
| - | root@ansible: | + | |
| - | root@ansible: | + | |
| - | ... | + | |
| - | #def remove(wr, selfref=ref(self)): | + | |
| - | def remove(wr, selfref=ref(self), _atomic_removal=_remove_dead_weakref): | + | |
| - | ... | + | |
| - | # | + | |
| - | _atomic_removal(d, | + | |
| - | ... | + | |
| - | </ | + | |
| - | <WRAP center round important 60%> | + | Ansible a besoin d'une configuration par clef asymétrique avec la machine |
| - | **Important** : N' | + | |
| - | </ | + | |
| - | =====LAB #4 - Configuration | + | * La machine **centos8** envoie à la machine **targeta** une requête d' |
| + | * La machine **targeta** recherche une correspondance pour ce module dans le fichier des clés autorisés **~/.ssh/ | ||
| + | * Dans le cas où une correspondance n'est pas trouvée, la machine **targeta** met fin à la communication, | ||
| + | * Dans le cas contraire la machine **targeta** génère une chaîne aléatoire de 256 bits appelée un **challenge** et la chiffre avec la **clé publique de la machine centos8**, | ||
| + | * La machine **centos8** reçoit le challenge et le décrypte avec la partie privée de sa clé. Il combine le challenge avec l' | ||
| + | * La machine **targeta** génère le même haché | ||
| - | ====ssh==== | + | Saisissez maintenant les commandes suivantes en tant que **trainee** dans la machine **centos8** : |
| - | Ansible a besoin d'une configuration par clef asymétrique avec la machine **TargetA** afin de fonctionner correctement. Dans cette configuration : | + | <WRAP center round important> |
| - | + | ||
| - | * La machine **Ansible** envoie à la machine **TargetA** une requête d' | + | |
| - | * La machine **TargetA** recherche une correspondance pour ce module dans le fichier des clés autorisés **~/ | + | |
| - | * Dans le cas où une correspondance n'est pas trouvée, la machine **TargetA** met fin à la communication, | + | |
| - | * Dans le cas contraire la machine **TargetA** génère une chaîne aléatoire de 256 bits appelée un **challenge** et la chiffre avec la **clé publique de la machine Ansible**, | + | |
| - | * La machine **Ansible** reçoit le challenge et le décrypte avec la partie privée de sa clé. Il combine le challenge avec l' | + | |
| - | * La machine **TargetA** génère le même haché et le compare avec celui reçu de la machine **Ansible**. Si les deux hachés sont identiques, l' | + | |
| - | + | ||
| - | Saisissez maintenant les commandes suivantes en tant que **trainee** dans la machine **Ansible** : | + | |
| - | + | ||
| - | <WRAP center round important | + | |
| **Important** - Lors de la génération des clefs, la passphrase doit être **vide**. | **Important** - Lors de la génération des clefs, la passphrase doit être **vide**. | ||
| </ | </ | ||
| < | < | ||
| - | root@ansible: | + | [trainee@centos8 |
| - | déconnexion | + | |
| - | trainee@ansible:~$ ssh-keygen -t rsa | + | |
| Generating public/ | Generating public/ | ||
| Enter file in which to save the key (/ | Enter file in which to save the key (/ | ||
| - | Created directory '/ | ||
| Enter passphrase (empty for no passphrase): | Enter passphrase (empty for no passphrase): | ||
| Enter same passphrase again: | Enter same passphrase again: | ||
| Ligne 275: | Ligne 215: | ||
| Your public key has been saved in / | Your public key has been saved in / | ||
| The key fingerprint is: | The key fingerprint is: | ||
| - | SHA256:JQNe6n1PZphil37Akn1uO5A8e/4MhhIAb99T70ffo8Y | + | SHA256:mgCPKDg5NBf68IbtjUqbvCVLrDf4nw2C6QdIQRgF/aY trainee@centos8.ittraining.loc |
| The key's randomart image is: | The key's randomart image is: | ||
| - | +---[RSA | + | +---[RSA |
| - | | . . . | + | |=*.. |
| - | | + + | | + | |..o . |
| - | | * o . . | + | | =oo | |
| - | | | + | |o+O+o |
| - | | . S.%.= . .| | + | |X..Bo S | |
| - | | . B=@ . .o| | + | |+*E o. o |
| - | | | + | |o*o+..o |
| - | | ..+oE...| | + | |B Xo + |
| - | | o++o | + | |.@+oo . |
| +----[SHA256]-----+ | +----[SHA256]-----+ | ||
| - | trainee@ansible:~$ ssh-keygen -t ecdsa | + | [trainee@centos8 |
| Generating public/ | Generating public/ | ||
| Enter file in which to save the key (/ | Enter file in which to save the key (/ | ||
| Ligne 296: | Ligne 236: | ||
| Your public key has been saved in / | Your public key has been saved in / | ||
| The key fingerprint is: | The key fingerprint is: | ||
| - | SHA256:Ir3cEmFZND2AyFqQ2n65dXOPlSAB1BzzkzR3ViI+OYc | + | SHA256:X2O1yKIbbCmNcIrnB9vYd2Tn8S8zISf/ |
| The key's randomart image is: | The key's randomart image is: | ||
| +---[ECDSA 256]---+ | +---[ECDSA 256]---+ | ||
| - | | .+ oo*B+o o +..| | ||
| - | | . + .o+=o= * . | | ||
| - | | o o + .+.E . | | ||
| - | |. o o .. .. + | | ||
| - | | . ..+ S. . . | | ||
| - | | . oo.=o . o | | ||
| - | | . o+..o + | | ||
| - | | . . . . | | ||
| | | | | | | ||
| + | | | | ||
| + | | . | | ||
| + | | . o . | | ||
| + | | . . S . * . | | ||
| + | | ..+ + +o+=.o o| | ||
| + | | . o*o Bo.o B +B| | ||
| + | | oo +o.o. . *+@| | ||
| + | | .. ... OE| | ||
| +----[SHA256]-----+ | +----[SHA256]-----+ | ||
| - | trainee@ansible:~$ ssh-keygen -t ed25519 | + | [trainee@centos8 |
| Generating public/ | Generating public/ | ||
| Enter file in which to save the key (/ | Enter file in which to save the key (/ | ||
| Ligne 317: | Ligne 257: | ||
| Your public key has been saved in / | Your public key has been saved in / | ||
| The key fingerprint is: | The key fingerprint is: | ||
| - | SHA256:HGNyqw1PwiaV9LOHg2oYFNasG8T67jTKdv+Hw/ | + | SHA256:nLP4esR7UmNsc6dAqmDUufS8ORxCCI+LpaE04sXAwZw |
| The key's randomart image is: | The key's randomart image is: | ||
| +--[ED25519 256]--+ | +--[ED25519 256]--+ | ||
| - | | .oo | + | |+.o | |
| - | | .o.o. o | | + | | E. | |
| - | | o.. + B | + | | o+ o . | |
| - | |..o o * B | | + | |oooo+ =. .. |
| - | | ..o. * S . | | + | |==oo o =S+ | |
| - | | oo + B o | | + | |+.. o o.BoO . . | |
| - | | .+ o o +. | | + | | |
| - | |.+.+ =...o | | + | | ..O . . | |
| - | |ooo ..o.+E=. | | + | | .o.+ |
| +----[SHA256]-----+ | +----[SHA256]-----+ | ||
| </ | </ | ||
| - | <WRAP center round important | + | <WRAP center round important> |
| **Important** - Les clés générées seront placées dans le répertoire **~/ | **Important** - Les clés générées seront placées dans le répertoire **~/ | ||
| </ | </ | ||
| Ligne 339: | Ligne 279: | ||
| < | < | ||
| - | trainee@ansible:~$ cat .ssh/ | + | [trainee@centos8 |
| - | trainee@ansible:~$ cat .ssh/ | + | [trainee@centos8 |
| - | trainee@ansible:~$ cat .ssh/ | + | [trainee@centos8 |
| - | trainee@ansible:~$ cat .ssh/ | + | [trainee@centos8 |
| - | ssh-rsa | + | ssh-rsa |
| - | ecdsa-sha2-nistp256 | + | ecdsa-sha2-nistp256 |
| - | ssh-ed25519 | + | ssh-ed25519 |
| </ | </ | ||
| - | Il convient maintenant de se connecter sur la machine **TargetA** en utilisant ssh et de vérifier la présence du répertoire ~/ | + | Il convient maintenant de se connecter sur la machine **targeta** en utilisant ssh et de créer le répertoire ~/.ssh : |
| - | + | ||
| - | En saisissant cette commande, vous obtiendrez une fenêtre similaire à celle-ci | + | |
| < | < | ||
| - | trainee@ansible:~$ ssh -l trainee | + | [trainee@centos8 |
| - | The authenticity of host 'targeta.i2tch.loc (10.0.2.10)' can't be established. | + | The authenticity of host '10.0.2.52 (10.0.2.52)' can't be established. |
| ECDSA key fingerprint is SHA256: | ECDSA key fingerprint is SHA256: | ||
| - | Are you sure you want to continue connecting (yes/no)? yes | + | Are you sure you want to continue connecting (yes/no/ |
| - | Warning: Permanently added 'targeta.i2tch.loc, | + | Warning: Permanently added ' |
| Debian GNU/Linux 9 | Debian GNU/Linux 9 | ||
| - | trainee@targeta.i2tch.loc's password: | + | trainee@10.0.2.52's password: |
| Linux targeta.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | Linux targeta.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
| Ligne 368: | Ligne 306: | ||
| Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
| permitted by applicable law. | permitted by applicable law. | ||
| - | Last login: | + | Last login: |
| - | trainee@targeta: | + | |
| - | drwx------ | + | trainee@targeta: |
| + | drwx------ | ||
| trainee@targeta: | trainee@targeta: | ||
| déconnexion | déconnexion | ||
| - | Connection to targeta.i2tch.loc closed. | + | Connection to 10.0.2.52 closed. |
| </ | </ | ||
| - | <WRAP center round important | + | <WRAP center round important> |
| - | **Important** | + | **Important** |
| </ | </ | ||
| - | <WRAP center round important | + | <WRAP center round important> |
| - | **Important** | + | **Important** |
| </ | </ | ||
| - | Ensuite, il convient de transférer le fichier **.ssh/ | + | Ensuite, il convient de transférer le fichier **.ssh/ |
| < | < | ||
| - | trainee@ansible:~$ scp .ssh/ | + | [trainee@centos8 |
| Debian GNU/Linux 9 | Debian GNU/Linux 9 | ||
| - | trainee@targeta.i2tch.loc's password: trainee | + | trainee@10.0.2.52's password: trainee |
| - | authorized_keys | + | authorized_keys |
| </ | </ | ||
| - | <WRAP center round important | + | <WRAP center round important> |
| **Important** : Notez que le mot de passe **trainee** ne sera pas en clair. | **Important** : Notez que le mot de passe **trainee** ne sera pas en clair. | ||
| </ | </ | ||
| - | Connectez-vous via ssh de la machine **Ansible** à la machine **TargetA** : | + | Connectez-vous via ssh de la machine **centos8** à la machine **targeta** : |
| < | < | ||
| - | trainee@ansible:~$ ssh -l trainee | + | [trainee@centos8 |
| Debian GNU/Linux 9 | Debian GNU/Linux 9 | ||
| Linux targeta.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | Linux targeta.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
| Ligne 410: | Ligne 350: | ||
| Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
| permitted by applicable law. | permitted by applicable law. | ||
| - | Last login: | + | Last login: |
| trainee@targeta: | trainee@targeta: | ||
| - | trainee@targeta: | ||
| - | déconnexion | ||
| - | Connection to targeta.i2tch.loc closed. | ||
| </ | </ | ||
| - | <WRAP center round important | + | <WRAP center round important> |
| **Important** : Notez que l' | **Important** : Notez que l' | ||
| </ | </ | ||
| - | ====sudo==== | + | ====2.2 - sudo==== |
| La commande **sudo** permet à un utilisateur autorisé d' | La commande **sudo** permet à un utilisateur autorisé d' | ||
| Ligne 428: | Ligne 365: | ||
| < | < | ||
| + | trainee@targeta: | ||
| + | Mot de passe : fenestros | ||
| root@targeta: | root@targeta: | ||
| # | # | ||
| Ligne 437: | Ligne 376: | ||
| # See the man page for details on how to write a sudoers file. | # See the man page for details on how to write a sudoers file. | ||
| # | # | ||
| - | Defaults env_reset | + | Defaults |
| - | Defaults mail_badpass | + | Defaults |
| - | Defaults secure_path="/ | + | Defaults |
| # Host alias specification | # Host alias specification | ||
| Ligne 448: | Ligne 387: | ||
| # User privilege specification | # User privilege specification | ||
| - | root ALL=(ALL: | + | root ALL=(ALL: |
| # Allow members of group sudo to execute any command | # Allow members of group sudo to execute any command | ||
| - | %sudo ALL=(ALL: | + | %sudo |
| # See sudoers(5) for more information on "# | # See sudoers(5) for more information on "# | ||
| Ligne 458: | Ligne 397: | ||
| </ | </ | ||
| - | <WRAP center round important | + | <WRAP center round important> |
| **Important** : Notez la présence de la ligne **%sudo ALL=(ALL) ALL**. Cette ligne possède le format **Qui Où = (En tant que qui) Quoi**. La ligne implique donc que les membres du groupe **sudo** peuvent exécuter à partir de n' | **Important** : Notez la présence de la ligne **%sudo ALL=(ALL) ALL**. Cette ligne possède le format **Qui Où = (En tant que qui) Quoi**. La ligne implique donc que les membres du groupe **sudo** peuvent exécuter à partir de n' | ||
| </ | </ | ||
| - | Créez | + | Vérifez |
| < | < | ||
| - | root@targeta: | + | root@targeta: |
| - | root@targeta: | + | trainee ALL=(ALL) |
| - | trainee ALL=(ALL) | + | root@targeta: |
| - | root@targeta: | + | -r--r----- 1 root root 31 janv. 29 2019 / |
| - | root@targeta:~# mv ansible_users | + | |
| - | root@targeta: | + | |
| </ | </ | ||
| Ligne 479: | Ligne 416: | ||
| root@targeta: | root@targeta: | ||
| déconnexion | déconnexion | ||
| - | trainee@targeta: | + | trainee@targeta: |
| + | déconnexion | ||
| + | Connection to 10.0.2.52 closed. | ||
| + | [trainee@centos8 ~]$ | ||
| </ | </ | ||
| - | <WRAP center round important | + | <WRAP center round important> |
| **Important** : Notez que trainee a pu exécuter la commande **su -** via sudo sans saisir son mot de passe. | **Important** : Notez que trainee a pu exécuter la commande **su -** via sudo sans saisir son mot de passe. | ||
| </ | </ | ||
| ----- | ----- | ||
| - | < | + | Copyright © 2023 Hugh Norris. |
| - | <div align=" | + | |
| - | Copyright © 2020 Hugh NORRIS. | + | |
| - | </ | + | |
| - | </ | + | |