Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
elearning:workbooks:redhat:rh124:l111 [2024/09/25 08:05] – created adminelearning:workbooks:redhat:rh124:l111 [2024/09/26 13:19] (Version actuelle) admin
Ligne 5: Ligne 5:
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
  
-======LCF513 - Gestion du Réseau======+======RH12412 - Gestion des Services et des Démons======
  
 =====Contenu du Module===== =====Contenu du Module=====
  
-  * **LCF513 - Gestion du Réseau**+  * **RH12412 - Gestion des Services et des Démons**
     * Contenu du Module     * Contenu du Module
-    * Présentation +    * Systemd 
-      * La Commande nmcli +      * LAB #1 - La Commande systemctl 
-    * LAB #- Configuration du Réseau +      * LAB #Fichiers de Configuration 
-      1.1 - Connections et Profils +        2.1 - Fichiers de Configuration par Défaut 
-      1.2 - Résolution des Noms  +        2.2 - Surchargement des Fichiers de Configuration par Défaut 
-      * 1.- Ajouter une Deuxième Adresse IP à un Profil +      * LAB #3 - La Commande systemd-analyze 
-      * 1.4 - La Commande hostname +      * LAB #Les Cibles Systemd 
-      * 1.5 La Commande ip +        4.1 - Contrôler les dépendances d'une Cible 
-      * 1.6 - Activer/Désactiver une Interface Manuellement +        4.2 - La Cible par Défaut 
-      * 1.7 - Routage Statique +      * LAB #Gestion des Services 
-        * La commande ip +        5.1 - Gestion des Instances Uniques 
-        * Activer/désactiver le routage sur le serveur +        5.2 - Gestion d'Instances Multiples 
-    * LAB #Diagnostique du Réseau +        5.3 - Interdire la Modification du Statut d'un Service
-      2.1 - ping +
-      2.2 - netstat -i +
-      * 2.3 - traceroute +
-    * LAB #Connexions à Distance +
-      3.1 - Telnet +
-      3.2 - wget +
-      3.3 - ftp +
-      * 3.4 - SSH +
-        * Présentation +
-          * SSH-1 +
-          * SSH-2 +
-        * Authentification par mot de passe +
-        * Authentification par clef asymétrique +
-        * Configuration du Serveur +
-        * Configuration du Client +
-        * Tunnels SSH +
-      * 3.5 - SCP +
-        * Présentation +
-        * Utilisation +
-      * 3.6 - Mise en Place des Clefs Asymétriques+
  
-=====Présentation=====+=====Systemd=====
  
-RHEL/CentOS 8 utilise **Network Manager** pour gérer le réseau. Network Manager est composé de deux éléments :+Les systèmes de démarrage antérieurs à Systemd, **SysVinit** et **Upstart**, étaient des systèmes de démarrage **séquentiels**. 
  
-  * un service qui gère les connexions réseaux et rapporte leurs états, +**Systemd** essaie, par contre, de démarrer autant de services en parallèle que possible. Ceci est rendu possible car la majorité d'architectures matérielles modernes sont multi-cœurs. Si un service dépend d'un autre qui n'est pas encore démarré ce premier est mis en attente dans une mémoire tampon. Qui plus est, les services qui ne sont pas nécessaires au démarrage de la machine, tel cups, ne sont démarrés ultérieurement que si nécessaire. Lors de démarrage, les partitions sont montées en parallèle. Dernièrement, **Systemd** remplace les scripts de démarrage traditionnels avec des binaires compilés, beaucoup plus rapides que leur prédécesseurs.
-  des front-ends qui passent par un API de configuration du service.+
  
-<WRAP center round important 60%> +Au lieu de parler de scripts de démarrage et de niveaux d'exécution, **Systemd** utilise la terminologie **Unités** (//Units//) et **Cibles** (//Targets//). Une Unité peut être :
-**Important** : Notez qu'avec cette version de NetworkManager, IPv6 est activée par défaut. +
-</WRAP>+
  
-Le service NetworkManager doit toujours être lancé :+  * **.automount** - active la fonctionalité d'automount. 
 +  * **.device** - expose une périphérique dans systemd. 
 +  * **.mount** - contrôle quand et comment les systèmes de fichiers sont montés. 
 +  * **.path** - active un service quand il y a un accès à un fichier ou répertoire sous surveillance par le système. 
 +  * **.service** - démarre, arrête, redémarre ou recharge un service. 
 +  * **.scope** - gère des services. 
 +  * **.slice** - regroupe des Unités dans une arborescence afin de limiter des ressources en utilisant des CGroups. 
 +  * **.snapshot** - un état sauvegardé du gestionnaire Systemd. 
 +  * **.socket** - permet aux Unités d'utiliser des sockets pour la communication inter-processus. 
 +  * **.swap** - encapsule une périphérique ou un fichier swap. 
 +  * **.timer** - déclenche l'activation d'autres Unités en utilisant des minuteurs de Systemd. 
 +  * **.target** - regroupe des Unités multiples afin qu'elles puissent être démarrées en même temps. Par exemple **network.target** regroupe toutes les Unités nécessaires pour démarrer toutes les interfaces réseaux en même temps.
  
-<code> +Une Cible est en quelque sorte une **grande étape** dans le démarrage du système :
-[root@centos8 ~]# systemctl status NetworkManager.service +
-● NetworkManager.service - Network Manager +
-   Loadedloaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor pr> +
-   Active: active (running) since Thu 2021-07-22 05:05:29 EDT; 1 months 7 days ago +
-     Docs: man:NetworkManager(8) +
- Main PID: 1002 (NetworkManager) +
-    Tasks: 3 (limit: 23535) +
-   Memory: 6.8M +
-   CGroup: /system.slice/NetworkManager.service +
-           └─1002 /usr/sbin/NetworkManager --no-daemon+
  
-Warning: Journal has been rotated since unit was startedLog output is incomplete or> +  * **halt.target** - arrête le système
-lines 1-11/11 (END+  * **poweroff.target** arrête le système et coupe le courant. 
-[^q] +  * **shutdown.target** - arrête le système. 
-</code>+  * **rescue.target** - démarre le système en mode single-user (seul root peut s'y connecter). Tous les systèmes de fichiers sont montés mais le réseau n'est pas démarré. 
 +  * **emergency.target** - démarre le système en mode single-user (seul root peut s'y connecter). Uniquement le système de fichiers racine est monté en mode lecture seule. Le réseau n'est pas démarré. 
 +  * **multi-user.target** - démarre le système en mode multi-utilisateur avec tous les systèmes de fichiers montés et le service network démarré. 
 +  * **graphical.target** - démarre le système en multi-user.target puis démarre l'interface graphique. 
 +  * **hibernate.target** - sauvegarde l'état courant sur disque et arrête le système. Quand le système est démarré, l'état est restauré. 
 +  * **reboot.target** - redémarre le système.
  
-===La Commande nmcli=== +**Systemd** utilise des Cibles d'une manière similaire à ce que **SysVinit** utilise des niveaux d'exécutionPour rendre la transition plus facile, il existe des **Cibles** qui "simulent" les niveaux d'exécution de **SysVinit** :
- +
-La commande **nmcli** (Network Manager Command Line Interface) est utilisée pour configurer NetworkManager. +
- +
-Les options et les sous-commandes peuvent être consultées en utilisant les commandes suivantes :+
  
 <code> <code>
-[root@centos8 ~]# nmcli help +[root@redhat9 ~]# ls -l /usr/lib/systemd/system/runlevel* 
-Usagenmcli [OPTIONS] OBJECT { COMMAND | help }+lrwxrwxrwx. 1 root root 15 Jul 18 13:00 /usr/lib/systemd/system/runlevel0.target -> poweroff.target 
 +lrwxrwxrwx. 1 root root 13 Jul 18 13:00 /usr/lib/systemd/system/runlevel1.target -> rescue.target 
 +lrwxrwxrwx. 1 root root 17 Jul 18 13:00 /usr/lib/systemd/system/runlevel2.target -> multi-user.target 
 +lrwxrwxrwx. 1 root root 17 Jul 18 13:00 /usr/lib/systemd/system/runlevel3.target -> multi-user.target 
 +lrwxrwxrwx. 1 root root 17 Jul 18 13:00 /usr/lib/systemd/system/runlevel4.target -> multi-user.target 
 +lrwxrwxrwx. 1 root root 16 Jul 18 13:00 /usr/lib/systemd/system/runlevel5.target -> graphical.target 
 +lrwxrwxrwx. 1 root root 13 Jul 18 13:00 /usr/lib/systemd/system/runlevel6.target -> reboot.target
  
-OPTIONS +/usr/lib/systemd/system/runlevel1.target.wants: 
-  -a, --ask                                ask for missing parameters +total 0
-  -c, --colors auto|yes|no                 whether to use colors in output +
-  -e, --escape yes|no                      escape columns separators in values +
-  -f, --fields <field,...>|all|common      specify fields to output +
-  -g, --get-values <field,...>|all|common  shortcut for -m tabular -t -f +
-  -h, --help                               print this help +
-  -m, --mode tabular|multiline             output mode +
-  -o, --overview                           overview mode +
-  -p, --pretty                             pretty output +
-  -s, --show-secrets                       allow displaying passwords +
-  -t, --terse                              terse output +
-  -v, --version                            show program version +
-  -w, --wait <seconds>                     set timeout waiting for finishing operations+
  
-OBJECT +/usr/lib/systemd/system/runlevel2.target.wants: 
-  g[eneral]       NetworkManager's general status and operations +total 0
-  n[etworking]    overall networking control +
-  r[adio]         NetworkManager radio switches +
-  c[onnection]    NetworkManager's connections +
-  d[evice]        devices managed by NetworkManager +
-  a[gent]         NetworkManager secret agent or polkit agent +
-  m[onitor]       monitor NetworkManager changes +
-</code>+
  
-=====LAB #1 - Configuration du Réseau=====+/usr/lib/systemd/system/runlevel3.target.wants: 
 +total 0
  
-====1.1 - Connections et Profils====+/usr/lib/systemd/system/runlevel4.target.wants: 
 +total 0
  
-NetworkManager inclus la notion de **connections** ou **profils** permettant des configurations différentes en fonction de la localisationPour voir les connections actuelles, utilisez la commande **nmcli c** avec la sous-commande **show** +/usr/lib/systemd/system/runlevel5.target.wants
- +total 0
-<code> +
-[root@centos8 ~]# nmcli c show +
-NAME    UUID                                  TYPE      DEVICE  +
-ens18   fc4a4d23-b15e-47a7-bcfa-b2e08f49553e  ethernet  ens18   +
-virbr0  03f6c432-2a09-47e7-9693-208431a572ee  bridge    virbr0 +
 </code> </code>
  
-Créez donc un profil IP fixe rattaché au périphérique **ens18** :+====LAB #1 - La Commande systemctl====
  
-<code> +Pour visualiser la liste des Unités, il convient d'utiliser la commande **systemctl** avec l'option **list-units** :
-[root@centos8 ~]# nmcli connection add con-name ip_fixe ifname ens18 type ethernet ip4 10.0.2.46/24 gw4 10.0.2.1 +
-Connection 'ip_fixe(0f48c74d-5d16-4c37-8220-24644507b589) successfully added. +
-</code> +
- +
-Constatez sa présence :+
  
 <code> <code>
-[root@centos8 ~]# nmcli c show +[root@redhat9 ~]# systemctl list-units 
-NAME     UUID                                  TYPE      DEVICE  +  UNIT                                                                                                     LOAD   ACTIVE SUB       DESCRIPTION                                > 
-ens18    fc4a4d23-b15e-47a7-bcfa-b2e08f49553e  ethernet  ens18   +  proc-sys-fs-binfmt_misc.automount                                                                        loaded active running   Arbitrary Executable File Formats File Syst> 
-virbr0   03f6c432-2a09-47e7-9693-208431a572ee  bridge    virbr0  +  sys-devices-pci0000:00-0000:00:01.1-ata2-host2-target2:0:0-2:0:0:0-block-sr0.device                      loaded active plugged   QEMU_DVD-ROM 
-ip_fixe  0f48c74d-5d16-4c37-8220-24644507b589  ethernet  --   +  sys-devices-pci0000:00-0000:00:05.0-0000:01:01.0-virtio2-host0-target0:0:0-0:0:0:0-block-sda-sda1.device loaded active plugged   QEMU_HARDDISK 1 
 +  sys-devices-pci0000:00-0000:00:05.0-0000:01:01.0-virtio2-host0-target0:0:0-0:0:0:0-block-sda-sda2.device loaded active plugged   QEMU_HARDDISK 2 
 +  sys-devices-pci0000:00-0000:00:05.0-0000:01:01.0-virtio2-host0-target0:0:0-0:0:0:0-block-sda.device      loaded active plugged   QEMU_HARDDISK 
 +  sys-devices-pci0000:00-0000:00:12.0-virtio1-net-ens18.device                                             loaded active plugged   Virtio network device 
 +  sys-devices-platform-serial8250-tty-ttyS0.device                                                         loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS0 
 +  sys-devices-platform-serial8250-tty-ttyS1.device                                                         loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS1 
 +  sys-devices-platform-serial8250-tty-ttyS2.device                                                         loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS2 
 +  sys-devices-platform-serial8250-tty-ttyS3.device                                                         loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS3 
 +  sys-devices-virtual-block-dm\x2d0.device                                                                 loaded active plugged   /sys/devices/virtual/block/dm-0 
 +  sys-devices-virtual-block-dm\x2d1.device                                                                 loaded active plugged   /sys/devices/virtual/block/dm-1 
 +  sys-devices-virtual-misc-rfkill.device                                                                   loaded active plugged   /sys/devices/virtual/misc/rfkill 
 +  sys-module-configfs.device                                                                               loaded active plugged   /sys/module/configfs 
 +  sys-module-fuse.device                                                                                   loaded active plugged   /sys/module/fuse 
 +  sys-subsystem-net-devices-ens18.device                                                                   loaded active plugged   Virtio network device                      > 
 +  -.mount                                                                                                  loaded active mounted   Root Mount 
 +  boot.mount                                                                                               loaded active mounted   /boot 
 +  dev-hugepages.mount                                                                                      loaded active mounted   Huge Pages File System 
 +  dev-mqueue.mount                                                                                         loaded active mounted   POSIX Message Queue File System 
 +  proc-sys-fs-binfmt_misc.mount                                                                            loaded active mounted   Arbitrary Executable File Formats File Syst> 
 +  run-credentials-systemd\x2dsysctl.service.mount                                                          loaded active mounted   /run/credentials/systemd-sysctl.service 
 +  run-credentials-systemd\x2dtmpfiles\x2dsetup.service.mount                                               loaded active mounted   /run/credentials/systemd-tmpfiles-setup.ser> 
 +  run-credentials-systemd\x2dtmpfiles\x2dsetup\x2ddev.service.mount                                        loaded active mounted   /run/credentials/systemd-tmpfiles-setup-dev> 
 +  run-user-1000.mount                                                                                      loaded active mounted   /run/user/1000 
 +  run-user-42.mount                                                                                        loaded active mounted   /run/user/42 
 +  sys-fs-fuse-connections.mount                                                                            loaded active mounted   FUSE Control File System 
 +  sys-kernel-config.mount                                                                                  loaded active mounted   Kernel Configuration File System 
 +  sys-kernel-debug-tracing.mount                                                                           loaded active mounted   /sys/kernel/debug/tracing 
 +  sys-kernel-debug.mount                                                                                   loaded active mounted   Kernel Debug File System 
 +  sys-kernel-tracing.mount                                                                                 loaded active mounted   Kernel Trace File System                   > 
 +  cups.path                                                                                                loaded active running   CUPS Scheduler 
 +  systemd-ask-password-plymouth.path                                                                       loaded active waiting   Forward Password Requests to Plymouth Direc> 
 +  systemd-ask-password-wall.path                                                                           loaded active waiting   Forward Password Requests to Wall Directory> 
 +  init.scope                                                                                               loaded active running   System and Service Manager 
 +  session-4.scope                                                                                          loaded active running   Session 4 of User trainee 
 +lines 1-37...skipping... 
 +  UNIT                                                                                                     LOAD   ACTIVE SUB       DESCRIPTION                                                                   
 +  proc-sys-fs-binfmt_misc.automount                                                                        loaded active running   Arbitrary Executable File Formats File System Automount Point                 
 +  sys-devices-pci0000:00-0000:00:01.1-ata2-host2-target2:0:0-2:0:0:0-block-sr0.device                      loaded active plugged   QEMU_DVD-ROM 
 +  sys-devices-pci0000:00-0000:00:05.0-0000:01:01.0-virtio2-host0-target0:0:0-0:0:0:0-block-sda-sda1.device loaded active plugged   QEMU_HARDDISK 1 
 +  sys-devices-pci0000:00-0000:00:05.0-0000:01:01.0-virtio2-host0-target0:0:0-0:0:0:0-block-sda-sda2.device loaded active plugged   QEMU_HARDDISK 2 
 +  sys-devices-pci0000:00-0000:00:05.0-0000:01:01.0-virtio2-host0-target0:0:0-0:0:0:0-block-sda.device      loaded active plugged   QEMU_HARDDISK 
 +  sys-devices-pci0000:00-0000:00:12.0-virtio1-net-ens18.device                                             loaded active plugged   Virtio network device 
 +  sys-devices-platform-serial8250-tty-ttyS0.device                                                         loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS0 
 +  sys-devices-platform-serial8250-tty-ttyS1.device                                                         loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS1 
 +  sys-devices-platform-serial8250-tty-ttyS2.device                                                         loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS2 
 +  sys-devices-platform-serial8250-tty-ttyS3.device                                                         loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS3 
 +  sys-devices-virtual-block-dm\x2d0.device                                                                 loaded active plugged   /sys/devices/virtual/block/dm-0 
 +  sys-devices-virtual-block-dm\x2d1.device                                                                 loaded active plugged   /sys/devices/virtual/block/dm-1 
 +  sys-devices-virtual-misc-rfkill.device                                                                   loaded active plugged   /sys/devices/virtual/misc/rfkill 
 +  sys-module-configfs.device                                                                               loaded active plugged   /sys/module/configfs 
 +  sys-module-fuse.device                                                                                   loaded active plugged   /sys/module/fuse 
 +  sys-subsystem-net-devices-ens18.device                                                                   loaded active plugged   Virtio network device                                                         
 +  -.mount                                                                                                  loaded active mounted   Root Mount 
 +  boot.mount                                                                                               loaded active mounted   /boot 
 +  dev-hugepages.mount                                                                                      loaded active mounted   Huge Pages File System 
 +  dev-mqueue.mount                                                                                         loaded active mounted   POSIX Message Queue File System 
 +  proc-sys-fs-binfmt_misc.mount                                                                            loaded active mounted   Arbitrary Executable File Formats File System 
 +  run-credentials-systemd\x2dsysctl.service.mount                                                          loaded active mounted   /run/credentials/systemd-sysctl.service 
 +  run-credentials-systemd\x2dtmpfiles\x2dsetup.service.mount                                               loaded active mounted   /run/credentials/systemd-tmpfiles-setup.service 
 +  run-credentials-systemd\x2dtmpfiles\x2dsetup\x2ddev.service.mount                                        loaded active mounted   /run/credentials/systemd-tmpfiles-setup-dev.service 
 +  run-user-1000.mount                                                                                      loaded active mounted   /run/user/1000 
 +  run-user-42.mount                                                                                        loaded active mounted   /run/user/42 
 +  sys-fs-fuse-connections.mount                                                                            loaded active mounted   FUSE Control File System 
 +  sys-kernel-config.mount                                                                                  loaded active mounted   Kernel Configuration File System 
 +  sys-kernel-debug-tracing.mount                                                                           loaded active mounted   /sys/kernel/debug/tracing 
 +  sys-kernel-debug.mount                                                                                   loaded active mounted   Kernel Debug File System 
 +  sys-kernel-tracing.mount                                                                                 loaded active mounted   Kernel Trace File System                                                      
 +  cups.path                                                                                                loaded active running   CUPS Scheduler 
 +  systemd-ask-password-plymouth.path                                                                       loaded active waiting   Forward Password Requests to Plymouth Directory Watch 
 +  systemd-ask-password-wall.path                                                                           loaded active waiting   Forward Password Requests to Wall Directory Watch                             
 +  init.scope                                                                                               loaded active running   System and Service Manager 
 +  session-4.scope                                                                                          loaded active running   Session 4 of User trainee 
 +  session-c1.scope                                                                                         loaded active running   Session c1 of User gdm                                                        
 +  accounts-daemon.service                                                                                  loaded active running   Accounts Service 
 +  atd.service                                                                                              loaded active running   Deferred execution scheduler 
 +  auditd.service                                                                                           loaded active running   Security Auditing Service 
 +  avahi-daemon.service                                                                                     loaded active running   Avahi mDNS/DNS-SD Stack 
 +  colord.service                                                                                           loaded active running   Manage, Install and Generate Color Profiles 
 +  crond.service                                                                                            loaded active running   Command Scheduler 
 +  cups.service                                                                                             loaded active running   CUPS Scheduler 
 +  dbus-broker.service                                                                                      loaded active running   D-Bus System Message Bus 
 +  dracut-shutdown.service                                                                                  loaded active exited    Restore /run/initramfs on shutdown 
 +  firewalld.service                                                                                        loaded active running   firewalld - dynamic firewall daemon 
 +  gdm.service                                                                                              loaded active running   GNOME Display Manager 
 +  irqbalance.service                                                                                       loaded active running   irqbalance daemon 
 +  iscsi.service                                                                                            loaded active exited    Login and scanning of iSCSI devices 
 +  kdump.service                                                                                            loaded active exited    Crash recovery kernel arming 
 +  kmod-static-nodes.service                                                                                loaded active exited    Create List of Static Device Nodes 
 +  libstoragemgmt.service                                                                                   loaded active running   libstoragemgmt plug-in server daemon 
 +  lvm2-monitor.service                                                                                     loaded active exited    Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling 
 +lines 1-55
 </code> </code>
  
-Notez que la sortie n'indique pas que le profil **ip_fixe** soit associé au periphérique **ens18** car le profil **ip_fixe** n'est pas activé :+Pour consulter la liste des Unités inactifs, utilisez la commande suivante :
  
 <code> <code>
-[root@centos8 ~]# nmcli d show +[root@redhat9 ~]# systemctl list-units --all | grep inactive | more 
-GENERAL.DEVICE:                         ens18 +● boot.automount                                                                                                 not-found inactive dead      boot.automount 
-GENERAL.TYPE:                           ethernet +● home.mount                                                                                                     not-found inactive dead      home.mount 
-GENERAL.HWADDR:                         4E:B1:31:BD:5D:B2 +● sysroot.mount                                                                                                  not-found inactive dead      sysroot.mount 
-GENERAL.MTU:                            1500 +  tmp.mount                                                                                                      loaded    inactive dead      Temporary Directory /tmp 
-GENERAL.STATE:                          100 (connected) +● var.mount                                                                                                      not-found inactive dead      var.mount 
-GENERAL.CONNECTION:                     ens18 +  systemd-ask-password-console.path                                                                              loaded    inactive dead      Dispatch Password Requests to Console Directory Watch 
-GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnect> +  alsa-restore.service                                                                                           loaded    inactive dead      Save/Restore Sound Card State 
-WIRED-PROPERTIES.CARRIER:               on +  alsa-state.service                                                                                             loaded    inactive dead      Manage Sound Card State (restore and store) 
-IP4.ADDRESS[1]:                         10.0.2.45/24 +● auto-cpufreq.service                                                                                           not-found inactive dead      auto-cpufreq.service 
-IP4.GATEWAY:                            10.0.2.1 +● autofs.service                                                                                                 not-found inactive dead      autofs.service 
-IP4.ROUTE[1]:                           dst = 10.0.2.0/24, nh = 0.0.0.0, mt = 100 +  blk-availability.service                                                                                       loaded    inactive dead      Availability of block devices 
-IP4.ROUTE[2]:                           dst = 0.0.0.0/0, nh = 10.0.2.1, mt = 100 +  cpupower.service                                                                                               loaded    inactive dead      Configure CPU power related settings 
-IP4.DNS[1]:                             8.8.8.8 +  dm-event.service                                                                                               loaded    inactive dead      Device-mapper event daemon 
-IP6.ADDRESS[1]:                         fe80::86b6:8d39:cab2:d84d/64 +  dnf-makecache.service                                                                                          loaded    inactive dead      dnf makecache 
-IP6.GATEWAY:                            -- +  dracut-cmdline.service                                                                                         loaded    inactive dead      dracut cmdline hook 
-IP6.ROUTE[1]:                           dst = fe80::/64, nh = ::, mt = 100 +  dracut-initqueue.service                                                                                       loaded    inactive dead      dracut initqueue hook 
-IP6.ROUTE[2]:                           dst = ff00::/8, nh = ::, mt = 256, table=255 +  dracut-mount.service                                                                                           loaded    inactive dead      dracut mount hook 
- +  dracut-pre-mount.service                                                                                       loaded    inactive dead      dracut pre-mount hook 
-GENERAL.DEVICE:                         virbr0 +  dracut-pre-pivot.service                                                                                       loaded    inactive dead      dracut pre-pivot and cleanup hook 
-GENERAL.TYPE:                           bridge +  dracut-pre-trigger.service                                                                                     loaded    inactive dead      dracut pre-trigger hook 
-GENERAL.HWADDR:                         52:54:00:79:02:66 +  dracut-pre-udev.service                                                                                        loaded    inactive dead      dracut pre-udev hook 
-GENERAL.MTU:                            1500 +  dracut-shutdown-onfailure.service                                                                              loaded    inactive dead      Service executing upon dracut-shutdown failure to perform cleanup 
-GENERAL.STATE:                          100 (connected (externally)) +● ebtables.service                                                                                               not-found inactive dead      ebtables.service 
-GENERAL.CONNECTION:                     virbr0 +  emergency.service                                                                                              loaded    inactive dead      Emergency Shell 
-GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnect> +● fcoe.service                                                                                                   not-found inactive dead      fcoe.service 
-IP4.ADDRESS[1]:                         192.168.122.1/24 +  getty@tty1.service                                                                                             loaded    inactive dead      Getty on tty1 
-IP4.GATEWAY:                            -- +  initrd-cleanup.service                                                                                         loaded    inactive dead      Cleaning Up and Shutting Down Daemons 
-IP4.ROUTE[1]:                           dst = 192.168.122.0/24, nh = 0.0.0.0, mt = 0 +  initrd-parse-etc.service                                                                                       loaded    inactive dead      Mountpoints Configured in the Real Root 
-IP6.GATEWAY:                            -+  initrd-switch-root.service                                                                                     loaded    inactive dead      Switch Root 
- +  initrd-udevadm-cleanup-db.service                                                                              loaded    inactive dead      Cleanup udev Database 
-GENERAL.DEVICE:                         lo +  insights-client-boot.service                                                                                   loaded    inactive dead      Run Insights Client at boot 
-GENERAL.TYPE:                           loopback +● ip6tables.service                                                                                              not-found inactive dead      ip6tables.service 
-GENERAL.HWADDR:                         00:00:00:00:00:00 +● ipset.service                                                                                                  not-found inactive dead      ipset.service 
-GENERAL.MTU:                            65536 +● iptables.service                                                                                               not-found inactive dead      iptables.service 
-GENERAL.STATE:                          10 (unmanaged) +  iscsi-init.service                                                                                             loaded    inactive dead      One time configuration for iscsi.service 
-GENERAL.CONNECTION:                     -+  iscsi-onboot.service                                                                                           loaded    inactive dead      Special handling of early boot iSCSI sessions 
-GENERAL.CON-PATH:                       -+  iscsi-shutdown.service                                                                                         loaded    inactive dead      Logout off all iSCSI sessions on shutdown 
-IP4.ADDRESS[1]:                         127.0.0.1/8 +  iscsi-starter.service                                                                                          loaded    inactive dead      iscsi-starter.service 
-IP4.GATEWAY:                            -- +  iscsid.service                                                                                                 loaded    inactive dead      Open-iSCSI 
-IP6.ADDRESS[1]:                         ::1/128 +  iscsiuio.service                                                                                               loaded    inactive dead      iSCSI UserSpace I/O driver 
-IP6.GATEWAY:                            -- +  ldconfig.service                                                                                               loaded    inactive dead      Rebuild Dynamic Linker Cache 
-IP6.ROUTE[1]:                           dst = ::1/128, nh = ::, mt = 256 +  logrotate.service                                                                                              loaded    inactive dead      Rotate log files 
- +  low-memory-monitor.service                                                                                     loaded    inactive dead      Low Memory Monitor 
-GENERAL.DEVICE:                         virbr0-nic +● lvm2-activation-early.service                                                                                  not-found inactive dead      lvm2-activation-early.service 
-GENERAL.TYPE:                           tun +  lvm2-lvmpolld.service                                                                                          loaded    inactive dead      LVM2 poll daemon 
-GENERAL.HWADDR:                         52:54:00:79:02:66 +  mdmonitor.service                                                                                              loaded    inactive dead      Software RAID monitoring and management 
-GENERAL.MTU:                            1500 +  microcode.service                                                                                              loaded    inactive dead      Load CPU microcode update 
-GENERAL.STATE:                          10 (unmanaged) +  mlocate-updatedb.service                                                                                       loaded    inactive dead      Update a database for mlocate 
-GENERAL.CONNECTION:                     -+  modprobe@configfs.service                                                                                      loaded    inactive dead      Load Kernel Module configfs 
-GENERAL.CON-PATH:                       -- +  modprobe@drm.service                                                                                           loaded    inactive dead      Load Kernel Module drm 
-lines 28-50/50 (END)+  modprobe@fuse.service                                                                                          loaded    inactive dead      Load Kernel Module fuse 
 +  multipathd.service                                                                                             loaded    inactive dead      Device-Mapper Multipath Device Controller 
 +● network.service                                                                                                not-found inactive dead      network.service 
 +  nftables.service                                                                                               loaded    inactive dead      Netfilter Tables 
 +● nslcd.service                                                                                                  not-found inactive dead      nslcd.service 
 +--More--
 [q] [q]
 </code> </code>
  
-Pour activer le profil ip_fixeutilisez la commande suivante :+Les points noirs au début de certaines lignes dans la sortie ci-dessus sont en réalité des points blancs à l'écran. Ces points impliquent que le service, la cible ou l'unité spécifié n'a pas été trouvé sur le système. Par exemple :
  
 <code> <code>
-[root@centos8 ~]# nmcli connection up ip_fixe +[root@redhat9 ~]# systemctl status network 
 +Unit network.service could not be found.
 </code> </code>
  
-Notez que votre terminal est bloqué à cause du changement de l'adresse IP.  +Pour consulter la liste des Unités ainsi que leurs statuts, utilisez la commande suivante :
- +
-<WRAP center round todo 60%> +
-**A faire** - Revenez à l'accueil du cloud IT Training et re-connectez-vous à la VM en tant que trainee en utilisant la connexion **CentOS8_SSH_10.0.2.46**. +
-</WRAP> +
- +
-Le profil ip_fixe est maintenant activé tandis que le profil enp0s3 a été désactivé :+
  
 <code> <code>
-[root@centos8 ~]# nmcli c show +[root@redhat9 ~]# systemctl list-unit-files | more 
-NAME     UUID                                  TYPE      DEVICE  +UNIT FILE                                  STATE           PRESET 
-ip_fixe  0f48c74d-5d16-4c37-8220-24644507b589  ethernet  ens18   +proc-sys-fs-binfmt_misc.automount          static          
-virbr0   03f6c432-2a09-47e7-9693-208431a572ee  bridge    virbr0  +-.mount                                    generated       - 
-ens18    fc4a4d23-b15e-47a7-bcfa-b2e08f49553e  ethernet  --   +boot.mount                                 generated       - 
-    +dev-hugepages.mount                        static          
-[root@centos8 ~]# nmcli d show +dev-mqueue.mount                           static          - 
-GENERAL.DEVICE:                         ens18 +proc-sys-fs-binfmt_misc.mount              disabled        disabled 
-GENERAL.TYPE:                           ethernet +run-vmblock\x2dfuse.mount                  disabled        disabled 
-GENERAL.HWADDR:                         4E:B1:31:BD:5D:B2 +sys-fs-fuse-connections.mount              static          - 
-GENERAL.MTU:                            1500 +sys-kernel-config.mount                    static          - 
-GENERAL.STATE:                          100 (connected) +sys-kernel-debug.mount                     static          - 
-GENERAL.CONNECTION:                     ip_fixe +sys-kernel-tracing.mount                   static          - 
-GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnect> +tmp.mount                                  disabled        disabled 
-WIRED-PROPERTIES.CARRIER:               on +cups.path                                  enabled         enabled 
-IP4.ADDRESS[1]:                         10.0.2.46/24 +insights-client-results.path               disabled        disabled 
-IP4.GATEWAY:                            10.0.2.1 +ostree-finalize-staged.path                disabled        disabled 
-IP4.ROUTE[1]:                           dst = 10.0.2.0/24, nh = 0.0.0.0, mt = 100 +systemd-ask-password-console.path          static          
-IP4.ROUTE[2]:                           dst = 0.0.0.0/0, nh = 10.0.2.1, mt = 100 +systemd-ask-password-plymouth.path         static          - 
-IP6.ADDRESS[1]:                         fe80::5223:aee1:998e:9f27/64 +systemd-ask-password-wall.path             static          - 
-IP6.GATEWAY:                            -+session-4.scope                            transient       - 
-IP6.ROUTE[1]:                           dst = fe80::/64, nh = ::, mt = 100 +session-c1.scope                           transient       - 
-IP6.ROUTE[2]:                           dst = ff00::/8, nh = ::, mt = 256, table=255 +accounts-daemon.service                    enabled         enabled 
- +alsa-restore.service                       static          - 
-GENERAL.DEVICE:                         virbr0 +alsa-state.service                         static          - 
-GENERAL.TYPE:                           bridge +arp-ethers.service                         disabled        disabled 
-GENERAL.HWADDR:                         52:54:00:79:02:66 +atd.service                                enabled         enabled 
-GENERAL.MTU:                            1500 +auditd.service                             enabled         enabled 
-GENERAL.STATE:                          100 (connected (externally)) +autovt@.service                            alias           - 
-GENERAL.CONNECTION:                     virbr0 +avahi-daemon.service                       enabled         enabled 
-GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnect> +blk-availability.service                   disabled        disabled 
-IP4.ADDRESS[1]:                         192.168.122.1/24 +bluetooth.service                          enabled         enabled 
-IP4.GATEWAY:                            -- +bolt.service                               static          - 
-IP4.ROUTE[1]:                           dst = 192.168.122.0/24, nh = 0.0.0.0, mt = 0 +brltty.service                             disabled        disabled 
-IP6.GATEWAY:                            -- +canberra-system-bootup.service             disabled        disabled 
- +canberra-system-shutdown-reboot.service    disabled        disabled 
-GENERAL.DEVICE:                         lo +canberra-system-shutdown.service           disabled        disabled 
-GENERAL.TYPE:                           loopback +chrony-wait.service                        disabled        disabled 
-GENERAL.HWADDR:                         00:00:00:00:00:00 +chronyd-restricted.service                 disabled        disabled 
-GENERAL.MTU:                            65536 +chronyd.service                            disabled        enabled 
-GENERAL.STATE:                          10 (unmanaged) +cni-dhcp.service                           disabled        disabled 
-GENERAL.CONNECTION:                     -- +cockpit-motd.service                       static          - 
-GENERAL.CON-PATH:                       -- +cockpit-wsinstance-http.service            static          - 
-IP4.ADDRESS[1]:                         127.0.0.1/8 +cockpit-wsinstance-https-factory@.service  static          
-IP4.GATEWAY:                            -+cockpit-wsinstance-https@.service          static          - 
-IP6.ADDRESS[1]:                         ::1/128 +cockpit.service                            static          
-IP6.GATEWAY:                            -- +colord.service                             static          - 
-IP6.ROUTE[1]:                           dst = ::1/128, nh = ::, mt = 256 +configure-printer@.service                 static          - 
- +console-getty.service                      disabled        disabled 
-GENERAL.DEVICE:                         virbr0-nic +container-getty@.service                   static          
-GENERAL.TYPE:                           tun +cpupower.service                           disabled        disabled 
-GENERAL.HWADDR:                         52:54:00:79:02:66 +crond.service                              enabled         enabled 
-GENERAL.MTU:                            1500 +cups-browsed.service                       disabled        disabled 
-GENERAL.STATE:                          10 (unmanaged) +cups.service                               enabled         enabled 
-GENERAL.CONNECTION:                     -+dbus-broker.service                        enabled         enabled 
-GENERAL.CON-PATH:                       -- +dbus-daemon.service                        disabled        disabled 
-lines 27-49/49 (END)+--More--
 [q] [q]
 </code> </code>
  
-Pour consulter les paramètres du profil **ens18**, utilisez la commande suivante :+Pour visualiser les Unités d'un type spécifique, il convient d'utiliser l'option **-t** :
  
 <code> <code>
-[root@centos8 ~]# nmcli -p connection show ens18 +[root@redhat9 ~]# systemctl list-unit-files -t mount 
-=============================================================================== +UNIT FILE                     STATE     PRESET   
-                      Connection profile details (ens18) +-.mount                       generated        
-=============================================================================== +boot.mount                    generated        
-connection.id:                          ens18 +dev-hugepages.mount           static           
-connection.uuid:                        fc4a4d23-b15e-47a7-bcfa-b2e08f49553e +dev-mqueue.mount              static           
-connection.stable-id:                   -- +proc-sys-fs-binfmt_misc.mount disabled  disabled 
-connection.type:                        802-3-ethernet +run-vmblock\x2dfuse.mount     disabled  disabled 
-connection.interface-name:              ens18 +sys-fs-fuse-connections.mount static           
-connection.autoconnect:                 yes +sys-kernel-config.mount       static           
-connection.autoconnect-priority:        0 +sys-kernel-debug.mount        static           
-connection.autoconnect-retries:         -1 (default) +sys-kernel-tracing.mount      static           
-connection.multi-connect:               0 (default) +tmp.mount                     disabled  disabled 
-connection.auth-retries:                -1 + 
-connection.timestamp:                   1630224060 +11 unit files listed.
-connection.read-only:                   no +
-connection.permissions:                 -- +
-connection.zone:                        -- +
-connection.master:                      -- +
-connection.slave-type:                  -- +
-connection.autoconnect-slaves:          -1 (default) +
-connection.secondaries:                 -- +
-connection.gateway-ping-timeout:        0 +
-connection.metered:                     unknown +
-connection.lldp:                        default +
-connection.mdns:                        -1 (default) +
-connection.llmnr:                       -1 (default) +
-connection.wait-device-timeout:         -1 +
-------------------------------------------------------------------------------- +
-802-3-ethernet.port:                    -- +
-802-3-ethernet.speed:                   0 +
-802-3-ethernet.duplex:                  -+
-802-3-ethernet.auto-negotiate:          no +
-802-3-ethernet.mac-address:             -- +
-802-3-ethernet.cloned-mac-address:      -- +
-802-3-ethernet.generate-mac-address-mask:-- +
-802-3-ethernet.mac-address-blacklist:   -- +
-802-3-ethernet.mtu:                     auto +
-802-3-ethernet.s390-subchannels:        -+
-802-3-ethernet.s390-nettype:            -+
-802-3-ethernet.s390-options:            -- +
-802-3-ethernet.wake-on-lan:             default +
-802-3-ethernet.wake-on-lan-password:    -- +
-------------------------------------------------------------------------------- +
-ipv4.method:                            manual +
-ipv4.dns:                               8.8.8.8 +
-ipv4.dns-search:                        ittraining.loc +
-ipv4.dns-options:                       -- +
-ipv4.dns-priority:                      0 +
-ipv4.addresses:                         10.0.2.45/24 +
-ipv4.gateway:                           10.0.2.1 +
-ipv4.routes:                            -- +
-ipv4.route-metric:                      -1 +
-ipv4.route-table:                       0 (unspec) +
-ipv4.routing-rules:                     -- +
-ipv4.ignore-auto-routes:                no +
-ipv4.ignore-auto-dns:                   no +
-ipv4.dhcp-client-id:                    -- +
-ipv4.dhcp-iaid:                         -- +
-ipv4.dhcp-timeout:                      0 (default) +
-ipv4.dhcp-send-hostname:                yes +
-ipv4.dhcp-hostname:                     -- +
-ipv4.dhcp-fqdn:                         -- +
-ipv4.dhcp-hostname-flags:               0x0 (none) +
-ipv4.never-default:                     no +
-ipv4.may-fail:                          yes +
-ipv4.dad-timeout:                       -1 (default) +
-ipv4.dhcp-vendor-class-identifier:      -- +
-ipv4.dhcp-reject-servers:               -- +
-------------------------------------------------------------------------------- +
-ipv6.method:                            auto +
-ipv6.dns:                               -- +
-ipv6.dns-search:                        -- +
-ipv6.dns-options:                       -- +
-ipv6.dns-priority:                      0 +
-ipv6.addresses:                         -- +
-ipv6.gateway:                           -- +
-ipv6.routes:                            -- +
-ipv6.route-metric:                      -1 +
-ipv6.route-table:                       0 (unspec) +
-ipv6.routing-rules:                     -- +
-ipv6.ignore-auto-routes:                no +
-ipv6.ignore-auto-dns:                   no +
-ipv6.never-default:                     no +
-ipv6.may-fail:                          yes +
-ipv6.ip6-privacy:                       0 (disabled) +
-ipv6.addr-gen-mode:                     stable-privacy +
-ipv6.ra-timeout:                        0 (default) +
-ipv6.dhcp-duid:                         -- +
-ipv6.dhcp-iaid:                         -- +
-ipv6.dhcp-timeout:                      0 (default) +
-ipv6.dhcp-send-hostname:                yes +
-ipv6.dhcp-hostname:                     -- +
-ipv6.dhcp-hostname-flags:               0x0 (none) +
-ipv6.token:                             -- +
-------------------------------------------------------------------------------- +
-proxy.method:                           none +
-proxy.browser-only:                     no +
-proxy.pac-url:                          -- +
-proxy.pac-script:                       -- +
-------------------------------------------------------------------------------- +
-lines 56-100/100 (END) +
-[q]+
 </code> </code>
  
-De même, pour consulter les paramètres du profil **ip_fixe**, utilisez la commande suivante :+Dans la colonne STATE on voit les mots **static** et **generated**. 
  
-<code> +  STATE = static 
-[root@centos8 ~]# nmcli -p connection show ip_fixe +    * Ceci implique que l'Unité ne peut ni être démarréeni être arrêtée par l'administrateurLe démarrage et l'arrêt d'une telle Unité est effectué par le systèmeEn règle généraleles Unités dont le STATE est static sont des dépendances d'autres Unité
-=============================================================================== +
-                     Connection profile details (ip_fixe) +
-=============================================================================== +
-connection.id:                          ip_fixe +
-connection.uuid:                        0f48c74d-5d16-4c37-8220-24644507b589 +
-connection.stable-id:                   -- +
-connection.type:                        802-3-ethernet +
-connection.interface-name:              ens18 +
-connection.autoconnect:                 yes +
-connection.autoconnect-priority:        0 +
-connection.autoconnect-retries:         -1 (default) +
-connection.multi-connect:               0 (default) +
-connection.auth-retries:                -1 +
-connection.timestamp:                   1630224329 +
-connection.read-only:                   no +
-connection.permissions:                 -- +
-connection.zone:                        -- +
-connection.master:                      -- +
-connection.slave-type:                  -- +
-connection.autoconnect-slaves:          -1 (default) +
-connection.secondaries:                 -- +
-connection.gateway-ping-timeout:        0 +
-connection.metered:                     unknown +
-connection.lldp:                        default +
-connection.mdns:                        -1 (default) +
-connection.llmnr:                       -1 (default) +
-connection.wait-device-timeout:         -1 +
-------------------------------------------------------------------------------- +
-802-3-ethernet.port:                    -- +
-802-3-ethernet.speed:                   0 +
-802-3-ethernet.duplex:                  -- +
-802-3-ethernet.auto-negotiate:          no +
-802-3-ethernet.mac-address:             -- +
-802-3-ethernet.cloned-mac-address:      -- +
-802-3-ethernet.generate-mac-address-mask:-- +
-802-3-ethernet.mac-address-blacklist:   -- +
-802-3-ethernet.mtu:                     auto +
-802-3-ethernet.s390-subchannels:        -- +
-802-3-ethernet.s390-nettype:            -- +
-802-3-ethernet.s390-options:            -- +
-802-3-ethernet.wake-on-lan:             default +
-802-3-ethernet.wake-on-lan-password:    -- +
-------------------------------------------------------------------------------- +
-ipv4.method:                            manual +
-ipv4.dns:                               -- +
-ipv4.dns-search:                        -- +
-ipv4.dns-options:                       -- +
-ipv4.dns-priority:                      0 +
-ipv4.addresses:                         10.0.2.46/24 +
-ipv4.gateway:                           10.0.2.1 +
-ipv4.routes:                            -- +
-ipv4.route-metric:                      -1 +
-ipv4.route-table:                       0 (unspec) +
-ipv4.routing-rules:                     -- +
-ipv4.ignore-auto-routes:                no +
-ipv4.ignore-auto-dns:                   no +
-ipv4.dhcp-client-id:                    -- +
-ipv4.dhcp-iaid:                         -- +
-ipv4.dhcp-timeout:                      0 (default) +
-ipv4.dhcp-send-hostname:                yes +
-ipv4.dhcp-hostname:                     -- +
-ipv4.dhcp-fqdn:                         -- +
-ipv4.dhcp-hostname-flags:               0x0 (none) +
-ipv4.never-default:                     no +
-ipv4.may-fail:                          yes +
-ipv4.dad-timeout:                       -1 (default) +
-ipv4.dhcp-vendor-class-identifier:      -- +
-ipv4.dhcp-reject-servers:               -- +
-------------------------------------------------------------------------------- +
-ipv6.method:                            auto +
-ipv6.dns:                               -- +
-ipv6.dns-search:                        -- +
-ipv6.dns-options:                       -- +
-ipv6.dns-priority:                      0 +
-ipv6.addresses:                         -- +
-ipv6.gateway:                           -- +
-ipv6.routes:                            -- +
-ipv6.route-metric:                      -1 +
-ipv6.route-table:                       0 (unspec) +
-ipv6.routing-rules:                     -- +
-ipv6.ignore-auto-routes:                no +
-ipv6.ignore-auto-dns:                   no +
-ipv6.never-default:                     no +
-ipv6.may-fail:                          yes +
-ipv6.ip6-privacy:                       -1 (unknown) +
-ipv6.addr-gen-mode:                     stable-privacy +
-ipv6.ra-timeout:                        0 (default) +
-ipv6.dhcp-duid:                         -- +
-ipv6.dhcp-iaid:                         -- +
-ipv6.dhcp-timeout:                      0 (default) +
-ipv6.dhcp-send-hostname:                yes +
-ipv6.dhcp-hostname:                     -- +
-ipv6.dhcp-hostname-flags:               0x0 (none) +
-ipv6.token:                             -- +
-------------------------------------------------------------------------------- +
-proxy.method:                           none +
-proxy.browser-only:                     no +
-proxy.pac-url:                          -- +
-proxy.pac-script:                       -- +
-------------------------------------------------------------------------------- +
-=============================================================================== +
-      Activate connection details (0f48c74d-5d16-4c37-8220-24644507b589) +
-=============================================================================== +
-GENERAL.NAME:                           ip_fixe +
-GENERAL.UUID:                           0f48c74d-5d16-4c37-8220-24644507b589 +
-GENERAL.DEVICES:                        ens18 +
-GENERAL.IP-IFACE:                       ens18 +
-GENERAL.STATE:                          activated +
-GENERAL.DEFAULT:                        yes +
-GENERAL.DEFAULT6:                       no +
-GENERAL.SPEC-OBJECT:                    -- +
-GENERAL.VPN:                            no +
-GENERAL.DBUS-PATH:                      /org/freedesktop/NetworkManager/ActiveConnection/+
-GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/Settings/+
-GENERAL.ZONE:                           -- +
-GENERAL.MASTER-PATH:                    -- +
-------------------------------------------------------------------------------- +
-IP4.ADDRESS[1]:                         10.0.2.46/24 +
-IP4.GATEWAY:                            10.0.2.1 +
-IP4.ROUTE[1]:                           dst 10.0.2.0/24, nh = 0.0.0.0, mt = 100 +
-IP4.ROUTE[2]:                           dst = 0.0.0.0/0nh = 10.0.2.1mt = 100 +
-------------------------------------------------------------------------------- +
-IP6.ADDRESS[1]:                         fe80::5223:aee1:998e:9f27/64 +
-IP6.GATEWAY:                            -- +
-IP6.ROUTE[1]:                           dst = fe80::/64, nh = ::, mt = 100 +
-IP6.ROUTE[2]:                           dst = ff00::/8, nh = ::, mt = 256, table=255 +
-------------------------------------------------------------------------------- +
-lines 83-127/127 (END) +
-[q] +
-</code>+
  
-Pour consulter la liste profils associés à un périphériqueutilisez la commande suivante :+  * STATE = generated 
 +    * Ceci implique que le fichier a été généré automatiquement en utilisant les informations dans le fichier **/etc/fstab** lors du démarrage du système. Dans le cas d'un point de montagel'exécutable respopnsable de la génération du fichier est **/lib/systemd/system-generators/systemd-fstab-generator** :
  
 <code> <code>
-[root@centos8 ~]# nmcli -f CONNECTIONS device show ens18 +[root@redhat9 ~]# ls -/lib/systemd/system-generators/systemd-fstab-generator 
-CONNECTIONS.AVAILABLE-CONNECTION-PATHS: /org/freedesktop/NetworkManager/Settings/1,/org/freedesktop/NetworkManager/Settings/+-rwxr-xr-x1 root root 57696 Jul 18 13:01 /lib/systemd/system-generators/systemd-fstab-generator
-CONNECTIONS.AVAILABLE-CONNECTIONS[1]:   fc4a4d23-b15e-47a7-bcfa-b2e08f49553e | ens18 +
-CONNECTIONS.AVAILABLE-CONNECTIONS[2]  0f48c74d-5d16-4c37-8220-24644507b589 | ip_fixe+
 </code> </code>
  
-Les fichiers de configuration pour le periphérique **ens18** se trouvent dans le répertoire **/etc/sysconfig/network-scripts/** :+Il existe aussi d'autres exécutables responsables de la génération d'autres fichiers :
  
 <code> <code>
-[root@centos8 ~]# ls -l /etc/sysconfig/network-scripts| grep ifcfg +[root@redhat9 ~]# ls -l /lib/systemd/system-generators 
--rw-r--r--. 1 root root 417 Jun 16 06:39 ifcfg-ens18 +total 396 
--rw-r--r--. 1 root root 326 Aug 29 03:58 ifcfg-ip_fixe+-rwxr-xr-x. 1 root root   541 Jul 24 06:08 kdump-dep-generator.sh 
 +-rwxr-xr-x. 1 root root 15832 May 17 18:27 ostree-system-generator 
 +lrwxrwxrwx. 1 root root    31 Aug  8 10:54 podman-system-generator -> ../../../libexec/podman/quadlet 
 +-rwxr-xr-x. 1 root root  1005 Feb 19  2024 selinux-autorelabel-generator.sh 
 +-rwxr-xr-x. 1 root root 15624 Jul 18 13:01 systemd-bless-boot-generator 
 +-rwxr-xr-x. 1 root root 40920 Jul 18 13:01 systemd-cryptsetup-generator 
 +-rwxr-xr-x. 1 root root 24312 Jul 18 13:01 systemd-debug-generator 
 +-rwxr-xr-x. 1 root root 57696 Jul 18 13:01 systemd-fstab-generator 
 +-rwxr-xr-x. 1 root root 24096 Jul 18 13:01 systemd-getty-generator 
 +-rwxr-xr-x. 1 root root 36496 Jul 18 13:01 systemd-gpt-auto-generator 
 +-rwxr-xr-x. 1 root root 16096 Jul 18 13:01 systemd-hibernate-resume-generator 
 +-rwxr-xr-x. 1 root root 24240 Jul 18 13:01 systemd-integritysetup-generator 
 +-rwxr-xr-x. 1 root root 15632 Jul 18 13:01 systemd-rc-local-generator 
 +-rwxr-xr-x. 1 root root 24296 Jul 18 13:01 systemd-run-generator 
 +-rwxr-xr-x. 1 root root 15824 Jul 18 13:01 systemd-system-update-generator 
 +-rwxr-xr-x. 1 root root 36424 Jul 18 13:01 systemd-sysv-generator 
 +-rwxr-xr-x. 1 root root 36872 Jul 18 13:01 systemd-veritysetup-generator
 </code> </code>
  
-====1.2 - Résolution des Noms==== +Les options de la commande **systemctl** sont :
- +
-L'étude du fichier **/etc/sysconfig/network-scripts/ifcfg-ip_fixe** démontre l'abscence de directives concernant les DNS :+
  
 <code> <code>
-[root@centos8 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ip_fixe +[root@redhat9 ~]# systemctl --help 
-TYPE=Ethernet +systemctl [OPTIONS...] COMMAND ...
-PROXY_METHOD=none +
-BROWSER_ONLY=no +
-BOOTPROTO=none +
-IPADDR=10.0.2.46 +
-PREFIX=24 +
-GATEWAY=10.0.2.+
-DEFROUTE=yes +
-IPV4_FAILURE_FATAL=no +
-IPV6INIT=yes +
-IPV6_AUTOCONF=yes +
-IPV6_DEFROUTE=yes +
-IPV6_FAILURE_FATAL=no +
-IPV6_ADDR_GEN_MODE=stable-privacy +
-NAME=ip_fixe +
-UUID=0f48c74d-5d16-4c37-8220-24644507b589 +
-DEVICE=ens18 +
-ONBOOT=yes +
-</code>+
  
-La résolution des noms est donc inactive :+Query or send control commands to the system manager.
  
-<code> +Unit Commands: 
-[root@centos8 ~]# ping www.free.fr +  list-units [PATTERN...            List units currently in memory 
-ping: www.free.fr: Name or service not known+  list-automounts [PATTERN...]        List automount units currently in memory, 
 +                                      ordered by path 
 +  list-sockets [PATTERN...]           List socket units currently in memory, 
 +                                      ordered by address 
 +  list-timers [PATTERN...]            List timer units currently in memory, 
 +                                      ordered by next elapse 
 +  is-active PATTERN...                Check whether units are active 
 +  is-failed PATTERN...                Check whether units are failed 
 +  status [PATTERN...|PID...]          Show runtime status of one or more units 
 +  show [PATTERN...|JOB...]            Show properties of one or more 
 +                                      units/jobs or the manager 
 +  cat PATTERN...                      Show files and drop-ins of specified units 
 +  help PATTERN...|PID...              Show manual for one or more units 
 +  list-dependencies [UNIT...]         Recursively show units which are required 
 +                                      or wanted by the units or by which those 
 +                                      units are required or wanted 
 +  start UNIT...                       Start (activate) one or more units 
 +  stop UNIT...                        Stop (deactivate) one or more units 
 +  reload UNIT...                      Reload one or more units 
 +  restart UNIT...                     Start or restart one or more units 
 +  try-restart UNIT...                 Restart one or more units if active 
 +  reload-or-restart UNIT...           Reload one or more units if possible, 
 +                                      otherwise start or restart 
 +  try-reload-or-restart UNIT...       If active, reload one or more units, 
 +                                      if supported, otherwise restart 
 +  isolate UNIT                        Start one unit and stop all others 
 +  kill UNIT...                        Send signal to processes of a unit 
 +  clean UNIT...                       Clean runtime, cache, state, logs or 
 +                                      configuration of unit 
 +  freeze PATTERN...                   Freeze execution of unit processes 
 +  thaw PATTERN...                     Resume execution of a frozen unit 
 +  set-property UNIT PROPERTY=VALUE... Sets one or more properties of a unit 
 +  bind UNIT PATH [PATH]               Bind-mount a path from the host into a 
 +                                      unit's namespace 
 +  mount-image UNIT PATH [PATH [OPTS]] Mount an image from the host into a 
 +                                      unit's namespace 
 +  service-log-level SERVICE [LEVEL]   Get/set logging threshold for service 
 +  service-log-target SERVICE [TARGET] Get/set logging target for service 
 +  reset-failed [PATTERN...]           Reset failed state for all, one, or more 
 +                                      units 
 +Unit File Commands: 
 +  list-unit-files [PATTERN...]        List installed unit files 
 +  enable [UNIT...|PATH...]            Enable one or more unit files 
 +  disable UNIT...                     Disable one or more unit files 
 +  reenable UNIT...                    Reenable one or more unit files 
 +  preset UNIT...                      Enable/disable one or more unit files 
 +                                      based on preset configuration 
 +  preset-all                          Enable/disable all unit files based on 
 +                                      preset configuration 
 +lines 1-55
 </code> </code>
  
-Modifiez donc la configuration du profil **ip_fixe** :+====LAB #2 - Fichiers de Configuration====
  
-<code> +===2.1 - Fichiers de Configuration par Défaut===
-[root@centos8 ~]# nmcli connection mod ip_fixe ipv4.dns 8.8.8.8 +
-</code>+
  
-L'étude du fichier **/etc/sysconfig/network-scripts/ifcfg-ip_fixe** démontre que la directive concernant le serveur DNS a été ajoutée :+Les fichiers de configuration des Cibles et fichiers de configuration des Unités installés par des paquets se trouvent dans le répertoire **/usr/lib/systemd/system** :
  
 <code> <code>
-[root@centos8 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ip_fixe +[root@redhat9 ~]# pkg-config systemd --variable=systemdsystemunitdir 
-TYPE=Ethernet +/usr/lib/systemd/system
-PROXY_METHOD=none +
-BROWSER_ONLY=no +
-BOOTPROTO=none +
-IPADDR=10.0.2.46 +
-PREFIX=24 +
-GATEWAY=10.0.2.1 +
-DEFROUTE=yes +
-IPV4_FAILURE_FATAL=no +
-IPV6INIT=yes +
-IPV6_AUTOCONF=yes +
-IPV6_DEFROUTE=yes +
-IPV6_FAILURE_FATAL=no +
-IPV6_ADDR_GEN_MODE=stable-privacy +
-NAME=ip_fixe +
-UUID=0f48c74d-5d16-4c37-8220-24644507b589 +
-DEVICE=ens18 +
-ONBOOT=yes +
-DNS1=8.8.8.8+
 </code> </code>
- 
-Afin que la modification du serveur DNS soit prise en compte, re-démarrez le service NetworkManager : 
  
 <code> <code>
-root@centos8 ~]# systemctl restart NetworkManager.service +[root@redhat9 ~]# ls -l /usr/lib/systemd/system | more 
-[root@centos8 ~]# systemctl status NetworkManager.service +total 1584 
-● NetworkManager.service - Network Manager +-rw-r--r--. 1 root root  729 Feb 24  2022 accounts-daemon.service 
-   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled) +-rw-r--r--. 1 root root  480 Jan 16  2024 alsa-restore.service 
-   Activeactive (running) since Sun 2021-08-29 04:15:11 EDT; 8s ago +-rw-r--r--. 1 root root  465 Jan 16  2024 alsa-state.service 
-     Docs: man:NetworkManager(8) +-rw-r--r--. 1 root root  275 Aug 10  2021 arp-ethers.service 
- Main PID973390 (NetworkManager) +-rw-r--r--. 1 root root  274 Apr  4  2022 atd.service 
-    Tasks: 4 (limit23535) +-rw-r--r--. 1 root root 1771 Nov  8  2023 auditd.service 
-   Memory: 4.6M +lrwxrwxrwx. 1 root root   14 Jul 18 13:00 autovt@.service -> getty@.service 
-   CGroup: /system.slice/NetworkManager.service +-rw-r--r--. 1 root root 1044 Nov  8  2023 avahi-daemon.service 
-           └─973390 /usr/sbin/NetworkManager --no-daemon +-rw-r--r--. 1 root root  870 Nov   2023 avahi-daemon.socket 
- +-rw-r--r--. 1 root root  964 Jul 18 13:00 basic.target 
-Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]: <info>  [1630224912.2235] device (ens18): state change: ip-check -> secondaries (reas> +drwxr-xr-x. 2 root root    6 Jul 18 13:00 basic.target.wants 
-Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]: <info>  [1630224912.2237] device (virbr0): state change: secondaries -> activated (re> +-r--r--r--1 root root  384 Feb  3  2024 blk-availability.service 
-Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]<info>  [1630224912.2241] managerNetworkManager state is now CONNECTED_LOCAL +-rw-r--r--1 root root  449 Oct 31  2022 blockdev@.target 
-Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]<info>  [1630224912.2251] policyset 'ip_fixe' (ens18) as default for IPv4 routing a> +-rw-r--r--. 1 root root  707 Jun 14  2022 bluetooth.service 
-Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]<info>  [1630224912.3090] device (virbr0)Activation: successful, device activated+-rw-r--r--. 1 root root  435 Oct 31  2022 bluetooth.target 
-Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]: <info>  [1630224912.3098] device (ens18): state changesecondaries -> activated (rea> +-rw-r--r--. 1 root root  642 Jan 16  2023 bolt.service 
-Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]<info>  [1630224912.3102] manager: NetworkManager state is now CONNECTED_SITE +-rw-r--r--. 1 root root  463 Oct 31  2022 boot-complete.target 
-Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]<info>  [1630224912.3111] device (ens18): Activationsuccessful, device activated+-rw-r--r--. 1 root root  217 Aug   2021 brltty.service 
-Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]<info>  [1630224912.3116] managerNetworkManager state is now CONNECTED_GLOBAL +-rw-r--r--1 root root  491 Jul 13  2023 canberra-system-bootup.service 
-Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]<info [1630224912.3121] managerstartup complete +-rw-r--r--. 1 root root  509 Jul 13  2023 canberra-system-shutdown-reboot.service 
-lines 1-20/20 (END)+-rw-r--r--1 root root  466 Jul 13  2023 canberra-system-shutdown.service 
 +-rw-r--r--. 1 root root 1811 Jan 23  2024 chronyd-restricted.service 
 +-rw-r--r--. 1 root root 1468 Jan 23  2024 chronyd.service 
 +-rw-r--r--1 root root 1082 Jan 23  2024 chrony-wait.service 
 +-rw-r--r--. 1 root root  277 Jul 23 09:37 cni-dhcp.service 
 +-rw-r--r--. 1 root root  302 Dec  4  2023 cni-dhcp.socket 
 +-rw-r--r--. 1 root root  222 Apr  2 05:45 cockpit-motd.service 
 +-rw-r--r--. 1 root root  720 Apr  2 05:45 cockpit.service 
 +-rw-r--r--1 root root  349 Apr  2 05:45 cockpit.socket 
 +-rw-r--r--. 1 root root  221 Apr  2 05:45 cockpit-wsinstance-http.service 
 +-rw-r--r--. 1 root root  165 Apr  2 05:45 cockpit-wsinstance-https-factory@.service 
 +-rw-r--r--. 1 root root  244 Apr  2 05:45 cockpit-wsinstance-https-factory.socket 
 +-rw-r--r--1 root root  215 Apr  2 05:45 cockpit-wsinstance-http.socket 
 +-rw-r--r--. 1 root root  264 Apr  2 05:45 cockpit-wsinstance-https@.service 
 +-rw-r--r--. 1 root root  478 Apr  2 05:45 cockpit-wsinstance-https@.socket 
 +-rw-r--r--. 1 root root  295 Aug   2021 colord.service 
 +-rw-r--r--1 root root  154 Aug 11  2021 configure-printer@.service 
 +-rw-r--r--. 1 root root 1102 Jul 18 13:00 console-getty.service 
 +-rw-r--r--. 1 root root 1254 Jul 18 13:00 container-getty@.service 
 +-rw-r--r--1 root root  294 Sep 13 18:49 cpupower.service 
 +-rw-r--r--. 1 root root  371 Nov 30  2023 crond.service 
 +-rw-r--r--1 root root  473 Oct 31  2022 cryptsetup-pre.target 
 +-rw-r--r--. 1 root root  420 Oct 31  2022 cryptsetup.target 
 +lrwxrwxrwx. 1 root root   13 Jul 18 13:00 ctrl-alt-del.target -reboot.target 
 +-rw-r--r--. 1 root root  234 Jan  7  2021 cups-browsed.service 
 +-rw-r--r--. 1 root root  142 Jun 19 11:00 cups.path 
 +-rw-r--r--. 1 root root  298 Jun 19 11:00 cups.service 
 +drwxr-xr-x2 root root   25 Sep 25 12:03 cups.service.d 
 +-rw-r--r--. 1 root root  148 Jun 19 11:00 cups.socket 
 +-rw-r--r--. 1 root root  529 Aug 23  2022 dbus-broker.service 
 +-rw-r--r--. 1 root root  560 Jun 12  2023 dbus-daemon.service 
 +lrwxrwxrwx1 root root   25 Jul 18 13:00 dbus-org.freedesktop.hostname1.service -systemd-hostnamed.service 
 +lrwxrwxrwx. 1 root root   23 Jul 18 13:00 dbus-org.freedesktop.locale1.service -> systemd-localed.service 
 +lrwxrwxrwx. root root   22 Jul 18 13:00 dbus-org.freedesktop.login1.service -> systemd-logind.service 
 +--More--
 [q] [q]
 </code> </code>
  
-Vérifiez que le fichier **/etc/resolv.conf** ait été modifié par NetworkManager :+Certains fichiers de configuration sont créés à la volée dans le répertoire **/run/systemd/system** lors du runtime puis ils sont détruits quand le système n'en a plus besoin :
  
 <code> <code>
-[root@centos8 ~]# cat /etc/resolv.conf +[root@redhat9 ~]# ls -l /run/systemd/system
-# Generated by NetworkManager +total 0
-search ittraining.loc +
-nameserver 8.8.8.8+
 </code> </code>
  
-Dernièrement vérifiez la resolution des noms :+Les fichiers de configuration des Unités crées par les utilisateurs doivent être mis dans le répertoire **/usr/lib/systemd/user** :
  
 <code> <code>
-[root@centos8 ~]# ping www.free.fr +[root@redhat9 ~]# pkg-config systemd --variable=systemduserunitdir 
-PING www.free.fr (212.27.48.10) 56(84) bytes of data. +/usr/lib/systemd/user
-64 bytes from www.free.fr (212.27.48.10): icmp_seq=1 ttl=47 time=29.3 ms +
-64 bytes from www.free.fr (212.27.48.10): icmp_seq=2 ttl=47 time=29.4 ms +
-64 bytes from www.free.fr (212.27.48.10): icmp_seq=3 ttl=47 time=29.4 ms +
-64 bytes from www.free.fr (212.27.48.10): icmp_seq=4 ttl=47 time=29.4 ms +
-^C +
---- www.free.fr ping statistics --- +
-4 packets transmitted, 4 received, 0% packet loss, time 3005ms +
-rtt min/avg/max/mdev = 29.266/29.377/29.428/0.183 ms+
 </code> </code>
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important** : Notez qu'il existe un front-end graphique en mode texte, **nmtui**, pour configurer NetworkManager.+**Important** : De cette façon les fichiers dans **/usr/lib/systemd/user** surchargent les fichiers dans le répertoire **/run/systemd/system** qui surchargent les fichiers dans le répertoire **/usr/lib/systemd/system**.
 </WRAP> </WRAP>
  
-====1.3 - Ajouter une Deuxième Adresse IP à un Profil==== +Prenons le cas du service **sshd** qui est configuré par le fichier **/usr/lib/systemd/system/sshd.service** :
- +
-Pour ajouter une deuxième adresse IP à un profil sous RHEL/CentOS 8, il convient d'utiliser la commande suivante :+
  
 <code> <code>
-[root@centos8 ~]# nmcli connection mod ip_fixe +ipv4.addresses 192.168.1.2/24 +[root@redhat9 ~]# cat /usr/lib/systemd/system/sshd.service 
-</code>+[Unit] 
 +Description=OpenSSH server daemon 
 +Documentation=man:sshd(8) man:sshd_config(5) 
 +After=network.target sshd-keygen.target 
 +Wants=sshd-keygen.target
  
-Rechargez la configuration du profil :+[Service] 
 +Type=notify 
 +EnvironmentFile=-/etc/sysconfig/sshd 
 +ExecStart=/usr/sbin/sshd -D $OPTIONS 
 +ExecReload=/bin/kill -HUP $MAINPID 
 +KillMode=process 
 +Restart=on-failure 
 +RestartSec=42s
  
-<code> +[Install] 
-[root@centos8 ~]# nmcli con up ip_fixe+WantedBy=multi-user.target
 </code> </code>
  
-Saisissez ensuite la commande suivante :+Dans le fichier on peut noter la présence des lignes suivantes dans la section **[Unit]** :
  
-<code> +  * **Description=OpenSSH server daemon**, 
-[root@centos8 ~]# nmcli connection show ip_fixe +    * Cette directive est utilisée pour donner une courte description des fonctionnalités de l'Unité
-connection.id:                          ip_fixe +  * **Documentation=man:sshd(8man:sshd_config(5)**, 
-connection.uuid:                        0f48c74d-5d16-4c37-8220-24644507b589 +    * Cette directive stipule les chapitres des manuels et les URLs contenant de l'information en relation avec l'Unité, 
-connection.stable-id:                   -- +  * **After=network.target sshd-keygen.target**, 
-connection.type:                        802-3-ethernet +    * Cette directive indique les cibles qui devraient être atteintes et les Unités qui devraient être démarrées avant l'Unité sshdPar contrecette directive ne spécifie pas une dépendance
-connection.interface-name:              ens18 +  * **Wants=sshd-keygen.target**
-connection.autoconnect:                 yes +    * Cette directive stipule une dépendance douceAutrement ditSystemd essayera de démarrer l'Unité **sshd-keygen.target** mais si ce démarrage est en échecl'Unité sshd sera démarré.
-connection.autoconnect-priority:        0 +
-connection.autoconnect-retries:         -1 (default) +
-connection.multi-connect:               0 (default) +
-connection.auth-retries:                -1 +
-connection.timestamp:                   1630225792 +
-connection.read-only:                   no +
-connection.permissions:                 -- +
-connection.zone:                        -- +
-connection.master:                      -- +
-connection.slave-type:                  -- +
-connection.autoconnect-slaves:          -1 (default) +
-connection.secondaries:                 -- +
-connection.gateway-ping-timeout:        0 +
-connection.metered:                     unknown +
-connection.lldp:                        default +
-connection.mdns:                        -1 (default) +
-connection.llmnr:                       -1 (default) +
-connection.wait-device-timeout:         -1 +
-802-3-ethernet.port:                    -- +
-802-3-ethernet.speed:                   0 +
-802-3-ethernet.duplex:                  -- +
-802-3-ethernet.auto-negotiate:          no +
-802-3-ethernet.mac-address:             -- +
-802-3-ethernet.cloned-mac-address:      -- +
-802-3-ethernet.generate-mac-address-mask:-- +
-802-3-ethernet.mac-address-blacklist:   -- +
-802-3-ethernet.mtu:                     auto +
-802-3-ethernet.s390-subchannels:        -- +
-802-3-ethernet.s390-nettype:            -- +
-802-3-ethernet.s390-options:            -- +
-802-3-ethernet.wake-on-lan:             default +
-802-3-ethernet.wake-on-lan-password:    -- +
-ipv4.method:                            manual +
-ipv4.dns:                               8.8.8.8 +
-ipv4.dns-search:                        -- +
-ipv4.dns-options:                       -- +
-ipv4.dns-priority:                      0 +
-ipv4.addresses:                         10.0.2.46/24192.168.1.2/24 +
-ipv4.gateway                          10.0.2.1 +
-ipv4.routes:                            -- +
-ipv4.route-metric:                      -1 +
-ipv4.route-table:                       (unspec) +
-ipv4.routing-rules                    -- +
-ipv4.ignore-auto-routes:                no +
-ipv4.ignore-auto-dns:                   no +
-ipv4.dhcp-client-id:                    -- +
-ipv4.dhcp-iaid:                         -- +
-ipv4.dhcp-timeout:                      0 (default+
-ipv4.dhcp-send-hostname:                yes +
-ipv4.dhcp-hostname:                     -- +
-ipv4.dhcp-fqdn:                         -- +
-ipv4.dhcp-hostname-flags:               0x0 (none) +
-ipv4.never-default:                     no +
-ipv4.may-fail:                          yes +
-ipv4.dad-timeout:                       -1 (default) +
-ipv4.dhcp-vendor-class-identifier:      -- +
-ipv4.dhcp-reject-servers:               -- +
-ipv6.method:                            auto +
-ipv6.dns:                               -- +
-ipv6.dns-search:                        -- +
-ipv6.dns-options:                       -- +
-ipv6.dns-priority:                      0 +
-ipv6.addresses:                         -- +
-ipv6.gateway:                           -- +
-ipv6.routes:                            -- +
-ipv6.route-metric:                      -1 +
-ipv6.route-table:                       0 (unspec) +
-ipv6.routing-rules:                     -- +
-ipv6.ignore-auto-routes:                no +
-ipv6.ignore-auto-dns:                   no +
-ipv6.never-default:                     no +
-ipv6.may-fail:                          yes +
-ipv6.ip6-privacy:                       -1 (unknown) +
-ipv6.addr-gen-mode:                     stable-privacy +
-ipv6.ra-timeout:                        0 (default) +
-ipv6.dhcp-duid:                         -- +
-ipv6.dhcp-iaid:                         -- +
-ipv6.dhcp-timeout:                      0 (default) +
-ipv6.dhcp-send-hostname:                yes +
-ipv6.dhcp-hostname:                     -- +
-ipv6.dhcp-hostname-flags:               0x0 (none) +
-ipv6.token:                             -- +
-proxy.method:                           none +
-proxy.browser-only:                     no +
-proxy.pac-url:                          -- +
-proxy.pac-script:                       -- +
-GENERAL.NAME:                           ip_fixe +
-GENERAL.UUID:                           0f48c74d-5d16-4c37-8220-24644507b589 +
-GENERAL.DEVICES:                        ens18 +
-GENERAL.IP-IFACE:                       ens18 +
-GENERAL.STATE:                          activated +
-GENERAL.DEFAULT:                        yes +
-GENERAL.DEFAULT6:                       no +
-GENERAL.SPEC-OBJECT:                    -- +
-GENERAL.VPN:                            no +
-GENERAL.DBUS-PATH:                      /org/freedesktop/NetworkManager/ActiveConnection/+
-GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/Settings/+
-GENERAL.ZONE:                           -- +
-GENERAL.MASTER-PATH:                    -- +
-IP4.ADDRESS[1]:                         10.0.2.46/24 +
-IP4.ADDRESS[2]:                         192.168.1.2/24 +
-IP4.GATEWAY:                            10.0.2.1 +
-IP4.ROUTE[1]:                           dst = 10.0.2.0/24nh = 0.0.0.0mt = 100 +
-IP4.ROUTE[2]:                           dst 192.168.1.0/24nh = 0.0.0.0, mt = 100 +
-IP4.ROUTE[3]:                           dst = 0.0.0.0/0nh = 10.0.2.1, mt = 100 +
-IP4.DNS[1]:                             8.8.8.8 +
-IP6.ADDRESS[1]:                         fe80::5223:aee1:998e:9f27/64 +
-IP6.GATEWAY:                            -+
-IP6.ROUTE[1]:                           dst = fe80::/64nh = ::, mt = 100 +
-IP6.ROUTE[2]:                           dst = ff00::/8, nh = ::, mt = 256, table=255 +
-lines 72-116/116 (END) +
-[q] +
-</code>+
  
-<WRAP center round important 60%> +Dans le fichier on peut aussi noter la présence des lignes suivantes dans la section **[Service]** :
-**Important** : Notez l'ajout de l'adresse secondaire à la ligne **ipv4.addresses: ** ainsi que l'ajout de la ligne **IP4.ADDRESS[2]:**+
-</WRAP>+
  
-Consultez maintenant le contenu du fichier **/etc/sysconfig/network-scripts/ifcfg-ip_fixe** :+  * **Type=notify**, 
 +    * Cette directive indique que le service informera Systemd quand son démarrage a terminé, 
 +  * **ExecStart=/usr/sbin/sshd -D $OPTIONS**, 
 +     * Cette directive définit l'exécutable à lancer, 
 +  * **ExecReload=/bin/kill -HUP $MAINPID**
 +    * Cette directive indique la commande necéssaire pour redémarrer le service, 
 +  * **KillMode=process**, 
 +    * Cette directive indique comment les processus du service doivent être arrêtés. La valeur de **process** implique l'utilisation de SIGTERM suivi par SIGHUP, 
 +  * **Restart=on-failure**, 
 +    * Cette ligne indique que le service doit être re-démarré en cas d'arrêt de celui-ci. 
 +  * **RestartSec=42s**, 
 +    * Cette directive stipule le temps d'attente entre l'arrêt du service et le redémarrage par Systemd,
  
-<code> +Dernièrement on note la présence de la ligne suivante dans la section **[Install]** :
-[root@centos8 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ip_fixe +
-TYPE=Ethernet +
-PROXY_METHOD=none +
-BROWSER_ONLY=no +
-BOOTPROTO=none +
-IPADDR=10.0.2.46 +
-PREFIX=24 +
-GATEWAY=10.0.2.1 +
-DEFROUTE=yes +
-IPV4_FAILURE_FATAL=no +
-IPV6INIT=yes +
-IPV6_AUTOCONF=yes +
-IPV6_DEFROUTE=yes +
-IPV6_FAILURE_FATAL=no +
-IPV6_ADDR_GEN_MODE=stable-privacy +
-NAME=ip_fixe +
-UUID=0f48c74d-5d16-4c37-8220-24644507b589 +
-DEVICE=ens18 +
-ONBOOT=yes +
-DNS1=8.8.8.8 +
-IPADDR1=192.168.1.2 +
-PREFIX1=24 +
-</code>+
  
-<WRAP center round important 60%> +  * **WantedBy=multi-user.target**, 
-**Important** : Notez l'ajout de la ligne **IPADDR1=192.168.1.2**. +    * Cette directive indique la Cible dans laquelle le service doit être démarré. La présence de cette directive crée un lien symbolique dans le répertoire **/etc/systemd/system/multi-user.target.wants** qui pointe vers ce fichier.
-</WRAP>+
  
-====1.4 - La Commande hostname==== +Pour consulter **l'ensemble** des directives de configuration ainsi que leurs valeurs d'une Unité, il convient d'utiliser la commande **systemctl show**  en spécifiant l'Unité concernée :
- +
-La procédure de la modification du hostname est simplifiée et sa prise en compte est immédiate :+
  
 <code> <code>
-[root@centos8 ~]# hostname +[root@redhat9 ~]# systemctl show sshd 
-centos8.ittraining.loc +Type=notify 
- +ExitType=main 
-[root@centos8 ~]# nmcli general hostname centos.ittraining.loc +Restart=on-failure 
- +NotifyAccess=main 
-[root@centos8 ~]# cat /etc/hostname +RestartUSec=42s 
-centos.ittraining.loc +TimeoutStartUSec=1min 30s 
- +TimeoutStopUSec=1min 30s 
-[root@centos8 ~]# hostname +TimeoutAbortUSec=1min 30s 
-centos.ittraining.loc +TimeoutStartFailureMode=terminate 
- +TimeoutStopFailureMode=terminate 
-[root@centos8 ~]# nmcli general hostname centos8.ittraining.loc +RuntimeMaxUSec=infinity 
- +RuntimeRandomizedExtraUSec=0 
-[root@centos8 ~]# cat /etc/hostname +WatchdogUSec=0 
-centos8.ittraining.loc +WatchdogTimestampMonotonic=0 
- +RootDirectoryStartOnly=no 
-[root@centos8 ~]# hostname +RemainAfterExit=no 
-centos8.ittraining.loc+GuessMainPID=yes 
 +MainPID=875 
 +ControlPID=0 
 +FileDescriptorStoreMax=0 
 +NFileDescriptorStore=0 
 +StatusErrno=0 
 +Result=success 
 +ReloadResult=success 
 +CleanResult=success 
 +UID=[not set
 +GID=[not set] 
 +NRestarts=0 
 +OOMPolicy=stop 
 +ReloadSignal=1 
 +ExecMainStartTimestamp=Wed 2024-09-25 12:44:53 CEST 
 +ExecMainStartTimestampMonotonic=18089127 
 +ExecMainExitTimestampMonotonic=0 
 +ExecMainPID=875 
 +ExecMainCode=0 
 +ExecMainStatus=0 
 +ExecStart={ path=/usr/sbin/sshd ; argv[]=/usr/sbin/sshd -D $OPTIONS ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 } 
 +ExecStartEx={ path=/usr/sbin/sshd ; argv[]=/usr/sbin/sshd -D $OPTIONS ; flags= ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 } 
 +ExecReload={ path=/bin/kill ; argv[]=/bin/kill -HUP $MAINPID ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 } 
 +ExecReloadEx={ path=/bin/kill ; argv[]=/bin/kill -HUP $MAINPID ; flags= ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 } 
 +Slice=system.slice 
 +ControlGroup=/system.slice/sshd.service 
 +ControlGroupId=3690 
 +MemoryCurrent=5275648 
 +MemoryAvailable=infinity 
 +CPUUsageNSec=122370000 
 +TasksCurrent=1 
 +IPIngressBytes=[no data
 +IPIngressPackets=[no data] 
 +IPEgressBytes=[no data
 +IPEgressPackets=[no data
 +IOReadBytes=18446744073709551615 
 +IOReadOperations=18446744073709551615 
 +IOWriteBytes=18446744073709551615 
 +IOWriteOperations=18446744073709551615 
 +lines 1-55
 </code> </code>
  
-====1.5 - La Commande ip==== +Pour consulter la liste des dépendances d'une Unité, il convient d'utiliser **systemctl list-dependancies** en spécifiant l'Unité concernée :
- +
-Sous RHEL/CentOS 8 la commande **ip** est préférée par rapport à la commande ifconfig :+
  
 <code> <code>
-[root@centos8 ~]# ip address +[root@redhat9 ~]# systemctl list-dependencies sshd.service 
-1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 +sshd.service 
-    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 +● ├─system.slice 
-    inet 127.0.0.1/8 scope host lo +● ├─sshd-keygen.target 
-       valid_lft forever preferred_lft forever +○ │ ├─sshd-keygen@ecdsa.service 
-    inet6 ::1/128 scope host  +○ │ ├─sshd-keygen@ed25519.service 
-       valid_lft forever preferred_lft forever +○ │ └─sshd-keygen@rsa.service 
-2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 +● └─sysinit.target 
-    link/ether 4e:b1:31:bd:5d:b2 brd ff:ff:ff:ff:ff:ff +●   ├─dev-hugepages.mount 
-    inet 10.0.2.46/24 brd 10.0.2.255 scope global noprefixroute ens18 +●   ├─dev-mqueue.mount 
-       valid_lft forever preferred_lft forever +●   ├─dracut-shutdown.service 
-    inet 192.168.1.2/24 brd 192.168.1.255 scope global noprefixroute ens18 +○   ├─iscsi-onboot.service 
-       valid_lft forever preferred_lft forever +○   ├─iscsi-starter.service 
-    inet6 fe80::5223:aee1:998e:9f27/64 scope link noprefixroute  +●   ├─kmod-static-nodes.service 
-       valid_lft forever preferred_lft forever +○   ├─ldconfig.service 
-3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000 +●   ├─lvm2-lvmpolld.socket 
-    link/ether 52:54:00:79:02:66 brd ff:ff:ff:ff:ff:ff +●   ├─lvm2-monitor.service 
-    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0 +○   ├─multipathd.service 
-       valid_lft forever preferred_lft forever +●   ├─nis-domainname.service 
-4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000 +●   ├─plymouth-read-write.service 
-    link/ether 52:54:00:79:02:66 brd ff:ff:ff:ff:ff:ff+●   ├─plymouth-start.service 
 +●   ├─proc-sys-fs-binfmt_misc.automount 
 +○   ├─selinux-autorelabel-mark.service 
 +●   ├─sys-fs-fuse-connections.mount 
 +●   ├─sys-kernel-config.mount 
 +●   ├─sys-kernel-debug.mount 
 +●   ├─sys-kernel-tracing.mount 
 +○   ├─systemd-ask-password-console.path 
 +○   ├─systemd-binfmt.service 
 +○   ├─systemd-boot-random-seed.service 
 +●   ├─systemd-boot-update.service 
 +○   ├─systemd-firstboot.service 
 +○   ├─systemd-hwdb-update.service 
 +○   ├─systemd-journal-catalog-update.service 
 +●   ├─systemd-journal-flush.service 
 +●   ├─systemd-journald.service 
 +○   ├─systemd-machine-id-commit.service 
 +●   ├─systemd-modules-load.service 
 +●   ├─systemd-network-generator.service 
 +○   ├─systemd-pcrmachine.service 
 +○   ├─systemd-pcrphase-sysinit.service 
 +○   ├─systemd-pcrphase.service 
 +●   ├─systemd-random-seed.service 
 +○   ├─systemd-repart.service 
 +●   ├─systemd-sysctl.service 
 +○   ├─systemd-sysusers.service 
 +●   ├─systemd-tmpfiles-setup-dev.service 
 +●   ├─systemd-tmpfiles-setup.service 
 +●   ├─systemd-udev-trigger.service 
 +●   ├─systemd-udevd.service 
 +○   ├─systemd-update-done.service 
 +●   ├─systemd-update-utmp.service 
 +●   ├─cryptsetup.target 
 +●   ├─integritysetup.target 
 +●   ├─local-fs.target 
 +●   │ ├─-.mount 
 +lines 1-55
 </code> </code>
  
-===Options de la Commande ip===+===2.2 - Surchargement des Fichiers de Configuration par Défaut===
  
-Les options de cette commande sont :+Les fichiers de configuration par défaut peuvent aussi être surchargés par des fichiers dans d'autres répertoires :
  
 <code> <code>
-[root@centos8 ~]# ip --help +[root@redhat9 ~]# pkg-config systemd --variable=systemdsystemunitpath 
-Usage: ip [ OPTIONS ] OBJECT { COMMAND | help } +/etc/systemd/system:/etc/systemd/system:/run/systemd/system:/usr/local/lib/systemd/system:/usr/lib/systemd/system:/usr/lib/systemd/system:/lib/systemd/system
-       ip [ -force ] -batch filename +
-where  OBJECT :{ link | address | addrlabel | route | rule | neigh | ntable | +
-                   tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm | +
-                   netns | l2tp | fou | macsec | tcp_metrics | token | netconf | ila | +
-                   vrf | sr | nexthop | mptcp } +
-       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] | +
-                    -h[uman-readable] | -iec | -j[son] | -p[retty] | +
-                    -f[amily] { inet | inet6 | mpls | bridge | link } | +
-                    -4 | -6 | -I | -D | -M | -B | -0 | +
-                    -l[oops] { maximum-addr-flush-attempts } | -br[ief] | +
-                    -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] | +
-                    -rc[vbuf] [size] | -n[etns] name | -N[umeric] | -a[ll] | +
-                    -c[olor]} +
 </code> </code>
- 
-====1.6 - Activer/Désactiver une Interface Manuellement==== 
- 
-Deux commandes existent pour désactiver et activer manuellement une interface réseau : 
  
 <code> <code>
-nmcli device disconnect enp0s3 +[root@redhat9 ~]ls -l /etc/systemd/system 
-# nmcli device connect enp0s3+total 8 
 +drwxr-xr-x. 2 root root   65 Oct 19  2023  basic.target.wants 
 +drwxr-xr-x. 2 root root   31 Oct 19  2023  bluetooth.target.wants 
 +lrwxrwxrwx. 1 root root   37 Oct 19  2023  ctrl-alt-del.target -> /usr/lib/systemd/system/reboot.target 
 +lrwxrwxrwx. 1 root root   41 Oct 19  2023  dbus-org.bluez.service -> /usr/lib/systemd/system/bluetooth.service 
 +lrwxrwxrwx. 1 root root   41 Oct 19  2023  dbus-org.fedoraproject.FirewallD1.service -> /usr/lib/systemd/system/firewalld.service 
 +lrwxrwxrwx. 1 root root   44 Oct 19  2023  dbus-org.freedesktop.Avahi.service -> /usr/lib/systemd/system/avahi-daemon.service 
 +lrwxrwxrwx. 1 root root   44 Oct 19  2023  dbus-org.freedesktop.ModemManager1.service -> /usr/lib/systemd/system/ModemManager.service 
 +lrwxrwxrwx. 1 root root   57 Oct 19  2023  dbus-org.freedesktop.nm-dispatcher.service -> /usr/lib/systemd/system/NetworkManager-dispatcher.service 
 +lrwxrwxrwx. 1 root root   43 Oct 19  2023  dbus.service -> /usr/lib/systemd/system/dbus-broker.service 
 +lrwxrwxrwx. 1 root root   40 Oct 19  2023  default.target -> /usr/lib/systemd/system/graphical.target 
 +drwxr-xr-x. 2 root root   45 Oct 19  2023  default.target.wants 
 +drwxr-xr-x. 2 root root   38 Oct 19  2023 'dev-virtio\x2dports-org.qemu.guest_agent.0.device.wants' 
 +lrwxrwxrwx. 1 root root   35 Oct 19  2023  display-manager.service -> /usr/lib/systemd/system/gdm.service 
 +drwxr-xr-x. 2 root root   32 Oct 19  2023  getty.target.wants 
 +drwxr-xr-x. 2 root root  181 Oct 19  2023  graphical.target.wants 
 +drwxr-xr-x. 2 root root   36 Oct 19  2023  local-fs.target.wants 
 +drwxr-xr-x. 2 root root 4096 Oct 19  2023  multi-user.target.wants 
 +drwxr-xr-x. 2 root root   48 Oct 19  2023  network-online.target.wants 
 +drwxr-xr-x. 2 root root   26 Oct 19  2023  printer.target.wants 
 +drwxr-xr-x. 2 root root   27 Oct 19  2023  remote-fs.target.wants 
 +drwxr-xr-x. 2 root root  186 Oct 19  2023  sockets.target.wants 
 +drwxr-xr-x. 2 root root 4096 Sep 25 12:08  sysinit.target.wants 
 +drwxr-xr-x. 2 root root   86 Oct 19  2023  timers.target.wants 
 +drwxr-xr-x. 2 root root   29 Oct 19  2023  vmtoolsd.service.requires
 </code> </code>
  
-<WRAP center round important 60%> +====LAB #3 - La Commande systemd-analyze====
-**Important** : Veuillez ne **PAS** exécuter ces deux commandes. +
-</WRAP>+
  
-====1.7 - Routage Statique==== +Pour avoir une évaluation du temps de démarrage, il convient d'utiliser la commande suivante :
- +
-===La commande ip=== +
- +
-Sous RHEL/CentOS 8pour supprimer la route vers le réseau 192.168.1.0 il convient d'utiliser la commande ip et non pas la commande route :+
  
 <code> <code>
-[root@centos8 ~]# ip route +[root@redhat9 ~]# systemd-analyze 
-default via 10.0.2.dev ens18 proto static metric 100  +Startup finished in 1.309s (kernel) + 4.384s (initrd) + 29.375s (userspace) = 35.069s  
-10.0.2.0/24 dev ens18 proto kernel scope link src 10.0.2.46 metric 100  +graphical.target reached after 29.358s in userspace.
-192.168.1.0/24 dev ens18 proto kernel scope link src 192.168.1.2 metric 100  +
-192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown +
- +
-root@centos8 ~]# ip route del 192.168.1.0/24 via 0.0.0.0 +
-[root@centos8 ~]# ip route +
-default via 10.0.2.1 dev ens18 proto static metric 100  +
-10.0.2.0/24 dev ens18 proto kernel scope link src 10.0.2.46 metric 100  +
-192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown +
 </code> </code>
  
-Pour ajouter la route vers le réseau 192.168.1.0 :+L'option **blame** de la commande systemd-analyze permet de voir le temps de démarrage de chaque Unité afin de pourvoir se concentrer sur les plus lentes :
  
 <code> <code>
-[root@centos8 ~]# ip route add 192.168.1.0/24 via 10.0.2.1 +[root@redhat9 ~]# systemd-analyze blame 
-[root@centos8 ~]# ip route +15.289s plymouth-quit-wait.service 
-default via 10.0.2.dev ens18 proto static metric 100  + 8.760s dev-disk-by\x2dpartuuid-d00dfc8a\x2d02.device 
-10.0.2.0/24 dev ens18 proto kernel scope link src 10.0.2.46 metric 100  + 8.760s dev-disk-by\x2did-scsi\x2d0QEMU_QEMU_HARDDISK_drive\x2dscsi0\x2dpart2.device 
-192.168.1.0/24 via 10.0.2.1 dev ens18  + 8.760s sys-devices-pci0000:00-0000:00:05.0-0000:01:01.0-virtio2-host0-target0:0:0-0:0:0:0-block-sda-sda2.device 
-192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown + 8.760s dev-disk-by\x2dpath-pci\x2d0000:01:01.0\x2dscsi\x2d0:0:0:0\x2dpart2.device 
 + 8.760s dev-sda2.device 
 + 8.662s sys-devices-pci0000:00-0000:00:05.0-0000:01:01.0-virtio2-host0-target0:0:0-0:0:0:0-block-sda-sda1.device 
 + 8.662s dev-disk-by\x2did-scsi\x2d0QEMU_QEMU_HARDDISK_drive\x2dscsi0\x2dpart1.device 
 + 8.662s dev-sda1.device 
 + 8.662s dev-disk-by\x2dpath-pci\x2d0000:01:01.0\x2dscsi\x2d0:0:0:0\x2dpart1.device 
 + 8.662s dev-disk-by\x2duuid-6f6c5bb9\x2d30be\x2d4734\x2dbc23\x2d03fed8541616.device 
 + 8.662s dev-disk-by\x2dpartuuid-d00dfc8a\x2d01.device 
 + 8.629s dev-sda.device 
 + 8.629s dev-disk-by\x2dpath-pci\x2d0000:01:01.0\x2dscsi\x2d0:0:0:0.device 
 + 8.629s dev-disk-by\x2did-scsi\x2d0QEMU_QEMU_HARDDISK_drive\x2dscsi0.device 
 + 8.629s sys-devices-pci0000:00-0000:00:05.0-0000:01:01.0-virtio2-host0-target0:0:0-0:0:0:0-block-sda.device 
 + 8.629s dev-disk-by\x2ddiskseq-1.device 
 + 8.589s sys-module-fuse.device 
 + 8.578s sys-devices-pci0000:00-0000:00:12.0-virtio1-net-ens18.device 
 + 8.578s sys-subsystem-net-devices-ens18.device 
 + 8.560s sys-devices-platform-serial8250-tty-ttyS0.device 
 + 8.560s dev-ttyS0.device 
 + 8.559s sys-devices-platform-serial8250-tty-ttyS2.device 
 + 8.559s dev-ttyS2.device 
 + 8.558s dev-ttyS1.device 
 + 8.558s sys-devices-platform-serial8250-tty-ttyS1.device 
 + 8.557s dev-ttyS3.device 
 + 8.557s sys-devices-platform-serial8250-tty-ttyS3.device 
 + 8.510s sys-module-configfs.device 
 + 4.024s initrd-switch-root.service 
 + 2.468s firewalld.service 
 + 2.157s kdump.service 
 + 1.944s systemd-udev-settle.service 
 + 1.548s dnf-makecache.service 
 + 1.454s NetworkManager-wait-online.service 
 + 1.309s udisks2.service 
 + 1.294s NetworkManager.service 
 + 1.112s power-profiles-daemon.service 
 + 1.091s polkit.service 
 + 1.015s accounts-daemon.service 
 +  953ms ModemManager.service 
 +  900ms user@42.service 
 +  888ms dracut-initqueue.service 
 +  671ms dbus-broker.service 
 +  661ms systemd-tmpfiles-setup-dev.service 
 +  658ms systemd-udevd.service 
 +  561ms lvm2-monitor.service 
 +  547ms boot.mount 
 +  506ms cups.service 
 +  464ms sshd.service 
 +  446ms logrotate.service 
 +  382ms systemd-random-seed.service 
 +  376ms auditd.service 
 +  371ms systemd-tmpfiles-setup.service 
 +  324ms systemd-sysctl.service 
 +lines 1-55
 </code> </code>
  
-<WRAP center round important 60%> +L'option **critical-chain** de la commande **systemd-analyze** permet de voir l'enchaînement des événements qui amènent au chargement de l'Unité qui est passée en argument :
-**Important** - La commande utilisée pour ajouter une passerelle par défaut prend la forme suivante **ip route add default via //adresse ip//**+
-</WRAP>+
  
-===Désactiver/Activer le routage sur le serveur===+<code> 
 +[root@redhat9 ~]# systemd-analyze critical-chain sshd.service 
 +The time when unit became active or started is printed after the "@" character. 
 +The time the unit took to start is printed after the "+" character.
  
-Pour désactiver le routage sur le serveur, il convient de désactiver la retransmission des paquets+sshd.service +464ms 
- +└─network.target @12.377s 
-Pour IPv4 : +  └─wpa_supplicant.service @25.556s +119ms 
- +    └─basic.target @7.432s 
-<code> +      └─dbus-broker.service @6.758s +671ms 
-[root@centos8 ~]# cat /proc/sys/net/ipv4/ip_forward +        └─dbus.socket @6.741s 
-1 +          └─sysinit.target @6.737s 
-[root@centos8 ~]# echo 0 > /proc/sys/net/ipv4/ip_forward +            └─systemd-update-utmp.service @6.721s +15ms 
-[root@centos8 ~]# cat /proc/sys/net/ipv4/ip_forward +              └─auditd.service @6.333s +376ms 
-0+                └─systemd-tmpfiles-setup.service @5.951s +371ms 
 +                  └─local-fs.target @5.939s 
 +                    └─run-user-42.mount @14.616s 
 +                      └─local-fs-pre.target @5.379s 
 +                        └─systemd-tmpfiles-setup-dev.service @3.398s +661ms 
 +                          └─kmod-static-nodes.service @3.243s +49ms 
 +                            └─systemd-journald.socket 
 +                              └─system.slice 
 +                                └─-.slice
 </code> </code>
  
-Pour activer le routage sur le serveur, il convient d'activer la retransmission des paquets:+Les options de la commande **systemd-analyze** sont :
  
 <code> <code>
-[root@centos8 ~]# echo 1 > /proc/sys/net/ipv4/ip_forward +[root@redhat9 ~]# systemd-analyze --help 
-[root@centos8 ~]# cat /proc/sys/net/ipv4/ip_forward +systemd-analyze [OPTIONS...COMMAND ...
-+
-</code>+
  
-Pour IPv6 :+Profile systemd, show unit dependencies, check unit files.
  
-<code> +Commands: 
-[root@centos8 ~]# cat /proc/sys/net/ipv6/conf/all/forwarding +  [time                    Print time required to boot the machine 
-1 +  blame                      Print list of running units ordered by 
-[root@centos8 ~]# echo "0" > /proc/sys/net/ipv6/conf/all/forwarding +                             time to init 
-[root@centos8 ~]cat /proc/sys/net/ipv6/conf/all/forwarding +  critical-chain [UNIT...  Print a tree of the time critical chain 
-0 +                             of units 
-</code>+  plot                       Output SVG graphic showing service 
 +                             initialization 
 +  dot [UNIT...             Output dependency graph in dot(1) format 
 +  dump [PATTERN...]          Output state serialization of service 
 +                             manager 
 +  cat-config                 Show configuration file and drop-ins 
 +  unit-files                 List files and symlinks for units 
 +  unit-paths                 List load directories for units 
 +  exit-status [STATUS...]    List exit status definitions 
 +  capability [CAP...]        List capability definitions 
 +  syscall-filter [NAME...]   List syscalls in seccomp filters 
 +  filesystems [NAME...]      List known filesystems 
 +  condition CONDITION...     Evaluate conditions and asserts 
 +  compare-versions VERSION1 [OP] VERSION2 
 +                             Compare two version strings 
 +  verify FILE...             Check unit files for correctness 
 +  calendar SPEC...           Validate repetitive calendar time 
 +                             events 
 +  timestamp TIMESTAMP...     Validate a timestamp 
 +  timespan SPAN...           Validate a time span 
 +  security [UNIT...]         Analyze security of unit 
 +  inspect-elf FILE...        Parse and print ELF package metadata
  
-Pour activer le routage sur le serveuril convient d'activer la retransmission des paquets: +Options: 
- +     --recursive-errors=MODE Control which units are verified 
-<code> +     --offline=BOOL          Perform a security review on unit file(s) 
-[root@centos8 ~]# echo "1" > /proc/sys/net/ipv6/conf/all/forwarding +     --threshold=N           Exit with a non-zero status when overall 
-[root@centos8 ~]# cat /proc/sys/net/ipv6/conf/all/forwarding +                             exposure level is over threshold value 
-1+     --security-policy=PATH  Use custom JSON security policy instead 
 +                             of built-in one 
 +     --json=pretty|short|off Generate JSON output of the security 
 +                             analysis tableor plot's raw time data 
 +     --no-pager              Do not pipe output into a pager 
 +     --no-legend             Disable column headers and hints in plot 
 +                             with either --table or --json= 
 +     --system                Operate on system systemd instance 
 +     --user                  Operate on user systemd instance 
 +     --global                Operate on global user configuration 
 +  -H --host=[USER@]HOST      Operate on remote host 
 +  -M --machine=CONTAINER     Operate on local container 
 +     --order                 Show only order in the graph 
 +     --require               Show only requirement in the graph 
 +     --from-pattern=GLOB     Show only origins in the graph 
 +     --to-pattern=GLOB       Show only destinations in the graph 
 +     --fuzz=SECONDS          Also print services which finished SECONDS 
 +lines 1-55
 </code> </code>
  
-=====LAB #Diagnostique du Réseau=====+====LAB #Les Cibles Systemd====
  
-====2.1 - ping==== +Chaque Cible est décrite par un fichier de configuration :
- +
-Pour tester l'accessibilité d'une machine, vous devez utiliser la commande **ping** :+
  
 <code> <code>
-[root@centos8 ~]# ping -c4 10.0.2.1 +[root@redhat9 ~]# cat /usr/lib/systemd/system/graphical.target 
-PING 10.0.2.1 (10.0.2.1) 56(84) bytes of data+#  SPDX-License-Identifier: LGPL-2.1-or-later 
-64 bytes from 10.0.2.1: icmp_seq=1 ttl=64 time=0.104 ms +
-64 bytes from 10.0.2.1: icmp_seq=2 ttl=64 time=0.325 ms +#  This file is part of systemd
-64 bytes from 10.0.2.1: icmp_seq=3 ttl=64 time=0.250 ms +# 
-64 bytes from 10.0.2.1: icmp_seq=4 ttl=64 time=0.123 ms+#  systemd is free software; you can redistribute it and/or modify it 
 +#  under the terms of the GNU Lesser General Public License as published by 
 +#  the Free Software Foundation; either version 2.1 of the License, or 
 +#  (at your option) any later version.
  
---- 10.0.2.1 ping statistics --- +[Unit] 
-4 packets transmitted, 4 received, 0% packet loss, time 3083ms +Description=Graphical Interface 
-rtt min/avg/max/mdev 0.104/0.200/0.325/0.092 ms+Documentation=man:systemd.special(7) 
 +Requires=multi-user.target 
 +Wants=display-manager.service 
 +Conflicts=rescue.service rescue.target 
 +After=multi-user.target rescue.service rescue.target display-manager.service 
 +AllowIsolate=yes
 </code> </code>
  
-===Options de la commande ping===+Dans ce fichier on peut noter la présence des lignes suivantes :
  
-Les options de cette commande sont :+  * **Requires=multi-user.target**, 
 +     * Cette ligne indique que le **graphical.target** ne peut pas être atteint si le **multi-user.target** n'a pas été atteint au préalable, 
 +  * **After=multi-user.target rescue.service rescue.target display-manager.service**, 
 +    * Cette ligne indique le **multi-user.target** et **rescue.target** doivent d'abord être atteints et que les services **rescue.service** et **display-manager.service** doivent d'abord être démarrés, 
 +  * **Conflicts=rescue.service rescue.target**, 
 +    * Cette ligne indique la Cible et le service en conflits avec le **graphical.target**, 
 +  * **Wants=display-manager.service**, 
 +    * Cette ligne indique quel service doit être démarré.
  
-<code> +===4.1 Contrôler les dépendances d'une Cible===
-[root@centos8 ~]# ping --help +
-ping: invalid option -- '-' +
-Usage: ping [-aAbBdDfhLnOqrRUvV64] [-c count] [-i interval] [-I interface] +
-            [-m mark] [-M pmtudisc_option] [-l preload] [-p pattern] [-Q tos] +
-            [-s packetsize] [-S sndbuf] [-t ttl] [-T timestamp_option] +
-            [-w deadline] [-W timeout] [hop1 ...] destination +
-Usage: ping -6 [-aAbBdDfhLnOqrRUvV] [-c count] [-i interval] [-I interface] +
-             [-l preload] [-m mark] [-M pmtudisc_option] +
-             [-N nodeinfo_option] [-p pattern] [-Q tclass] [-s packetsize] +
-             [-S sndbuf] [-t ttl] [-T timestamp_option] [-w deadline] +
-             [-W timeout] destination +
-</code>+
  
-====2.2 - netstat -i==== +Les dépendances d'une Cible peuvent être consultées en utilisant la commande **systemctl list-dependencies** :
- +
-Pour visualiser les statistiques réseaux, vous disposez de la commande **netstat** :+
  
 <code> <code>
-[root@centos8 ~]# netstat -i +[root@redhat9 ~]# systemctl list-dependencies multi-user.target 
-Kernel Interface table +multi-user.target 
-Iface             MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg +● ├─atd.service 
-ens18            1500   476056      0      0 0        363562      0      0      0 BMRU +● ├─auditd.service 
-lo              65536    10936      0      0 0         10936      0      0      0 LRU +● ├─avahi-daemon.service 
-virbr0           1500        0      0      0 0                  0      0      0 BMU+● ├─crond.service 
 +● ├─cups.path 
 +● ├─cups.service 
 +● ├─firewalld.service 
 +○ ├─insights-client-boot.service 
 +● ├─irqbalance.service 
 +● ├─kdump.service 
 +● ├─libstoragemgmt.service 
 +● ├─mcelog.service 
 +○ ├─mdmonitor.service 
 +● ├─ModemManager.service 
 +● ├─NetworkManager.service 
 +○ ├─ostree-readonly-sysroot-migration.service 
 +● ├─plymouth-quit-wait.service 
 +○ ├─plymouth-quit.service 
 +● ├─rhsmcertd.service 
 +● ├─rsyslog.service 
 +○ ├─smartd.service 
 +● ├─sshd.service 
 +○ ├─sssd.service 
 +● ├─systemd-ask-password-wall.path 
 +● ├─systemd-logind.service 
 +○ ├─systemd-update-utmp-runlevel.service 
 +● ├─systemd-user-sessions.service 
 +○ ├─tuned.service 
 +○ ├─vmtoolsd.service 
 +● ├─basic.target 
 +● │ ├─-.mount 
 +○ │ ├─low-memory-monitor.service 
 +○ │ ├─microcode.service 
 +● │ ├─paths.target 
 +● │ ├─slices.target 
 +● │ │ ├─-.slice 
 +● │ │ └─system.slice 
 +● │ ├─sockets.target 
 +● │ │ ├─avahi-daemon.socket 
 +● │ │ ├─cups.socket 
 +● │ │ ├─dbus.socket 
 +● │ │ ├─dm-event.socket 
 +● │ │ ├─iscsid.socket 
 +● │ │ ├─iscsiuio.socket 
 +○ │ │ ├─multipathd.socket 
 +● │ │ ├─sssd-kcm.socket 
 +● │ │ ├─systemd-coredump.socket 
 +● │ │ ├─systemd-initctl.socket 
 +● │ │ ├─systemd-journald-dev-log.socket 
 +● │ │ ├─systemd-journald.socket 
 +● │ │ ├─systemd-udevd-control.socket 
 +● │ │ └─systemd-udevd-kernel.socket 
 +● │ ├─sysinit.target 
 +● │ │ ├─dev-hugepages.mount 
 +lines 1-55
 </code> </code>
  
-===Options de la commande netstat===+Les points noirs au début de chaque ligne dans la sortie ci-dessus peuvent être de trois couleurs différentes :
  
-Les options de cette commande sont :+  * **Vert** implique que le service, la cible ou l'unité est activé et démarré.  
 +  * **Blanc** implique le service, la cible ou l'unité est inactif. 
 +  * **Rouge** implique que le service, la cible ou l'unité n'a pas démarré à cause d'une erreur fatale.
  
-<code> +Pour visualiser les Unités en état d'erreur fataleutilisez la commande **systemctl --failed** :
-[root@centos8 ~]# netstat --help +
-usage: netstat [-vWeenNcCF] [<Af>] -r         netstat {-V|--version|-h|--help} +
-       netstat [-vWnNcaeol] [<Socket> ...] +
-       netstat { [-vWeenNac] -I[<Iface>] | [-veenNac] -i | [-cnNe] -M | -s [-6tuw] } [delay] +
- +
-        -r, --route              display routing table +
-        -I, --interfaces=<Iface> display interface table for <Iface> +
-        -i, --interfaces         display interface table +
-        -g, --groups             display multicast group memberships +
-        -s, --statistics         display networking statistics (like SNMP) +
-        -M, --masquerade         display masqueraded connections +
- +
-        -v, --verbose            be verbose +
-        -W, --wide               don't truncate IP addresses +
-        -n--numeric            don't resolve names +
-        --numeric-hosts          don't resolve host names +
-        --numeric-ports          don't resolve port names +
-        --numeric-users          don't resolve user names +
-        -N, --symbolic           resolve hardware names +
-        -e, --extend             display other/more information +
-        -p, --programs           display PID/Program name for sockets +
-        -o, --timers             display timers +
-        -c, --continuous         continuous listing +
- +
-        -l, --listening          display listening server sockets +
-        -a, --all                display all sockets (default: connected) +
-        -F, --fib                display Forwarding Information Base (default) +
-        -C, --cache              display routing cache instead of FIB +
-        -Z, --context            display SELinux security context for sockets +
- +
-  <Socket>={-t|--tcp} {-u|--udp} {-U|--udplite} {-S|--sctp} {-w|--raw} +
-           {-x|--unix} --ax25 --ipx --netrom +
-  <AF>=Use '-6|-4' or '-A <af>' or '--<af>'; default: inet +
-  List of possible address families (which support routing): +
-    inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25)  +
-    netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP)  +
-    x25 (CCITT X.25) +
-</code> +
- +
-====2.3 - traceroute==== +
- +
-La commande ping est à la base de la commande **traceroute**. Cette commande sert à découvrir la route empruntée pour accéder à un site donné :+
  
 <code> <code>
-[root@centos8 ~]# traceroute www.ittraining.network +[root@redhat9 ~]# systemctl --failed 
-bash: traceroute: command not found... +  UNIT LOAD ACTIVE SUB DESCRIPTION 
-Install package 'traceroute' to provide command 'traceroute'? [N/y] y +loaded units listed.
- +
- +
- * Waiting in queue...  +
-The following packages have to be installed: +
- traceroute-3:2.1.0-6.el8.x86_64        Traces the route taken by packets over an IPv4/IPv6 network +
-Proceed with changes? [N/y] y +
- +
- +
- * Waiting in queue...  +
- * Waiting for authentication...  +
- * Waiting in queue...  +
- * Downloading packages...  +
- * Requesting data...  +
- * Testing changes...  +
- * Installing packages...  +
-traceroute to www.ittraining.network (109.228.56.52), 30 hops max, 60 byte packets +
-  _gateway (10.0.2.1)  0.132 ms  0.101 ms  0.078 ms +
- 2  79.137.68.252 (79.137.68.252)  0.542 ms  0.656 ms  0.809 ms +
-  10.50.24.61 (10.50.24.61)  0.238 ms  0.219 ms 10.50.24.60 (10.50.24.60)  0.239 ms +
-  10.50.0.16 (10.50.0.16)  0.172 ms 10.50.0.22 (10.50.0.22)  0.194 ms  0.173 ms +
-  10.73.248.192 (10.73.248.192)  0.766 ms 10.73.248.194 (10.73.248.194)  0.730 ms 10.73.248.192 (10.73.248.192)  0.757 ms +
-  waw-wa2-sbb1-nc5.pl.eu (91.121.131.150)  1.102 ms  1.396 ms  1.099 ms +
-  fra-fr5-sbb1-nc5.de.eu (213.251.128.113)  18.309 ms fra-fr5-sbb2-nc5.de.eu (54.36.50.116)  21.881 ms fra-fr5-sbb1-nc5.de.eu (213.251.128.113)  16.764 ms +
-  10.200.0.6 (10.200.0.6)  20.922 ms 10.200.0.0 (10.200.0.0)  16.959 ms 10.200.0.4 (10.200.0.4)  21.143 ms +
-  decix.bb-a.fra3.fra.de.oneandone.net (80.81.192.123)  18.789 ms decix.bb-c.act.fra.de.oneandone.net (80.81.193.123)  20.310 ms decix.bb-a.fra3.fra.de.oneandone.net (80.81.192.123)  18.693 ms +
-10  ae-14.bb-b.fr7.fra.de.oneandone.net (212.227.120.149)  22.222 ms  22.206 ms  22.257 ms +
-11  port-channel-3.gw-ngcs-1.dc1.con.glo.gb.oneandone.net (88.208.255.131)  39.660 ms  39.679 ms ae-19.bb-b.thn.lon.gb.oneandone.net (212.227.120.33)  33.973 ms +
-12  109.228.63.209 (109.228.63.209)  37.363 ms port-channel-3.gw-ngcs-1.dc1.con.glo.gb.oneandone.net (88.208.255.131)  39.534 ms 109.228.63.209 (109.228.63.209)  37.901 ms +
-13  * 109.228.63.209 (109.228.63.209)  38.014 ms  37.991 ms +
-14  * * * +
-15  * * * +
-16  * * * +
-17  * * * +
-18  * * * +
-19  * * * +
-20  * * * +
-21  * * * +
-22  * * * +
-23  * * * +
-24  * * * +
-25  * * * +
-26  * * * +
-27  * * * +
-28  * * * +
-29  * * *^C+
 </code> </code>
  
-===Options de la commande traceroute=== +Les dépendances sont créés sous la forme de liens symboliques dans les répertoires **/etc/systemd/system/multi-user.target.wants** et **/usr/lib/systemd/system/multi-user.target.wants** :
- +
-Les options de cette commande sont :+
  
 <code> <code>
-[root@centos8 ~]# traceroute --help +[root@redhat9 ~]# ls -l /etc/systemd/system/multi-user.target.wants 
-Usage: +total 0 
-  traceroute [ -46dFITnreAUDV ] [ -f first_ttl ] [ -g gate,... ] [ -i device ] [ -m max_ttl ] [ -N squeries ] [ -p port ] [ -t tos ] [ -l flow_label ] [ -w MAX,HERE,NEAR ] [ -q nqueries ] [ -s src_addr ] [ -z sendwait ] [ --fwmark=num ] host [ packetlen ] +lrwxrwxrwx. 1 root root 35 Oct 19  2023 atd.service -> /usr/lib/systemd/system/atd.service 
-Options: +lrwxrwxrwx. 1 root root 38 Oct 19  2023 auditd.service -> /usr/lib/systemd/system/auditd.service 
-  -4                          Use IPv4 +lrwxrwxrwx. 1 root root 44 Oct 19  2023 avahi-daemon.service -> /usr/lib/systemd/system/avahi-daemon.service 
-  -6                          Use IPv6 +lrwxrwxrwx. 1 root root 37 Oct 19  2023 crond.service -> /usr/lib/systemd/system/crond.service 
-  -d  --debug                 Enable socket level debugging +lrwxrwxrwx. 1 root root 33 Oct 19  2023 cups.path -> /usr/lib/systemd/system/cups.path 
-  -F  --dont-fragment         Do not fragment packets +lrwxrwxrwx. root root 36 Oct 19  2023 cups.service -> /usr/lib/systemd/system/cups.service 
-  -f first_ttl  --first=first_ttl +lrwxrwxrwx1 root root 41 Oct 19  2023 firewalld.service -> /usr/lib/systemd/system/firewalld.service 
-                              Start from the first_ttl hop (instead from 1+lrwxrwxrwx. 1 root root 52 Oct 19  2023 insights-client-boot.service -> /usr/lib/systemd/system/insights-client-boot.service 
-  -g gate,...  --gateway=gate,... +lrwxrwxrwx. 1 root root 42 Oct 19  2023 irqbalance.service -> /usr/lib/systemd/system/irqbalance.service 
-                              Route packets through the specified gateway +lrwxrwxrwx. 1 root root 37 Oct 19  2023 kdump.service -> /usr/lib/systemd/system/kdump.service 
-                              (maximum 8 for IPv4 and 127 for IPv6) +lrwxrwxrwx. 1 root root 46 Oct 19  2023 libstoragemgmt.service -> /usr/lib/systemd/system/libstoragemgmt.service 
-  -I  --icmp                  Use ICMP ECHO for tracerouting +lrwxrwxrwx. 1 root root 38 Oct 19  2023 mcelog.service -> /usr/lib/systemd/system/mcelog.service 
-  -T  --tcp                   Use TCP SYN for tracerouting (default port is 80) +lrwxrwxrwx. 1 root root 41 Oct 19  2023 mdmonitor.service -> /usr/lib/systemd/system/mdmonitor.service 
-  -i device  --interface=device +lrwxrwxrwx1 root root 44 Oct 19  2023 ModemManager.service -> /usr/lib/systemd/system/ModemManager.service 
-                              Specify a network interface to operate with +lrwxrwxrwx. 1 root root 46 Oct 19  2023 NetworkManager.service -> /usr/lib/systemd/system/NetworkManager.service 
-  -m max_ttl  --max-hops=max_ttl +lrwxrwxrwx. 1 root root 40 Oct 19  2023 remote-fs.target -> /usr/lib/systemd/system/remote-fs.target 
-                              Set the max number of hops (max TTL to be +lrwxrwxrwx1 root root 41 Oct 19  2023 rhsmcertd.service -> /usr/lib/systemd/system/rhsmcertd.service 
-                              reached)Default is 30 +lrwxrwxrwx1 root root 39 Oct 19  2023 rsyslog.service -> /usr/lib/systemd/system/rsyslog.service 
-  -N squeries  --sim-queries=squeries +lrwxrwxrwx1 root root 38 Oct 19  2023 smartd.service -> /usr/lib/systemd/system/smartd.service 
-                              Set the number of probes to be tried +lrwxrwxrwx1 root root 36 Oct 19  2023 sshd.service -> /usr/lib/systemd/system/sshd.service 
-                              simultaneously (default is 16) +lrwxrwxrwx1 root root 36 Oct 19  2023 sssd.service -> /usr/lib/systemd/system/sssd.service 
-  -n                          Do not resolve IP addresses to their domain names +lrwxrwxrwx. root root 37 Oct 19  2023 tuned.service -> /usr/lib/systemd/system/tuned.service 
-  -p port  --port=port        Set the destination port to useIt is either +lrwxrwxrwx. 1 root root 40 Oct 19  2023 vmtoolsd.service -> /usr/lib/systemd/system/vmtoolsd.service
-                              initial udp port value for "default" method +
-                              (incremented by each probe, default is 33434), or +
-                              initial seq for "icmp" (incremented as well, +
-                              default from 1), or some constant destination +
-                              port for other methods (with default of 80 for +
-                              "tcp", 53 for "udp", etc.+
-  -t tos  --tos=tos           Set the TOS (IPv4 type of service) or TC (IPv6 +
-                              traffic class) value for outgoing packets +
-  -l flow_label  --flowlabel=flow_label +
-                              Use specified flow_label for IPv6 packets +
-  -w MAX,HERE,NEAR  --wait=MAX,HERE,NEAR +
-                              Wait for a probe no more than HERE (default 3) +
-                              times longer than a response from the same hop, +
-                              or no more than NEAR (default 10) times than some +
-                              next hop, or MAX (default 5.0) seconds (float +
-                              point values allowed too) +
-  -q nqueries  --queries=nqueries +
-                              Set the number of probes per each hopDefault is +
-                              3 +
-  -r                          Bypass the normal routing and send directly to a +
-                              host on an attached network +
-  -s src_addr  --source=src_addr +
-                              Use source src_addr for outgoing packets +
-  -z sendwait  --sendwait=sendwait +
-                              Minimal time interval between probes (default 0). +
-                              If the value is more than 10, then it specifies a +
-                              number in milliseconds, else it is a number of +
-                              seconds (float point values allowed too) +
-  -e  --extensions            Show ICMP extensions (if present), including MPLS +
-  -A  --as-path-lookups       Perform AS path lookups in routing registries and +
-                              print results directly after the corresponding +
-                              addresses +
-  -M name  --module=name      Use specified module (either builtin or external) +
-                              for traceroute operationsMost methods have +
-                              their shortcuts (`-I' means `-M icmp' etc.) +
-  -O OPTS,...  --options=OPTS,... +
-                              Use module-specific option OPTS for the +
-                              traceroute moduleSeveral OPTS allowed, +
-                              separated by commaIf OPTS is "help", print info +
-                              about available options +
-  --sport=num                 Use source port num for outgoing packetsImplies +
-                              `-N 1+
-  --fwmark=num                Set firewall mark for outgoing packets +
-  -U  --udp                   Use UDP to particular port for tracerouting +
-                              (instead of increasing the port per each probe), +
-                              default port is 53 +
-  -UL                         Use UDPLITE for tracerouting (default dest port +
-                              is 53) +
-  -D  --dccp                  Use DCCP Request for tracerouting (default port +
-                              is 33434) +
-  -P prot  --protocol=prot    Use raw packet of protocol prot for tracerouting +
-  --mtu                       Discover MTU along the path being tracedImplies +
-                              `-F -N 1+
-  --back                      Guess the number of hops in the backward path and +
-                              print if it differs +
-  -V  --version               Print version info and exit +
-  --help                      Read this help and exit+
  
-Arguments+[root@redhat9 ~]# ls -l /usr/lib/systemd/system/multi-user.target.wants 
-+     host          The host to traceroute to +total 0 
-      packetlen     The full packet length (default is the length of an IP +lrwxrwxrwx. 1 root root 15 Jul 18 13:00 getty.target -> ../getty.target 
-                    header plus 40)Can be ignored or increased to a minimal +lrwxrwxrwx. 1 root root 44 May 17 18:27 ostree-readonly-sysroot-migration.service -> ../ostree-readonly-sysroot-migration.service 
-                    allowed value+lrwxrwxrwx. 1 root root 24 Jul 14  2023 plymouth-quit.service -> ../plymouth-quit.service 
 +lrwxrwxrwx1 root root 29 Jul 14  2023 plymouth-quit-wait.service -> ../plymouth-quit-wait.service 
 +lrwxrwxrwx. 1 root root 33 Jul 18 13:00 systemd-ask-password-wall.path -> ../systemd-ask-password-wall.path 
 +lrwxrwxrwx. 1 root root 25 Jul 18 13:00 systemd-logind.service -> ../systemd-logind.service 
 +lrwxrwxrwx. 1 root root 39 Jul 18 13:00 systemd-update-utmp-runlevel.service -> ../systemd-update-utmp-runlevel.service 
 +lrwxrwxrwx. 1 root root 32 Jul 18 13:00 systemd-user-sessions.service -> ../systemd-user-sessions.service
 </code> </code>
  
-=====LAB #3 Connexions à Distance=====+===4.2 La Cible par Défaut===
  
-==== 3.1 - Telnet ====+==Consulter la Cible par Défaut==
  
-<WRAP center round important> +Pour consulter la cible par défaut, il convient d'utiliser la commande **systemctl get-default** :
-**Important** - Si la commande **telnet** n'est pas installée sous CentOS 8, installez-le à l'aide de la commande **dnf install telnet** en tant que root. +
-</WRAP> +
- +
-La commande **telnet** est utilisée pour établir une connexion à distance avec un serveur telnet : +
- +
-<file> +
-  # telnet numero_ip +
-</file> +
- +
-<WRAP center round important 60%> +
-**Important** - Le service telnet revient à une redirection des canaux standards d'entrée et de sortie. Notez que la connexion n'est **pas** sécurisée. Pour fermer la connexion, il faut saisir la commande **exit**. La commande telnet n'offre pas de services de transfert de fichiers. Pour cela, il convient d'utiliser la command **ftp**+
-</WRAP> +
- +
-===Options de la commande telnet=== +
- +
-Les options de cette commande sont :+
  
 <code> <code>
-[[root@centos8 ~]# telnet --help +[root@redhat9 ~]# systemctl get-default 
-telnet: invalid option -- '-' +graphical.target
-Usage: telnet [-4] [-6] [-8] [-E] [-L] [-S tos] [-a] [-c] [-d] [-e char] [-l user] +
-        [-n tracefile] [-b hostalias ] [-r]  +
- [host-name [port]]+
 </code> </code>
  
-==== 3.2 - wget ==== +La Cible par défaut est représentée par le lien symbolique **/etc/systemd/system/default.target** :
- +
-La commande **wget** est utilisée pour récupérer un fichier via http, https ou ftp +
  
 <code> <code>
-[root@centos8 ~]# wget https://www.dropbox.com/s/wk79lkfr6f12u9j/wget_file.txt +[root@redhat9 ~]# ls -l /etc/systemd/system/default.target 
-... +lrwxrwxrwx1 root root 40 Oct 19  2023 /etc/systemd/system/default.target -> /usr/lib/systemd/system/graphical.target
- +
-[root@centos8 ~]# cat wget_file.txt  +
-This is a file retrieved by the wget command.+
 </code> </code>
  
-===Options de la commande wget===+==Modifier la Cible par Défaut==
  
-Les options de cette commande sont :+Pour modifier la Cible par défaut avec une prise en compte lors du **prochain** démarrage, il convient d'utiliser la commande **systemctl set-default** :
  
 <code> <code>
-[root@centos8 ~]# wget --help +[root@redhat9 ~]# systemctl set-default multi-user.target 
-GNU Wget 1.19.5, a non-interactive network retriever+Removed "/etc/systemd/system/default.target"
-Usage: wget [OPTION]... [URL]...+Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/multi-user.target.
  
-Mandatory arguments to long options are mandatory for short options too.+[root@redhat9 ~]# ls -l /etc/systemd/system/default.target 
 +lrwxrwxrwx. 1 root root 41 Sep 26 14:50 /etc/systemd/system/default.target -> /usr/lib/systemd/system/multi-user.target
  
-Startup: +[root@redhat9 ~]# systemctl set-default graphical.target 
-  -V,  --version                   display the version of Wget and exit +Removed "/etc/systemd/system/default.target". 
-  -h,  --help                      print this help +Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/graphical.target.
-  -b,  --background                go to background after startup +
-  -e,  --execute=COMMAND           execute a `.wgetrc'-style command+
  
-Logging and input file: +[root@redhat9 ~]# ls -l /etc/systemd/system/default.target 
-  -o,  --output-file=FILE          log messages to FILE +lrwxrwxrwx. 1 root root 40 Sep 26 14:51 /etc/systemd/system/default.target -> /usr/lib/systemd/system/graphical.target 
-  -a,  --append-output=FILE        append messages to FILE +</code>
-  -d,  --debug                     print lots of debugging information +
-  -q,  --quiet                     quiet (no output) +
-  -v,  --verbose                   be verbose (this is the default+
-  -nv, --no-verbose                turn off verboseness, without being quiet +
-       --report-speed=TYPE         output bandwidth as TYPE TYPE can be bits +
-  -i,  --input-file=FILE           download URLs found in local or external FILE +
-       --input-metalink=FILE       download files covered in local Metalink FILE +
-  -F,  --force-html                treat input file as HTML +
-  -B,  --base=URL                  resolves HTML input-file links (-i -F) +
-                                     relative to URL +
-       --config=FILE               specify config file to use +
-       --no-config                 do not read any config file +
-       --rejected-log=FILE         log reasons for URL rejection to FILE+
  
-Download: +==Modifier la Cible en Cours==
-  -t,  --tries=NUMBER              set number of retries to NUMBER (0 unlimits) +
-       --retry-connrefused         retry even if connection is refused +
-       --retry-on-http-error=ERRORS    comma-separated list of HTTP errors to retry +
-  -O,  --output-document=FILE      write documents to FILE +
-  -nc, --no-clobber                skip downloads that would download to +
-                                     existing files (overwriting them) +
-       --no-netrc                  don't try to obtain credentials from .netrc +
-  -c,  --continue                  resume getting a partially-downloaded file +
-       --start-pos=OFFSET          start downloading from zero-based position OFFSET +
-       --progress=TYPE             select progress gauge type +
-       --show-progress             display the progress bar in any verbosity mode +
-  -N,  --timestamping              don't re-retrieve files unless newer than +
-                                     local +
-       --no-if-modified-since      don't use conditional if-modified-since get +
-                                     requests in timestamping mode +
-       --no-use-server-timestamps  don't set the local file's timestamp by +
-                                     the one on the server +
-  -S,  --server-response           print server response +
-       --spider                    don't download anything +
-  -T,  --timeout=SECONDS           set all timeout values to SECONDS +
-       --dns-timeout=SECS          set the DNS lookup timeout to SECS +
-       --connect-timeout=SECS      set the connect timeout to SECS +
-       --read-timeout=SECS         set the read timeout to SECS +
-  -w,  --wait=SECONDS              wait SECONDS between retrievals +
-       --waitretry=SECONDS         wait 1..SECONDS between retries of a retrieval +
-       --random-wait               wait from 0.5*WAIT...1.5*WAIT secs between retrievals +
-       --no-proxy                  explicitly turn off proxy +
-  -Q,  --quota=NUMBER              set retrieval quota to NUMBER +
-       --bind-address=ADDRESS      bind to ADDRESS (hostname or IP) on local host +
-       --limit-rate=RATE           limit download rate to RATE +
-       --no-dns-cache              disable caching DNS lookups +
-       --restrict-file-names=OS    restrict chars in file names to ones OS allows +
-       --ignore-case               ignore case when matching files/directories +
-  -4,  --inet4-only                connect only to IPv4 addresses +
-  -6,  --inet6-only                connect only to IPv6 addresses +
-       --prefer-family=FAMILY      connect first to addresses of specified family, +
-                                     one of IPv6, IPv4, or none +
-       --user=USER                 set both ftp and http user to USER +
-       --password=PASS             set both ftp and http password to PASS +
-       --ask-password              prompt for passwords +
-       --use-askpass=COMMAND       specify credential handler for requesting  +
-                                     username and password.  If no COMMAND is  +
-                                     specified the WGET_ASKPASS or the SSH_ASKPASS  +
-                                     environment variable is used. +
-       --no-iri                    turn off IRI support +
-       --local-encoding=ENC        use ENC as the local encoding for IRIs +
-       --remote-encoding=ENC       use ENC as the default remote encoding +
-       --unlink                    remove file before clobber +
-       --keep-badhash              keep files with checksum mismatch (append .badhash) +
-       --metalink-index=NUMBER     Metalink application/metalink4+xml metaurl ordinal NUMBER +
-       --metalink-over-http        use Metalink metadata from HTTP response headers +
-       --preferred-location        preferred location for Metalink resources +
-       --xattr                     turn on storage of metadata in extended file attributes+
  
-Directories: +Il est possible de modifier la cible actuellement en cours en utilisant la commande **systemctl isolate** :
-  -nd, --no-directories            don't create directories +
-  -x,  --force-directories         force creation of directories +
-  -nH, --no-host-directories       don't create host directories +
-       --protocol-directories      use protocol name in directories +
-  -P,  --directory-prefix=PREFIX   save files to PREFIX/.. +
-       --cut-dirs=NUMBER           ignore NUMBER remote directory components+
  
-HTTP options: +<code> 
-       --http-user=USER            set http user to USER +[root@redhat9 ~]# systemctl isolate rescue
-       --http-password=PASS        set http password to PASS +
-       --no-cache                  disallow server-cached data +
-       --default-page=NAME         change the default page name (normally +
-                                     this is 'index.html'.) +
-  -E,  --adjust-extension          save HTML/CSS documents with proper extensions +
-       --ignore-length             ignore 'Content-Length' header field +
-       --header=STRING             insert STRING among the headers +
-       --compression=TYPE          choose compression, one of auto, gzip and none. (default: none) +
-       --max-redirect              maximum redirections allowed per page +
-       --proxy-user=USER           set USER as proxy username +
-       --proxy-password=PASS       set PASS as proxy password +
-       --referer=URL               include 'Referer: URL' header in HTTP request +
-       --save-headers              save the HTTP headers to file +
-  -U,  --user-agent=AGENT          identify as AGENT instead of Wget/VERSION +
-       --no-http-keep-alive        disable HTTP keep-alive (persistent connections) +
-       --no-cookies                don't use cookies +
-       --load-cookies=FILE         load cookies from FILE before session +
-       --save-cookies=FILE         save cookies to FILE after session +
-       --keep-session-cookies      load and save session (non-permanent) cookies +
-       --post-data=STRING          use the POST method; send STRING as the data +
-       --post-file=FILE            use the POST method; send contents of FILE +
-       --method=HTTPMethod         use method "HTTPMethod" in the request +
-       --body-data=STRING          send STRING as data. --method MUST be set +
-       --body-file=FILE            send contents of FILE. --method MUST be set +
-       --content-disposition       honor the Content-Disposition header when +
-                                     choosing local file names (EXPERIMENTAL) +
-       --content-on-error          output the received content on server errors +
-       --auth-no-challenge         send Basic HTTP authentication information +
-                                     without first waiting for the server'+
-                                     challenge+
  
-HTTPS (SSL/TLS) options: +[root@redhat9 ~]# systemctl list-units --type target | egrep "eme|res|gra|mul" | head -1 
-       --secure-protocol=PR        choose secure protocol, one of auto, SSLv2, +  rescue.target         loaded active active Rescue Mode 
-                                     SSLv3, TLSv1, TLSv1_1, TLSv1_2 and PFS +             
-       --https-only                only follow secure HTTPS links +[root@redhat9 ~]# runlevel 
-       --no-check-certificate      don't validate the server's certificate +5 1
-       --certificate=FILE          client certificate file +
-       --certificate-type=TYPE     client certificate type, PEM or DER +
-       --private-key=FILE          private key file +
-       --private-key-type=TYPE     private key type, PEM or DER +
-       --ca-certificate=FILE       file with the bundle of CAs +
-       --ca-directory=DIR          directory where hash list of CAs is stored +
-       --crl-file=FILE             file with bundle of CRLs +
-       --pinnedpubkey=FILE/HASHES  Public key (PEM/DER) file, or any number +
-                                   of base64 encoded sha256 hashes preceded by +
-                                   'sha256//' and separated by ';', to verify +
-                                   peer against+
  
-       --ciphers=STR           Set the priority string (GnuTLS) or cipher list string (OpenSSL) directly. +[root@redhat9 ~]# who -r 
-                                   Use with care. This option overrides --secure-protocol. +         run-level  2024-09-26 14:52                   last=5
-                                   The format and syntax of this string depend on the specific SSL/TLS engine. +
-HSTS options: +
-       --no-hsts                   disable HSTS +
-       --hsts-file                 path of HSTS database (will override default) +
- +
-FTP options: +
-       --ftp-user=USER             set ftp user to USER +
-       --ftp-password=PASS         set ftp password to PASS +
-       --no-remove-listing         don't remove '.listing' files +
-       --no-glob                   turn off FTP file name globbing +
-       --no-passive-ftp            disable the "passive" transfer mode +
-       --preserve-permissions      preserve remote file permissions +
-       --retr-symlinks             when recursing, get linked-to files (not dir) +
- +
-FTPS options: +
-       --ftps-implicit                 use implicit FTPS (default port is 990) +
-       --ftps-resume-ssl               resume the SSL/TLS session started in the control connection when +
-                                         opening a data connection +
-       --ftps-clear-data-connection    cipher the control channel only; all the data will be in plaintext +
-       --ftps-fallback-to-ftp          fall back to FTP if FTPS is not supported in the target server +
-WARC options: +
-       --warc-file=FILENAME        save request/response data to a .warc.gz file +
-       --warc-header=STRING        insert STRING into the warcinfo record +
-       --warc-max-size=NUMBER      set maximum size of WARC files to NUMBER +
-       --warc-cdx                  write CDX index files +
-       --warc-dedup=FILENAME       do not store records listed in this CDX file +
-       --no-warc-compression       do not compress WARC files with GZIP +
-       --no-warc-digests           do not calculate SHA1 digests +
-       --no-warc-keep-log          do not store the log file in a WARC record +
-       --warc-tempdir=DIRECTORY    location for temporary files created by the +
-                                     WARC writer +
- +
-Recursive download: +
-  -r,  --recursive                 specify recursive download +
-  -l,  --level=NUMBER              maximum recursion depth (inf or 0 for infinite) +
-       --delete-after              delete files locally after downloading them +
-  -k,  --convert-links             make links in downloaded HTML or CSS point to +
-                                     local files +
-       --convert-file-only         convert the file part of the URLs only (usually known as the basename) +
-       --backups=N                 before writing file X, rotate up to N backup files +
-  -K,  --backup-converted          before converting file X, back up as X.orig +
-  -m,  --mirror                    shortcut for -N -r -l inf --no-remove-listing +
-  -p,  --page-requisites           get all images, etc. needed to display HTML page +
-       --strict-comments           turn on strict (SGML) handling of HTML comments +
- +
-Recursive accept/reject: +
-  -A,  --accept=LIST               comma-separated list of accepted extensions +
-  -R,  --reject=LIST               comma-separated list of rejected extensions +
-       --accept-regex=REGEX        regex matching accepted URLs +
-       --reject-regex=REGEX        regex matching rejected URLs +
-       --regex-type=TYPE           regex type (posix) +
-  -D,  --domains=LIST              comma-separated list of accepted domains +
-       --exclude-domains=LIST      comma-separated list of rejected domains +
-       --follow-ftp                follow FTP links from HTML documents +
-       --follow-tags=LIST          comma-separated list of followed HTML tags +
-       --ignore-tags=LIST          comma-separated list of ignored HTML tags +
-  -H,  --span-hosts                go to foreign hosts when recursive +
-  -L,  --relative                  follow relative links only +
-  -I,  --include-directories=LIST  list of allowed directories +
-       --trust-server-names        use the name specified by the redirection +
-                                     URL'last component +
-  -X,  --exclude-directories=LIST  list of excluded directories +
-  -np, --no-parent                 don't ascend to the parent directory +
- +
-Email bug reports, questions, discussions to <bug-wget@gnu.org> +
-and/or open issues at https://savannah.gnu.org/bugs/?func=additem&group=wget.+
 </code> </code>
- 
-==== 3.3 - ftp ==== 
- 
-<WRAP center round important 60%> 
-**Important** - Si la commande **ftp** n'est pas installée sous CentOS 8, installez-le à l'aide de la commande **dnf install ftp** en tant que root. 
-</WRAP> 
- 
-La commande **ftp** est utilisée pour le transfert de fichiers. Une fois connecté, il convient d'utiliser la commande **help** pour afficher la liste des commandes disponibles : 
  
 <code> <code>
-ftp> help +[root@redhat9 ~]# systemctl isolate graphical
-Commands may be abbreviated.  Commands are:+
  
-! debug mdir sendport site +[root@redhat9 ~]# systemctl list-units --type target | egrep "eme|res|gra|mul" | head -1 
-$ dir mget put size +  graphical.target       loaded active active Graphical Interface
-account disconnect mkdir pwd status +
-append exit mls quit struct +
-ascii form mode quote system +
-bell get modtime recv sunique +
-binary glob mput reget tenex +
-bye hash newer rstatus tick +
-case help nmap rhelp trace +
-cd idle nlist rename type +
-cdup image ntrans reset user +
-chmod lcd open restart umask +
-close ls prompt rmdir verbose +
-cr macdef passive runique ? +
-delete mdelete proxy send +
-ftp>  +
-</code>+
  
-Le caractère **!** permet d'exécuter une commande sur la machine cliente+[root@redhat9 ~]# runlevel 
 +1 5
  
-<code> +[root@redhat9 ~]# who -r 
-ftp> !pwd +         run-level 5  2024-09-26 14:55                   last=1
-/root+
 </code> </code>
  
-Pour transférer un fichier vers le serveur, il convient d'utiliser la commande **put** :+====LAB #5 - Gestion des Services====
  
-<file> +===5.1 - Gestion des Instances Uniques===
-ftp> put nom_fichier_local nom_fichier_distant +
-</file>+
  
-Vous pouvez également transférer plusieurs fichiers à la fois grâce à la commande **mput**. Dans ce cas précis, il convient de saisir la commande suivante:+Commencez par installer le paquet **httpd** :
  
-<file+<code
-ftp> mput nom*.* +[root@redhat9 ~]# dnf install httpd 
-</file>+Updating Subscription Management repositories
 +Last metadata expiration check: 1:59:56 ago on Thu 26 Sep 2024 12:57:02 PM CEST. 
 +Dependencies resolved. 
 +================================================================================================================================================================================================================== 
 + Package                                           Architecture                          Version                                            Repository                                                       Size 
 +================================================================================================================================================================================================================== 
 +Installing: 
 + httpd                                             x86_64                                2.4.57-11.el9_4.1                                  rhel-9-for-x86_64-appstream-rpms                                 51 k 
 +Installing dependencies: 
 + apr                                               x86_64                                1.7.0-12.el9_3                                     rhel-9-for-x86_64-appstream-rpms                                126 k 
 + apr-util                                          x86_64                                1.6.1-23.el9                                       rhel-9-for-x86_64-appstream-rpms                                 97 k 
 + apr-util-bdb                                      x86_64                                1.6.1-23.el9                                       rhel-9-for-x86_64-appstream-rpms                                 14 k 
 + httpd-core                                        x86_64                                2.4.57-11.el9_4.1                                  rhel-9-for-x86_64-appstream-rpms                                1.5 M 
 + httpd-filesystem                                  noarch                                2.4.57-11.el9_4.1                                  rhel-9-for-x86_64-appstream-rpms                                 14 k 
 + httpd-tools                                       x86_64                                2.4.57-11.el9_4.1                                  rhel-9-for-x86_64-appstream-rpms                                 86 k 
 + redhat-logos-httpd                                noarch                                90.4-2.el9                                         rhel-9-for-x86_64-appstream-rpms                                 18 k 
 +Installing weak dependencies: 
 + apr-util-openssl                                  x86_64                                1.6.1-23.el9                                       rhel-9-for-x86_64-appstream-rpms                                 17 k 
 + mod_http2                                         x86_64                                2.0.26-2.el9_4                                     rhel-9-for-x86_64-appstream-rpms                                167 k 
 + mod_lua                                           x86_64                                2.4.57-11.el9_4.1                                  rhel-9-for-x86_64-appstream-rpms                                 60 k
  
-Pour transférer un fichier du serveur, il convient d'utiliser la commande **get** :+Transaction Summary 
 +================================================================================================================================================================================================================== 
 +Install  11 Packages
  
-<file> +Total download size: 2.2 M 
-ftp> get nom_fichier +Installed size: 6.0 M 
-</file>+Is this ok [y/N]: y 
 +Downloading Packages: 
 +(1/11): apr-util-bdb-1.6.1-23.el9.x86_64.rpm                                                                                                                                       28 kB/s |  14 kB     00:00     
 +(2/11): apr-util-openssl-1.6.1-23.el9.x86_64.rpm                                                                                                                                   31 kB/s |  17 kB     00:00     
 +(3/11): apr-util-1.6.1-23.el9.x86_64.rpm                                                                                                                                          165 kB/s |  97 kB     00:00     
 +(4/11): redhat-logos-httpd-90.4-2.el9.noarch.rpm                                                                                                                                   69 kB/s |  18 kB     00:00     
 +(5/11): apr-1.7.0-12.el9_3.x86_64.rpm                                                                                                                                             374 kB/s | 126 kB     00:00     
 +(6/11): mod_http2-2.0.26-2.el9_4.x86_64.rpm                                                                                                                                       435 kB/s | 167 kB     00:00     
 +(7/11): httpd-core-2.4.57-11.el9_4.1.x86_64.rpm                                                                                                                                   2.9 MB/s | 1.5 MB     00:00     
 +(8/11): httpd-filesystem-2.4.57-11.el9_4.1.noarch.rpm                                                                                                                              31 kB/s |  14 kB     00:00     
 +(9/11): httpd-2.4.57-11.el9_4.1.x86_64.rpm                                                                                                                                         63 kB/s |  51 kB     00:00     
 +(10/11): httpd-tools-2.4.57-11.el9_4.1.x86_64.rpm                                                                                                                                 297 kB/s |  86 kB     00:00     
 +(11/11): mod_lua-2.4.57-11.el9_4.1.x86_64.rpm                                                                                                                                     154 kB/s |  60 kB     00:00     
 +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
 +Total                                                                                                                                                                             1.2 MB/s | 2.2 MB     00:01      
 +Running transaction check 
 +Transaction check succeeded. 
 +Running transaction test 
 +Transaction test succeeded. 
 +Running transaction 
 +  Preparing        :                                                                                                                                                                                          1/1  
 +  Installing       : apr-1.7.0-12.el9_3.x86_64                                                                                                                                                               1/11  
 +  Installing       : apr-util-bdb-1.6.1-23.el9.x86_64                                                                                                                                                        2/11  
 +  Installing       : apr-util-openssl-1.6.1-23.el9.x86_64                                                                                                                                                    3/11  
 +  Installing       : apr-util-1.6.1-23.el9.x86_64                                                                                                                                                            4/11  
 +  Installing       : httpd-tools-2.4.57-11.el9_4.1.x86_64                                                                                                                                                    5/11  
 +  Running scriptlet: httpd-filesystem-2.4.57-11.el9_4.1.noarch                                                                                                                                               6/11  
 +  Installing       : httpd-filesystem-2.4.57-11.el9_4.1.noarch                                                                                                                                               6/11  
 +  Installing       : httpd-core-2.4.57-11.el9_4.1.x86_64                                                                                                                                                     7/11  
 +  Installing       : mod_lua-2.4.57-11.el9_4.1.x86_64                                                                                                                                                        8/11  
 +  Installing       : redhat-logos-httpd-90.4-2.el9.noarch                                                                                                                                                    9/11  
 +  Installing       : mod_http2-2.0.26-2.el9_4.x86_64                                                                                                                                                        10/11  
 +  Installing       : httpd-2.4.57-11.el9_4.1.x86_64                                                                                                                                                         11/11  
 +  Running scriptlet: httpd-2.4.57-11.el9_4.1.x86_64                                                                                                                                                         11/11  
 +  Verifying        : apr-util-1.6.1-23.el9.x86_64                                                                                                                                                            1/11  
 +  Verifying        : apr-util-bdb-1.6.1-23.el9.x86_64                                                                                                                                                        2/11  
 +  Verifying        : apr-util-openssl-1.6.1-23.el9.x86_64                                                                                                                                                    3/11  
 +  Verifying        : redhat-logos-httpd-90.4-2.el9.noarch                                                                                                                                                    4/11  
 +  Verifying        : apr-1.7.0-12.el9_3.x86_64                                                                                                                                                               5/11  
 +  Verifying        : mod_http2-2.0.26-2.el9_4.x86_64                                                                                                                                                         6/11  
 +  Verifying        : httpd-2.4.57-11.el9_4.1.x86_64                                                                                                                                                          7/11  
 +  Verifying        : httpd-core-2.4.57-11.el9_4.1.x86_64                                                                                                                                                     8/11  
 +  Verifying        : httpd-filesystem-2.4.57-11.el9_4.1.noarch                                                                                                                                               9/11  
 +  Verifying        : httpd-tools-2.4.57-11.el9_4.1.x86_64                                                                                                                                                   10/11  
 +  Verifying        : mod_lua-2.4.57-11.el9_4.1.x86_64                                                                                                                                                       11/11  
 +Installed products updated.
  
-Vous pouvez également transférer plusieurs fichiers à la fois grâce à la commande **mget** ( voir la commande **mput** ci-dessus ).+Installed: 
 +  apr-1.7.0-12.el9_3.x86_64                apr-util-1.6.1-23.el9.x86_64                  apr-util-bdb-1.6.1-23.el9.x86_64         apr-util-openssl-1.6.1-23.el9.x86_64     httpd-2.4.57-11.el9_4.1.x86_64       
 +  httpd-core-2.4.57-11.el9_4.1.x86_64      httpd-filesystem-2.4.57-11.el9_4.1.noarch     httpd-tools-2.4.57-11.el9_4.1.x86_64     mod_http2-2.0.26-2.el9_4.x86_64          mod_lua-2.4.57-11.el9_4.1.x86_64     
 +  redhat-logos-httpd-90.4-2.el9.noarch    
  
-Pour supprimer un fichier sur le serveur, il convient d'utiliser la commande **del** :+Complete! 
 +</code>
  
-<file> +Pour obtenir le détail sur un service donné, il convient d'utiliser la commande **systemctl status** :
-ftp> del nom_fichier +
-</file> +
- +
-Pour fermer la session, il convient d'utiliser la commande **quit** :+
  
 <code> <code>
-ftp> quit +[root@redhat9 ~]# systemctl status httpd.service 
-[root@centos7 ~]# +○ httpd.service - The Apache HTTP Server 
 +     Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; preset: disabled) 
 +     Active: inactive (dead) 
 +       Docs: man:httpd.service(8)
 </code> </code>
  
-====3.4 - SSH==== +Dans le cas du service httpd ci-dessuson peut constater que le statut est **disabled**. Le statut peut être une de 2 valeurs :
- +
-===Présentation=== +
- +
-La commande **[[wpfr>Ssh|ssh]]** est le successeur et la remplaçante de la commande **[[wpfr>Rlogin|rlogin]]**. Il permet d'établir des connexions sécurisées avec une machine distante. SSH comporte cinq acteurs : +
- +
-  * Le **serveur SSH** +
-    * le démon sshd, qui s'occupe des authentifications et autorisations des clients,  +
-  * Le **client SSH** +
-    * ssh ou scp, qui assure la connexion et le dialogue avec le serveur, +
-  * La **session** qui représente la connexion courante et qui commence juste après l'authentification réussie, +
-  * Les **clefs** +
-    * **Couple de clef utilisateur asymétriques** et persistantes qui assurent l'identité d'un utilisateur et qui sont stockés sur disque dur, +
-    * **Clef hôte asymétrique et persistante** garantissant l'identité du serveur er qui est conservé sur disque dur +
-    * **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 une seule clef tandis que SSH-2 utilise une clef par direction de la communication, +
-  La **base de données des hôtes connus** qui stocke les clés des connexions précédentes. +
- +
-SSH fonctionne de la manière suivante pour la la mise en place d'un canal sécurisé: +
- +
-  * Le client contacte le serveur sur son port 22, +
-  * 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, +
-  * Le serveur SSH s'identifie auprès du client en lui fournissant : +
-    * 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'algorithmes supportés, +
-  * Le serveur déchiffre la clé de session, +
-  * Le client et le serveur mettent en place le canal sécurisé. +
- +
-==SSH-1== +
- +
-SSH-1 utilise une paire de clefs de type RSA1. Il assure l'intégrité des données par une **[[wpfr>Contrôle_de_redondance_cyclique|Contrôle de Redondance Cyclique]]** (CRC) et est un bloc dit **monolithique**. +
- +
-Afin de s'identifier, le client essaie chacune des six méthodes suivantes : +
- +
-  * **Kerberos**, +
-  * **Rhosts**, +
-  * **%%RhostsRSA%%**, +
-  * Par **clef asymétrique**, +
-  * **TIS**, +
-  * Par **mot de passe**. +
- +
-==SSH-2== +
- +
-SSH-2 utilise **DSA** ou **RSA**. Il assure l'intégrité des données par l'algorithme **HMAC**. SSH-2 est organisé en trois **couches** : +
- +
-  * **SSH-TRANS** – Transport Layer Protocol, +
-  * **SSH-AUTH** – Authentification Protocol, +
-  * **SSH-CONN** – Connection Protocol. +
- +
-SSH-2 diffère de SSH-1 essentiellement dans la phase authentification.  +
- +
-Trois méthodes d'authentification : +
- +
-  * Par **clef asymétrique**, +
-    * Identique à SSH-1 sauf avec l'algorithme DSA, +
-  * **%%RhostsRSA%%**, +
-  * Par **mot de passe**.+
  
-==Options de la commande==+  * **disabled** - le service ne démarrera pas lors du prochain démarrage du système. 
 +  * **enabled** - le service démarrera lors du prochain démarrage du système.
  
-Les options de cette commande sont :+Il est possible de vérifier le statut en utilisant le commande **systemctl is-enabled** :
  
 <code> <code>
-[root@centos8 ~]# ssh --help +[root@redhat9 ~]# systemctl is-enabled httpd.service 
-unknown option -- - +disabled
-usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface] +
-           [-b bind_address] [-c cipher_spec] [-D [bind_address:]port] +
-           [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11] +
-           [-i identity_file] [-J [user@]host[:port]] [-L address] +
-           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port] +
-           [-Q query_option] [-R address] [-S ctl_path] [-W host:port] +
-           [-w local_tun[:remote_tun]] destination [command]+
 </code> </code>
  
-===Authentification par mot de passe=== +Pour rendre le statut **enabled**, il convient d'utiliser la commande **systemctl enable** :
- +
-L'utilisateur fournit un mot de passe au client ssh. Le client ssh le transmet de façon sécurisée au serveur ssh puis  le serveur vérifie le mot de passe et l'accepte ou non. +
- +
-Avantage: +
-  Aucune configuration de clef asymétrique n'est nécessaire. +
- +
-Inconvénients: +
-  L'utilisateur doit fournir à chaque connexion un identifiant et un mot de passe, +
-  Moins sécurisé qu'un système par clef asymétrique. +
- +
-===Authentification par clef asymétrique=== +
- +
-  Le **client** envoie au serveur une requête d'authentification par clé asymétrique qui contient le module de la clé à utiliser+
-  * Le **serveur** recherche une correspondance pour ce module dans le fichier des clés autorisés **~/.ssh/authorized_keys**, +
-    * Dans le cas où une correspondance n'est pas trouvée, le serveur met fin à la communication, +
-    * 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'identifiant de session et chiffre le résultat. Ensuite il envoie le résultat chiffré au serveur. +
-  * 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'authentification est réussie. +
- +
-===Configuration du Serveur=== +
- +
-La configuration du serveur s'effectue dans le fichier **/etc/ssh/sshd_config** :+
  
 <code> <code>
-[root@centos8 ~]# cat /etc/ssh/sshd_config +[root@redhat9 ~]# systemctl enable httpd.service 
-#       $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $+Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
  
-This is the sshd server system-wide configuration file See +[root@redhat9 ~]systemctl is-enabled httpd.service 
-# sshd_config(5) for more information.+enabled
  
-This sshd was compiled with PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin+[root@redhat9 ~]systemctl status httpd.service 
 +○ httpd.service - The Apache HTTP Server 
 +     Loadedloaded (/usr/lib/systemd/system/httpd.service; enabled; presetdisabled) 
 +     Active: inactive (dead) 
 +       Docs: man:httpd.service(8) 
 +</code>
  
-# The strategy used for options in the default sshd_config shipped with +Dans le cas du service httpd ci-dessuson peut maintenant constater que l'état est **inactive (dead)**.  L'état peut être une de 7 valeurs :
-# OpenSSH is to specify options with their default value where +
-# possiblebut leave them commented.  Uncommented options override the +
-# default value.+
  
-# If you want to change the port on a SELinux system, you have to tell +  * **inactive (dead)** le service est arrêté
-# SELinux about this change. +  * **active(running** le service est démarré avec un ou plusieurs processus
-# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER +  * **active(exited)** le service a terminé une configuration unique
-+  * **active(waiting)** - le service est démarré mais en attente d'un évènement
-#Port 22 +  * **activating** le service est en cours d'activation
-#AddressFamily any +  * **deactivating** le service est en cours de désactivation
-#ListenAddress 0.0.0.0 +  * **failed** le service rencontré une erreur fatale.
-#ListenAddress :: +
- +
-HostKey /etc/ssh/ssh_host_rsa_key +
-HostKey /etc/ssh/ssh_host_ecdsa_key +
-HostKey /etc/ssh/ssh_host_ed25519_key +
- +
-# Ciphers and keying +
-#RekeyLimit default none +
- +
-# This system is following system-wide crypto policyThe changes to +
-# crypto properties (Ciphers, MACs, ...will not have any effect here. +
-# They will be overridden by command-line options passed to the server +
-# on command line+
-# Please, check manual pages for update-crypto-policies(8and sshd_config(5). +
- +
-# Logging +
-#SyslogFacility AUTH +
-SyslogFacility AUTHPRIV +
-#LogLevel INFO +
- +
-# Authentication: +
- +
-#LoginGraceTime 2m +
-PermitRootLogin yes +
-#StrictModes yes +
-#MaxAuthTries 6 +
-#MaxSessions 10 +
- +
-#PubkeyAuthentication yes +
- +
-# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2 +
-# but this is overridden so installations will only check .ssh/authorized_keys +
-AuthorizedKeysFile      .ssh/authorized_keys +
- +
-#AuthorizedPrincipalsFile none +
- +
-#AuthorizedKeysCommand none +
-#AuthorizedKeysCommandUser nobody +
- +
-# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts +
-#HostbasedAuthentication no +
-# Change to yes if you don't trust ~/.ssh/known_hosts for +
-# HostbasedAuthentication +
-#IgnoreUserKnownHosts no +
-# Don't read the user's ~/.rhosts and ~/.shosts files +
-#IgnoreRhosts yes +
- +
-# To disable tunneled clear text passwords, change to no here! +
-#PasswordAuthentication yes +
-#PermitEmptyPasswords no +
-PasswordAuthentication yes +
- +
-# Change to no to disable s/key passwords +
-#ChallengeResponseAuthentication yes +
-ChallengeResponseAuthentication no +
- +
-# Kerberos options +
-#KerberosAuthentication no +
-#KerberosOrLocalPasswd yes +
-#KerberosTicketCleanup yes +
-#KerberosGetAFSToken no +
-#KerberosUseKuserok yes +
- +
-# GSSAPI options +
-GSSAPIAuthentication yes +
-GSSAPICleanupCredentials no +
-#GSSAPIStrictAcceptorCheck yes +
-#GSSAPIKeyExchange no +
-#GSSAPIEnablek5users no +
- +
-# Set this to 'yes' to enable PAM authentication, account processing, +
-# and session processing. If this is enabled, PAM authentication will +
-# be allowed through the ChallengeResponseAuthentication and +
-# PasswordAuthentication.  Depending on your PAM configuration, +
-# PAM authentication via ChallengeResponseAuthentication may bypass +
-# the setting of "PermitRootLogin without-password"+
-# If you just want the PAM account and session checks to run without +
-# PAM authentication, then enable this but set PasswordAuthentication +
-# and ChallengeResponseAuthentication to 'no'. +
-# WARNING: 'UsePAM no' is not supported in Fedora and may cause several +
-# problems. +
-UsePAM yes +
- +
-#AllowAgentForwarding yes +
-#AllowTcpForwarding yes +
-#GatewayPorts no +
-X11Forwarding yes +
-#X11DisplayOffset 10 +
-#X11UseLocalhost yes +
-#PermitTTY yes +
- +
-# It is recommended to use pam_motd in /etc/pam.d/sshd instead of PrintMotd, +
-# as it is more configurable and versatile than the built-in version+
-PrintMotd no +
- +
-#PrintLastLog yes +
-#TCPKeepAlive yes +
-#PermitUserEnvironment no +
-#Compression delayed +
-#ClientAliveInterval 0 +
-#ClientAliveCountMax 3 +
-#UseDNS no +
-#PidFile /var/run/sshd.pid +
-#MaxStartups 10:30:100 +
-#PermitTunnel no +
-#ChrootDirectory none +
-#VersionAddendum none +
- +
-# no default banner path +
-#Banner none +
- +
-# Accept locale-related environment variables +
-AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES +
-AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT +
-AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE +
-AcceptEnv XMODIFIERS +
- +
-# override default of no subsystems +
-Subsystem       sftp    /usr/libexec/openssh/sftp-server +
- +
-# Example of overriding settings on per-user basis +
-#Match User anoncvs +
-#       X11Forwarding no +
-#       AllowTcpForwarding no +
-#       PermitTTY no +
-#       ForceCommand cvs server +
-</code>+
  
-Pour ôter les lignes de commentaires dans ce fichier, utilisez la commande suivante :+Il est possible de vérifier l'état en utilisant le commande **systemctl is-active** :
  
 <code> <code>
-[root@centos8 ~]# cd /tmp ; grep -E -v '^(#|$)'  /etc/ssh/sshd_config > sshd_config +[root@redhat9 ~]# systemctl is-active httpd.service 
-[root@centos8 tmp]# cat sshd_config  +inactive
-HostKey /etc/ssh/ssh_host_rsa_key +
-HostKey /etc/ssh/ssh_host_ecdsa_key +
-HostKey /etc/ssh/ssh_host_ed25519_key +
-SyslogFacility AUTHPRIV +
-PermitRootLogin yes +
-AuthorizedKeysFile      .ssh/authorized_keys +
-PasswordAuthentication yes +
-ChallengeResponseAuthentication no +
-GSSAPIAuthentication yes +
-GSSAPICleanupCredentials no +
-UsePAM yes +
-X11Forwarding yes +
-PrintMotd no +
-AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES +
-AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT +
-AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE +
-AcceptEnv XMODIFIERS +
-Subsystem       sftp    /usr/libexec/openssh/sftp-server+
 </code> </code>
  
-Pour sécuriser le serveur sshajoutez ou modifiez les directives suivantes : +Pour rendre l'état **active(running)**utilisez la commande suivante :
- +
-<file> +
-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 +
-</file> +
- +
-Votre fichier ressemblera à celui-ci :+
  
 <code> <code>
-[root@centos8 tmp]# vi sshd_config  +[root@redhat9 ~]# systemctl start httpd.service
-[root@centos8 tmp]# cat sshd_config  +
-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 +
-HostKey /etc/ssh/ssh_host_rsa_key +
-HostKey /etc/ssh/ssh_host_ecdsa_key +
-HostKey /etc/ssh/ssh_host_ed25519_key +
-SyslogFacility AUTHPRIV +
-AuthorizedKeysFile      .ssh/authorized_keys +
-PasswordAuthentication yes +
-ChallengeResponseAuthentication no +
-GSSAPIAuthentication yes +
-GSSAPICleanupCredentials no +
-UsePAM yes +
-PrintMotd no +
-AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES +
-AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT +
-AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE +
-AcceptEnv XMODIFIERS +
-Subsystem       sftp    /usr/libexec/openssh/sftp-server+
 </code> </code>
  
-Renommez le fichier **/etc/ssh/sshd_config** en **/etc/ssh/sshd_config.old** :+Vérifiez ensuite l'état du service :
  
 <code> <code>
-[root@centos8 tmp]# cp /etc/ssh/sshd_config /etc/ssh/sshd_config.old +[root@redhat9 ~]# systemctl is-active httpd.service 
-</code>+active
  
-Copiez le fichier **/tmp/sshd_config** vers **/etc/ssh/** :+[root@redhat9 ~]# systemctl status httpd.service 
 +● httpd.service - The Apache HTTP Server 
 +     Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; presetdisabled) 
 +     Active: active (running) since Thu 2024-09-26 15:01:28 CEST; 43s ago 
 +       Docs: man:httpd.service(8) 
 +   Main PID: 7187 (httpd) 
 +     Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes served/sec:   0 B/sec" 
 +      Tasks: 177 (limit: 48800) 
 +     Memory: 40.5M 
 +        CPU: 128ms 
 +     CGroup: /system.slice/httpd.service 
 +             ├─7187 /usr/sbin/httpd -DFOREGROUND 
 +             ├─7188 /usr/sbin/httpd -DFOREGROUND 
 +             ├─7189 /usr/sbin/httpd -DFOREGROUND 
 +             ├─7190 /usr/sbin/httpd -DFOREGROUND 
 +             └─7191 /usr/sbin/httpd -DFOREGROUND
  
-<code> +Sep 26 15:01:28 redhat9.ittraining.loc systemd[1]: Starting The Apache HTTP Server... 
-[root@centos8 tmp]# cp /tmp/sshd_config /etc/ssh +Sep 26 15:01:28 redhat9.ittraining.loc httpd[7187]: Server configured, listening on: port 80 
-cpoverwrite '/etc/ssh/sshd_config'? y+Sep 26 15:01:28 redhat9.ittraining.loc systemd[1]Started The Apache HTTP Server.
 </code> </code>
  
-Redémarrez le service sshd :+Pour arrêter une Unité de service, utilisez la commande suivante :
  
 <code> <code>
-[root@centos8 tmp]# systemctl restart sshd +[root@redhat9 ~]# systemctl stop httpd.service
-[root@centos8 tmp]# systemctl status sshd +
-● sshd.service - OpenSSH server daemon +
-   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled) +
-   Active: active (running) since Mon 2021-08-30 02:17:00 EDT; 11s ago +
-     Docs: man:sshd(8) +
-           man:sshd_config(5) +
- Main PID: 1042039 (sshd) +
-    Tasks: 1 (limit: 23535) +
-   Memory: 1.1M +
-   CGroup: /system.slice/sshd.service +
-           └─1042039 /usr/sbin/sshd -D -oCiphers=aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes256-cbc,aes128-gcm@openssh.com,a>+
  
-Aug 30 02:17:00 centos8.ittraining.loc systemd[1]: Starting OpenSSH server daemon... +[root@redhat9 ~]# systemctl status httpd.service 
-Aug 30 02:17:00 centos8.ittraining.loc sshd[1042039]Server listening on 0.0.0.0 port 22. +○ httpd.service - The Apache HTTP Server 
-Aug 30 02:17:00 centos8.ittraining.loc sshd[1042039]Server listening on :: port 22+     Loadedloaded (/usr/lib/systemd/system/httpd.service; enabled; presetdisabled) 
-Aug 30 02:17:00 centos8.ittraining.loc systemd[1]Started OpenSSH server daemon. +     Activeinactive (dead) since Thu 2024-09-26 15:02:55 CEST; 2s ago 
-[q] +   Duration1min 26.084s 
-</code>+       Docsman:httpd.service(8) 
 +    Process7187 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=0/SUCCESS) 
 +   Main PID: 7187 (code=exited, status=0/SUCCESS) 
 +     Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes served/sec:   0 B/sec" 
 +        CPU: 178ms
  
-Mettez l'utilisateur **trainee** dans le groupe **adm** +Sep 26 15:01:28 redhat9.ittraining.loc systemd[1]: Starting The Apache HTTP Server... 
- +Sep 26 15:01:28 redhat9.ittraining.loc httpd[7187]: Server configured, listening on: port 80 
-<code> +Sep 26 15:01:28 redhat9.ittraining.loc systemd[1]: Started The Apache HTTP Server. 
-[root@centos8 tmp]# groups trainee +Sep 26 15:02:54 redhat9.ittraining.loc systemd[1]: Stopping The Apache HTTP Server... 
-trainee trainee +Sep 26 15:02:55 redhat9.ittraining.loc systemd[1]: httpd.service: Deactivated successfully. 
-[root@centos8 tmp]# usermod -aG adm trainee +Sep 26 15:02:55 redhat9.ittraining.loc systemd[1]Stopped The Apache HTTP Server.
-[root@centos8 tmp]# groups trainee +
-trainee trainee adm+
 </code> </code>
  
-Pour générer les clefs du serveursaisissez la commande suivante en tant que **root**. Notez que la passphrase doit être **vide**.+Pour désactiver un service au prochain démarrage du systèmeutilisez l'option **disable** :
  
 <code> <code>
-[root@centos8 tmp]# ssh-keygen -t dsa +[root@redhat9 ~]# systemctl disable httpd.service 
-Generating public/private dsa key pair+Removed "/etc/systemd/system/multi-user.target.wants/httpd.service".
-Enter file in which to save the key (/root/.ssh/id_dsa): /etc/ssh/ssh_host_dsa_key +
-Enter passphrase (empty for no passphrase):  +
-Enter same passphrase again:  +
-Your identification has been saved in /etc/ssh/ssh_host_dsa_key. +
-Your public key has been saved in /etc/ssh/ssh_host_dsa_key.pub. +
-The key fingerprint is: +
-SHA256:dywC6jKyIMaTxsaEamz1kmthEmuG18HxmS22qRICOYk root@centos8.ittraining.loc +
-The key's randomart image is: +
-+---[DSA 1024]----+ +
-|                 | +
-|               | +
-|.o . o.+         | +
-|E.  o.*..  .     | +
-|+ooo.o +S o o    | +
-|X==++ o  o o     | +
-|B/=+oo           | +
-|Ooo++            | +
-|. .o             | +
-+----[SHA256]-----+ +
-</code> +
  
-De la même façon, il est possible de générer les clefs au format **[[https://fr.wikipedia.org/wiki/Chiffrement_RSA|RSA]]**, **[[https://fr.wikipedia.org/wiki/Elliptic_curve_digital_signature_algorithm|ECDSA]]** et **[[https://fr.wikipedia.org/wiki/EdDSA|ED25519]]** :+[root@redhat9 ~]# systemctl status httpd.service 
 +○ httpd.service - The Apache HTTP Server 
 +     Loadedloaded (/usr/lib/systemd/system/httpd.service; disabled; preset: disabled) 
 +     Active: inactive (dead) 
 +       Docs: man:httpd.service(8)
  
-<code> +Sep 26 15:01:28 redhat9.ittraining.loc systemd[1]: Starting The Apache HTTP Server... 
-[root@centos8 tmp]# ssh-keygen -t rsa +Sep 26 15:01:28 redhat9.ittraining.loc httpd[7187]: Server configured, listening onport 80 
-Generating public/private rsa key pair. +Sep 26 15:01:28 redhat9.ittraining.loc systemd[1]: Started The Apache HTTP Server
-Enter file in which to save the key (/root/.ssh/id_rsa)/etc/ssh/ssh_host_rsa_key +Sep 26 15:02:54 redhat9.ittraining.loc systemd[1]: Stopping The Apache HTTP Server... 
-Enter passphrase (empty for no passphrase) +Sep 26 15:02:55 redhat9.ittraining.loc systemd[1]: httpd.serviceDeactivated successfully
-Enter same passphrase again:  +Sep 26 15:02:55 redhat9.ittraining.loc systemd[1]: Stopped The Apache HTTP Server.
-Your identification has been saved in /etc/ssh/ssh_host_rsa_key. +
-Your public key has been saved in /etc/ssh/ssh_host_rsa_key.pub. +
-The key fingerprint is: +
-SHA256:8jXFK50NnoJCz9E7aPKpFYSYCstCPfRsdmlLBTNUnKg root@centos8.ittraining.loc +
-The key's randomart image is: +
-+---[RSA 3072]----+ +
-|    .==o     | +
-|  o oo o=+     | +
-|.. oo=+=o . +    | +
-|oo .+E++.+ = *   | +
-|o..   +.S B * .  | +
-|.      B + =     | +
-|        =        | +
-|               | +
-|      .          | +
-+----[SHA256]-----+ +
-[root@centos8 tmp]# ssh-keygen -t ecdsa +
-Generating public/private ecdsa key pair. +
-Enter file in which to save the key (/root/.ssh/id_ecdsa)/etc/ssh/ssh_host_ecdsa_key +
-Enter passphrase (empty for no passphrase):  +
-Enter same passphrase again +
-Your identification has been saved in /etc/ssh/ssh_host_ecdsa_key. +
-Your public key has been saved in /etc/ssh/ssh_host_ecdsa_key.pub+
-The key fingerprint is: +
-SHA256:AMqFUJKGqnUEPh/IYda0wnbW1kXK+lnprpHsOo4UMbI root@centos8.ittraining.loc +
-The key's randomart image is: +
-+---[ECDSA 256]---+ +
-|++*=+    .o      | +
-|oX.=o+ o o       | +
-|o %.B + +        | +
-|...O.= o       | +
-|..E.o . S o      | +
-|.    . o =       | +
-|    .   * .      | +
-|   . ... o       | +
-|    ..ooo..      | +
-+----[SHA256]-----+ +
-[root@centos8 tmp]# ssh-keygen -t ed25519 +
-Generating public/private ed25519 key pair. +
-Enter file in which to save the key (/root/.ssh/id_ed25519)/etc/ssh/ssh_host_ed25519_key +
-Enter passphrase (empty for no passphrase):  +
-Enter same passphrase again:  +
-Your identification has been saved in /etc/ssh/ssh_host_ed25519_key+
-Your public key has been saved in /etc/ssh/ssh_host_ed25519_key.pub. +
-The key fingerprint is: +
-SHA256:CtbcN9iXv00PfbHFGf2bEW7iRibOFwRctyqM5hmlhwE root@centos8.ittraining.loc +
-The key's randomart image is: +
-+--[ED25519 256]--+ +
-|       E  .... . | +
-|        .  .. . o| +
-|         . . . +.| +
-|     o . oB ..o.=| +
-|    o o S*+=o* *+| +
-|   . . .o.*o*.+.B| +
-|      .  o o +o++| +
-|            o  =o| +
-|              . o| +
-+----[SHA256]-----++
 </code> </code>
  
-Les clefs publiques générées possèdent l'extension **.pub**. Les clefs privées n'ont pas d'extension :+===5.2 - Gestion d'Instances Multiples===
  
-<code> +Systemd permet l'utilisation des gabarits (templates) des fichiers de configuration des UnitésDe cette façon il est possible de faire coexister deux ou plusieurs instances du même serviceUn gabarit est reconnaissable par le caractère **@** qui est placé juste avant le point dans le nom du fichier :
-[root@centos8 tmp]# ls /etc/ssh +
-moduli      ssh_config.d  sshd_config.old     ssh_host_ecdsa_key.pub  ssh_host_ed25519_key.pub  ssh_host_rsa_key.pub +
-ssh_config  sshd_config   ssh_host_ecdsa_key  ssh_host_ed25519_key    ssh_host_rsa_key +
-</code> +
- +
-Re-démarrez ensuite le service sshd :+
  
 <code> <code>
-[root@centos8 tmp]# systemctl restart sshd.service +[root@redhat9 ~]# cat /usr/lib/systemd/system/httpd@.service 
-[root@centos8 tmp]# systemctl status sshd.service +# This is a template for httpd instances. 
-● sshd.service - OpenSSH server daemon +# See httpd@.service(8) for more information.
-   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled) +
-   Active: active (running) since Mon 2021-08-30 02:24:57 EDT; 9s ago +
-     Docs: man:sshd(8) +
-           man:sshd_config(5) +
- Main PID: 1042204 (sshd) +
-    Tasks: 1 (limit: 23535) +
-   Memory: 1.1M +
-   CGroup: /system.slice/sshd.service +
-           └─1042204 /usr/sbin/sshd -D -oCiphers=aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes256-cbc,aes128-gcm@openssh.com,a>+
  
-Aug 30 02:24:57 centos8.ittraining.loc systemd[1]: Starting OpenSSH server daemon... +[Unit
-Aug 30 02:24:57 centos8.ittraining.loc sshd[1042204]: Server listening on 0.0.0.0 port 22. +Description=The Apache HTTP Server 
-Aug 30 02:24:57 centos8.ittraining.loc sshd[1042204]: Server listening on :: port 22+After=network.target remote-fs.target nss-lookup.target 
-Aug 30 02:24:57 centos8.ittraining.loc systemd[1]: Started OpenSSH server daemon. +Documentation=man:httpd@.service(8)
-[q] +
-</code>+
  
-===Configuration du Client==+[Service] 
- +Type=notify 
-Saisissez maintenant les commandes suivantes en tant que **trainee** : +Environment=LANG=
- +Environment=HTTPD_INSTANCE=%i 
-<WRAP center round important 60%> +ExecStartPre=/bin/mkdir -m 710 -p /run/httpd/instance-%i 
-**Important** Lors de la génération des clefs, la passphrase doit être **vide**. +ExecStartPre=/bin/chown root.apache /run/httpd/instance-%i 
-</WRAP> +ExecStartPre=/bin/mkdir -m 700 -/var/lib/httpd/instance-%i 
- +ExecStartPre=/bin/chown apache.apache /var/lib/httpd/instance-%i 
-<code> +ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND -f conf/%i.conf 
-[root@centos8 tmp]# exit +ExecReload=/usr/sbin/httpd $OPTIONS -k graceful -f conf/%i.conf 
-logout +# Send SIGWINCH for graceful stop 
-[trainee@centos8 ~]$ ssh-keygen -t dsa +KillSignal=SIGWINCH 
-Generating public/private dsa key pair. +KillMode=mixed 
-Enter file in which to save the key (/home/trainee/.ssh/id_dsa):  +PrivateTmp=true 
-Created directory '/home/trainee/.ssh'. +OOMPolicy=continue
-Enter passphrase (empty for no passphrase):  +
-Enter same passphrase again:  +
-Your identification has been saved in /home/trainee/.ssh/id_dsa+
-Your public key has been saved in /home/trainee/.ssh/id_dsa.pub+
-The key fingerprint is: +
-SHA256:Qd17X1iROjk5rLOQBbyVg1hNXkUdTeiFtEpn3rgPKc4 trainee@centos8.ittraining.loc +
-The key's randomart image is: +
-+---[DSA 1024]----+ +
-|        =o+o.o+OB| +
-|       o +o=o oo=| +
-|        . +.+oB+ | +
-|         o o.&+o.| +
-|        S o o.*.o| +
-|         o o   o.| +
-|          . + +  | +
-|           + . o | +
-|            E   .| +
-+----[SHA256]-----+ +
-[trainee@centos8 ~]$ ssh-keygen -t rsa +
-Generating public/private rsa key pair.+
  
-Enter file in which to save the key (/home/trainee/.ssh/id_rsa): Enter passphrase (empty for no passphrase):  +[Install
-Enter same passphrase again:  +WantedBy=multi-user.target
-Your identification has been saved in /home/trainee/.ssh/id_rsa. +
-Your public key has been saved in /home/trainee/.ssh/id_rsa.pub. +
-The key fingerprint is: +
-SHA256:BgEjoWQrGCzdJfyZczVZYVoafiHsz9GK5PDWuywG/z0 trainee@centos8.ittraining.loc +
-The key's randomart image is: +
-+---[RSA 3072]----+ +
-|o+o++oo  .oo*.   | +
-|=+o.oo . .=B .   | +
-|=.   ..o o+...   | +
-|.     =.o o.. .  | +
-|       oS= = o   | +
-|       .. = =    | +
-|             | +
-|          +...E  | +
-|         . o+... | +
-+----[SHA256]-----+ +
-[trainee@centos8 ~]$ ssh-keygen -t ecdsa +
-Generating public/private ecdsa key pair. +
-Enter file in which to save the key (/home/trainee/.ssh/id_ecdsa):  +
-Enter passphrase (empty for no passphrase):  +
-Enter same passphrase again:  +
-Your identification has been saved in /home/trainee/.ssh/id_ecdsa. +
-Your public key has been saved in /home/trainee/.ssh/id_ecdsa.pub. +
-The key fingerprint is: +
-SHA256:mpBDgsCxP2DqRPkmGvXHpNnvm5B+Cl7MSiiZKfDjWLk trainee@centos8.ittraining.loc +
-The key's randomart image is: +
-+---[ECDSA 256]---+ +
-|o..              | +
-|.oo              | +
-|.*o . .          | +
-|+.++ B           | +
-|+o =B + S        | +
-|=*oo.* =         | +
-|B.* o O .        | +
-|.= = = o..       | +
-|. E o oo+.       | +
-+----[SHA256]-----+ +
-[trainee@centos8 ~]$ ssh-keygen -t ed25519 +
-Generating public/private ed25519 key pair. +
-Enter file in which to save the key (/home/trainee/.ssh/id_ed25519):  +
-Enter passphrase (empty for no passphrase):  +
-Enter same passphrase again:  +
-Your identification has been saved in /home/trainee/.ssh/id_ed25519. +
-Your public key has been saved in /home/trainee/.ssh/id_ed25519.pub. +
-The key fingerprint is: +
-SHA256:JfFxG2mg9feAvFGxoxZ8uSsON3sXvtYQYYg5iVxzZS4 trainee@centos8.ittraining.loc +
-The key's randomart image is: +
-+--[ED25519 256]--+ +
-|       ..o*=++=. | +
-|        o==O+Boo | +
-|        o ooE.O. | +
-|           O.= | +
-|        S   + ...| +
-|            .o | +
-|          . + o.o| +
-|           + +.oo| +
-|            o..o.| +
-+----[SHA256]-----++
 </code> </code>
  
-Les clés générées seront placées dans le répertoire **~/.ssh/** :+Une instance créée à partir de ce gabarit devrait avoir un nom sous la forme suivante :
  
 <code> <code>
-[trainee@centos8 ~]$ ls .ssh +httpd@<nom_instance>.service
-id_dsa  id_dsa.pub  id_ecdsa  id_ecdsa.pub  id_ed25519  id_ed25519.pub  id_rsa  id_rsa.pub+
 </code> </code>
  
-===Tunnels SSH===+Dans ce fichier on peut constater l'utilisation d'un **identifier** sous la forme de **%i**. Les identifiers sont de deux types - un dit **échappé** où les caractères non-ASCII alphanumérique sont remplacés par **escapes** de type langage C et l'autre non-échappé :
  
-Le protocole SSH peut être utilisé pour sécuriser les protocoles tels telnetpop3 etc.. En effeton peut créer un //tunnel// SSH dans lequel passe les communications du protocole non-sécurisé.+  * %n : est remplacé par le nom complet échappé de l'Unité. 
 +  * %N : est remplacé par le nom complet non-échappé de l'Unité. 
 +  * %p : est remplacé par le préfixe échappé de l'Unitéc'est-à-dire la partie **avant** le caractère @. 
 +  * %P : est remplacé par le préfixe non-échappé de l'Unité, c'est-à-dire la partie **avant** le caractère @. 
 +  * %i : est remplacé par le nom de l'instance échappé de l'Unitéc'est-à-dire la partie **après** le caractère @ et **avant** le point. 
 +  * %I : est remplacé par le nom de l'instance non-échappé de l'Unité, c'est-à-dire la partie **après** le caractère @ et **avant** le point. 
 +  * %f : est remplacé par le préfixe non-échappé ou le nom de l'instance non-échappé préfixé par le caractère **/**. 
 +  * %c : est remplacé par le CGroup de l'Unité sans le chemin /sys/fs/cgroup/systemd/
 +  * %u : est remplacé par le nom de l'utilisateur responsable de l'exécution de l'Unité. 
 +  * %U : est remplacé par l'UID de l'utilisateur responsable de l'exécution de l'Unité. 
 +  * %H : est remplacé par le nom d'hôte sur lequel est exécuté l'Unité. 
 +  * %% : est remplacé" par le caractère **%**.
  
-La commande pour créer un tunnel ssh prend la forme suivante : +Créez maintenant deux copies du fichier **/usr/lib/systemd/system/httpd@.service** :
- +
-  ssh -N -f compte@hôte -Lport-local:localhost:port_distant +
- +
-Dans votre cas, vous allez créer un tunnel dans votre propre vm entre le port 15023 et le port 23 :+
  
 <code> <code>
-[root@centos8 ~]# ssh -N -f trainee@localhost -L15023:localhost:23 +[root@redhat9 ~]# cp /usr/lib/systemd/system/httpd@.service /usr/lib/systemd/system/httpd@instance01.service
-\S +
-Kernel \r on an \m +
-trainee@localhost's password: trainee +
-</code>+
  
-Installez maintenant le serveur telnet : +[root@redhat9 ~]# cp /usr/lib/systemd/system/httpd@.service /usr/lib/systemd/system/httpd@instance02.service
- +
-<code> +
-[root@centos8 ~]# dnf install telnet-server+
 </code> </code>
  
-Telnet n'est ni démarré ni activéIl convient donc de le démarrer et de l'activer :+Créez deux copies du fichier **/etc/httpd/conf/httpd.conf** :
  
 <code> <code>
-[root@centos8 ~]# systemctl status telnet.socket +[root@redhat9 ~]# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/instance01.conf
-● telnet.socket - Telnet Server Activation Socket +
-   Loaded: loaded (/usr/lib/systemd/system/telnet.socket; disabled; vendor preset: disabled) +
-   Active: inactive (dead) +
-     Docs: man:telnetd(8) +
-   Listen: [::]:23 (Stream) +
- Accepted: 0; Connected: 0; +
-  +
-[root@centos8 ~]# systemctl start telnet.socket+
  
-[root@centos8 ~]# systemctl status telnet.socket +[root@redhat9 ~]# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/instance02.conf
-● telnet.socket - Telnet Server Activation Socket +
-   Loaded: loaded (/usr/lib/systemd/system/telnet.socket; disabled; vendor preset: disabled) +
-   Active: active (listening) since Mon 2021-08-30 02:44:01 EDT; 4s ago +
-     Docs: man:telnetd(8) +
-   Listen: [::]:23 (Stream) +
- Accepted: 0; Connected: 0; +
-   CGroup: /system.slice/telnet.socket +
- +
-Aug 30 02:44:01 centos8.ittraining.loc systemd[1]: Listening on Telnet Server Activation Socket. +
- +
-[root@centos8 ~]# systemctl enable telnet.socket +
-Created symlink /etc/systemd/system/sockets.target.wants/telnet.socket → /usr/lib/systemd/system/telnet.socket.+
 </code> </code>
  
-Connectez-vous ensuite via telnet sur le port 15023, vous constaterez que votre connexion n'aboutit pas :+Editez la directive **Listen** du fichier **/etc/httpd/conf/instance01.conf** et ajoutez la directive **PidFile** :
  
 <code> <code>
-[root@centos8 ~]# telnet localhost 15023 +[root@redhat9 ~]# vi /etc/httpd/conf/instance01.conf 
-Trying ::1... +
-Connected to localhost. +
-Escape character is '^]'.+
  
-Kernel 4.18.0-305.7.1.el8.i2tch.x86_64 on an x86_64 +[root@redhat9 ~]# more /etc/httpd/conf/instance01.conf  
-centos8 login: trainee +
-Password:  +# This is the main Apache HTTP server configuration file.  It contains the 
-Last login: Mon Aug 30 02:37:00 from ::1 +# configuration directives that give the server its instructions. 
-[trainee@centos8 ~]$ whoami +# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information. 
-trainee +# In particular, see  
-[trainee@centos8 ~]$ pwd +# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html> 
-/home/trainee +# for a discussion of each configuration directive. 
-</code>+
 +# See the httpd.conf(5) man page for more information on this configuration, 
 +# and httpd.service(8) on using and configuring the httpd service. 
 +
 +# Do NOT simply read the instructions in here without understanding 
 +# what they do.  They're here only as hints or reminders.  If you are unsure 
 +# consult the online docs. You have been warned.   
 +# 
 +# Configuration and logfile namesIf the filenames you specify for many 
 +# of the server's control files begin with "/" (or "drive:/" for Win32), the 
 +# server will use that explicit path.  If the filenames do *not* begin 
 +# with "/", the value of ServerRoot is prepended -- so 'log/access_log' 
 +# with ServerRoot set to '/www' will be interpreted by the 
 +# server as '/www/log/access_log', where as '/log/access_log' will be 
 +# interpreted as '/log/access_log'.
  
-<WRAP center round important 60%> +# 
-**Important** Notez bien que votre communication telnet passe par le tunnel SSH+# ServerRoot: The top of the directory tree under which the server'
-</WRAP>+# configuration, error, and log files are kept. 
 +
 +# Do not add a slash at the end of the directory path.  If you point 
 +# ServerRoot at a non-local disk, be sure to specify a local disk on the 
 +# Mutex directive, if file-based mutexes are used If you wish to share the 
 +# same ServerRoot for multiple httpd daemons, you will need to change at 
 +# least PidFile. 
 +
 +ServerRoot "/etc/httpd"
  
-====3.SCP====+
 +# Listen: Allows you to bind Apache to specific IP addresses and/or 
 +# ports, instead of the defaultSee also the <VirtualHost> 
 +# directive. 
 +
 +# Change this to Listen on a specific IP address, but note that if 
 +# httpd.service is enabled to run at boot time, the address may not be 
 +# available when the service starts.  See the httpd.service(8) man 
 +# page for more information. 
 +
 +#Listen 12.34.56.78:80 
 +Listen 8008 
 +PidFile /var/run/httpd/instance01.pid 
 +
 +# Dynamic Shared Object (DSO) Support 
 +
 +# To be able to use the functionality of a module which was built as a DSO you 
 +# have to place corresponding `LoadModule' lines at this location so the 
 +# directives contained in it are actually available _before_ they are used. 
 +--More--(19%) 
 +[q] 
 +</code> 
  
-===Présentation===+Editez la directive **Listen** du fichier **/etc/httpd/conf/instance02.conf**  et ajoutez la directive **PidFile** :
  
-La commande **scp** est le successeur et la remplaçante de la commande **rcp** de la famille des commandes **remote**Il permet de faire des transferts sécurisés à partir d'une machine distante :+<code> 
 +[root@redhat9 ~]# vi /etc/httpd/conf/instance02.conf 
  
-  $ scp compte@numero_ip(nom_de_machine):/chemin_distant/fichier_distant /chemin_local/fichier_local+[root@redhat9 ~]# more /etc/httpd/conf/instance02.conf  
 +
 +# This is the main Apache HTTP server configuration file.  It contains the 
 +# configuration directives that give the server its instructions. 
 +# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information. 
 +# In particular, see  
 +# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html> 
 +# for a discussion of each configuration directive. 
 +
 +# See the httpd.conf(5man page for more information on this configuration, 
 +# and httpd.service(8) on using and configuring the httpd service. 
 +
 +# Do NOT simply read the instructions in here without understanding 
 +# what they do.  They're here only as hints or reminders.  If you are unsure 
 +# consult the online docs. You have been warned.   
 +
 +# Configuration and logfile namesIf the filenames you specify for many 
 +# of the server's control files begin with "/" (or "drive:/" for Win32), the 
 +# server will use that explicit path.  If the filenames do *not* begin 
 +# with "/", the value of ServerRoot is prepended -- so 'log/access_log' 
 +# with ServerRoot set to '/www' will be interpreted by the 
 +# server as '/www/log/access_log', where as '/log/access_log' will be 
 +# interpreted as '/log/access_log'.
  
-ou vers une machine distante :+
 +# ServerRootThe top of the directory tree under which the server'
 +# configuration, error, and log files are kept. 
 +
 +# Do not add a slash at the end of the directory path.  If you point 
 +# ServerRoot at a non-local disk, be sure to specify a local disk on the 
 +# Mutex directive, if file-based mutexes are used.  If you wish to share the 
 +# same ServerRoot for multiple httpd daemons, you will need to change at 
 +# least PidFile. 
 +
 +ServerRoot "/etc/httpd"
  
-  $ scp /chemin_local/fichier_local compte@numero_ip(nom_de_machine):/chemin_distant/fichier_distant +
- +# ListenAllows you to bind Apache to specific IP addresses and/or 
-===Utilisation=== +# ports, instead of the default. See also the <VirtualHost> 
- +# directive. 
-Nous allons maintenant utiliser **scp** pour chercher un fichier sur le <<serveur>> :+# 
 +# Change this to Listen on a specific IP address, but note that if 
 +# httpd.service is enabled to run at boot time, the address may not be 
 +# available when the service starts.  See the httpd.service(8) man 
 +# page for more information. 
 +
 +#Listen 12.34.56.78:80 
 +Listen 8009 
 +PidFile /var/run/httpd/instance02.pid
  
-Créez le fichier **/home/trainee/scp_test** : +# 
- +# Dynamic Shared Object (DSO) Support 
-<code> +# 
-[trainee@centos8 ~]$ touch scp-test +# To be able to use the functionality of a module which was built as a DSO you 
-[trainee@centos8 ~]$ exit +# have to place corresponding `LoadModule' lines at this location so the 
-logout +# directives contained in it are actually available _before_ they are used. 
-Connection closed by foreign host+--More--(19%) 
-[root@centos8 ~]+[q]
 </code> </code>
  
-Récupérez le fichier **scp_test** en utilisant scp :+Démarrez les deux services :
  
 <code> <code>
-[root@centos8 ~]# scp trainee@127.0.0.1:/home/trainee/scp-test . +[root@redhat9 ~]# systemctl start httpd@instance01.service
-The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established. +
-ECDSA key fingerprint is SHA256:Q7T/CP0SLiMbMAIgVzTuEHegYS/spPE5zzQchCHD5Vw. +
-Are you sure you want to continue connecting (yes/no/[fingerprint])? yes +
-Warning: Permanently added '127.0.0.1' (ECDSA) to the list of known hosts. +
-\S +
-Kernel \r on an \m +
-trainee@127.0.0.1's password: trainee +
-scp-test                                                                                                           100%    0     0.0KB/  00:00    +
  
-[root@centos8 ~]# ls -l +[root@redhat9 ~]# systemctl status httpd@instance01.service 
-total 32 +● httpd@instance01.service The Apache HTTP Server 
--rw-------1 root root 1358 Jun 16 06:40 anaconda-ks.cfg +     Loaded: loaded (/usr/lib/systemd/system/httpd@instance01.service; disabled; presetdisabled) 
-drwxr-xr-x3 root root   21 Jun 16 06:39 home +     Active: active (running) since Thu 2024-09-26 15:14:25 CEST; 9s ago 
--rw-r--r--. 1 root root 1749 Aug 24 11:20 I2TCH.asc +       Docs: man:httpd@.service(8) 
--rw-r--r--. 1 root root 1853 Jun 16 06:54 initial-setup-ks.cfg +    Process: 7424 ExecStartPre=/bin/mkdir -m 710 -p /run/httpd/instance-instance01 (code=exited, status=0/SUCCESS) 
--rw-r--r--. 1 root root   31 Aug 24 11:22 message.txt +    Process7425 ExecStartPre=/bin/chown root.apache /run/httpd/instance-instance01 (code=exited, status=0/SUCCESS) 
--rw-r--r--1 root root  561 Aug 24 11:32 message.txt.asc +    Process: 7426 ExecStartPre=/bin/mkdir -m 700 -p /var/lib/httpd/instance-instance01 (code=exited, status=0/SUCCESS) 
--rw-r--r--. 1 root root  367 Aug 24 11:30 message.txt.gpg +    Process: 7427 ExecStartPre=/bin/chown apache.apache /var/lib/httpd/instance-instance01 (code=exited, status=0/SUCCESS) 
--rw-r--r--. 1 root root  329 Aug 24 11:23 message.txt.sig +   Main PID7429 (httpd) 
--rw-r--r--. 1 root root    0 Aug 30 03:55 scp-test +     Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes served/sec:   0 B/sec" 
--rw-r--r--. 1 root root   46 Aug 29 06:22 wget_file.txt +      Tasks: 177 (limit: 48800) 
-</code>+     Memory: 42.1M 
 +        CPU122ms 
 +     CGroup: /system.slice/system-httpd.slice/httpd@instance01.service 
 +             ├─7429 /usr/sbin/httpd -DFOREGROUND -f conf/instance01.conf 
 +             ├─7430 /usr/sbin/httpd -DFOREGROUND -f conf/instance01.conf 
 +             ├─7431 /usr/sbin/httpd -DFOREGROUND -f conf/instance01.conf 
 +             ├─7432 /usr/sbin/httpd -DFOREGROUND -f conf/instance01.conf 
 +             └─7433 /usr/sbin/httpd -DFOREGROUND -f conf/instance01.conf
  
-====3.6 - Mise en Place des Clefs Asymétriques====+Sep 26 15:14:24 redhat9.ittraining.loc systemd[1]: Starting The Apache HTTP Server... 
 +Sep 26 15:14:25 redhat9.ittraining.loc httpd[7429]: Server configured, listening on: port 8008 
 +Sep 26 15:14:25 redhat9.ittraining.loc systemd[1]: Started The Apache HTTP Server.
  
-Il convient maintenant de se connecter sur le <<serveur>> en utilisant ssh et vérifiez la présence du répertoire ~/.ssh :+[root@redhat9 ~]# systemctl start httpd@instance02.service
  
-<code> +[root@redhat9 ~]# systemctl status httpd@instance02.service 
-[root@centos8 ~]# ssh -l trainee 127.0.0.1 +● httpd@instance02.service - The Apache HTTP Server 
-\S +     Loaded: loaded (/usr/lib/systemd/system/httpd@instance02.service; disabled; preset: disabled) 
-Kernel \r on an \+     Active: active (running) since Thu 2024-09-26 15:14:43 CEST; 7s ago 
-trainee@127.0.0.1's passwordtrainee +       Docs: man:httpd@.service(8) 
-Activate the web console withsystemctl enable --now cockpit.socket+    Process: 7614 ExecStartPre=/bin/mkdir -710 -p /run/httpd/instance-instance02 (code=exited, status=0/SUCCESS) 
 +    Process: 7615 ExecStartPre=/bin/chown root.apache /run/httpd/instance-instance02 (code=exited, status=0/SUCCESS) 
 +    Process: 7616 ExecStartPre=/bin/mkdir -m 700 -p /var/lib/httpd/instance-instance02 (code=exited, status=0/SUCCESS) 
 +    Process: 7617 ExecStartPre=/bin/chown apache.apache /var/lib/httpd/instance-instance02 (code=exited, status=0/SUCCESS) 
 +   Main PID: 7618 (httpd) 
 +     Status: "Started, listening on: port 8009" 
 +      Tasks: 177 (limit: 48800) 
 +     Memory: 42.1M 
 +        CPU113ms 
 +     CGroup/system.slice/system-httpd.slice/httpd@instance02.service 
 +             ├─7618 /usr/sbin/httpd -DFOREGROUND -f conf/instance02.conf 
 +             ├─7619 /usr/sbin/httpd -DFOREGROUND -f conf/instance02.conf 
 +             ├─7620 /usr/sbin/httpd -DFOREGROUND -f conf/instance02.conf 
 +             ├─7621 /usr/sbin/httpd -DFOREGROUND -f conf/instance02.conf 
 +             └─7622 /usr/sbin/httpd -DFOREGROUND -f conf/instance02.conf
  
-[trainee@centos8 ~]$ ls -la | grep .ssh +Sep 26 15:14:43 redhat9.ittraining.loc systemd[1]: Starting The Apache HTTP Server..
-drwx------ 2 trainee trainee      4096 Aug 30 02:26 .ssh+Sep 26 15:14:43 redhat9.ittraining.loc httpd[7618]Server configured, listening on: port 8009 
 +Sep 26 15:14:43 redhat9.ittraining.loc systemd[1]: Started The Apache HTTP Server.
 </code> </code>
  
-<WRAP center round important 60%> +===5.3 Interdire la Modification du Statut d'un Service===
-**Important** Si le dossier distant .ssh n'existe pas dans le répertoire personnel de l'utilisateur connecté, il faut le créer avec des permissions de 700. Dans votre cas, puisque votre machine joue le rôle de serveur **et** du client, le dossier /home/trainee/.ssh existe **déjà**. +
-</WRAP>+
  
-Ensuite, il convient de transférer le fichier local **.ssh/id_ecdsa.pub** du <<client>> vers le <<serveur>> en le renommant en **authorized_keys** :+Il est possible d'interdire la modification en utilisant la commande **systemctl mask**:
  
 <code> <code>
-[trainee@centos8 ~]$ exit +[root@redhat9 ~]# systemctl status httpd.service 
-logout +○ httpd.service - The Apache HTTP Server 
-Connection to 127.0.0.1 closed.+     Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; preset: disabled) 
 +     Active: inactive (dead) 
 +       Docs: man:httpd.service(8)
  
-[root@centos8 ~]# exit +Sep 26 15:01:28 redhat9.ittraining.loc systemd[1]: Starting The Apache HTTP Server... 
-logout+Sep 26 15:01:28 redhat9.ittraining.loc httpd[7187]: Server configured, listening on: port 80 
 +Sep 26 15:01:28 redhat9.ittraining.loc systemd[1]: Started The Apache HTTP Server. 
 +Sep 26 15:02:54 redhat9.ittraining.loc systemd[1]: Stopping The Apache HTTP Server... 
 +Sep 26 15:02:55 redhat9.ittraining.loc systemd[1]: httpd.service: Deactivated successfully. 
 +Sep 26 15:02:55 redhat9.ittraining.loc systemd[1]: Stopped The Apache HTTP Server.
  
-[trainee@centos8 ~]$ scp .ssh/id_ecdsa.pub trainee@127.0.0.1:/home/trainee/.ssh/authorized_keys +[root@redhat9 ~]# systemctl mask httpd.service 
-The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established. +Created symlink /etc/systemd/system/httpd.service → /dev/null.
-ECDSA key fingerprint is SHA256:Q7T/CP0SLiMbMAIgVzTuEHegYS/spPE5zzQchCHD5Vw. +
-Are you sure you want to continue connecting (yes/no/[fingerprint])? yes +
-Warning: Permanently added '127.0.0.1' (ECDSA) to the list of known hosts. +
-\S +
-Kernel \r on an \m +
-trainee@127.0.0.1's password: trainee +
-id_ecdsa.pub                                                                                                       100%  192   497.6KB/  00:00 +
-</code>+
  
-Connectez-vous via telnet :+[root@redhat9 ~]# systemctl enable httpd.service 
 +Failed to enable unitUnit file /etc/systemd/system/httpd.service is masked.
  
-<code> +[root@redhat9 ~]# systemctl start httpd.service 
-[trainee@centos8 ~]$ ssh -l trainee localhost +Failed to start httpd.serviceUnit httpd.service is masked.
-The authenticity of host 'localhost (::1)' can't be established+
-ECDSA key fingerprint is SHA256:Q7T/CP0SLiMbMAIgVzTuEHegYS/spPE5zzQchCHD5Vw. +
-Are you sure you want to continue connecting (yes/no/[fingerprint])? yes +
-Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts. +
-\S +
-Kernel \r on an \m +
-Activate the web console withsystemctl enable --now cockpit.socket +
- +
-Last login: Mon Aug 30 03:57:14 2021 from 127.0.0.1 +
-[trainee@centos8 ~]$+
 </code> </code>
  
-<WRAP center round important 60%> +Pour autoriser de nouveau les modifications, il convient d'utiliser la commande **systemctl unmask** :
-**Important** - Lors de la connexion au serveur, l'authentification utilise le couple de clefs asymétrique au format ecdsa et aucun mot de passe n'est requis. +
-</WRAP> +
- +
-Insérez maintenant les clefs publiques restantes dans le fichier .ssh/authorized_keys :+
  
 <code> <code>
-[trainee@centos8 ~]$ cd .ssh +[root@redhat9 ~]# systemctl unmask httpd.service 
-[trainee@centos8 .ssh]$ ls +Removed "/etc/systemd/system/httpd.service"
-authorized_keys  id_dsa  id_dsa.pub  id_ecdsa  id_ecdsa.pub  id_ed25519  id_ed25519.pub  id_rsa  id_rsa.pub  known_hosts + 
-[trainee@centos8 .ssh]$ cat authorized_keys  +[root@redhat9 ~]# systemctl enable httpd.service 
-ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHDrzSXP+Ecxf/sQ18VwCRNm7rrSrrsaJmuIw/RgTH5puKF5E+Yy15cvAAKBXpJPxUmrOaOyhab84PevV7XSHcI= trainee@centos8.ittraining.loc+Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service. 
 + 
 +[root@redhat9 ~]# systemctl start httpd.service
  
-[trainee@centos8 .ssh]$ cat id_rsa.pub >> authorized_keys +[root@redhat9 ~]# systemctl status httpd.service 
-[trainee@centos8 .ssh]$ cat id_dsa.pub >> authorized_keys +● httpd.service - The Apache HTTP Server 
-[trainee@centos8 .ssh]$ cat id_ed25519.pub >> authorized_keys+     Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; preset: disabled) 
 +     Active: active (running) since Thu 2024-09-26 15:17:38 CEST; 18s ago 
 +       Docs: man:httpd.service(8) 
 +   Main PID: 7896 (httpd) 
 +     Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes served/sec:   0 B/sec" 
 +      Tasks: 177 (limit: 48800) 
 +     Memory: 40.1M 
 +        CPU: 99ms 
 +     CGroup: /system.slice/httpd.service 
 +             ├─7896 /usr/sbin/httpd -DFOREGROUND 
 +             ├─7897 /usr/sbin/httpd -DFOREGROUND 
 +             ├─7898 /usr/sbin/httpd -DFOREGROUND 
 +             ├─7899 /usr/sbin/httpd -DFOREGROUND 
 +             └─7900 /usr/sbin/httpd -DFOREGROUND
  
-[trainee@centos8 .ssh]$ cat authorized_keys +Sep 26 15:17:38 redhat9.ittraining.loc systemd[1]: Starting The Apache HTTP Server... 
-ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHDrzSXP+Ecxf/sQ18VwCRNm7rrSrrsaJmuIw/RgTH5puKF5E+Yy15cvAAKBXpJPxUmrOaOyhab84PevV7XSHcI= trainee@centos8.ittraining.loc +Sep 26 15:17:38 redhat9.ittraining.loc httpd[7896]: Server configured, listening on: port 80 
-ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQD3ZSMn/GIAHtaDFc6ZNnKJam9hzq8TxqMN5IopUr8QhwODyPadbB+FgH4r50qTux4ubwr1BlymgIdqRVWy32mE15M8tdtKc3j8DNMpUwPGEh+s/PT7GW+3E3shoyPvpLc1kKaKXKGl/JwfCK/8IYsubk2BmiiJYkzLECotPlaaxm4w1K0AtlnZQuLHt1HK3/rHChxo2o2w1t59/QwNcMLiKve1Z+zQ1POKo8VJ/DDrf90y2QWC28ejUs/ZjP6f6C4bn5Jjol4TbHls3ArMsbU6C1Ev5jqbzZ0kmognQ2CnRjeNM51YdFo6nRsLoPQKpeLRMBpT/87HK1bPUOBVCyhXxSkqkVhMlgg8tgcD/MRlBaUVFoZ1wQ0L26Fe+q7c2Oykj54pdXCAK2ZTpCXGfhd/FxrfqGw7cSeKlGX4QUzHMjMk2oHFC9h30BUk1gGN21KJPTh7/S1OZVrnCc3GUi5fXPvEpral0IU0sws+j03dj0sWm5ICQFKRkmZN11HCyT0= trainee@centos8.ittraining.loc +Sep 26 15:17:38 redhat9.ittraining.loc systemd[1]: Started The Apache HTTP Server.
-ssh-dss AAAAB3NzaC1kc3MAAACBALIdwEEqHrMWSUdzARm9ldsZK9ebbtZShtmwgdjphOk77fxymK0y6wV7QEmLL25LOcLb12uZ1F0LtRt/t2oqgrwqk3vUSpCPLr09AXpcD/nxL9kc+rUxHyl6u1mHtyfCVLCPSvavCMR8TaA8egVMk3EwGRfHTiuDOKi7Iwus7gXPAAAAFQDHEQPGVRI7gVYKzCT6nrjDsQQ6jwAAAIEAhhhH7fEjdldASXY0qTWkCvcs3cfK9/Ff315zByn47O02y9Vdo3QG5nOr1Oo8fc2xEkIBNmFr8Rr2g60cpvEev5hy4XZ1ghxnQ53iwKuiS72ZATwhD6bZBrsiH0k1Et25gRcj5KCvDe/jHhbxCxsCuHUH2qvWsQNVwztE7hD0sxkAAACAQ8Dkpy8zXj7jW8o1txxf2W6J4r2+1lPldymA45ywZokN4SCwvXlpPAuyBt0/HiU0R2PI9aqOAMosCLcy9WmnSwLQ2Z7QcD2i3XlAih2+1q9NJP22sPT3jSK9UZcdRjoZ/eNiz84sXZucNape32tFxjvcV4txobH/vD53q8g63fA= trainee@centos8.ittraining.loc +
-ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOfFQULLU8IZyKiSU63D2Zz6yGLqyHcBHnCRdSR9JSmc trainee@centos8.ittraining.loc+
 </code> </code>
  
 ----- -----
 Copyright © 2024 Hugh Norris. Copyright © 2024 Hugh Norris.
Menu