Différences

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

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
elearning:workbooks:redhat:rh124:l110 [2024/09/25 08:11] adminelearning:workbooks:redhat:rh124:l110 [2024/11/28 08:58] (Version actuelle) admin
Ligne 5: Ligne 5:
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
  
-======RH12411 - Gestion du Démarrage et de l'Arrêt du Système======+======RH12411 - Gestion de la Journalisation======
  
 =====Contenu du Module===== =====Contenu du Module=====
  
-  * **RH12411 - Gestion du Démarrage et de l'Arrêt du Système** +  * **RH12411 - Gestion de la Journalisation**
-    * Contenu du Module+
     * Présentation     * Présentation
-    * BIOS, EFI et OpenFirmware +    * La Commande dmesg 
-      Systèmes à base du BIOS +    LAB #1 - Surveillance Sécuritaire 
-        Charger de Démarrage +      1.1 - La Commande last 
-      * Systèmes à base de l'EFI +      * 1.2 - La Commande lastlog 
-      * Autres Systèmes +      * 1.3 - La Commande lastb 
-    Gestionnaire d'amorçage +      1.4 - Le Fichier /var/log/secure 
-      * GRUB 2 +      * 1.5 - Gestion des évènements audit 
-        * Le fichier /boot/grub/device.map +        * Le fichier /var/log/audit/audit.log 
-        * Le fichier /etc/default/grub +        * auditd 
-        Les fichiers du répertoire /etc/grub.d +        * auditctl 
-        Configurer l'Authentification +        * audispd 
-        Modifier la Configuration de GRUB en Ligne de Commande +        * La consultation des événements audit 
-      * Chargeurs de Démarrages Alternatifs +          * La Commande aureport 
-        Systemd-boot +          * La Commande ausearch 
-        * U-boot +    * Le fichier /var/log/messages 
-        * Le Projet Syslinux +    Applications 
-          SYSLINUX +    LAB #2 - rsyslog 
-          * EXTLINUX +      * 2.1 - Priorités 
-          * ISOLINUX +      * 2.2 - Sous-systèmes applicatifs 
-          * PXELINUX +      2.3 /etc/rsyslog.conf 
-        Isodhpfx +        * Modules 
-    * Initramfs +        * Directives Globales 
-      * Examiner l'image existante +        Règles 
-      Le script init +          * Sous-système applicatif.Priorité 
-      Consulter le contenu d'un fichier dans initramfs +          * Sous-système applicatif!Priorité 
-    Processus de Démarrage du Noyau Linux +          * Sous-système applicatif=Priorité 
-    * Processus Init +          L'utilisation du caractère spécial 
-    * Systemd +          n Sous-systèmes avec la même priorité 
-      * LAB #- La Commande systemctl +          n Sélecteurs avec la même Action 
-      * LAB #Fichiers de Configuration +    * LAB #3 - La Commande logger 
-        2.1 - Fichiers de Configuration par Défaut +    * LAB #- La Commande logrotate 
-        2.2 - Surchargement des Fichiers de Configuration par Défaut +    * LAB #La Journalisation avec journald 
-      * LAB #3 - La Commande systemd-analyze +      5.1 - Consultation des Journaux 
-      * LAB #4 - Les Cibles Systemd +      5.2 - Consultation des Journaux d'une Application Spécifique 
-        4.Contrôler les dépendances d'une Cible +      * 5.3 - Consultation des Journaux depuis le Dernier Démarrage 
-        * 4.2 - La Cible par Défaut +      * 5.4 - Consultation des Journaux d'une Priorité Spécifique 
-      * LAB #5 - Gestion des Services +      5.Consultation des Journaux d'une Plage de Dates ou d'Heures 
-        * 5.Gestion des Instances Uniques +      * 5.6 Consultation des Journaux en Live 
-        5.2 Gestion d'Instances Multiples +      * 5.Consultation des Journaux avec des Mots Clefs 
-        5.Interdire la Modification du Statut d'un Service +    LAB #6 Le Serveur d'Horloge 
-    * Arrêt Système du Système +      6.Introduction 
-      * La Commande shutdown +      * 6.2 - Le Service chronyd 
-      * La Commande reboot +      * 6.2 - Le Fichier /etc/chrony.conf
-      * La Commande halt +
-      * La Commande poweroff+
  
 =====Présentation===== =====Présentation=====
  
-Le processus de démarrage de Linux peut être résumé en trois étapes majeurs :+La majorité des journaux du système et des applications se trouve dans le répertoire **/var/log**.
  
-  * Le **firmware** ou **micrologiciel** démarre en effectuant un test rapide du matériel, appelé un **Power-On Self Test** ou **POST**, puis recherche le **Charger de Démarrage** (//Bootloader//) à exécuter à partir d'un support bootable, +<WRAP center round important 60%> 
-  * Le Charger de Démarrage est exécuté et il détermine quel noyau Linux à charger, +**Important** : Il est conseillé de déplacer le point de montage du répertoire **/var/log** sur une partition physique ou un volume logique à partDe cette façon, en cas de journalisation rapide trop bavarde la limite de la taille de ce répertoire est celle de la taille de la partition physique ou du volume logique. Si vous laissez ce répertoire dans la racine du système, il existe un risque à ce que les journaux grossissent si vite qu'ils occupent toute l'espace disque libre, créant ainsi un crash système.
-  * Le noyau se charge en mémoire et commence à exécuter en arrière plan les programmes nécessaires au fonctionnement du système. +
- +
-<WRAP center round tip 60%> +
-**A retenir** : Il est possible de consulter le défilement des messages lors du démarrage en appuyant sur la touche <key>Echap</key> ou simultanément sur les touches <key>Ctrl</key>+<key>Alt</key>+<key>F1</key>En sachant que la liste des messages se défilent rapidement, il est possible de les consulter **après** le démarrage du système à l'aide de la commande **dmesg** qui lit les derniers messages contenu dans le **Kernel Ring Buffer**. Ces messages sont aussi copiés dans le fichier **/var/log/boot.log**.+
 </WRAP> </WRAP>
  
-Cette description simpliste résume cependant un processus bien plus compliqué que ce cours va détailler.+=====La Commande /bin/dmesg=====
  
-=====BIOS, EFI et OpenFirmware=====+Cette commande retourne les messages du noyau (**//Kernel Ring Buffer//**) stockés dans le fichier **/var/log/dmesg** lors du dernier démarrage du système :
  
-====Systèmes à base du BIOS====+<code> 
 +[root@redhat9 ~]# dmesg | more 
 +[    0.000000] Linux version 5.14.0-427.37.1.el9_4.x86_64 (mockbuild@x86-64-02.build.eng.rdu2.redhat.com) (gcc (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3), GNU ld version 2.35.2-43.el9) #1 SMP PREEMPT_DYNAMIC Fri  
 +Sep 13 12:41:50 EDT 2024 
 +[    0.000000] The list of certified hardware and cloud instances for Red Hat Enterprise Linux 9 can be viewed at the Red Hat Ecosystem Catalog, https://catalog.redhat.com. 
 +[    0.000000] Command line: BOOT_IMAGE=(hd0,msdos1)/vmlinuz-5.14.0-427.37.1.el9_4.x86_64 root=/dev/mapper/rhel-root ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/
 +oot rd.lvm.lv=rhel/swap rhgb quiet 
 +[    0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers' 
 +[    0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers' 
 +[    0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers' 
 +[    0.000000] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256 
 +[    0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format. 
 +[    0.000000] signal: max sigframe size: 1776 
 +[    0.000000] BIOS-provided physical RAM map: 
 +[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable 
 +[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved 
 +[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved 
 +[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000bffd9fff] usable 
 +[    0.000000] BIOS-e820: [mem 0x00000000bffda000-0x00000000bfffffff] reserved 
 +[    0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved 
 +[    0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved 
 +[    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000023fffffff] usable 
 +[    0.000000] NX (Execute Disable) protection: active 
 +[    0.000000] SMBIOS 2.8 present. 
 +[    0.000000] DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.1-0-g3208b098f51a-prebuilt.qemu.org 04/01/2014 
 +[    0.000000] Hypervisor detected: KVM 
 +[    0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00 
 +[    0.000001] kvm-clock: using sched offset of 11342917026 cycles 
 +[    0.000003] clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881590591483 ns 
 +[    0.000010] tsc: Detected 2099.998 MHz processor 
 +[    0.001013] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved 
 +[    0.001016] e820: remove [mem 0x000a0000-0x000fffff] usable 
 +[    0.001021] last_pfn 0x240000 max_arch_pfn 0x400000000 
 +[    0.001058] MTRR map: 4 entries (3 fixed + 1 variable; max 19), built from 8 variable MTRRs 
 +[    0.001061] x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WP  UC- WT   
 +[    0.001103] last_pfn 0xbffda max_arch_pfn 0x400000000 
 +[    0.009594] found SMP MP-table at [mem 0x000f5bc0-0x000f5bcf] 
 +[    0.009621] Using GB pages for direct mapping 
 +[    0.009825] RAMDISK: [mem 0x3149c000-0x34a45fff] 
 +[    0.009836] ACPI: Early table checksum verification disabled 
 +[    0.009849] ACPI: RSDP 0x00000000000F5980 000014 (v00 BOCHS ) 
 +[    0.009857] ACPI: RSDT 0x00000000BFFE300C 000038 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +[    0.009870] ACPI: FACP 0x00000000BFFE2DDE 000074 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +[    0.009876] ACPI: DSDT 0x00000000BFFDF040 003D9E (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +[    0.009881] ACPI: FACS 0x00000000BFFDF000 000040 
 +[    0.009885] ACPI: APIC 0x00000000BFFE2E52 000090 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +[    0.009889] ACPI: SSDT 0x00000000BFFE2EE2 0000CA (v01 BOCHS  VMGENID  00000001 BXPC 00000001) 
 +[    0.009893] ACPI: HPET 0x00000000BFFE2FAC 000038 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +[    0.009898] ACPI: WAET 0x00000000BFFE2FE4 000028 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +[    0.009901] ACPI: Reserving FACP table memory at [mem 0xbffe2dde-0xbffe2e51] 
 +[    0.009902] ACPI: Reserving DSDT table memory at [mem 0xbffdf040-0xbffe2ddd] 
 +[    0.009903] ACPI: Reserving FACS table memory at [mem 0xbffdf000-0xbffdf03f] 
 +[    0.009904] ACPI: Reserving APIC table memory at [mem 0xbffe2e52-0xbffe2ee1] 
 +[    0.009905] ACPI: Reserving SSDT table memory at [mem 0xbffe2ee2-0xbffe2fab] 
 +[    0.009906] ACPI: Reserving HPET table memory at [mem 0xbffe2fac-0xbffe2fe3] 
 +[    0.009906] ACPI: Reserving WAET table memory at [mem 0xbffe2fe4-0xbffe300b] 
 +[    0.010241] No NUMA configuration found 
 +--More-- 
 +[q] 
 +</code>
  
-Au démarrage d'un système à base d'un processeur x86 ou x86-64, le premier programme exécuté a été traditionnellement le BIOS. Le BIOS a pour fonction de :+Les option de cette commande sont :
  
-  * Tester les composants et les circuits, +<code> 
-  * Faire appel au BIOS de la carte graphique pour initialiser le système d'affichage, +[root@redhat9 ~]# dmesg --help
-  * Détecter les périphériques de stockage, +
-  * Lancer le **Charger de Démarrage** du système d'exploitation en utilisant le **bootstrap loader**.+
  
-===Chargeur de Démarrage===+Usage: 
 + dmesg [options]
  
-La première partie du Chargeur de Démarrage est en règle générale placé dans le MBR du disqueLe format du MBR est le suivant :+Display or control the kernel ring buffer.
  
-  * 446 octets pour le Charger de Démarrage+Options: 
-  * 64 octets pour la table de partitionssoit 16 octets par partition décrite+ -C--clear                 clear the kernel ring buffer 
-  octets ayant une valeur fixe en hexadécimale de **AA55**.+ -c--read-clear            read and clear all messages 
 + -D--console-off           disable printing messages to console 
 + -E, --console-on            enable printing messages to console 
 + -F, --file <file>           use the file instead of the kernel log buffer 
 + -f, --facility <list>       restrict output to defined facilities 
 + -H, --human                 human readable output 
 + -k, --kernel                display kernel messages 
 + -L, --color[=<when>       colorize messages (auto, always or never) 
 +                               colors are enabled by default 
 + -l, --level <list>          restrict output to defined levels 
 + -n, --console-level <level> set level of messages printed to console 
 + -P, --nopager               do not pipe output into a pager 
 + -p, --force-prefix          force timestamp output on each line of multi-line messages 
 + -r, --raw                   print the raw message buffer 
 +     --noescape              don't escape unprintable character 
 + -S, --syslog                force to use syslog(2) rather than /dev/kmsg 
 + -s, --buffer-size <size>    buffer size to query the kernel ring buffer 
 + -u, --userspace             display userspace messages 
 + -w, --follow                wait for new messages 
 + -W, --follow-new            wait and print only new messages 
 + -x, --decode                decode facility and level to readable string 
 + -d, --show-delta            show time delta between printed messages 
 + -e, --reltime               show local time and time delta in readable format 
 + -T, --ctime                 show human-readable timestamp (may be inaccurate!) 
 + -t, --notime                don't show any timestamp with messages 
 +     --time-format <format>  show timestamp using the given format: 
 +                               [delta|reltime|ctime|notime|iso] 
 +Suspending/resume will make ctime and iso timestamps inaccurate. 
 +     --since <time>          display the lines since the specified time 
 +     --until <time>          display the lines until the specified time
  
-====Systèmes à base de l'EFI====+ -h, --help                  display this help 
 + -V, --version               display version
  
-Depuis 2011, le BIOS est en train d'être remplacé par l'utilisation de l'**[[http://fr.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface|UEFI]]** (**U**nified **E**xtensible **F**irmware **I**nterface ou //Interface micrologicielle extensible unifiée//) issue du développement de l'EFI conçue par Intel pour les processeurs Itanium.. +Supported log facilities: 
 +    kern - kernel messages 
 +    user - random user-level messages 
 +    mail - mail system 
 +  daemon - system daemons 
 +    auth - security/authorization messages 
 +  syslog - messages generated internally by syslogd 
 +     lpr - line printer subsystem 
 +    news - network news subsystem
  
-Sous EFI la première partie du gestionnaire de démarrage est un fichier ayant une extension .efi se trouvant dans un sous-répertoire au nom du système d'exploitation à lancer dans une partition appelée **EFI System Partition** ou **ESP**. Cette partition est normalement montée à **/boot/efi** sous Linux.+Supported log levels (priorities): 
 +   emerg system is unusable 
 +   alert - action must be taken immediately 
 +    crit - critical conditions 
 +     err - error conditions 
 +    warn - warning conditions 
 +  notice - normal but significant condition 
 +    info - informational 
 +   debug - debug-level messages
  
-Pour que EFI fonctionne, le micrologiciel (**firmware**d'EFI doit avoir connaissance de chaque système d'exploitation à démarrer.+For more details see dmesg(1). 
 +</code>
  
-<WRAP center round tip 60%> +=====LAB #1 - Surveillance Sécuritaire=====
-**A retenir** : Sous Linux c'est l'application **efibootmgr** qui permet de créer et de supprimer des entrées ainsi que de modifier l'ordre de démarrage. +
-</WRAP>+
  
-<WRAP center round important 60%> +====1.1 La Commande last====
-**Important** : L'UEFI gère les **SSD** (//Solid State Drives//) qui utilisent le standard **NVMe** (//Non-Volatile Memory Express//). Linux supporte les SSD depuis le noyau 3.3. +
-</WRAP>+
  
-====Autres Systèmes====+Cette commande indique les dates et heures des connexions des utilisateurs à partir du contenu du fichier **/var/log/wtmp** :
  
-Les systèmes utilisant des processeurs autre qu'un x86 ou x86-64 utilisent un logiciel tel **[[http://fr.wikipedia.org/wiki/Open_Firmware|OpenFirmware]]**.+<code> 
 +[root@redhat9 ~]# last 
 +trainee  pts/1        10.0.2.1         Sat Sep 28 08:43   still logged in 
 +trainee  pts/0        10.0.2.1         Sat Sep 28 08:09   still logged in 
 +trainee  pts/0        10.0.2.1         Fri Sep 27 08:02 - 17:23  (09:20) 
 +trainee  pts/0        10.0.2.1         Fri Sep 27 07:49 - 08:02  (00:13) 
 +trainee  pts/0        10.0.2.1         Thu Sep 26 12:20 - 15:44  (03:23) 
 +trainee  pts/0        10.0.2.1         Wed Sep 25 12:47 - 17:31  (04:44) 
 +reboot   system boot  5.14.0-427.37.1. Wed Sep 25 12:44   still running 
 +reboot   system boot  5.14.0-427.37.1. Wed Sep 25 12:29   still running 
 +trainee  pts/0        10.0.2.1         Wed Sep 25 11:35 - 12:29  (00:54) 
 +trainee  pts/0        10.0.2.1         Wed Sep 25 10:14 - 10:50  (00:35) 
 +reboot   system boot  5.14.0-284.11.1. Wed Sep 25 10:14 - 12:29  (02:15) 
 +trainee  pts/1        10.0.2.99        Thu Oct 19 18:35 - 18:35  (00:00) 
 +trainee  tty2         tty2             Thu Oct 19 18:28 - crash (341+15:45) 
 +trainee  seat0        login screen     Thu Oct 19 18:28 - crash (341+15:45) 
 +reboot   system boot  5.14.0-284.11.1. Thu Oct 19 18:27 - 12:29 (341+18:02)
  
-=====Gestionnaires de Démarrage=====+wtmp begins Thu Oct 19 18:27:17 2023 
 +</code>
  
-====GRUB 2====+Les option de cette commande sont :
  
-GRUB 2 est une ré-écriture complète de GRUB Legacy. Il apporte des améliorations, notamment GRUB 2 sait utiliser des partitions RAID et LVM.+<code> 
 +[root@redhat9 ~]# last --help
  
-Le lancement de GRUB 2 se fait en trois étapes :+Usage: 
 + last [options] [<username>...] [<tty>...]
  
-  * Etape 1 : Le **boot.img**, stocké dans les 512 premiers octets du secteur 0 avec la table des partitions, est lancé. Son seul but est de lancer l'étape 1.5, +Show a listing of last logged in users.
-  * Etape 1.5 : Le **core.img**, d'une taille approximative de 25 Ko et stocké dans les secteurs 1 à 62, est lance. Son travail est de charger des pilotes qui supportent de multiples systèmes de fichiers puis de lancer l'étape 2 dans un des systèmes de fichiers, +
-  * Etape 2 : Contenu dans le répertoire **/boot/grub2/**, il lance le menu pour que l'utilisateur puisse choisir les système d'exploitation à lancer.+
  
-Dans le cas où le Charger de Démarrage **GRUB 2** n'est pas installéil convient de saisir la commande suivante :+Options: 
 + -<number>            how many lines to show 
 + -a, --hostlast       display hostnames in the last column 
 + -d, --dns            translate the IP number back into a hostname 
 + -f, --file <file>    use a specific file instead of /var/log/wtmp 
 + -F, --fulltimes      print full login and logout times and dates 
 + -i, --ip             display IP numbers in numbers-and-dots notation 
 + -n, --limit <number> how many lines to show 
 + -R, --nohostname     don't display the hostname field 
 + -s, --since <time>   display the lines since the specified time 
 + -t, --until <time>   display the lines until the specified time 
 + -p, --present <time> display who were present at the specified time 
 + -w, --fullnames      display full user and domain names 
 + -x--system         display system shutdown entries and run level changes 
 +     --time-format <format>  show timestamps in the specified <format>: 
 +                               notime|short|full|iso
  
-  # grub2-install /dev/périphérique [Entrée]+ -h, --help           display this help 
 + -V, --version        display version
  
-où **périphérique** est le nom du périphérique ou l'étape de GRUB2 doit s'installer dans le MBR+For more details see last(1). 
 +</code>
  
-**GRUB 2** lit ses entrées de menus à partir du fichier **/boot/grub2/grub.cfg**. Pour visualiser ce fichier, il convient de saisir la commande suivante :+====1.- La Commande lastlog==== 
 + 
 +Cette commande indique les dates et heures de la connexion au système la plus récente des utilisateurs :
  
 <code> <code>
-[root@centos8 ~]# cat /boot/grub2/grub.cfg  +[root@redhat9 ~]# lastlog 
-# +Username         Port     From                                       Latest 
-# DO NOT EDIT THIS FILE +root             pts/1                                              Sat Sep 28 08:43:22 +0200 2024 
-# +bin                                                                 **Never logged in** 
-# It is automatically generated by grub2-mkconfig using templates +daemon                                                              **Never logged in** 
-# from /etc/grub.d and settings from /etc/default/grub +adm                                                                 **Never logged in** 
-#+lp                                                                  **Never logged in** 
 +sync                                                                **Never logged in** 
 +shutdown                                                            **Never logged in** 
 +halt                                                                **Never logged in** 
 +mail                                                                **Never logged in** 
 +operator                                                            **Never logged in** 
 +games                                                               **Never logged in** 
 +ftp                                                                 **Never logged in** 
 +nobody                                                              **Never logged in** 
 +systemd-coredump                                                    **Never logged in** 
 +dbus                                                                **Never logged in** 
 +polkitd                                                             **Never logged in** 
 +avahi                                                               **Never logged in** 
 +tss                                                                 **Never logged in** 
 +colord                                                              **Never logged in** 
 +clevis                                                              **Never logged in** 
 +rtkit                                                               **Never logged in** 
 +sssd                                                                **Never logged in** 
 +geoclue                                                             **Never logged in** 
 +libstoragemgmt                                                      **Never logged in** 
 +systemd-oom                                                         **Never logged in** 
 +setroubleshoot                                                      **Never logged in** 
 +pipewire                                                            **Never logged in** 
 +flatpak                                                             **Never logged in** 
 +gdm              tty1                                               Thu Sep 26 14:55:01 +0200 2024 
 +cockpit-ws                                                          **Never logged in** 
 +cockpit-wsinstance                                                    **Never logged in** 
 +gnome-initial-setup                                                    **Never logged in** 
 +sshd                                                                **Never logged in** 
 +chrony                                                              **Never logged in** 
 +dnsmasq                                                             **Never logged in** 
 +tcpdump                                                             **Never logged in** 
 +trainee          pts/1    10.0.2.1                                  Sat Sep 28 08:43:17 +0200 2024 
 +apache                                                              **Never logged in** 
 +fenestros2       pts/0                                              Fri Sep 27 14:22:01 +0200 2024 
 +fenestros1                                                          **Never logged in** 
 +</code>
  
-### BEGIN /etc/grub.d/00_header ### +Les option de cette commande sont :
-set pager=1+
  
-if -f ${config_directory}/grubenv ]; then +<code> 
-  load_env -f ${config_directory}/grubenv +[root@redhat9 ~]# lastlog --help 
-elif [ -s $prefix/grubenv ]; then +Usage: lastlog [options]
-  load_env +
-fi +
-if "${next_entry}" ; then +
-   set default="${next_entry}" +
-   set next_entry= +
-   save_env next_entry +
-   set boot_once=true +
-else +
-   set default="${saved_entry}" +
-fi+
  
-if [ x"${feature_menuentry_id}" = xy ]; then +Options: 
-  menuentry_id_option="--id" +  -b, --before DAYS             print only lastlog records older than DAYS 
-else +  -C, --clear                   clear lastlog record of an user (usable only with -u) 
-  menuentry_id_option="" +  -h, --help                    display this help message and exit 
-fi+  -R, --root CHROOT_DIR         directory to chroot into 
 +  -S, --set                     set lastlog record to current time (usable only with -u) 
 +  -t, --time DAYS               print only lastlog records more recent than DAYS 
 +  -u, --user LOGIN              print lastlog record of the specified LOGIN 
 +</code>
  
-export menuentry_id_option+====1.3 - La Commande lastb====
  
-if [ "${prev_saved_entry}" ]; then +Cette commande indique les dates et heures des connexions infructueuses des utilisateurs à partir du contenu du fichier **/var/log/btmp** :
-  set saved_entry="${prev_saved_entry}" +
-  save_env saved_entry +
-  set prev_saved_entry= +
-  save_env prev_saved_entry +
-  set boot_once=true +
-fi+
  
-function savedefault { +<code> 
-  if -z "${boot_once}" ]; then +[root@redhat9 ~]# lastb 
-    saved_entry="${chosen}" +root     pts/                        Wed Sep 25 11:41 - 11:41  (00:00) 
-    save_env saved_entry +root     pts/                        Thu Oct 19 18:29 - 18:29  (00:00)
-  fi +
-}+
  
-function load_video { +btmp begins Thu Oct 19 18:29:22 2023 
-  if [ x$feature_all_video_module = xy ]; then +</code>
-    insmod all_video +
-  else +
-    insmod efi_gop +
-    insmod efi_uga +
-    insmod ieee1275_fb +
-    insmod vbe +
-    insmod vga +
-    insmod video_bochs +
-    insmod video_cirrus +
-  fi +
-}+
  
-terminal_output console +Les options de cette commande sont :
-if [ x$feature_timeout_style = xy ] ; then +
-  set timeout_style=menu +
-  set timeout=5 +
-# Fallback normal timeout code in case the timeout_style feature is +
-# unavailable. +
-else +
-  set timeout=5 +
-fi +
-### END /etc/grub.d/00_header ###+
  
-### BEGIN /etc/grub.d/00_tuned ### +<code> 
-set tuned_params="" +[root@redhat9 ~]lastb --help
-set tuned_initrd="" +
-### END /etc/grub.d/00_tuned ###+
  
-### BEGIN /etc/grub.d/01_menu_auto_hide ### +Usage: 
-if "${boot_success}" = "1" -o "${boot_indeterminate}" = "1" ]; then + lastb [options] [<username>...] [<tty>...]
-  set last_boot_ok=1 +
-else +
-  set last_boot_ok=0 +
-fi+
  
-# Reset boot_indeterminate after successful boot +Show listing of last logged in users.
-if [ "${boot_success}" = "1" ] ; then +
-  set boot_indeterminate=0 +
-# Avoid boot_indeterminate causing the menu to be hidden more then once +
-elif [ "${boot_indeterminate}" = "1" ]; then +
-  set boot_indeterminate=2 +
-fi +
-set boot_success=0 +
-save_env boot_success boot_indeterminate+
  
-if [ x$feature_timeout_style = xy ] ; then +Options: 
-  if [ "${menu_show_once}" ]; then + -<number>            how many lines to show 
-    unset menu_show_once + -a, --hostlast       display hostnames in the last column 
-    save_env menu_show_once + -d, --dns            translate the IP number back into a hostname 
-    set timeout_style=menu + -f, --file <file>    use a specific file instead of /var/log/btmp 
-    set timeout=60 + -F, --fulltimes      print full login and logout times and dates 
-  elif [ "${menu_auto_hide}" -a "${last_boot_ok}" = "1" ]; then + -i, --ip             display IP numbers in numbers-and-dots notation 
-    set orig_timeout_style=${timeout_style} + -n, --limit <number> how many lines to show 
-    set orig_timeout=${timeout} + -R, --nohostname     don't display the hostname field 
-    if [ "${fastboot}" = "1" ]; then + -s, --since <time>   display the lines since the specified time 
-      # timeout_style=menu + timeout=0 avoids the countdown code keypress check + -t, --until <time>   display the lines until the specified time 
-      set timeout_style=menu + -p, --present <time> display who were present at the specified time 
-      set timeout=0 + -w, --fullnames      display full user and domain names 
-    else + -x, --system         display system shutdown entries and run level changes 
-      set timeout_style=hidden +     --time-format <format>  show timestamps in the specified <format>: 
-      set timeout=1 +                               notime|short|full|iso
-    fi +
-  fi +
-fi +
-### END /etc/grub.d/01_menu_auto_hide ###+
  
-### BEGIN /etc/grub.d/01_users ### + -h, --help           display this help 
-if [ -f ${prefix}/user.cfg ]; then + -V, --version        display version
-  source ${prefix}/user.cfg +
-  if [ -n "${GRUB2_PASSWORD}" ]; then +
-    set superusers="root" +
-    export superusers +
-    password_pbkdf2 root ${GRUB2_PASSWORD} +
-  fi +
-fi +
-### END /etc/grub.d/01_users ###+
  
-### BEGIN /etc/grub.d/10_linux ### +For more details see last(1). 
-insmod part_msdos +</code>
-insmod ext2 +
-set root='hd0,msdos1' +
-if [ x$feature_platform_search_hint = xy ]; then +
-  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  2ae4c035-9244-458c-82c5-a49ae169cdb6 +
-else +
-  search --no-floppy --fs-uuid --set=root 2ae4c035-9244-458c-82c5-a49ae169cdb6 +
-fi +
-insmod part_msdos +
-insmod ext2 +
-set boot='hd0,msdos1' +
-if [ x$feature_platform_search_hint = xy ]; then +
-  search --no-floppy --fs-uuid --set=boot --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  2ae4c035-9244-458c-82c5-a49ae169cdb6 +
-else +
-  search --no-floppy --fs-uuid --set=boot 2ae4c035-9244-458c-82c5-a49ae169cdb6 +
-fi+
  
-# This section was generated by a scriptDo not modify the generated file all changes +====1.Le Fichier /var/log/secure====
-# will be lost the next time file is regenerated. Instead edit the BootLoaderSpec files. +
-+
-# The blscfg command parses the BootLoaderSpec files stored in /boot/loader/entries and +
-# populates the boot menu. Please refer to the Boot Loader Specification documentation +
-# for the files format: https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/.+
  
-set default_kernelopts="root=UUID=4c0cc28c-0d59-45be-bd73-d292b80be33c ro crashkernel=auto resume=UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 rhgb quiet "+Sous RHEL 9 ce fichier contient la journalisation des opérations de gestion des authentifications :
  
-insmod blscfg +<code> 
-blscfg +[root@redhat9 ~]tail -n 15 /var/log/secure 
-### END /etc/grub.d/10_linux ###+Sep 27 14:08:31 redhat9 passwd[10515]: gkr-pam: couldn't update the login keyring password: no old password was entered 
 +Sep 27 14:21:40 redhat9 su[10537]: pam_unix(su:session): session opened for user fenestros2(uid=1001) by trainee(uid=0) 
 +Sep 27 14:21:50 redhat9 su[10537]: pam_unix(su:session): session closed for user fenestros2 
 +Sep 27 14:22:01 redhat9 su[10561]: pam_unix(su-l:session): session opened for user fenestros2(uid=1001) by trainee(uid=0) 
 +Sep 27 14:23:49 redhat9 su[10561]: pam_unix(su-l:session): session closed for user fenestros2 
 +Sep 27 17:23:32 redhat9 sshd[9392]: Received disconnect from 10.0.2.1 port 37560:11: disconnected by user 
 +Sep 27 17:23:32 redhat9 sshd[9392]: Disconnected from user trainee 10.0.2.1 port 37560 
 +Sep 27 17:23:32 redhat9 sshd[9357]: pam_unix(sshd:session): session closed for user trainee 
 +Sep 27 17:23:32 redhat9 su[10062]: pam_unix(su-l:session): session closed for user root 
 +Sep 28 08:09:13 redhat9 sshd[11965]: Accepted password for trainee from 10.0.2.1 port 42238 ssh2 
 +Sep 28 08:09:13 redhat9 systemd[11972]: pam_unix(systemd-user:session): session opened for user trainee(uid=1000) by trainee(uid=0) 
 +Sep 28 08:09:13 redhat9 sshd[11965]: pam_unix(sshd:session): session opened for user trainee(uid=1000) by trainee(uid=0) 
 +Sep 28 08:43:17 redhat9 sshd[12053]: Accepted password for trainee from 10.0.2.1 port 33994 ssh2 
 +Sep 28 08:43:17 redhat9 sshd[12053]: pam_unix(sshd:session): session opened for user trainee(uid=1000) by trainee(uid=0) 
 +Sep 28 08:43:22 redhat9 su[12102]: pam_unix(su-l:session): session opened for user root(uid=0) by trainee(uid=1000) 
 +</code>
  
-### BEGIN /etc/grub.d/20_linux_xen ### +====1.5 - Gestion des Evénements audit====
-### END /etc/grub.d/20_linux_xen ###+
  
-### BEGIN /etc/grub.d/20_ppc_terminfo ### +===Le fichier /var/log/audit/audit.log===
-### END /etc/grub.d/20_ppc_terminfo ###+
  
-### BEGIN /etc/grub.d/30_os-prober ### +Ce fichier contient les messages du système d'audit, appelés des **événements**Le système audit est installé par défaut dans RHEL 9 par le paquet **audit**. Le système audit collectionne des informations telles :
-### END /etc/grub.d/30_os-prober ###+
  
-### BEGIN /etc/grub.d/30_uefi-firmware ### +  * des appels système, 
-### END /etc/grub.d/30_uefi-firmware ###+  * des accès aux fichiers, 
 +  * des informations en provenance de %%SELinux%%.
  
-### BEGIN /etc/grub.d/40_custom ### +Consultez maintenant le fichier **/var/log/audit.log** :
-# This file provides an easy way to add custom menu entries Simply type the +
-# menu entries you want to add after this comment.  Be careful not to change +
-# the 'exec tail' line above. +
-### END /etc/grub.d/40_custom ###+
  
-### BEGIN /etc/grub.d/41_custom ### +<code> 
-if [ - ${config_directory}/custom.cfg ]; then +[root@redhat9 ~]tail -n 15 /var/log/audit/audit.log 
-  source ${config_directory}/custom.cfg +type=CRYPTO_KEY_USER msg=audit(1727528067.947:1046): pid=12618 uid=0 auid=1000 ses=14 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=destroy kind=server fp=SHA256:93:f7:28:a0:3a:d4:ca:78:e9:ac:1a:21:98:58:c9:77:6d:88:8b:6c:65:09:71:5d:4c:7b:7f:1c:05:e9:0c:4e direction=? spid=12618 suid=0  exe="/usr/sbin/sshd" hostname=? addr=? terminal=? res=success'UID="root" AUID="trainee" SUID="root" 
-elif [ -"${config_directory}" -a -f  $prefix/custom.cfg ]; then +type=CRED_ACQ msg=audit(1727528067.948:1047): pid=12618 uid=0 auid=1000 ses=14 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_localuser,pam_unix acct="trainee" exe="/usr/sbin/sshd" hostname=10.0.2.1 addr=10.0.2.1 terminal=ssh res=success'UID="root" AUID="trainee" 
-  source $prefix/custom.cfg; +type=USER_LOGIN msg=audit(1727528067.994:1048): pid=12613 uid=0 auid=1000 ses=14 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=login id=1000 exe="/usr/sbin/sshd" hostname=? addr=10.0.2.1 terminal=/dev/pts/1 res=success'UID="root" AUID="trainee" ID="trainee" 
-fi +type=USER_START msg=audit(1727528067.994:1049): pid=12613 uid=0 auid=1000 ses=14 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=login id=1000 exe="/usr/sbin/sshdhostname=? addr=10.0.2.1 terminal=/dev/pts/1 res=success'UID="root" AUID="trainee" ID="trainee" 
-### END /etc/grub.d/41_custom ###+type=CRYPTO_KEY_USER msg=audit(1727528067.996:1050): pid=12613 uid=0 auid=1000 ses=14 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=destroy kind=server fp=SHA256:93:f7:28:a0:3a:d4:ca:78:e9:ac:1a:21:98:58:c9:77:6d:88:8b:6c:65:09:71:5d:4c:7b:7f:1c:05:e9:0c:4e direction=? spid=12628 suid=1000  exe="/usr/sbin/sshd" hostname=? addr=? terminal=? res=success'UID="root" AUID="trainee" SUID="trainee" 
 +type=BPF msg=audit(1727528068.011:1051): prog-id=189 op=LOAD 
 +type=BPF msg=audit(1727528068.011:1052): prog-id=190 op=LOAD 
 +type=SERVICE_START msg=audit(1727528068.076:1053): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-hostnamed comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'UID="root" AUID="unset" 
 +type=USER_AUTH msg=audit(1727528075.273:1054): pid=12662 uid=1000 auid=1000 ses=14 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:authentication grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=? addr=? terminal=/dev/pts/1 res=success'UID="trainee" AUID="trainee" 
 +type=USER_ACCT msg=audit(1727528075.276:1055): pid=12662 uid=1000 auid=1000 ses=14 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_unix,pam_localuser acct="root" exe="/usr/bin/su" hostname=? addr=? terminal=/dev/pts/1 res=success'UID="trainee" AUID="trainee" 
 +type=CRED_ACQ msg=audit(1727528075.277:1056): pid=12662 uid=1000 auid=1000 ses=14 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=? addr=? terminal=/dev/pts/1 res=success'UID="trainee" AUID="trainee" 
 +type=USER_START msg=audit(1727528075.281:1057): pid=12662 uid=1000 auid=1000 ses=14 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask,pam_xauth acct="root" exe="/usr/bin/su" hostname=? addr=? terminal=/dev/pts/1 res=success'UID="trainee" AUID="trainee" 
 +type=SERVICE_STOP msg=audit(1727528105.326:1058): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-hostnamed comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'UID="root" AUID="unset" 
 +type=BPF msg=audit(1727528105.369:1059): prog-id=190 op=UNLOAD 
 +type=BPF msg=audit(1727528105.369:1060): prog-id=189 op=UNLOAD
 </code> </code>
  
-Notez que ce fichier ne doit pas être modifié manuellement. En effet, il est généré par la commande **grub2-mkconfig**. La commande grub2-mkconfig prend en argument l'emplacement du fichier grub.cfg, par exemple :+La gestion des événements audit se repose sur trois exécutables :
  
-  * grub2-mkconfig -o /boot/grub2/grub.cfg, ou +===auditd===
-  * grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg+
  
-Lors de l'exécution de la commande **grub2-mkconfig** plusieurs fichiers sont lus : +Cet exécutable est le daemon du système audit. Il est responsable de l’écriture des enregistrements audit sur disque. Son fichier de configuration est le **/etc/audit/auditd.conf** :
- +
-===Le fichier /boot/grub2/device.map===+
  
 <code> <code>
-[root@centos8 ~]# cat /boot/grub2/device.map +[root@redhat9 ~]# cat /etc/audit/auditd.conf 
-this device map was generated by anaconda +
-(hd0)      /dev/sda +# This file controls the configuration of the audit daemon 
-(hd1)      /dev/sda +#
-</code> +
- +
-===Le fichier /etc/default/grub=== +
- +
-Ce fichier contient la configuration par défaut des paramètres de GRUB 2 :+
  
-<code> +local_events = yes 
-[root@centos8 ~]# cat /etc/default/grub +write_logs = yes 
-GRUB_TIMEOUT=5 +log_file = /var/log/audit/audit.log 
-GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" +log_group = root 
-GRUB_DEFAULT=saved +log_format = ENRICHED 
-GRUB_DISABLE_SUBMENU=true +flush = INCREMENTAL_ASYNC 
-GRUB_TERMINAL_OUTPUT="console" +freq = 50 
-GRUB_CMDLINE_LINUX="crashkernel=auto resume=UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 rhgb quiet" +max_log_file = 8 
-GRUB_DISABLE_RECOVERY="true" +num_logs = 5 
-GRUB_ENABLE_BLSCFG=true+priority_boost 4 
 +name_format NONE 
 +##name mydomain 
 +max_log_file_action ROTATE 
 +space_left 75 
 +space_left_action SYSLOG 
 +verify_email yes 
 +action_mail_acct root 
 +admin_space_left = 50 
 +admin_space_left_action = SUSPEND 
 +disk_full_action = SUSPEND 
 +disk_error_action = SUSPEND 
 +use_libwrap = yes 
 +##tcp_listen_port = 60 
 +tcp_listen_queue = 5 
 +tcp_max_per_addr = 1 
 +##tcp_client_ports = 1024-65535 
 +tcp_client_max_idle 
 +transport = TCP 
 +krb5_principal = auditd 
 +##krb5_key_file = /etc/audit/audit.key 
 +distribute_network = no 
 +q_depth = 2000 
 +overflow_action = SYSLOG 
 +max_restarts = 10 
 +plugin_dir = /etc/audit/plugins.d 
 +end_of_event_timeout 2
 </code> </code>
  
-<WRAP center round important 60%> +Les option de cette commande sont :
-**Important** : Notez que toute modification de ce fichier nécessite l'exécution de la commande **grub2-mkconfig** pour que les modifications soient prises en compte. +
-</WRAP> +
- +
-Dans ce fichier les directives sont +
- +
-^  Directive  ^ Description ^ +
-| GRUB_TIMEOUT | Durée de l'affichage du menu avant le démarrage en utilisant la valeur de GRUB_DEFAULT | +
-| GRUB_DISTRIBUTOR | Ligne de commande qui génère le texte de l'entrée | +
-| GRUB_DEFAULT | Entrée du menu sélectionner par défaut | +
-| GRUB_DISABLE_SUBMENU | Active ou désactive les sous-menus de GRUB2 | +
-| GRUB_TERMINAL_OUTPUT | Spécifie le terminal par défaut | +
-| GRUB_CMDLINE_LINUX | Paramètres passés au noyau peu importe le type de démarrage | +
-| GRUB_DISABLE_RECOVERY | Active ou désactive la génération des entrées en mode **recovery** | +
-| GRUB_BLSCFG | Active ou désactive l'utilisation de la nouvelle spécification du gestionnaire de démarrage pour configurer celui-ci | +
- +
-===Les fichiers du répertoire /etc/grub.d=== +
- +
-Les fichiers de ce répertoire sont exécutés dans l'ordre alphanumérique et servent à construire les menus de GRUB 2 :+
  
 <code> <code>
-[root@centos8 ~]#  ls -l /etc/grub.d +[root@redhat9 ~]# auditd --help 
-total 92 +auditdunrecognized option '--help' 
--rwxr-xr-x. 1 root root  8958 Mar  2 15:51 00_header +Usageauditd [-f] [-l] [-n] [-s disable|enable|nochange] [-c <config_file>]
--rwxr-xr-x. 1 root root  1043 Jun 15  2020 00_tuned +
--rwxr-xr-x. 1 root root   232 Mar  2 15:51 01_users +
--rwxr-xr-x. 1 root root   832 Mar  2 15:51 08_fallback_counting +
--rwxr-xr-x. 1 root root 14088 Mar  2 15:51 10_linux +
--rwxr-xr-x. 1 root root   830 Mar  2 15:51 10_reset_boot_success +
--rwxr-xr-x. 1 root root   889 Mar  2 15:51 12_menu_auto_hide +
--rwxr-xr-x. 1 root root 11696 Mar  2 15:51 20_linux_xen +
--rwxr-xr-x. 1 root root  2559 Mar  2 15:51 20_ppc_terminfo +
--rwxr-xr-x. 1 root root 10670 Mar  2 15:51 30_os-prober +
--rwxr-xr-x. 1 root root  1412 Mar  2 15:51 30_uefi-firmware +
--rwxr-xr-x. 1 root root   214 Mar  2 15:51 40_custom +
--rwxr-xr-x. 1 root root   216 Mar  2 15:51 41_custom +
--rw-r--r--. 1 root root   483 Mar  2 15:51 README+
 </code> </code>
  
-  * **Le fichier /etc/grub.d/10_Linux**, +===auditctl===
-    * Le fichier **10_Linux** contient des boucles pour rechercher des noyaux Linux, +
-  * **Le fichier /etc/grub.d/30_os-prober**, +
-    * Ce fichier recherche des éventuels systèmes d'exploitation autre que Linux, +
-  * **Les fichiers /etc/grub.d/40_custom et /etc/grub.d/41_custom**, +
-    * Ces deux fichiers sont fournis en tant que modèles à personnaliser.+
  
-===Le Fichier /boot/grub2/grubenv=== +Cet exécutable est utilisé pour configurer les règles du système audit. Au démarrageauditctl lit et applique les règles contunues dans le fichier **/etc/audit/audit.rules** :
- +
-Le fichier **/boot/grub2/grubenv** contient l'entrée du menu sauvegardéeréférencée par la directive **GRUB_DEFAULT** du fichier **/etc/default/grub** :+
  
 <code> <code>
-[root@centos8 ~]# cat /boot/grub2/grubenv +[root@redhat9 ~]# cat /etc/audit/audit.rules 
-GRUB Environment Block +## This file is automatically generated from /etc/audit/rules.d 
-saved_entry=de79af4f226d480fa7d3fec4cabbf97a-4.18.0-240.22.1.el8_3.x86_64 +-
-kernelopts=root=UUID=4c0cc28c-0d59-45be-bd73-d292b80be33c ro crashkernel=auto resume=UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 rhgb quiet  +-b 8192 
-boot_success=1 +-f 
-boot_indeterminate=0 +--backlog_wait_time 60000
-########################################################################################################################################## +
-########################################################################################################################################## +
-########################################################################################################################################## +
-########################################################################################################################################## +
-########################################################################################################################################## +
-############################################################[root@centos8 ~]# +
-</code>+
  
-===Modifier la Configuration de GRUB 2 en Ligne de Commande===+[root@redhat9 ~]# ls -l /etc/audit/rules.d 
 +total 4 
 +-rw-------. 1 root root 244 Oct 19  2023 audit.rules
  
-Lors du démarrage de GRUB 2, trois actions sont possibles à partir du menu :+[root@redhat9 ~]# cat /etc/audit/rules.d/audit.rules  
 +## First rule - delete all 
 +-D
  
-  * Lancer un système d'exploitation en le sélectionnant avec les flèches puis en appuyant sur la touche <key>Entrée</key>, +## Increase the buffers to survive stress events. 
-  * Lancer l'éditeur en appuyant sur la touche **e**, +## Make this bigger for busy systems 
-  * Lancer l’interface de la ligne de commande GRUB en appuyant sur la touche **c**.+-b 8192
  
-En mode édition notez l'utilisation des touches suivantes :+## This determine how long to wait in burst of events 
 +--backlog_wait_time 60000
  
-  * **flèches** : se déplacer dans l'écran. L'édition se fait en utilisant simplement les touches du clavier, +## Set failure mode to syslog 
-  * **Crtl-X** : démarrer avec la configuration modifiée, +-f 1
-  * **echap** : abandonner les modifications et retourner à l'interface menu de GRUB 2.+
  
-====Chargeurs de Démarrages Alternatifs====+</code>
  
-===Systemd-boot===+Les options de cette commande sont :
  
-Un Chargeur de Démarrage étroitement lié à Systemd voir plus bas ), celui-ci connaît actuellement un gain de popularité.+<code> 
 +[root@redhat9 ~]# auditctl -h 
 +usage: auditctl [options] 
 +    -a <l,a>                          Append rule to end of <l>ist with <a>ction 
 +    -A <l,a>                          Add rule at beginning of <l>ist with <a>ction 
 +    -b <backlog>                      Set max number of outstanding audit buffers 
 +                                      allowed Default=64 
 +    -c                                Continue through errors in rules 
 +    -C f=f                            Compare collected fields if available: 
 +                                      Field name, operator(=,!=), field name 
 +    -d <l,a>                          Delete rule from <l>ist with <a>ction 
 +                                      l=task,exit,user,exclude,filesystem 
 +                                      a=never,always 
 +    -D                                Delete all rules and watches 
 +    -e [0..2]                         Set enabled flag 
 +    -f [0..2]                         Set failure flag 
 +                                      0=silent 1=printk 2=panic 
 +    -F f=v                            Build rule: field name, operator(=,!=,<,>,<=, 
 +                                      >=,&,&=) value 
 +    -h                                Help 
 +    -i                                Ignore errors when reading rules from file 
 +    -k <key>                          Set filter key on audit rule 
 +    -l                                List rules 
 +    -m text                           Send a user-space message 
 +    -p [r|w|x|a]                      Set permissions filter on watch 
 +                                      r=read, w=write, x=execute, a=attribute 
 +    -q <mount,subtree>                make subtree part of mount point's dir watches 
 +    -r <rate>                         Set limit in messages/sec (0=none) 
 +    -R <file>                         read rules from file 
 +    -s                                Report status 
 +    -S syscall                        Build rule: syscall name or number 
 +    --signal <signal>                 Send the specified signal to the daemon 
 +    -t                                Trim directory watches 
 +    -v                                Version 
 +    -w <path>                         Insert watch at <path> 
 +    -W <path>                         Remove watch at <path> 
 +    --loginuid-immutable              Make loginuids unchangeable once set 
 +    --backlog_wait_time               Set the kernel backlog_wait_time 
 +    --reset-lost                      Reset the lost record counter 
 +    --reset_backlog_wait_time_actual  Reset the actual backlog wait time counter 
 +There was an error while processing parameters 
 +</code>
  
-===U-boot===+===La consultation des événements audit===
  
-Un Chargeur de Démarrage qui peut booter n'importe quelle image à partir de n'importe quel support.+La consultation des événements audit se fait en utilisant les commandes **ausearch** et **aureport** :
  
-===Le Projet Syslinux===+==La Commande aureport==
  
-==SYSLINUX==+Cette commande est utilisée pour générer des rapports :
  
-Un Chargeur de Démarrage pour les systèmes qui utilisent le système de fichier FAT. Par exemple le systèmes sur clefs USB.+<code> 
 +[root@redhat9 ~]# aureport
  
-==EXTLINUX==+Summary Report 
 +====================== 
 +Range of time in logs: 10/19/2023 18:27:19.140 - 09/28/2024 14:57:20.231 
 +Selected time for report: 10/19/2023 18:27:19 - 09/28/2024 14:57:20.231 
 +Number of changes in configuration: 72 
 +Number of changes to accounts, groups, or roles: 30 
 +Number of logins: 12 
 +Number of failed logins: 0 
 +Number of authentications: 43 
 +Number of failed authentications: 11 
 +Number of users: 4 
 +Number of terminals: 9 
 +Number of host names: 4 
 +Number of executables: 21 
 +Number of commands: 11 
 +Number of files: 0 
 +Number of AVC's: 0 
 +Number of MAC events: 41 
 +Number of failed syscalls: 0 
 +Number of anomaly events: 0 
 +Number of responses to anomaly events: 0 
 +Number of crypto events: 104 
 +Number of integrity events: 0 
 +Number of virt events: 0 
 +Number of keys: 0 
 +Number of process IDs: 158 
 +Number of events: 2567 
 +</code>
  
-Un Chargeur de Démarrage de petite taille qui sait booter des systèmes de fichier, EXT2, EXT3, EXT4 et BRTFS.+Les options de cette commande sont :
  
-==ISOLINUX==+<code> 
 +[root@redhat9 ~]# aureport --help 
 +usage: aureport [options] 
 +        -a,--avc                        Avc report 
 +        -au,--auth                      Authentication report 
 +        --comm                          Commands run report 
 +        -c,--config                     Config change report 
 +        -cr,--crypto                    Crypto report 
 +        --debug                         Write malformed events that are skipped to stderr 
 +        --eoe-timeout secs              End of Event Timeout 
 +        -e,--event                      Event report 
 +        --escape option                 Escape output 
 +        -f,--file                       File name report 
 +        --failed                        only failed events in report 
 +        -h,--host                       Remote Host name report 
 +        --help                          help 
 +        -i,--interpret                  Interpretive mode 
 +        -if,--input <Input File name>   use this file as input 
 +        --input-logs                    Use the logs even if stdin is a pipe 
 +        --integrity                     Integrity event report 
 +        -k,--key                        Key report 
 +        -l,--login                      Login report 
 +        -m,--mods                       Modification to accounts report 
 +        -ma,--mac                       Mandatory Access Control (MAC) report 
 +        -n,--anomaly                    aNomaly report 
 +        -nc,--no-config                 Don't include config events 
 +        --node <node name>              Only events from a specific node 
 +        -p,--pid                        Pid report 
 +        -r,--response                   Response to anomaly report 
 +        -s,--syscall                    Syscall report 
 +        --success                       only success events in report 
 +        --summary                       sorted totals for main object in report 
 +        -t,--log                        Log time range report 
 +        -te,--end [end date] [end time] ending date & time for reports 
 +        -tm,--terminal                  TerMinal name report 
 +        -ts,--start [start date] [start time]   starting data & time for reports 
 +        --tty                           Report about tty keystrokes 
 +        -u,--user                       User name report 
 +        -v,--version                    Version 
 +        --virt                          Virtualization report 
 +        -x,--executable                 eXecutable name report 
 +        If no report is given, the summary report will be displayed 
 +</code>
  
-Un Chargeur de Démarrage pour booter des LiveCD et LiveDVD. Dans le cas d'ISOLINUX, deux fichiers sont necéssaires :+==La Commande ausearch==
  
-  * **isolinux.bin** qui contient l'image du Chargeur de Démarrage et +Cette commande est utilisée pour rechercher des événementsPar exemple, pour rechercher les événements liés à un utilisateur représenté par son UID :
-  * **isolinux.cfg** qui contient les paramètres de configuration.+
  
-==PXELINUX== +<code> 
-  +[root@redhat9 ~]# ausearch -ui 1000 | more 
-Un Chargeur de Démarrage pour booter à partir d'un serveur réseauCe système utilise le standard **PXE** (//Pre-boot Execution Environment//) qui utilise :+---- 
 +time->Thu Oct 19 18:29:20 2023 
 +type=USER_AUTH msg=audit(1697732960.285:140): pid=6261 uid=1000 auid=1000 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:authentication grantors=? acct="root" exe="/usr/bin/su" hos 
 +tname=? addr=? terminal=/dev/pts/0 res=failed' 
 +---- 
 +time->Thu Oct 19 18:29:31 2023 
 +type=USER_AUTH msg=audit(1697732971.707:144): pid=6294 uid=1000 auid=1000 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:authentication grantors=pam_unix acct="root" exe="/usr/bin/ 
 +su" hostname=? addr=? terminal=/dev/pts/0 res=success' 
 +---- 
 +time->Thu Oct 19 18:29:31 2023 
 +type=USER_ACCT msg=audit(1697732971.746:145): pid=6294 uid=1000 auid=1000 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_unix,pam_localuser acct="root" exe= 
 +"/usr/bin/su" hostname=? addr=? terminal=/dev/pts/0 res=success' 
 +---- 
 +time->Thu Oct 19 18:29:31 2023 
 +type=CRED_ACQ msg=audit(1697732971.747:146): pid=6294 uid=1000 auid=1000 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/su" host 
 +name=? addr=? terminal=/dev/pts/0 res=success' 
 +---- 
 +time->Thu Oct 19 18:29:31 2023 
 +type=USER_START msg=audit(1697732971.835:147): pid=6294 uid=1000 auid=1000 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_keyinit,pam_keyinit,pam_limits,
 +am_systemd,pam_unix,pam_umask,pam_xauth acct="root" exe="/usr/bin/su" hostname=? addr=? terminal=/dev/pts/0 res=success' 
 +---- 
 +time->Thu Oct 19 18:35:21 2023 
 +type=USER_AUTH msg=audit(1697733321.865:218): pid=6500 uid=1000 auid=1000 ses=6 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:authentication grantors=pam_unix acct="root" exe="/usr/bin/ 
 +su" hostname=? addr=? terminal=/dev/pts/1 res=success' 
 +---- 
 +time->Thu Oct 19 18:35:21 2023 
 +type=USER_ACCT msg=audit(1697733321.905:219): pid=6500 uid=1000 auid=1000 ses=6 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_unix,pam_localuser acct="root" exe= 
 +"/usr/bin/su" hostname=? addr=? terminal=/dev/pts/1 res=success' 
 +---- 
 +time->Thu Oct 19 18:35:21 2023 
 +type=CRED_ACQ msg=audit(1697733321.905:220): pid=6500 uid=1000 auid=1000 ses=6 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/su" host 
 +name=? addr=? terminal=/dev/pts/1 res=success' 
 +---- 
 +time->Thu Oct 19 18:35:21 2023 
 +type=USER_START msg=audit(1697733321.909:221): pid=6500 uid=1000 auid=1000 ses=6 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_keyinit,pam_keyinit,pam_limits,
 +am_systemd,pam_unix,pam_umask,pam_xauth acct="root" exe="/usr/bin/su" hostname=? addr=? terminal=/dev/pts/1 res=success' 
 +---- 
 +time->Thu Oct 19 18:35:40 2023 
 +type=USER_END msg=audit(1697733340.703:222): pid=6500 uid=1000 auid=1000 ses=6 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_keyinit,pam_keyinit,pam_limits,pa 
 +m_systemd,pam_unix,pam_umask,pam_xauth acct="root" exe="/usr/bin/su" hostname=? addr=? terminal=/dev/pts/1 res=success' 
 +---- 
 +time->Thu Oct 19 18:35:40 2023 
 +type=CRED_DISP msg=audit(1697733340.704:223): pid=6500 uid=1000 auid=1000 ses=6 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/su" hos 
 +tname=? addr=? terminal=/dev/pts/1 res=success' 
 +---- 
 +time->Wed Sep 25 10:15:06 2024 
 +type=USER_AUTH msg=audit(1727252106.538:115): pid=1963 uid=1000 auid=1000 ses=2 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:authentication grantors=pam_unix acct="root" exe="/usr/bin/ 
 +su" hostname=? addr=? terminal=/dev/pts/0 res=success' 
 +---- 
 +time->Wed Sep 25 10:15:06 2024 
 +type=USER_ACCT msg=audit(1727252106.579:116): pid=1963 uid=1000 auid=1000 ses=2 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_unix,pam_localuser acct="root" exe= 
 +"/usr/bin/su" hostname=? addr=? terminal=/dev/pts/0 res=success' 
 +---- 
 +time->Wed Sep 25 10:15:06 2024 
 +type=CRED_ACQ msg=audit(1727252106.579:117): pid=1963 uid=1000 auid=1000 ses=2 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/su" host 
 +--More-- 
 +[q] 
 +</code> 
  
-    * **DHCP** pour attribuer une adresse IP à la machine et +Les options de cette commande sont :
-    * **BOOTP** pour charger l'image du Chargeur de Démarrage à partir du serveur en utilisant le protocol **TFTP** (//Trivial File Transfer Protocol//). L'image à télécharger doit s'appeler **/tftpboot/pxelinux.0** et chaque machine doit avoir un fichier de configuration dans le répertoire **/tftpboot/pxelinux.cfg/**+
  
-===Isodhpfx===+<code> 
 +[root@redhat9 ~]# ausearch --help 
 +usage: ausearch [options] 
 +        -a,--event <Audit event id>     search based on audit event id 
 +        --arch <CPU>                    search based on the CPU architecture 
 +        -c,--comm  <Comm name>          search based on command line name 
 +        --checkpoint <checkpoint file>  search from last complete event 
 +        --debug                 Write malformed events that are skipped to stderr 
 +        -e,--exit  <Exit code or errno> search based on syscall exit code 
 +        -escape <option>                escape output 
 +        --eoe-timeout secs              End of Event timeout 
 +        --extra-keys                    add a final column with key information 
 +        --extra-labels                  add columns of information about subject and object labels 
 +        --extra-obj2                    add columns of information about a second object 
 +        --extra-time                    add columns of information about broken down time 
 +        -f,--file  <File name>          search based on file name 
 +        --format [raw|default|interpret|csv|text] results format options 
 +        -ga,--gid-all <all Group id>    search based on All group ids 
 +        -ge,--gid-effective <effective Group id>  search based on Effective 
 +                                        group id 
 +        -gi,--gid <Group Id>            search based on group id 
 +        -h,--help                       help 
 +        -hn,--host <Host Name>          search based on remote host name 
 +        -i,--interpret                  Interpret results to be human readable 
 +        -if,--input <Input File name>   use this file instead of current logs 
 +        --input-logs                    Use the logs even if stdin is a pipe 
 +        --just-one                      Emit just one event 
 +        -k,--key  <key string>          search based on key field 
 +        -l, --line-buffered             Flush output on every line 
 +        -m,--message  <Message type>    search based on message type 
 +        -n,--node  <Node name>          search based on machine's name 
 +        -o,--object  <SE Linux Object context> search based on context of object 
 +        -p,--pid  <Process id>          search based on process id 
 +        -pp,--ppid <Parent Process id>  search based on parent process id 
 +        -r,--raw                        output is completely unformatted 
 +        -sc,--syscall <SysCall name>    search based on syscall name or number 
 +        -se,--context <SE Linux context> search based on either subject or 
 +                                         object 
 +        --session <login session id>    search based on login session id 
 +        -su,--subject <SE Linux context> search based on context of the Subject 
 +        -sv,--success <Success Value>   search based on syscall or event 
 +                                        success value 
 +        -te,--end [end date] [end time] ending date & time for search 
 +        -ts,--start [start date] [start time]   starting date & time for search 
 +        -tm,--terminal <TerMinal>       search based on terminal 
 +        -ua,--uid-all <all User id>     search based on All user id's 
 +        -ue,--uid-effective <effective User id>  search based on Effective 
 +                                        user id 
 +        -ui,--uid <User Id>             search based on user id 
 +        -ul,--loginuid <login id>       search based on the User's Login id 
 +        -uu,--uuid <guest UUID>         search for events related to the virtual 
 +                                        machine with the given UUID. 
 +        -v,--version                    version 
 +        -vm,--vm-name <guest name>      search for events related to the virtual 
 +                                        machine with the name. 
 +        -w,--word                       string matches are whole word 
 +        -x,--executable <executable name>  search based on executable name 
 +</code>
  
-Un Chargeur de Démarrage hybrideappelé **isodhpfx.bin**, qui peut être chargé sur un disque **ou** une clef USB. Le fichier isodhpfx.bin est créé avec le programme **xorriso**.+<WRAP center round important 60%> 
 +**Important** : Pour plus d'information concernant le système audit, consultez les manuels de **auditd**, **auditctl**, **audispd**, **aureport** et **ausearch**. 
 +</WRAP>
  
-====Initramfs====+=====Le fichier /var/log/messages=====
  
-Le fichier Initramfs //%%INITial Ram File System%%// est une archive au format cpio :+Ce fichier contient la plupart des messages du système :
  
 <code> <code>
-[root@centos8 ~]# cp /boot/initramfs-4.18.0-240.22.1.el8_3.x86_64.img /tmp/custom +[root@redhat9 ~]# tail -n 15 /var/log/messages 
-[root@centos8 ~]# cd /tmp +Sep 28 13:33:57 redhat9 systemd[1]: dnf-makecache.service: Consumed 1.476s CPU time. 
-[root@centos8 tmp]# ls +Sep 28 13:35:04 redhat9 cupsd[5736]: REQUEST localhost - - "POST HTTP/1.1" 200 182 Renew-Subscription successful-ok 
-cpio.list +Sep 28 14:33:24 redhat9 cupsd[5736]: REQUEST localhost - - "POST HTTP/1.1" 200 182 Renew-Subscription successful-ok 
-custom +Sep 28 14:54:27 redhat9 systemd-logind[5671]: New session 14 of user trainee. 
-dateref +Sep 28 14:54:27 redhat9 systemd[1]: Started Session 14 of User trainee
-incremental.tar +Sep 28 14:54:28 redhat9 systemd[1]: Starting Hostname Service... 
-mbr.save +Sep 28 14:54:28 redhat9 systemd[1]: Started Hostname Service. 
-systemd-private-9af7a2f7444849578f55b306bfd9f820-chronyd.service-iQiNzF +Sep 28 14:54:35 redhat9 su[12662]: (to root) trainee on pts/1 
-tblpart.save +Sep 28 14:55:05 redhat9 systemd[1]: systemd-hostnamed.service: Deactivated successfully
-test.cpio +Sep 28 14:57:20 redhat9 systemd[1]: Starting Cleanup of Temporary Directories..
-test.print +Sep 28 14:57:20 redhat9 systemd[1]: systemd-tmpfiles-clean.service: Deactivated successfully
-test.tar +Sep 28 14:57:20 redhat9 systemd[1]: Finished Cleanup of Temporary Directories
-tmp.iso +Sep 28 14:57:20 redhat9 systemd[1]: run-credentials-systemd\x2dtmpfiles\x2dclean.service.mount: Deactivated successfully
-vg0_backup+Sep 28 15:02:37 redhat9 systemd[5851]: Starting Cleanup of User's Temporary Files and Directories..
 +Sep 28 15:02:37 redhat9 systemd[5851]: Finished Cleanup of User's Temporary Files and Directories
 +</code>
  
-[root@centos8 tmp]# mv custom custom.gz+=====Applications=====
  
-[root@centos8 tmp]# gunzip custom.gz+Certaines applications consignent leurs journaux dans des répertoires spécifiquesPar exemple :
  
-[root@centos8 tmp]# mkdir initramfs+   * cups, 
 +   * httpd, 
 +   * samba, 
 +   * ...
  
-[root@centos8 tmp]# cd initramfs +<code> 
- +[root@redhat9 ~]# ls -l /var/log 
-[root@centos8 initramfs]# cpio -cid -../custom +total 1952 
-216 blocks +drwxr-xr-x. 2 root   root     4096 Oct 19  2023 anaconda 
-[root@centos8 initramfs]# ls +drwx------. 2 root   root       23 Nov  8  2023 audit 
-bin  dev  etc  init  lib  lib64  proc  root  run  sbin  shutdown  sys  sysroot  tmp  usr  var+-rw-------1 root   root        0 Sep 26 00:00 boot.log 
 +-rw-------. 1 root   root    68528 Sep 26 00:00 boot.log-20240926 
 +-rw-rw----. 1 root   utmp      768 Sep 25 11:41 btmp 
 +drwxr-x---. 2 chrony chrony      6 Jan 23  2024 chrony 
 +-rw-------. 1 root   root    31832 Sep 28 15:01 cron 
 +drwxr-xr-x. 2 lp     sys        57 Jun 19 11:00 cups 
 +-rw-r--r--. 1 root   root   150441 Sep 28 13:33 dnf.librepo.log 
 +-rw-r--r--. 1 root   root   672698 Sep 28 13:33 dnf.log 
 +-rw-r--r--. 1 root   root    96613 Sep 28 13:33 dnf.rpm.log 
 +-rw-r-----. 1 root   root        0 Oct 19  2023 firewalld 
 +drwx--x--x. 2 root   gdm         6 Jan 18  2024 gdm 
 +-rw-r--r--. 1 root   root     4440 Sep 28 14:39 hawkey.log 
 +drwx------. 2 root   root       41 Sep 26 15:01 httpd 
 +drwx------. 2 root   root        6 Feb 15  2024 insights-client 
 +-rw-------. 1 root   root     3942 Sep 26 14:55 kdump.log 
 +-rw-rw-r--. 1 root   utmp   293168 Sep 28 14:54 lastlog 
 +-rw-------. 1 root   root        0 Oct 19  2023 maillog 
 +-rw-------. 1 root   root   875426 Sep 28 15:02 messages 
 +drwx------. 2 root   root        6 Oct 19  2023 private 
 +drwxr-xr-x. 2 root   root        6 Aug 15 09:40 qemu-ga 
 +lrwxrwxrwx. 1 root   root       39 Oct 19  2023 README -> ../../usr/share/doc/systemd/README.logs 
 +drwxr-xr-x. 2 root   root       43 Jan 18  2024 rhsm 
 +drwx------. 3 root   root       17 May  1 21:13 samba 
 +-rw-------. 1 root   root    28327 Sep 28 14:54 secure 
 +drwx------. 2 root   root        6 Aug 11  2021 speech-dispatcher 
 +-rw-------. 1 root   root        0 Oct 19  2023 spooler 
 +drwxr-x---. 2 sssd   sssd       26 May 17 03:59 sssd 
 +-rw-------. 1 root   root        0 Oct 19  2023 tallylog 
 +drwxr-xr-x. 2 root   root       23 Feb 22  2024 tuned 
 +-rw-rw-r--. 1 root   utmp    12288 Sep 28 14:54 wtmp
 </code> </code>
  
-===Examiner l'image existante===+=====LAB #2 - rsyslog=====
  
-Pour examiner une image initramfs archivéeil convient d'utiliser la commande **lsinitrd** :+**rsyslog**, le successeur de syslogcentralise les journaux du système grâce au daemon **rsyslog**
  
-<code> +rsyslog apporte des améliorations par rapport à syslogd 
-[root@centos8 tmp]# lsinitrd custom | more +
-Imagecustom: 25M +
-======================================================================== +
-Early CPIO image +
-======================================================================== +
-drwxr-xr-x   3 root     root            0 Feb 22 10:57 . +
--rw-r--r--   1 root     root            2 Feb 22 10:57 early_cpio +
-drwxr-xr-x   3 root     root            0 Feb 22 10:57 kernel +
-drwxr-xr-x   3 root     root            0 Feb 22 10:57 kernel/x86 +
-drwxr-xr-x   2 root     root            0 Feb 22 10:57 kernel/x86/microcode +
--rw-r--r--   1 root     root       109568 Feb 22 10:57 kernel/x86/microcode/GenuineIntel.bin +
-======================================================================== +
-Version: dracut-049-95.git20200804.el8_3.4+
  
-Arguments: -f --kver '4.18.0-240.22.1.el8_3.x86_64'+  * l'addition du protocole **TCP** pour la communication, 
 +  * la haute disponibilité, 
 +  * l'utilisation des bases de données au format MySQL et PostgreSQL pour stocker des journaux
  
-dracut modules: +Les messages de journalisation envoyés à rsyslog sont marqués avec un **Sous-système applicatif** et une **Priorité**Le binôme Sous-système applicatif/Priorité s'appelle un **Sélecteur**.
-bash +
-systemd +
-systemd-initrd +
-nss-softokn +
-rngd +
-i18n +
-network-legacy +
-network +
-ifcfg +
-drm +
-plymouth +
-prefixdevname +
-kernel-modules +
-kernel-modules-extra +
-kernel-network-modules +
-resume +
-rootfs-block +
-terminfo +
-udev-rules +
-biosdevname +
-dracut-systemd +
-usrmount +
-base +
-fs-lib +
-memstrack +
-microcode_ctl-fw_dir_override +
-shutdown +
-======================================================================== +
-drwxr-xr-x  12 root     root            0 Feb 22 10:57 . +
-crw-r--r--   1 root     root       5,   1 Feb 22 10:57 dev/console +
-crw-r--r--   1 root     root       1,  11 Feb 22 10:57 dev/kmsg +
-crw-r--r--   1 root     root       1,   3 Feb 22 10:57 dev/null +
-crw-r--r--   1 root     root       1,   8 Feb 22 10:57 dev/random +
-crw-r--r--   1 root     root       1,   9 Feb 22 10:57 dev/urandom +
-lrwxrwxrwx   1 root     root            7 Feb 22 10:57 bin -> usr/bin +
-drwxr-xr-x   2 root     root            0 Feb 22 10:57 dev +
-drwxr-xr-x  11 root     root            0 Feb 22 10:57 etc +
--rw-r--r--   1 root     root           30 Nov 10  2020 etc/centos-release +
-drwxr-xr-x   2 root     root            0 Feb 22 10:57 etc/cmdline.+
-drwxr-xr-x   2 root     root            0 Feb 22 10:57 etc/conf.d +
--rw-r--r--   1 root     root          124 Feb 22 10:57 etc/conf.d/systemd.conf +
---More-- +
-</code>+
  
-===Le script init===+rsyslog décide ensuite de l'**action** à entreprendre concernant les informations transmises :
  
-RHEL/CentOS 8 utilise le système de démarrage **systemd**. Pour cette raison le script init est un lien symbolique vers **/usr/lib/systemd/systemd** :+  * ignorer les informations, 
 +  * envoyer les informations à un rsyslog sur une autre machine (par exemple, **@machine2**), 
 +  * inscrire les informations dans un fichier sur disque (par exemple, **/var/log/messages**), 
 +  transmettre les informations à un utilisateur (par exemple **root**), 
 +  * transmettre les informations à tous les utilisateurs (par exemple *****), 
 +  * transmettre les informations à une application liée à rsyslog via un tube (par exemple, **|logrotate**). 
 + 
 +Sous RHEL 9, le daemon rsyslog est configuré par l'édition du fichier **/etc/sysconfig/rsyslog** :
  
 <code> <code>
-[root@centos8 tmp]# lsinitrd custom | grep usr/lib/systemd/systemd | grep init +[root@redhat9 ~]# cat /etc/sysconfig/rsyslog 
-lrwxrwxrwx   1 root     root           23 Feb 22 10:57 init -> usr/lib/systemd/systemd+# Options for rsyslogd 
 +# Syslogd options are deprecated since rsyslog v3. 
 +# If you want to use them, switch to compatibility mode 2 by "-c 2" 
 +# See rsyslogd(8) for more details 
 +SYSLOGD_OPTIONS=""
 </code> </code>
  
-===Consulter le contenu d'un fichier dans initramfs===+L'option **-c** de la directive **SYSLOGD_OPTIONS** spécifie le niveau de compatibilité avec les anciennes versions de rsyslog ainsi qu'avec son prédécesseur syslogd :
  
-Pour consulter le contenu d'un fichier inclus dans l'initramfs, il convient d'utiliser la commande **lsinitrd** de la manière suivante :+^ Directive ^ Version ^ 
 +| SYSLOGD_OPTIONS="-c 4" | Mode natif - aucune compatibilité | 
 +| SYSLOGD_OPTIONS="-c 2" | rsyslog V2 - mode compatibilité | 
 +| SYSLOGD_OPTIONS="-c 0" | syslogd |
  
-<code> +====2.1 Priorités====
-[root@centos8 tmp]# lsinitrd /boot/initramfs-$(uname -r).img  /etc/ld.so.conf +
-include ld.so.conf.d/*.conf +
-</code>+
  
-====Processus de Démarrage du Noyau Linux====+La **Priorité** permet d'indiquer à rsyslog l'importance des informations :
  
-Le processus de démarrage du Noyau Linux peut être divisé en étapes :+^ Niveau ^ Priorité ^ Description ^ 
 +| 0 | emerg/panic | Système inutilisable | 
 +| 1 | alert | Action immédiate requise | 
 +| 2 | crit | Condition critique atteinte | 
 +| 3 | err/error | Erreurs rencontrées | 
 +| 4 | warning/warn | Avertissements présentés | 
 +| 5 | notice | Condition normale - message important | 
 +| info | Condition normale - message simple | 
 +| 7 | debug | Condition normale - message de débogage | 
  
-^ Etape ^ Description ^ +====2.Sous-systèmes applicatifs====
-| Chargement, configuration et exécution du chargeur du noyau | Le fichier **bootsect.s** est chargé en mémoire par le BIOS. Une fois configuré celui-ci charge le reste du noyau en mémoire | +
-| Configuration des paramètres et bascule vers le mode 32 bits | Le fichier **boot.s** met en place un **[[http://fr.wikipedia.org/wiki/Interrupt_Descriptor_Table|IDT]]** (//Interrupt Descriptor Table//) temporaire et **[[http://fr.wikipedia.org/wiki/Global_Descriptor_Table|GDT]]** (//Global Descriptor Table//) temporaire et gère le basculement vers le mode 32 bits | +
-| Décompression du Noyau | Le fichier **head.s** décompresse le noyau | +
-| Initialisation du noyau et de la mémoire | Le fichier **head.s** crée un GDT et IDT définitif | +
-| Configuration du noyau | Le fichier **main.c** met en place les contraintes de mémoire et configure la mémoire virtuelle | +
-| Création du processus Init | Le fichier **main.c** crée le processus init |+
  
-La fonction **init_post()** essaie ensuite d'exécuter un des processus suivant dans l'ordre :+Le **Sous-système applicatif**, aussi appelé **facility**, permet d'indiquer à rsyslog le type de programme qui envoie les informations :
  
-  * /sbin/init ==> /usr/sbin/init ==> /usr/lib/systemd/systemd +^ Fonction ^ Description ^ 
-  /etc/init +| auth/auth-priv | Message de sécurité autorisation | 
-  * /bin/init +| cron | Message de cron ou at | 
-  * /bin/sh ==> /bin/bash ==> /usr/bin/bash+| daemon | Message d'un daemon | 
 +| kern | Message du noyau | 
 +| lpr | Message du système d'impression | 
 +| mail | Message du système de mail | 
 +| news | Message du système de news | 
 +| syslog | Message interne de rsyslogd | 
 +| user | Message utilisateur | 
 +| uucp | Message du système UUCP | 
 +| local0 - local7 | Réservés pour des utilisations locales |
  
-Dans le cas d'un échec à ce stade le message **Kernel Panic** sera affiché. 
  
-=====Systemd=====+====2.3 - /etc/rsyslog.conf====
  
-Les systèmes de démarrage antérieurs à Systemd, **SysVinit** et **Upstart**, étaient des systèmes de démarrage **séquentiels**. +rsyslog est configuré par le fichier **/etc/rsyslog.conf** :
  
-**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.+<code> 
 +[root@redhat9 ~]# cat /etc/rsyslog.conf 
 +# rsyslog configuration file
  
-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 :+# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html 
 +# or latest version online at http://www.rsyslog.com/doc/rsyslog_conf.html  
 +# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html
  
-  * **.automount** - active la fonctionalité d'automount. +#### GLOBAL DIRECTIVES ####
-  * **.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.+
  
-Une Cible est en quelque sorte une **grande étape** dans le démarrage du système :+# Where to place auxiliary files 
 +global(workDirectory="/var/lib/rsyslog")
  
-  * **halt.target** - arrête le système. +# Use default timestamp format 
-  * **poweroff.target** - arrête le système et coupe le courant. +module(load="builtin:omfile" Template="RSYSLOG_TraditionalFileFormat")
-  * **shutdown.target** - arrête le système. +
-  * **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.+
  
-**Systemd** utilise des Cibles d'une manière similaire à ce que **SysVinit** utilise des niveaux d'exécution. Pour rendre la transition plus facile, il existe des **Cibles** qui "simulent" les niveaux d'exécution de **SysVinit** :+#### MODULES ####
  
-<code> +module(load="imuxsock"    provides support for local system logging (e.gvia logger command) 
-[root@centos8 ~]ls -l /usr/lib/systemd/system/runlevel* +       SysSock.Use="off") # Turn off message reception via local log socket;  
-lrwxrwxrwx1 root root 15 Apr  7 16:55 /usr/lib/systemd/system/runlevel0.target -> poweroff.target +                          # local messages are retrieved through imjournal now. 
-lrwxrwxrwx1 root root 13 Apr  7 16:55 /usr/lib/systemd/system/runlevel1.target -> rescue.target +module(load="imjournal"             # provides access to the systemd journal 
-lrwxrwxrwx. 1 root root 17 Apr  7 16:55 /usr/lib/systemd/system/runlevel2.target -> multi-user.target +       UsePid="system" # PID nummber is retrieved as the ID of the process the journal entry originates from 
-lrwxrwxrwx1 root root 17 Apr  7 16:55 /usr/lib/systemd/system/runlevel3.target -> multi-user.target +       FileCreateMode="0644" # Set the access permissions for the state file 
-lrwxrwxrwx. 1 root root 17 Apr  7 16:55 /usr/lib/systemd/system/runlevel4.target -> multi-user.target +       StateFile="imjournal.state") # File to store the position in the journal 
-lrwxrwxrwx. 1 root root 16 Apr  7 16:55 /usr/lib/systemd/system/runlevel5.target -> graphical.target +#module(load="imklog") # reads kernel messages (the same are read from journald) 
-lrwxrwxrwx. 1 root root 13 Apr  7 16:55 /usr/lib/systemd/system/runlevel6.target -> reboot.target+#module(load="immark") # provides --MARK-- message capability
  
-/usr/lib/systemd/system/runlevel1.target.wants: +# Include all config files in /etc/rsyslog.d/ 
-total 0+include(file="/etc/rsyslog.d/*.conf" mode="optional")
  
-/usr/lib/systemd/system/runlevel2.target.wants: +# Provides UDP syslog reception 
-total 0+# for parameters see http://www.rsyslog.com/doc/imudp.html 
 +#module(load="imudp") # needs to be done just once 
 +#input(type="imudp" port="514")
  
-/usr/lib/systemd/system/runlevel3.target.wants: +# Provides TCP syslog reception 
-total 0+# for parameters see http://www.rsyslog.com/doc/imtcp.html 
 +#module(load="imtcp") # needs to be done just once 
 +#input(type="imtcp" port="514")
  
-/usr/lib/systemd/system/runlevel4.target.wants: +#### RULES ####
-total 0+
  
-/usr/lib/systemd/system/runlevel5.target.wants: +# Log all kernel messages to the console. 
-total 0 +# Logging much else clutters up the screen
-</code>+#kern.*                                                 /dev/console
  
-====LAB #1 - La Commande systemctl====+Log anything (except mail) of level info or higher. 
 +# Don't log private authentication messages! 
 +*.info;mail.none;authpriv.none;cron.none                /var/log/messages
  
-Pour visualiser la liste des Unités, il convient d'utiliser la commande **systemctl** avec l'option **list-units** :+# The authpriv file has restricted access. 
 +authpriv.                                             /var/log/secure
  
-<code> +Log all the mail messages in one place
-[root@centos8 ~]systemctl list-units +mail.                                                 -/var/log/maillog
-UNIT                                                                                      LOAD   ACTIVE SUB       DESCRIPTION                                                                   +
-proc-sys-fs-binfmt_misc.automount                                                         loaded active waiting   Arbitrary Executable File Formats File System Automount Point                 +
-sys-devices-pci0000:00-0000:00:01.1-ata2-host1-target1:0:0-1:0:0:0-block-sr0.device       loaded active plugged   CD-ROM                                                                        +
-sys-devices-pci0000:00-0000:00:03.0-net-enp0s3.device                                     loaded active plugged   82540EM Gigabit Ethernet Controller (PRO/1000 MT Desktop Adapter)             +
-sys-devices-pci0000:00-0000:00:05.0-sound-card0.device                                    loaded active plugged   82801AA AC'97 Audio Controller                                                +
-sys-devices-pci0000:00-0000:00:0d.0-ata3-host2-target2:0:0-2:0:0:0-block-sda-sda1.device  loaded active plugged   VBOX_HARDDISK 1                                                               +
-sys-devices-pci0000:00-0000:00:0d.0-ata3-host2-target2:0:0-2:0:0:0-block-sda-sda2.device  loaded active plugged   VBOX_HARDDISK 2                                                               +
-sys-devices-pci0000:00-0000:00:0d.0-ata3-host2-target2:0:0-2:0:0:0-block-sda-sda3.device  loaded active plugged   VBOX_HARDDISK 3                                                               +
-sys-devices-pci0000:00-0000:00:0d.0-ata3-host2-target2:0:0-2:0:0:0-block-sda.device       loaded active plugged   VBOX_HARDDISK                                                                 +
-sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb1.device  loaded active plugged   VBOX_HARDDISK 1                                                               +
-sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb10.device loaded active plugged   VBOX_HARDDISK 10                                                              +
-sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb11.device loaded active plugged   VBOX_HARDDISK my_ext4                                                         +
-sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb12.device loaded active plugged   VBOX_HARDDISK 12                                                              +
-sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb2.device  loaded active plugged   VBOX_HARDDISK 2                                                               +
-sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb3.device  loaded active plugged   VBOX_HARDDISK 3                                                               +
-sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb4.device  loaded active plugged   VBOX_HARDDISK 4                                                               +
-sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb5.device  loaded active plugged   VBOX_HARDDISK 5                                                               +
-sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb6.device  loaded active plugged   VBOX_HARDDISK 6                                                               +
-sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb7.device  loaded active plugged   VBOX_HARDDISK 7                                                               +
-sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb8.device  loaded active plugged   VBOX_HARDDISK 8                                                               +
-sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb9.device  loaded active plugged   VBOX_HARDDISK 9                                                               +
-sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb.device       loaded active plugged   VBOX_HARDDISK                                                                 +
-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-net-virbr0.device                                                     loaded active plugged   /sys/devices/virtual/net/virbr0                                               +
-sys-devices-virtual-net-virbr0\x2dnic.device                                              loaded active plugged   /sys/devices/virtual/net/virbr0-nic                                           +
-sys-module-configfs.device                                                                loaded active plugged   /sys/module/configfs                                                          +
-sys-subsystem-net-devices-enp0s3.device                                                   loaded active plugged   82540EM Gigabit Ethernet Controller (PRO/1000 MT Desktop Adapter)             +
-sys-subsystem-net-devices-virbr0.device                                                   loaded active plugged   /sys/subsystem/net/devices/virbr0                                             +
-sys-subsystem-net-devices-virbr0\x2dnic.device                                            loaded active plugged   /sys/subsystem/net/devices/virbr0-nic                                         +
--.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                                               +
-run-user-1000.mount                                                                       loaded active mounted   /run/user/1000                                                                +
-sys-kernel-config.mount                                                                   loaded active mounted   Kernel Configuration File System                                              +
-sys-kernel-debug.mount                                                                    loaded active mounted   Kernel Debug File System                                                      +
-sys-kernel-tracing.mount                                                                  loaded active mounted   /sys/kernel/tracing                                                           +
-var-lib-nfs-rpc_pipefs.mount                                                              loaded active mounted   RPC Pipe 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-96.scope                                                                          loaded active running   Session 96 of user trainee                                                    +
-atd.service                                                                               loaded active running   Job spooling tools                                                            +
-auditd.service                                                                            loaded active running   Security Auditing Service                                                     +
-avahi-daemon.service                                                                      loaded active running   Avahi mDNS/DNS-SD Stack                                                       +
-chronyd.service                                                                           loaded active running   NTP client/server                                                             +
-crond.service                                                                             loaded active running   Command Scheduler                                                             +
-cups.service                                                                              loaded active running   CUPS Scheduler                                                                +
-dbus.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                                           +
-lines 1-57 +
-</code>+
  
-Pour consulter la liste des Unités inactifs, utilisez la commande suivante : 
  
-<code> +Log cron stuff 
-[root@centos8 ~]systemctl list-units --all | grep inactive | more +cron.*                                                  /var/log/cron
-● boot.automount                                                                                                 not-found inactive dead      boot.automount                                                                               +
-  proc-fs-nfsd.mount                                                                                             loaded    inactive dead      NFSD configuration filesystem                                                                +
-  proc-sys-fs-binfmt_misc.mount                                                                                  loaded    inactive dead      Arbitrary Executable File Formats File System                                                +
-  sys-fs-fuse-connections.mount                                                                                  loaded    inactive dead      FUSE Control File System                                                                     +
-● sysroot.mount                                                                                                  not-found inactive dead      sysroot.mount                                                                                +
-  tmp.mount                                                                                                      loaded    inactive dead      Temporary Directory (/tmp)                                                                   +
-  var-lib-machines.mount                                                                                         loaded    inactive dead      Virtual Machine and Container Storage                                                        +
-  systemd-ask-password-console.path                                                                              loaded    inactive dead      Dispatch Password Requests to Console Directory Watch                                        +
-● apparmor.service                                                                                               not-found inactive dead      apparmor.service                                                                             +
-  auth-rpcgss-module.service                                                                                     loaded    inactive dead      Kernel Module supporting RPCSEC_GSS                                                          +
-  cpupower.service                                                                                               loaded    inactive dead      Configure CPU power related settings                                                         +
-● display-manager.service                                                                                        not-found inactive dead      display-manager.service                                                                      +
-  dm-event.service                                                                                               loaded    inactive dead      Device-mapper event daemon                                                                   +
-  dnf-makecache.service                                                                                          loaded    inactive dead      dnf makecache                                                                                +
-  dracut-cmdline.service                                                                                         loaded    inactive dead      dracut cmdline hook                                                                          +
-  dracut-initqueue.service                                                                                       loaded    inactive dead      dracut initqueue hook                                                                        +
-  dracut-mount.service                                                                                           loaded    inactive dead      dracut mount hook                                                                            +
-  dracut-pre-mount.service                                                                                       loaded    inactive dead      dracut pre-mount hook                                                                        +
-  dracut-pre-pivot.service                                                                                       loaded    inactive dead      dracut pre-pivot and cleanup hook                                                            +
-  dracut-pre-trigger.service                                                                                     loaded    inactive dead      dracut pre-trigger hook                                                                      +
-  dracut-pre-udev.service                                                                                        loaded    inactive dead      dracut pre-udev hook                                                                         +
-  ebtables.service                                                                                               loaded    inactive dead      Ethernet Bridge Filtering tables                                                             +
-  emergency.service                                                                                              loaded    inactive dead      Emergency Shell                                                                              +
-  initrd-cleanup.service                                                                                         loaded    inactive dead      Cleaning Up and Shutting Down Daemons                                                        +
-  initrd-parse-etc.service                                                                                       loaded    inactive dead      Reload Configuration from the Real Root                                                      +
-  initrd-switch-root.service                                                                                     loaded    inactive dead      Switch Root                                                                                  +
-  initrd-udevadm-cleanup-db.service                                                                              loaded    inactive dead      Cleanup udevd DB                                                                             +
-● ip6tables.service                                                                                              not-found inactive dead      ip6tables.service                                                                            +
-● ipset.service                                                                                                  not-found inactive dead      ipset.service                                                                                +
-● iptables.service                                                                                               not-found inactive dead      iptables.service                                                                             +
-  iscsi-onboot.service                                                                                           loaded    inactive dead      Special handling of early boot iSCSI sessions                                                +
-  iscsi.service                                                                                                  loaded    inactive dead      Login and scanning of iSCSI devices                                                          +
-  iscsid.service                                                                                                 loaded    inactive dead      Open-iSCSI                                                                                   +
-  iscsiuio.service                                                                                               loaded    inactive dead      iSCSI UserSpace I/O driver                                                                   +
-  ldconfig.service                                                                                               loaded    inactive dead      Rebuild Dynamic Linker Cache                                                                 +
-  libvirt-guests.service                                                                                         loaded    inactive dead      Suspend/Resume Running libvirt Guests                                                        +
-  libvirtd.service                                                                                               loaded    inactive dead      Virtualization daemon                                                                        +
-  loadmodules.service                                                                                            loaded    inactive dead      Load legacy module configuration                                                             +
-● lvm2-activation.service                                                                                        not-found inactive dead      lvm2-activation.service                                                                      +
-  lvm2-lvmpolld.service                                                                                          loaded    inactive dead      LVM2 poll daemon                                                                             +
-  mdmonitor.service                                                                                              loaded    inactive dead      Software RAID monitoring and management                                                      +
-  microcode.service                                                                                              loaded    inactive dead      Load CPU microcode update                                                                    +
-● network.service                                                                                                not-found inactive dead      network.service                                                                              +
-  nfs-blkmap.service                                                                                             loaded    inactive dead      pNFS block layout mapping daemon                                                             +
-  nfs-convert.service                                                                                            loaded    inactive dead      Preprocess NFS configuration convertion                                                      +
-  nfs-idmapd.service                                                                                             loaded    inactive dead      NFSv4 ID-name mapping service                                                                +
-  nfs-mountd.service                                                                                             loaded    inactive dead      NFS Mount Daemon                                                                             +
-  nfs-server.service                                                                                             loaded    inactive dead      NFS server and services                                                                      +
-  nfs-utils.service                                                                                              loaded    inactive dead      NFS server and client services                                                               +
-  nfsdcld.service                                                                                                loaded    inactive dead      NFSv4 Client Tracking Daemon                                                                 +
-  nftables.service                                                                                               loaded    inactive dead      Netfilter Tables                                                                             +
-● ntpd.service                                                                                                   not-found inactive dead      ntpd.service                                                                                 +
-● ntpdate.service                                                                                                not-found inactive dead      ntpdate.service                                                                              +
-  plymouth-switch-root.service                                                                                   loaded    inactive dead      Plymouth switch root service                                                                 +
-  rc-local.service                                                                                               loaded    inactive dead      /etc/rc.d/rc.local Compatibility                                                             +
-  rescue.service                                                                                                 loaded    inactive dead      Rescue Shell                                                                                 +
-  rpc-gssd.service                                                                                               loaded    inactive dead      RPC security service for NFS client and server                                               +
---More-- +
-</code>+
  
-Les points noirs au début de certaines lignes dans la sortie ci-dessus sont en réalité des points blancs à l'écranCes points impliquent que le service, la cible ou l'unité spécifié n'a pas été trouvé sur le système. Par exemple :+# Everybody gets emergency messages 
 +*.emerg                                                 :omusrmsg:*
  
-<code> +Save news errors of level crit and higher in a special file
-[root@centos8 ~]systemctl status ntpd +uucp,news.crit                                          /var/log/spooler
-Unit ntpd.service could not be found+
-</code>+
  
-Pour consulter la liste des Unités ainsi que leurs statuts, utilisez la commande suivante :+# Save boot messages also to boot.log 
 +local7.*                                                /var/log/boot.log
  
-<code> + 
-[root@centos8 ~]systemctl list-unit-files | more +### sample forwarding rule ### 
-UNIT FILE                                                              STATE     +#action(type="omfwd"   
-proc-sys-fs-binfmt_misc.automount                                      static    +# # An on-disk queue is created for this actionIf the remote host is 
--.mount                                                                generated +# # down, messages are spooled to disk and sent when it is up again
-boot.mount                                                             generated +#queue.filename="fwdRule1"       # unique name prefix for spool files 
-dev-hugepages.mount                                                    static    +#queue.maxdiskspace="1g"         # 1gb space limit (use as much as possible) 
-dev-mqueue.mount                                                       static    +#queue.saveonshutdown="on"       # save messages to disk on shutdown 
-proc-fs-nfsd.mount                                                     static    +#queue.type="LinkedList"         # run asynchronously 
-proc-sys-fs-binfmt_misc.mount                                          static    +#action.resumeRetryCount="-1"    # infinite retries if host is down 
-sys-fs-fuse-connections.mount                                          static    +# # Remote Logging (we use TCP for reliable delivery) 
-sys-kernel-config.mount                                                static    +# # remote_host is: name/ip, e.g192.168.0.1, port optional e.g10514 
-sys-kernel-debug.mount                                                 static    +#Target="remote_host" Port="XXX" Protocol="tcp")
-tmp.mount                                                              disabled  +
-var-lib-machines.mount                                                 static    +
-var-lib-nfs-rpc_pipefs.mount                                           static    +
-cups.path                                                              enabled   +
-systemd-ask-password-console.path                                      static    +
-systemd-ask-password-plymouth.path                                     static    +
-systemd-ask-password-wall.path                                         static    +
-session-96.scope                                                       transient +
-arp-ethers.service                                                     disabled  +
-atd.service                                                            enabled   +
-auditd.service                                                         enabled   +
-auth-rpcgss-module.service                                             static    +
-autovt@.service                                                        enabled   +
-avahi-daemon.service                                                   enabled   +
-blk-availability.service                                               disabled  +
-chrony-dnssrv@.service                                                 static    +
-chrony-wait.service                                                    disabled  +
-chronyd.service                                                        enabled   +
-cockpit-motd.service                                                   static    +
-cockpit-wsinstance-http-redirect.service                               static    +
-cockpit-wsinstance-http.service                                        static    +
-cockpit-wsinstance-https-factory@.service                              static    +
-cockpit-wsinstance-https@.service                                      static    +
-cockpit.service                                                        static    +
-console-getty.service                                                  disabled  +
-container-getty@.service                                               static    +
-cpupower.service                                                       disabled  +
-crond.service                                                          enabled   +
-cups-browsed.service                                                   disabled  +
-cups.service                                                           enabled   +
-dbus-org.fedoraproject.FirewallD1.service                              enabled   +
-dbus-org.freedesktop.Avahi.service                                     enabled   +
-dbus-org.freedesktop.hostname1.service                                 static    +
-dbus-org.freedesktop.import1.service                                   static    +
-dbus-org.freedesktop.locale1.service                                   static    +
-dbus-org.freedesktop.login1.service                                    static    +
-dbus-org.freedesktop.machine1.service                                  static    +
-dbus-org.freedesktop.nm-dispatcher.service                             enabled   +
-dbus-org.freedesktop.portable1.service                                 static    +
-dbus-org.freedesktop.timedate1.service                                 enabled   +
-dbus.service                                                           static    +
-debug-shell.service                                                    disabled  +
-dm-event.service                                                       static    +
-dnf-makecache.service                                                  static    +
-dnsmasq.service                                                        disabled  +
-dracut-cmdline.service                                                 static    +
---More--+
 </code> </code>
  
-Pour visualiser les Unités d'un type spécifique, il convient d'utiliser l'option **-t** :+Ce fichier est divisé en 3 parties :
  
-<code> +  * **Modules**, 
-[root@centos8 ~]# systemctl list-unit-files -t mount +    * Section traitant le chargement des modules offrant des fonctionnalités étendues à rsyslog, 
-UNIT FILE                     STATE     +  * **Directives Globales** (//Global Directives//), 
--.mount                       generated +    * Section traitant les options de comportement global du service rsyslog, 
-boot.mount                    generated +  * **Règles** (//Rules//), 
-dev-hugepages.mount           static    +    * Section traitant les règles de configuration des journauxLes règles au format syslogd gardent le même formatLes nouvelles règles, compatibles seulement avec rsyslog commencent par **module**.
-dev-mqueue.mount              static    +
-proc-fs-nfsd.mount            static    +
-proc-sys-fs-binfmt_misc.mount static    +
-sys-fs-fuse-connections.mount static    +
-sys-kernel-config.mount       static    +
-sys-kernel-debug.mount        static    +
-tmp.mount                     disabled  +
-var-lib-machines.mount        static    +
-var-lib-nfs-rpc_pipefs.mount  static   +
  
-12 unit files listed. +===Modules===
-</code>+
  
-Dans la colonne STATE on voit les mots **static** et **generated**. +Depuis la version 3 de rsyslog, la réception des données par ce dernier appelée les **inputs** est gérée par l'utilisation de modulesParmi les modules les plus fréquemment utilisés, on trouve :
  
-  STATE static +^ Module ^ Fonction ^ 
-    Ceci implique que l'Unité ne peut ni être démarrée, ni être arrêtée par l'administrateur. Le démarrage et l'arrêt d'une telle Unité est effectué par le système. En règle générale, les Unités dont le STATE est static sont des dépendances d'autres Unité+| module(load="imuxsock" SysSock.Use="off") | Active la trace des messages locaux, per exemple de la commande **logger** | 
 +| module(load="imjournal" StateFile="imjournal.state") | Fournit un accès au journal **systemd** | 
 +| module(load="imklog") | Active la trace de messages du **noyau** | 
 +| module(load="immark") | Active la trace des messages de type **mark** | 
 +| module(load="imudp") | Active la réception de messages en utilisant le protocole **UDP** | 
 +| module(load="imtcp") | Active la réception de messages en utilisant le protocole **TCP** |
  
-  * STATE = generated +Dans le fichier **/etc/rsyslog.conf** nous pouvons constater que les inputs **module(load="imuxsock"** et **module(load="imjournal"** sont activés :
-    * 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 montage, l'exécutable respopnsable de la génération du fichier est **/lib/systemd/system-generators/systemd-fstab-generator** :+
  
-<code+<file
-[root@centos8 ~]# ls -l /lib/systemd/system-generators/systemd-fstab-generator +... 
--rwxr-xr-x1 root root 46096 Apr  7 16:56 /lib/systemd/system-generators/systemd-fstab-generator +#### MODULES ####
-</code>+
  
-Il existe aussi d'autres exécutables responsables de la génération d'autres fichiers :+module(load="imuxsock"    # provides support for local system logging (e.g. via logger command) 
 +       SysSock.Use="off") # Turn off message reception via local log socket;  
 +                          # local messages are retrieved through imjournal now. 
 +module(load="imjournal"             # provides access to the systemd journal 
 +       UsePid="system" # PID nummber is retrieved as the ID of the process the journal entry originates from 
 +       FileCreateMode="0644" # Set the access permissions for the state file 
 +       StateFile="imjournal.state") # File to store the position in the journal 
 +#module(load="imklog") # reads kernel messages (the same are read from journald) 
 +#module(load="immark") # provides --MARK-- message capability 
 +... 
 +</file>
  
-<code> +Pour activer la réception de messages à partir de serveurs rsyslog distants en utilisant le protocole **UDP**, il convient de décommenter les directives de chargement de modules dans le fichier **/etc/rsyslog.conf** et de re-démarrer le service :
-[root@centos8 ~]# ls -l /lib/systemd/system-generators +
-total 508 +
--rwxr-xr-x1 root root    504 Jan  4 11:25 kdump-dep-generator.sh +
--r-xr-xr-x. 1 root root 134976 Aug 17  2020 lvm2-activation-generator +
--rwxr-xr-x. 1 root root  67792 Jul 20  2020 nfs-server-generator +
--rwxr-xr-x. 1 root root  38216 Jul 20  2020 rpc-pipefs-generator +
--rwxr-xr-x. 1 root root    743 Apr 23  2020 selinux-autorelabel-generator.sh +
--rwxr-xr-x. 1 root root  33504 Apr  7 16:56 systemd-cryptsetup-generator +
--rwxr-xr-x. 1 root root  16648 Apr  7 16:56 systemd-debug-generator +
--rwxr-xr-x. 1 root root  46096 Apr  7 16:56 systemd-fstab-generator +
--rwxr-xr-x. 1 root root  17064 Apr  7 16:56 systemd-getty-generator +
--rwxr-xr-x. 1 root root  29432 Apr  7 16:56 systemd-gpt-auto-generator +
--rwxr-xr-x. 1 root root  12568 Apr  7 16:56 systemd-hibernate-resume-generator +
--rwxr-xr-x. 1 root root  12368 Apr  7 16:56 systemd-rc-local-generator +
--rwxr-xr-x. 1 root root  12408 Apr  7 16:56 systemd-system-update-generator +
--rwxr-xr-x. 1 root root  33544 Apr  7 16:56 systemd-sysv-generator +
--rwxr-xr-x. 1 root root  17024 Apr  7 16:56 systemd-veritysetup-generator +
-</code>+
  
-Les options de la commande **systemctl** sont :+<file> 
 +... 
 +# Provides UDP syslog reception 
 +# for parameters see http://www.rsyslog.com/doc/imudp.html 
 +#module(load="imudp") # needs to be done just once 
 +#input(type="imudp" port="514")
  
-<code> +Provides TCP syslog reception 
-[root@centos8 ~]systemctl --help +# for parameters see http://www.rsyslog.com/doc/imtcp.html 
-systemctl [OPTIONS...] {COMMAND} ...+#module(load="imtcp") # needs to be done just once 
 +#input(type="imtcp" port="514"
 +... 
 +</file>
  
-Query or send control commands to the systemd manager.+<WRAP center round important 60%> 
 +**Important** : Les deux directives **module(load="imudp")** et **input(type="imudp" port="514")** crée un ** Écouteur** sur le port UDP/514 tandis que les deux directives **module(load="imtcp")** et **input(type="imtcp" port="514")** crée un Écouteur sur le port TCP/514Le port 514 est le port standard pour les Écouteurs de rsyslog. Cependant il est possible de modifier le numéro du port. 
 +</WRAP>
  
-  -h --help           Show this help +Pour envoyer l'ensemble des traces de journalisation vers un serveur rsyslog distantil convient de décommenter et modifier la ligne **Target** dans la section suivante du fichier **/etc/rsyslog.conf** :
-     --version        Show package version +
-     --system         Connect to system manager +
-     --user           Connect to user service manager +
-  -H --host=[USER@]HOST +
-                      Operate on remote host +
-  -M --machine=CONTAINER +
-                      Operate on local container +
-  -t --type=TYPE      List units of a particular type +
-     --state=STATE    List units with particular LOAD or SUB or ACTIVE state +
-  -p --property=NAME  Show only properties by this name +
-  -a --all            Show all properties/all units currently in memory, +
-                      including dead/empty ones. To list all units installed on +
-                      the system, use the 'list-unit-files' command instead. +
-     --failed         Same as --state=failed +
-  ---full           Don't ellipsize unit names on output +
-  -r --recursive      Show unit list of host and local containers +
-     --reverse        Show reverse dependencies with 'list-dependencies' +
-     --job-mode=MODE  Specify how to deal with already queued jobswhen +
-                      queueing a new job +
-     --show-types     When showing sockets, explicitly show their type +
-     --value          When showing properties, only print the value +
-  -i --ignore-inhibitors +
-                      When shutting down or sleeping, ignore inhibitors +
-     --kill-who=WHO   Who to send signal to +
-  -s --signal=SIGNAL  Which signal to send +
-     --now            Start or stop unit in addition to enabling or disabling it +
-     --dry-run        Only print what would be done +
-  -q --quiet          Suppress output +
-     --wait           For (re)start, wait until service stopped again +
-     --no-block       Do not wait until operation finished +
-     --no-wall        Don't send wall message before halt/power-off/reboot +
-     --no-reload      Don't reload daemon after en-/dis-abling unit files +
-     --no-legend      Do not print a legend (column headers and hints) +
-     --no-pager       Do not pipe output into a pager +
-     --no-ask-password +
-                      Do not ask for system passwords +
-     --global         Enable/disable/mask unit files globally +
-     --runtime        Enable/disable/mask unit files temporarily until next +
-                      reboot +
-  -f --force          When enabling unit files, override existing symlinks +
-                      When shutting down, execute action immediately +
-     --preset-mode=   Apply only enable, only disable, or all presets +
-     --root=PATH      Enable/disable/mask unit files in the specified root +
-                      directory +
-  -n --lines=INTEGER  Number of journal entries to show +
-  -o --output=STRING  Change journal output mode (short, short-precise, +
-                             short-iso, short-iso-precise, short-full, +
-                             short-monotonic, short-unix, +
-                             verbose, export, json, json-pretty, json-sse, cat) +
-     --firmware-setup Tell the firmware to show the setup menu on next boot +
-     --plain          Print unit dependencies as a list instead of a tree+
  
-lines 1-57 +<file> 
-</code>+... 
 +# ### sample forwarding rule ### 
 +#action(type="omfwd"   
 +# # An on-disk queue is created for this action. If the remote host is 
 +# # down, messages are spooled to disk and sent when it is up again. 
 +#queue.filename="fwdRule1"       # unique name prefix for spool files 
 +#queue.maxdiskspace="1g"         # 1gb space limit (use as much as possible) 
 +#queue.saveonshutdown="on"       # save messages to disk on shutdown 
 +#queue.type="LinkedList"         # run asynchronously 
 +#action.resumeRetryCount="-1"    # infinite retries if host is down 
 +# # Remote Logging (we use TCP for reliable delivery) 
 +# # remote_host is: name/ip, e.g. 192.168.0.1, port optional e.g. 10514 
 +#Target="remote_host" Port="XXX" Protocol="tcp"
 +... 
 +</file>
  
-====LAB #2 - Fichiers de Configuration====+<WRAP center round important 60%> 
 +**Important** : Ces directives utilisent le protocole TCP. Le serveur distant doit donc être configuré pour ce mode de communication. La directive **Target="remote_host" Port="514" Protocol="tcp")** doit être modifiée pour indiquer l'adresse IP du serveur rsyslog distant. 
 +</WRAP>
  
-===2.1 - Fichiers de Configuration par Défaut===+===Directives Globales===
  
-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** :+Les directives dans cette section servent à configurer le comportement de rsyslog. Par exemple, nous pouvons constater la présence de la directive suivante :
  
-<code+<file
-[root@centos8 ~]# pkg-config systemd --variable=systemdsystemunitdir +module(load="builtin:omfile" Template="RSYSLOG_TraditionalFileFormat") 
-/usr/lib/systemd/system +</file>
-</code>+
  
-<code> +Cette directive stipule que le format des entrées dans les fichiers de journalisation **ne doit pas** être au format d'horodatage étendu de rsyslog qui offre plus de précision que le format de syslog classique.
-[root@centos8 ~]# ls -l /usr/lib/systemd/system | more +
-total 1464 +
--rw-r--r--1 root root  275 Apr 26  2020 arp-ethers.service +
--rw-r--r--. 1 root root  222 May 11  2019 atd.service +
--rw-r--r--. 1 root root 1512 Apr 23  2020 auditd.service +
--rw-r--r--. 1 root root  628 Jul 20  2020 auth-rpcgss-module.service +
-lrwxrwxrwx. 1 root root   14 Apr  7 16:55 autovt@.service -> getty@.service +
--rw-r--r--. 1 root root 1044 Nov 16  2020 avahi-daemon.service +
--rw-r--r--. 1 root root  870 Nov 16  2020 avahi-daemon.socket +
--rw-r--r--. 1 root root  956 Apr  7 16:54 basic.target +
-drwxr-xr-x. 2 root root    6 Apr  7 16:55 basic.target.wants +
--r--r--r--. 1 root root  408 Aug 17  2020 blk-availability.service +
--rw-r--r--. 1 root root  419 Jun 22  2018 bluetooth.target +
--rw-r--r--. 1 root root  455 Apr  7 16:54 boot-complete.target +
--rw-r--r--. 1 root root  209 Nov 19  2019 chrony-dnssrv@.service +
--rw-r--r--. 1 root root  138 Nov 19  2019 chrony-dnssrv@.timer +
--rw-r--r--. 1 root root  491 Nov 19  2019 chronyd.service +
--rw-r--r--. 1 root root  472 May 10  2019 chrony-wait.service +
--rw-r--r--. 1 root root  222 Aug 24  2020 cockpit-motd.service +
--rw-r--r--. 1 root root  835 Aug 24  2020 cockpit.service +
--rw-r--r--. 1 root root  373 Aug 24  2020 cockpit.socket +
--rw-r--r--. 1 root root  251 Aug 24  2020 cockpit-wsinstance-http-redirect.service +
--rw-r--r--. 1 root root  233 Aug 24  2020 cockpit-wsinstance-http-redirect.socket +
--rw-r--r--. 1 root root  221 Aug 24  2020 cockpit-wsinstance-http.service +
--rw-r--r--. 1 root root  165 Aug 24  2020 cockpit-wsinstance-https-factory@.service +
--rw-r--r--. 1 root root  244 Aug 24  2020 cockpit-wsinstance-https-factory.socket +
--rw-r--r--. 1 root root  215 Aug 24  2020 cockpit-wsinstance-http.socket +
--rw-r--r--. 1 root root  264 Aug 24  2020 cockpit-wsinstance-https@.service +
--rw-r--r--. 1 root root  478 Aug 24  2020 cockpit-wsinstance-https@.socket +
--rw-r--r--. 1 root root 1082 Apr  7 16:55 console-getty.service +
--rw-r--r--. 1 root root 1263 Apr  7 16:55 container-getty@.service +
--rw-r--r--. 1 root root  294 Apr  8 15:21 cpupower.service +
--rw-r--r--. 1 root root  356 Nov  8  2019 crond.service +
--rw-r--r--. 1 root root  465 Jun 22  2018 cryptsetup-pre.target +
--rw-r--r--. 1 root root  412 Jun 22  2018 cryptsetup.target +
-lrwxrwxrwx. 1 root root   13 Apr  7 16:55 ctrl-alt-del.target -> reboot.target +
--rw-r--r--. 1 root root  234 Oct  4  2017 cups-browsed.service +
--r--r--r--. 1 root root  142 Jun 15  2020 cups.path +
--r--r--r--. 1 root root  248 Jun 15  2020 cups.service +
--r--r--r--. 1 root root  136 Jun 15  2020 cups.socket +
-lrwxrwxrwx. 1 root root   25 Apr  7 16:55 dbus-org.freedesktop.hostname1.service -> systemd-hostnamed.service +
-lrwxrwxrwx. 1 root root   23 Apr  7 16:55 dbus-org.freedesktop.import1.service -> systemd-importd.service +
-lrwxrwxrwx. 1 root root   23 Apr  7 16:55 dbus-org.freedesktop.locale1.service -> systemd-localed.service +
-lrwxrwxrwx. 1 root root   22 Apr  7 16:55 dbus-org.freedesktop.login1.service -> systemd-logind.service +
-lrwxrwxrwx. 1 root root   24 Apr  7 16:55 dbus-org.freedesktop.machine1.service -> systemd-machined.service +
-lrwxrwxrwx. 1 root root   25 Apr  7 16:55 dbus-org.freedesktop.portable1.service -> systemd-portabled.service +
-lrwxrwxrwx. 1 root root   25 Apr  7 16:55 dbus-org.freedesktop.timedate1.service -> systemd-timedated.service +
--rw-r--r--. 1 root root  380 Apr  7 12:08 dbus.service +
--rw-r--r--. 1 root root  102 Apr  7 12:08 dbus.socket +
-drwxr-xr-x. 2 root root    6 Apr  7 16:55 dbus.target.wants +
--rw-r--r--. 1 root root 1084 Apr  7 16:55 debug-shell.service +
-lrwxrwxrwx. 1 root root   16 Apr  7 16:55 default.target -> graphical.target +
-drwxr-xr-x. 2 root root    6 Apr  7 16:55 default.target.wants +
--rw-r--r--. 1 root root  750 Jun 22  2018 dev-hugepages.mount +
--rw-r--r--. 1 root root  665 Jun 22  2018 dev-mqueue.mount +
--r--r--r--. 1 root root  345 Aug 17  2020 dm-event.service +
--r--r--r--. 1 root root  248 Aug 17  2020 dm-event.socket +
--rw-r--r--. 1 root root  457 Jun  2  2020 dnf-makecache.service +
---More-- +
-</code>+
  
-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 :+===Règles===
  
-<code> +Chaque règle prend la forme suivante :
-[root@centos8 ~]# ls -l /run/systemd/system/ +
-total 0 +
-</code>+
  
-Les fichiers de configuration des Unités crées par les utilisateurs doivent être mis dans le répertoire **/usr/lib/systemd/user** :+<file> 
 +Sélecteur[; ...]  [-] Action 
 +</file>
  
-<code> +Un Sélecteur est défini d'une des façons suivantes :
-[root@centos8 ~]# pkg-config systemd --variable=systemduserunitdir +
-/usr/lib/systemd/user +
-</code>+
  
-<WRAP center round important 60%> +==Sous-système applicatif.Priorité==
-**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>+
  
-Prenons le cas du service **sshd** qui est configuré par le fichier **/usr/lib/systemd/system/sshd.service** :+Dans ce cas on ne tient compte que des messages de priorité égale ou supérieure à la Priorité indiquée.
  
-<code> +==Sous-système applicatif!Priorité==
-[root@centos8 ~]# cat /usr/lib/systemd/system/sshd.service +
-[Unit] +
-Description=OpenSSH server daemon +
-Documentation=man:sshd(8) man:sshd_config(5) +
-After=network.target sshd-keygen.target +
-Wants=sshd-keygen.target+
  
-[Service] +Dans ce cas on ne tient compte que des messages de priorité inférieure à la Priorité indiquée.
-Type=notify +
-EnvironmentFile=-/etc/crypto-policies/back-ends/opensshserver.config +
-EnvironmentFile=-/etc/sysconfig/sshd +
-ExecStart=/usr/sbin/sshd -D $OPTIONS $CRYPTO_POLICY +
-ExecReload=/bin/kill -HUP $MAINPID +
-KillMode=process +
-Restart=on-failure +
-RestartSec=42s+
  
-[Install] +==Sous-système applicatif=Priorité==
-WantedBy=multi-user.target +
-</code>+
  
-Dans le fichier on peut noter la présence des lignes suivantes dans la section **[Unit]** :+Dans ce cas on ne tient compte que des messages de priorité égale à la Priorité indiquée.
  
-  * **Description=OpenSSH server daemon**, +==L'utilisation du caractère spécial *==
-    * Cette directive est utilisée pour donner une courte description des fonctionnalités de l'Unité, +
-  * **Documentation=man:sshd(8) man:sshd_config(5)**, +
-    * Cette directive stipule les chapitres des manuels et les URLs contenant de l'information en relation avec l'Unité, +
-  **After=network.target sshd-keygen.target**, +
-    * Cette directive indique les cibles qui devraient être atteintes et les Unités qui devraient être démarrées avant l'Unité sshd. Par contre, cette directive ne spécifie pas une dépendance, +
-  * **Wants=sshd-keygen.target**, +
-    * Cette directive stipule une dépendance douce. Autrement dit, Systemd essayera de démarrer l'Unité **sshd-keygen.target** mais si ce démarrage est en échec, l'Unité sshd sera démarré.+
  
-Dans le fichier on peut aussi noter la présence des lignes suivantes dans la section **[Service]** :+La valeur du Sous-système applicatif et/ou de la Priorité peut également être *****. Dans ce cas, toutes les valeurs possibles du **Sous-système applicatif** et/ou de la **Priorité** sont concernées, par exemple **cron.***.
  
-  * **Type=notify**, +==n Sous-systèmes avec la même priorité==
-    * Cette directive indique que le service informera Systemd quand son démarrage a terminé, +
-  * **ExecStart=/usr/sbin/sshd -D $OPTIONS $CRYPTO_POLICY**, +
-     * 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,+
  
-Dernièrement on note la présence de la ligne suivante dans la section **[Install]** :+Plusieurs Sous-systèmes applicatifs peuvent être stipulés pour la même Priorité en les séparant avec un **virgule**. Par exemple **uucp,news.crit**.
  
-  * **WantedBy=multi-user.target**, +==n Sélecteurs avec la même Action==
-    * 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.+
  
-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 :+Une Action peut s'appliquer à plusieurs Sélecteurs en les séparant par le caractère **;**, par exemple : ***.info;mail.none;authpriv.none;cron.none**.
  
-<code> 
-[root@centos8 ~]# systemctl show sshd 
-Type=notify 
-Restart=on-failure 
-NotifyAccess=main 
-RestartUSec=42s 
-TimeoutStartUSec=1min 30s 
-TimeoutStopUSec=1min 30s 
-RuntimeMaxUSec=infinity 
-WatchdogUSec=0 
-WatchdogTimestamp=Thu 2021-06-03 15:09:54 EDT 
-WatchdogTimestampMonotonic=12502561 
-PermissionsStartOnly=no 
-RootDirectoryStartOnly=no 
-RemainAfterExit=no 
-GuessMainPID=yes 
-MainPID=902 
-ControlPID=0 
-FileDescriptorStoreMax=0 
-NFileDescriptorStore=0 
-StatusErrno=0 
-Result=success 
-UID=[not set] 
-GID=[not set] 
-NRestarts=0 
-ExecMainStartTimestamp=Thu 2021-06-03 15:09:54 EDT 
-ExecMainStartTimestampMonotonic=12446178 
-ExecMainExitTimestampMonotonic=0 
-ExecMainPID=902 
-ExecMainCode=0 
-ExecMainStatus=0 
-ExecStart={ path=/usr/sbin/sshd ; argv[]=/usr/sbin/sshd -D $OPTIONS $CRYPTO_POLICY ; ignore_errors=no ; 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 } 
-Slice=system.slice 
-ControlGroup=/system.slice/sshd.service 
-MemoryCurrent=6270976 
-CPUUsageNSec=[not set] 
-EffectiveCPUs= 
-EffectiveMemoryNodes= 
-TasksCurrent=1 
-IPIngressBytes=18446744073709551615 
-IPIngressPackets=18446744073709551615 
-IPEgressBytes=18446744073709551615 
-IPEgressPackets=18446744073709551615 
-Delegate=no 
-CPUAccounting=no 
-CPUWeight=[not set] 
-StartupCPUWeight=[not set] 
-CPUShares=[not set] 
-StartupCPUShares=[not set] 
-CPUQuotaPerSecUSec=infinity 
-CPUQuotaPeriodUSec=infinity 
-AllowedCPUs= 
-AllowedMemoryNodes= 
-IOAccounting=no 
-IOWeight=[not set] 
-StartupIOWeight=[not set] 
-BlockIOAccounting=no 
-BlockIOWeight=[not set] 
-lines 1-57 
-</code> 
  
-Pour consulter la liste des dépendances d'une Unité, il convient d'utiliser **systemctl list-dependancies** en spécifiant l'Unité concernée :+<WRAP center round important 60%> 
 +**Important** : Une Action précédée par le signe **-** est entreprise d'une manière **asynchrone**. Dans le cas ou l'action est entreprise d'une manière **synchrone**, la pertinence des journaux est garantie mais au prix d'un ralentissement du système. 
 +</WRAP>
  
-<code> +=====LAB #La Commande logger=====
-[root@centos8 ~]systemctl list-dependencies sshd.service +
-sshd.service +
-● ├─system.slice +
-● ├─sshd-keygen.target +
-● │ ├─sshd-keygen@ecdsa.service +
-● │ ├─sshd-keygen@ed25519.service +
-● │ └─sshd-keygen@rsa.service +
-● └─sysinit.target +
-●   ├─dev-hugepages.mount +
-●   ├─dev-mqueue.mount +
-●   ├─dracut-shutdown.service +
-●   ├─import-state.service +
-●   ├─iscsi-onboot.service +
-●   ├─kmod-static-nodes.service +
-●   ├─ldconfig.service +
-●   ├─loadmodules.service +
-●   ├─lvm2-lvmpolld.socket +
-●   ├─lvm2-monitor.service +
-●   ├─nis-domainname.service +
-●   ├─plymouth-read-write.service +
-●   ├─plymouth-start.service +
-●   ├─proc-sys-fs-binfmt_misc.automount +
-●   ├─rngd.service +
-●   ├─selinux-autorelabel-mark.service +
-●   ├─sys-fs-fuse-connections.mount +
-●   ├─sys-kernel-config.mount +
-●   ├─sys-kernel-debug.mount +
-●   ├─systemd-ask-password-console.path +
-●   ├─systemd-binfmt.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-random-seed.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 +
-●   ├─local-fs.target +
-●   │ ├─-.mount +
-●   │ ├─boot.mount +
-●   │ └─systemd-remount-fs.service +
-●   └─swap.target +
-●     └─dev-disk-by\x2duuid-c8bb3f47\x2dd67f\x2d4b21\x2db781\x2d766899dc83d4.swap +
-</code>+
  
-===2.2 - Surchargement des Fichiers de Configuration par Défaut===+La commande **/usr/bin/logger** permet d'intégrer des informations dans rsyslogCeci peut s'avérer utile dans des scripts bash.
  
-Les fichiers de configuration par défaut peuvent aussi être surchargés par des fichiers dans d'autres répertoires : +La syntaxe de la commande est :
- +
-<code> +
-[root@centos8 ~]# pkg-config systemd --variable=systemdsystemunitpath +
-/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 +
-</code> +
- +
-<code> +
-[root@centos8 ~]# ls -l /etc/systemd/system +
-total 4 +
-drwxr-xr-x. 2 root root   31 May  8  2020 basic.target.wants +
-lrwxrwxrwx. 1 root root   41 May  8  2020 dbus-org.fedoraproject.FirewallD1.service -> /usr/lib/systemd/system/firewalld.service +
-lrwxrwxrwx. 1 root root   44 Jun  3 14:02 dbus-org.freedesktop.Avahi.service -> /usr/lib/systemd/system/avahi-daemon.service +
-lrwxrwxrwx. 1 root root   57 May  8  2020 dbus-org.freedesktop.nm-dispatcher.service -> /usr/lib/systemd/system/NetworkManager-dispatcher.service +
-lrwxrwxrwx. 1 root root   41 May  8  2020 dbus-org.freedesktop.timedate1.service -> /usr/lib/systemd/system/timedatex.service +
-lrwxrwxrwx. 1 root root   37 May  8  2020 default.target -> /lib/systemd/system/multi-user.target +
-drwxr-xr-x. 2 root root   32 May  8  2020 getty.target.wants +
-drwxr-xr-x. 2 root root 4096 Jun  3 14:02 multi-user.target.wants +
-drwxr-xr-x. 2 root root   48 May  8  2020 network-online.target.wants +
-drwxr-xr-x. 2 root root   33 Apr 19 12:07 nfs-blkmap.service.requires +
-drwxr-xr-x. 2 root root   33 Apr 19 12:07 nfs-idmapd.service.requires +
-drwxr-xr-x. 2 root root   33 Apr 19 12:07 nfs-mountd.service.requires +
-drwxr-xr-x. 2 root root   33 Apr 19 12:07 nfs-server.service.requires +
-drwxr-xr-x. 2 root root   26 Jun  3 14:02 printer.target.wants +
-drwxr-xr-x. 2 root root   52 Apr 19 12:07 remote-fs.target.wants +
-drwxr-xr-x. 2 root root   33 Apr 19 12:07 rpc-gssd.service.requires +
-drwxr-xr-x. 2 root root   33 Apr 19 12:07 rpc-statd-notify.service.requires +
-drwxr-xr-x. 2 root root   33 Apr 19 12:07 rpc-statd.service.requires +
-drwxr-xr-x. 2 root root  260 Jun  3 14:02 sockets.target.wants +
-drwxr-xr-x. 2 root root  235 Apr 19 12:07 sysinit.target.wants +
-lrwxrwxrwx. 1 root root   39 May  8  2020 syslog.service -> /usr/lib/systemd/system/rsyslog.service +
-lrwxrwxrwx. 1 root root    9 May 11  2019 systemd-timedated.service -> /dev/null +
-drwxr-xr-x. 2 root root   34 May  8  2020 timers.target.wants +
-</code>+
  
-====LAB #3 La Commande systemd-analyze====+<file> 
 +logger -p Sous-système applicatif.Priorité message 
 +</file>
  
-Pour avoir une évaluation du temps de démarrage, il convient d'utiliser la commande suivante :+Par exemple saisissez la commande suivante :
  
 <code> <code>
-[root@centos8 ~]# systemd-analyze +[root@redhat9 ~]# logger -user.info Linux est super
-Startup finished in 1.665s (kernel) + 6.977s (initrd) + 8.458s (userspace) = 17.101s +
-multi-user.target reached after 5.528s in userspace+
 </code> </code>
  
-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 :+Consultez la fin de votre syslog :
  
 <code> <code>
-[root@centos8 ~]# systemd-analyze blame +[root@redhat9 ~]# tail /var/log/messages 
-          4.080s dracut-initqueue.service +Sep 28 15:05:26 redhat9 dnf[12735]: Extra Packages for Enterprise Linux 9 openh264  6.9 kB/s | 993  B     00:00 
-          3.257s kdump.service +Sep 28 15:05:26 redhat9 dnf[12735]: Extra Packages for Enterprise Linux 9 Next  199 kB/s |  26 kB     00:00 
-          1.727s tuned.service +Sep 28 15:05:27 redhat9 dnf[12735]: Red Hat Enterprise Linux 9 for x86_64 AppStre  12 kB/s | 4.5 kB     00:00 
-          1.415s initrd-switch-root.service +Sep 28 15:05:27 redhat9 dnf[12735]: Red Hat Enterprise Linux 9 for x86_64 BaseOS  7.4 kB/s | 4.1 kB     00:00 
-          1.393s NetworkManager-wait-online.service +Sep 28 15:05:28 redhat9 dnf[12735]: Red Hat CodeReady Linux Builder for RHEL 9 x86_  34 kB/s | 4.5 kB     00:00 
-          1.116s systemd-machined.service +Sep 28 15:05:28 redhat9 dnf[12735]: Metadata cache created
-          1.111s dracut-cmdline.service +Sep 28 15:05:28 redhat9 systemd[1]: dnf-makecache.service: Deactivated successfully
-           850ms sssd.service +Sep 28 15:05:28 redhat9 systemd[1]: Finished dnf makecache
-           791ms vdo.service +Sep 28 15:05:28 redhat9 systemd[1]dnf-makecache.service: Consumed 2.948s CPU time
-           713ms firewalld.service +Sep 28 15:15:29 redhat9 root[12751]: Linux est super
-           622ms lvm2-monitor.service +
-           605ms polkit.service +
-           508ms chronyd.service +
-           434ms avahi-daemon.service +
-           426ms systemd-logind.service +
-           417ms netcf-transaction.service +
-           410ms dracut-pre-udev.service +
-           295ms libvirtd.service +
-           275ms dnf-makecache.service +
-           243ms systemd-udevd.service +
-           221ms systemd-journald.service +
-           196ms systemd-tmpfiles-setup.service +
-           151ms dracut-pre-pivot.service +
-           139ms sysroot.mount +
-           139ms systemd-update-utmp-runlevel.service +
-           122ms systemd-vconsole-setup.service +
-           110ms lvm2-pvscan@8:25.service +
-            98ms systemd-udev-trigger.service +
-            82ms gssproxy.service +
-            81ms cups.service +
-            79ms initrd-parse-etc.service +
-            77ms NetworkManager.service +
-            72ms lvm2-pvscan@8:23.service +
-            69ms systemd-user-sessions.service +
-            68ms lvm2-pvscan@8:22.service +
-            67ms unbound-anchor.service +
-            66ms rsyslog.service +
-            62ms boot.mount +
-            56ms sshd.service +
-            54ms smartd.service +
-            54ms systemd-fsck@dev-disk-by\x2duuid-2ae4c035\x2d9244\x2d458c\x2d82c5\x2da49ae169cdb6.service +
-            53ms user@1000.service +
-            52ms auditd.service +
-            51ms plymouth-quit.service +
-            49ms rngd-wake-threshold.service +
-            46ms import-state.service +
-            46ms systemd-tmpfiles-setup-dev.service +
-            43ms ksmtuned.service +
-            42ms plymouth-quit-wait.service +
-            42ms var-lib-nfs-rpc_pipefs.mount +
-            42ms rpc-statd-notify.service +
-            38ms plymouth-switch-root.service +
-            37ms systemd-remount-fs.service +
-            37ms plymouth-start.service +
-            33ms dev-disk-by\x2duuid-c8bb3f47\x2dd67f\x2d4b21\x2db781\x2d766899dc83d4.swap +
-            33ms systemd-tmpfiles-clean.service +
-            31ms dev-hugepages.mount +
-lines 1-57+
 </code> </code>
  
-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 :+Les options de la commande logger sont :
  
 <code> <code>
-[root@centos8 ~]# systemd-analyze critical-chain sshd.service +[root@redhat9 ~]# logger --help
-The time after the unit is active or started is printed after the "@" character. +
-The time the unit takes to start is printed after the "+" character.+
  
-sshd.service +56ms +Usage: 
-└─network.target @3.799s + logger [options] [<message>]
-  └─NetworkManager.service @3.719s +77ms +
-    └─network-pre.target @3.718s +
-      └─firewalld.service @3.004s +713ms +
-        └─polkit.service @2.397s +605ms +
-          └─basic.target @2.392s +
-            └─sockets.target @2.392s +
-              └─sssd-kcm.socket @2.391s +
-                └─sysinit.target @2.379s +
-                  └─systemd-update-utmp.service @2.370s +8ms +
-                    └─auditd.service @2.317s +52ms +
-                      └─systemd-tmpfiles-setup.service @2.118s +196ms +
-                        └─import-state.service @2.070s +46ms +
-                          └─local-fs.target @2.069s +
-                            └─boot.mount @2.006s +62ms +
-                              └─systemd-fsck@dev-disk-by\x2duuid-2ae4c035\x2d9244\x2d458c\x2d82c5\x2da49ae169cdb6.service @1.943s +54ms +
-                                └─local-fs-pre.target @1.942s +
-                                  └─lvm2-monitor.service @1.319s +622ms +
-                                    └─dm-event.socket @1.317s +
-                                      └─-.mount +
-                                        └─system.slice +
-                                          └─-.slice +
-</code>+
  
-Les options de la commande **systemd-analyze** sont : +Enter messages into the system log.
- +
-<code> +
-[root@centos7 ~]# systemd-analyze --help +
-systemd-analyze [OPTIONS...] {COMMAND} ...+
  
-Process systemd profiling information+Options: 
 + -i                       log the logger command's PID 
 +     --id[=<id>         log the given <id>, or otherwise the PID 
 + -f, --file <file>        log the contents of this file 
 + -e, --skip-empty         do not log empty lines when processing files 
 +     --no-act             do everything except the write the log 
 + -p, --priority <prio>    mark given message with this priority 
 +     --octet-count        use rfc6587 octet counting 
 +     --prio-prefix        look for a prefix on every line read from stdin 
 + -s, --stderr             output message to standard error as well 
 + -S, --size <size>        maximum size for a single message 
 + -t, --tag <tag>          mark every line with this tag 
 + -n, --server <name>      write to this remote syslog server 
 + -P, --port <port>        use this port for UDP or TCP connection 
 + -T, --tcp                use TCP only 
 + -d, --udp                use UDP only 
 +     --rfc3164            use the obsolete BSD syslog protocol 
 +     --rfc5424[=<snip>  use the syslog protocol (the default for remote); 
 +                            <snip> can be notime, or notq, and/or nohost 
 +     --sd-id <id>         rfc5424 structured data ID 
 +     --sd-param <data>    rfc5424 structured data name=value 
 +     --msgid <msgid>      set rfc5424 message id field 
 + -u, --socket <socket>    write to this Unix socket 
 +     --socket-errors[=<on|off|auto>
 +                          print connection errors when using Unix sockets 
 +     --journald[=<file> write journald entry
  
-  -h --help           Show this help + -h--help               display this help 
-     --version        Show package version + -V, --version            display version
-     --system         Connect to system manager +
-     --user           Connect to user service manager +
-     --order          When generating a dependency graph, show only order +
-     --require        When generating a dependency graph, show only requirement +
-     --from-pattern=GLOB, --to-pattern=GLOB +
-                      When generating a dependency graph, filter only origins +
-                      or destinations, respectively +
-     --fuzz=TIMESPAN  When printing the tree of the critical chain, print also +
-                      services, which finished TIMESPAN earlier, than the +
-                      latest in the branch. The unit of TIMESPAN is seconds +
-                      unless specified with a different unit, i.e. 50ms +
-     --no-pager       Do not pipe output into a pager+
  
-Commands: +For more details see logger(1).
-  time                Print time spent in the kernel before reaching userspace +
-  blame               Print list of running units ordered by time to init +
-  critical-chain      Print a tree of the time critical chain of units +
-  plot                Output SVG graphic showing service initialization +
-  dot                 Output dependency graph in dot(1) format +
-  set-log-level LEVEL Set logging threshold for systemd +
-  dump                Output state serialization of service manager+
 </code> </code>
  
-====LAB #4 - Les Cibles Systemd====+=====LAB #4 - La Commande logrotate=====
  
-Chaque Cible est décrite par un fichier de configuration :+Les fichiers journaux grossissent régulièrement. Le programme **/usr/sbin/logrotate** est utilisé pour effectuer des rotations de ces fichiers selon la configuration contenue dans le fichier **/etc/logrotate.conf**. 
 + 
 +Visualisez le fichier **/etc/logrotate.conf** :
  
 <code> <code>
-[root@centos8 ~]# cat /usr/lib/systemd/system/graphical.target +[root@redhat9 ~]# cat /etc/logrotate.conf 
- SPDX-License-Identifier: LGPL-2.1+ +see "man logrotate" for details
-+
-#  This file is part of systemd. +
-+
-#  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.+
  
-[Unit] +# global options do not affect preceding include directives
-Description=Graphical Interface +
-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>+
  
-Dans ce fichier on peut noter la présence des lignes suivantes :+# rotate log files weekly 
 +weekly
  
-  * **Requires=multi-user.target**, +# keep 4 weeks worth of backlogs 
-     * 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, +rotate 4
-  * **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é.+
  
-===4.1 - Contrôler les dépendances d'une Cible===+# create new (empty) log files after rotating old ones 
 +create
  
-Les dépendances d'une Cible peuvent être consultées en utilisant la commande **systemctl list-dependencies** :+# use date as a suffix of the rotated file 
 +dateext
  
-<code> +uncomment this if you want your log files compressed 
-[root@centos8 ~]systemctl list-dependencies multi-user.target +#compress
-multi-user.target +
-● ├─atd.service +
-● ├─auditd.service +
-● ├─avahi-daemon.service +
-● ├─chronyd.service +
-● ├─crond.service +
-● ├─cups.path +
-● ├─cups.service +
-● ├─dbus.service +
-● ├─dnf-makecache.timer +
-● ├─firewalld.service +
-● ├─irqbalance.service +
-● ├─kdump.service +
-● ├─ksm.service +
-● ├─ksmtuned.service +
-● ├─libstoragemgmt.service +
-● ├─libvirtd.service +
-● ├─mcelog.service +
-● ├─mdmonitor.service +
-● ├─netcf-transaction.service +
-● ├─NetworkManager.service +
-● ├─plymouth-quit-wait.service +
-● ├─plymouth-quit.service +
-● ├─rpcbind.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 +
-● ├─vdo.service +
-● ├─basic.target +
-● │ ├─-.mount +
-● │ ├─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 +
-● │ │ ├─libvirtd-ro.socket +
-● │ │ ├─libvirtd.socket +
-● │ │ ├─rpcbind.socket +
-● │ │ ├─sssd-kcm.socket +
-● │ │ ├─systemd-coredump.socket +
-● │ │ ├─systemd-initctl.socket +
-● │ │ ├─systemd-journald-dev-log.socket +
-● │ │ ├─systemd-journald.socket +
-● │ │ ├─systemd-udevd-control.socket +
-lines 1-57 +
-</code>+
  
-Les points noirs au début de chaque ligne dans la sortie ci-dessus peuvent être de trois couleurs différentes :+# packages drop log rotation information into this directory 
 +include /etc/logrotate.d
  
-  * **Vert** implique que le service, la cible ou l'unité est activé et démarré.  +system-specific logs may be also be configured here.
-  * **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. +
- +
-Pour visualiser les Unités en état d'erreur fatale, utilisez la commande **systemctl --failed** : +
- +
-<code> +
-[root@centos8 ~]systemctl --failed +
-0 loaded units listed. Pass --all to see loaded but inactive units, too. +
-To show all installed unit files use 'systemctl list-unit-files'.+
 </code> </code>
  
-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** :+Dans la première partie de ce fichier on trouve des directives pour :
  
-<code> +  * remplacer les fichiers journaux chaque semaine 
-[root@centos8 ~]# ls -l /etc/systemd/system/multi-user.target.wants +  * garder 4 archives des fichiers journaux 
-total 0 +  * créer un nouveau fichier log une fois le précédent archivé 
-lrwxrwxrwx. 1 root root 35 May  8  2020 atd.service -> /usr/lib/systemd/system/atd.service +  * comprimer les archives créées.
-lrwxrwxrwx. 1 root root 38 May  8  2020 auditd.service -> /usr/lib/systemd/system/auditd.service +
-lrwxrwxrwx. 1 root root 44 Jun  3 14:02 avahi-daemon.service -> /usr/lib/systemd/system/avahi-daemon.service +
-lrwxrwxrwx. 1 root root 39 May  8  2020 chronyd.service -> /usr/lib/systemd/system/chronyd.service +
-lrwxrwxrwx. 1 root root 37 May  8  2020 crond.service -> /usr/lib/systemd/system/crond.service +
-lrwxrwxrwx. 1 root root 33 Jun  3 14:02 cups.path -> /usr/lib/systemd/system/cups.path +
-lrwxrwxrwx. 1 root root 36 Jun  3 14:02 cups.service -> /usr/lib/systemd/system/cups.service +
-lrwxrwxrwx. 1 root root 43 May  8  2020 dnf-makecache.timer -> /usr/lib/systemd/system/dnf-makecache.timer +
-lrwxrwxrwx. 1 root root 41 May  8  2020 firewalld.service -> /usr/lib/systemd/system/firewalld.service +
-lrwxrwxrwx. 1 root root 42 May  8  2020 irqbalance.service -> /usr/lib/systemd/system/irqbalance.service +
-lrwxrwxrwx. 1 root root 37 May  8  2020 kdump.service -> /usr/lib/systemd/system/kdump.service +
-lrwxrwxrwx. 1 root root 35 Apr 19 12:07 ksm.service -> /usr/lib/systemd/system/ksm.service +
-lrwxrwxrwx. 1 root root 40 Apr 19 12:07 ksmtuned.service -> /usr/lib/systemd/system/ksmtuned.service +
-lrwxrwxrwx. 1 root root 46 May  8  2020 libstoragemgmt.service -> /usr/lib/systemd/system/libstoragemgmt.service +
-lrwxrwxrwx. 1 root root 40 Apr 19 12:07 libvirtd.service -> /usr/lib/systemd/system/libvirtd.service +
-lrwxrwxrwx. 1 root root 38 May  8  2020 mcelog.service -> /usr/lib/systemd/system/mcelog.service +
-lrwxrwxrwx. 1 root root 41 May  8  2020 mdmonitor.service -> /usr/lib/systemd/system/mdmonitor.service +
-lrwxrwxrwx. 1 root root 49 Apr 19 12:07 netcf-transaction.service -> /usr/lib/systemd/system/netcf-transaction.service +
-lrwxrwxrwx. 1 root root 46 May  8  2020 NetworkManager.service -> /usr/lib/systemd/system/NetworkManager.service +
-lrwxrwxrwx. 1 root root 41 Apr 19 12:07 nfs-client.target -> /usr/lib/systemd/system/nfs-client.target +
-lrwxrwxrwx. 1 root root 40 May  8  2020 remote-fs.target -> /usr/lib/systemd/system/remote-fs.target +
-lrwxrwxrwx. 1 root root 39 Apr 19 12:07 rpcbind.service -> /usr/lib/systemd/system/rpcbind.service +
-lrwxrwxrwx. 1 root root 39 May  8  2020 rsyslog.service -> /usr/lib/systemd/system/rsyslog.service +
-lrwxrwxrwx. 1 root root 38 May  8  2020 smartd.service -> /usr/lib/systemd/system/smartd.service +
-lrwxrwxrwx. 1 root root 36 May  8  2020 sshd.service -> /usr/lib/systemd/system/sshd.service +
-lrwxrwxrwx. 1 root root 36 May  8  2020 sssd.service -> /usr/lib/systemd/system/sssd.service +
-lrwxrwxrwx. 1 root root 37 May  8  2020 tuned.service -> /usr/lib/systemd/system/tuned.service +
-lrwxrwxrwx. 1 root root 35 May  8  2020 vdo.service -> /usr/lib/systemd/system/vdo.service+
  
-[root@centos8 ~]# ls -l /usr/lib/systemd/system/multi-user.target.wants +La directive **include /etc/logrotate.d** indique que les configurations incluent dans le répertoire cité doivent être incorporées dans le fichier de configuration de logrotate.
-total 0 +
-lrwxrwxrwx. 1 root root 15 Apr  7 12:08 dbus.service -> ../dbus.service +
-lrwxrwxrwx. 1 root root 15 Apr  7 16:55 getty.target -> ../getty.target +
-lrwxrwxrwx. 1 root root 24 Oct  6  2020 plymouth-quit.service -> ../plymouth-quit.service +
-lrwxrwxrwx. 1 root root 29 Oct  6  2020 plymouth-quit-wait.service -> ../plymouth-quit-wait.service +
-lrwxrwxrwx. 1 root root 33 Apr  7 16:55 systemd-ask-password-wall.path -> ../systemd-ask-password-wall.path +
-lrwxrwxrwx. 1 root root 25 Apr  7 16:55 systemd-logind.service -> ../systemd-logind.service +
-lrwxrwxrwx. 1 root root 39 Apr  7 16:55 systemd-update-utmp-runlevel.service -> ../systemd-update-utmp-runlevel.service +
-lrwxrwxrwx. 1 root root 32 Apr  7 16:55 systemd-user-sessions.service -> ../systemd-user-sessions.service +
-</code>+
  
-===4.2 - La Cible par Défaut===+La deuxième partie du fichier concerne des configurations spécifiques pour certains fichiers journaux.
  
-==Consulter la Cible par Défaut==+<WRAP center round important 60%> 
 +**Important** : Notez que la compression des fichiers de journalisation n'est pas activée par défaut. 
 +</WRAP>
  
-Pour consulter la cible par défaut, il convient d'utiliser la commande **systemctl get-default** :+Les options de la commande logrotate sont :
  
 <code> <code>
-[root@centos8 ~]# systemctl get-default +[root@redhat9 ~]# logrotate --help 
-multi-user.target +Usage: logrotate [OPTION...] <configfile> 
-</code>+  -d, --debug               Don't do anything, just test and print debug messages 
 +  -f, --force               Force file rotation 
 +  -m, --mail=command        Command to send mail (instead of `/bin/mail'
 +  -s, --state=statefile     Path of state file 
 +      --skip-state-lock     Do not lock the state file 
 +  -v, --verbose             Display messages during rotation 
 +  -l, --log=logfile         Log file or 'syslog' to log to syslog 
 +      --version             Display version information
  
-La Cible par défaut est représentée par le lien symbolique **/etc/systemd/system/default.target** +Help options
- +  -?, --help                Show this help message 
-<code> +      --usage               Display brief usage message
-[root@centos8 ~]# ls -l /etc/systemd/system/default.target +
-lrwxrwxrwx. 1 root root 37 May  8  2020 /etc/systemd/system/default.target -> /lib/systemd/system/multi-user.target+
 </code> </code>
  
-==Modifier la Cible par Défaut==+=====LAB #5 - La Journalisation avec journald=====
  
-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** :+Sous RHEL 9, les fichiers de Syslog sont gardés pour une question de compatibilité. Cependant, tous les journaux sont d'abord collectés par **Journald** pour ensuite être redistribués vers les fichiers classiques se trouvant dans le répertoire /var/log. Les journaux de journald sont stockés dans un seul et unique fichier dynamique dans le répertoire **/run/log/journal** :
  
 <code> <code>
-[root@centos8 ~]# systemctl set-default graphical.target +[root@redhat9 ~]# ls -l /run/log/journal
-Removed /etc/systemd/system/default.target. +total 0 
-Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/graphical.target. +drwxr-s---+ 2 root systemd-journal 60 Sep 25 12:44 5a35a3eb625c45cea1d33535723e791f
-[root@centos8 ~]# ls -l /etc/systemd/system/default.target +
-lrwxrwxrwx. 1 root root 40 Jun  6 08:11 /etc/systemd/system/default.target -> /usr/lib/systemd/system/graphical.target +
-[root@centos8 ~]# systemctl set-default multi-user.target +
-Removed /etc/systemd/system/default.target. +
-Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/multi-user.target. +
-[root@centos8 ~]# ls -l /etc/systemd/system/default.target +
-lrwxrwxrwx. 1 root root 41 Jun  6 08:11 /etc/systemd/system/default.target -> /usr/lib/systemd/system/multi-user.target+
 </code> </code>
  
-==Modifier la Cible en Cours==+A l'extinction de la machine les journaux sont **effacés**.
  
-Il est possible de modifier la cible actuellement en cours en utilisant la commande **systemctl isolate** :+La configuration de ce comportement se trouve dans le fichier **/etc/systemd/journald.conf** et est défini par la valeur de la variable **Storage** :
  
 <code> <code>
-[root@centos8 ~]# systemctl isolate rescue +[root@redhat9 ~]# cat /etc/systemd/journald.conf 
-[root@centos8 ~]systemctl list-units --type target | egrep "eme|res|gra|mul" | head -+ This file is part of systemd. 
-rescue.target       loaded active active Rescue Mode              +
-[root@centos8 ~]runlevel +#  systemd is free software; you can redistribute it and/or modify it under the 
-3 1 +#  terms of the GNU Lesser General Public License as published by the Free 
-[root@centos8 ~]who -r +#  Software Foundation; either version 2.of the License, or (at your option) 
-         run-level 1  2021-06-15 04:22                   last=3 +#  any later version
-</code>+
 +# Entries in this file show the compile time defaults. Local configuration 
 +should be created by either modifying this file, or by creating "drop-ins" in 
 +# the journald.conf.d/ subdirectory. The latter is generally recommended. 
 +# Defaults can be restored by simply deleting this file and all drop-ins. 
 +
 +# Use 'systemd-analyze cat-config systemd/journald.conf' to display the full config. 
 +
 +# See journald.conf(5) for details.
  
-<code> +[Journal] 
-[root@centos8 ~]# systemctl isolate multi-user +#Storage=auto 
-[root@centos8 ~]systemctl list-units --type target | egrep "eme|res|gra|mul" | head -1 +#Compress=yes 
-multi-user.target      loaded active active Multi-User System           +#Seal=yes 
-[root@centos8 ~]runlevel +#SplitMode=uid 
-1 3 +#SyncIntervalSec=5m 
-[root@centos8 ~]who -r +#RateLimitIntervalSec=30s 
-         run-level 3  2021-06-15 04:24                   last=1+#RateLimitBurst=10000 
 +#SystemMaxUse= 
 +#SystemKeepFree= 
 +#SystemMaxFileSize= 
 +#SystemMaxFiles=100 
 +#RuntimeMaxUse= 
 +#RuntimeKeepFree= 
 +#RuntimeMaxFileSize= 
 +#RuntimeMaxFiles=100 
 +#MaxRetentionSec= 
 +#MaxFileSec=1month 
 +#ForwardToSyslog=no 
 +#ForwardToKMsg=no 
 +#ForwardToConsole=no 
 +#ForwardToWall=yes 
 +#TTYPath=/dev/console 
 +#MaxLevelStore=debug 
 +#MaxLevelSyslog=debug 
 +#MaxLevelKMsg=notice 
 +#MaxLevelConsole=info 
 +#MaxLevelWall=emerg 
 +#LineMax=48K 
 +#ReadKMsg=yes 
 +Audit=
 </code> </code>
  
-====LAB #5 - Gestion des Services====+La valeur de la variable peut être :
  
-===5.1 Gestion des Instances Uniques===+  * **auto** si le répertoire **/var/log/journal** existe, le journal devient persistant, 
 +  * **persistent** - le journal est persistant et est stocké dans le répertoire **/var/log/journal**, 
 +  * **volatile** - le journal est stocké dans un fichier dynamique dans le répertoire **/run/log/journal**.
  
-Commencez par installer le paquet **httpd** :+Pour rendre le journal permenant, modifiez le fichier **/etc/systemd/journald.conf** et décommentez la directive **Storage** :
  
 <code> <code>
-[root@centos8 ~]# dnf install httpd+[root@redhat9 ~]# vi /etc/systemd/journald.conf 
 +[root@redhat9 ~]# cat /etc/systemd/journald.conf 
 +#  This file is part of systemd. 
 +
 +#  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. 
 +
 +# Entries in this file show the compile time defaults. Local configuration 
 +# should be created by either modifying this file, or by creating "drop-ins" in 
 +# the journald.conf.d/ subdirectory. The latter is generally recommended. 
 +# Defaults can be restored by simply deleting this file and all drop-ins. 
 +
 +# Use 'systemd-analyze cat-config systemd/journald.conf' to display the full config. 
 +
 +# See journald.conf(5) for details. 
 + 
 +[Journal] 
 +Storage=auto 
 +#Compress=yes 
 +#Seal=yes 
 +#SplitMode=uid 
 +#SyncIntervalSec=5m 
 +#RateLimitIntervalSec=30s 
 +#RateLimitBurst=10000 
 +#SystemMaxUse= 
 +#SystemKeepFree= 
 +#SystemMaxFileSize= 
 +#SystemMaxFiles=100 
 +#RuntimeMaxUse= 
 +#RuntimeKeepFree= 
 +#RuntimeMaxFileSize= 
 +#RuntimeMaxFiles=100 
 +#MaxRetentionSec= 
 +#MaxFileSec=1month 
 +#ForwardToSyslog=no 
 +#ForwardToKMsg=no 
 +#ForwardToConsole=no 
 +#ForwardToWall=yes 
 +#TTYPath=/dev/console 
 +#MaxLevelStore=debug 
 +#MaxLevelSyslog=debug 
 +#MaxLevelKMsg=notice 
 +#MaxLevelConsole=info 
 +#MaxLevelWall=emerg 
 +#LineMax=48K 
 +#ReadKMsg=yes 
 +Audit=
 </code> </code>
  
-Pour obtenir le détail sur un service donné, il convient d'utiliser la commande **systemctl status** :+Créez le répertoire **/var/log/journal** :
  
 <code> <code>
-[root@centos8 ~]# systemctl status httpd.service +[root@redhat9 ~]# mkdir /var/log/journal 
-● httpd.service The Apache HTTP Server +[root@redhat9 ~]# ls -/var/log/journal
-   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) +total 0
-   Active: inactive (dead) +
-     Docs: man:httpd.service(8)+
 </code> </code>
  
-Dans le cas du service httpd ci-dessus, on peut constater que le statut est **disabled**. Le statut peut être une de 2 valeurs : +Redémarrez votre VM :
- +
-  * **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. +
- +
-Il est possible de vérifier le statut en utilisant le commande **systemctl is-enabled** :+
  
 <code> <code>
-[root@centos8 ~]# systemctl is-enabled httpd.service +[root@redhat9 ~]# reboot 
-disabled+[root@redhat9 ~]# Connection to 10.0.2.101 closed by remote host
 +Connection to 10.0.2.101 closed.
 </code> </code>
  
-Pour rendre le statut **enabled**, il convient d'utiliser la commande **systemctl enable** :+Reconnectez-vous à votre VM :
  
 <code> <code>
-[root@centos8 ~]# systemctl enable httpd.service +[trainee@redhat9 ~]$ su - 
-Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.+Password: fenestros
  
-[root@centos8 ~]# systemctl is-enabled httpd.service +[root@redhat9 ~]# ls -l /run/log/journal/ 
-enabled+total 0
  
-[root@centos8 ~]# systemctl status httpd.service +[root@redhat9 ~]# ls -/var/log/journal
-● httpd.service The Apache HTTP Server +total 0 
-   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) +drwxr-sr-x+ 2 root systemd-journal 53 Sep 28 15:39 5a35a3eb625c45cea1d33535723e791f
-   Active: inactive (dead) +
-     Docs: man:httpd.service(8)+
 </code> </code>
  
-Dans le cas du service httpd ci-dessus, on peut maintenant constater que l'état est **inactive (dead)**.  L'état peut être une de 7 valeurs :+Journald ne peut pas envoyer de traces à un autre ordinateur. Pour utiliser un serveur de journalisation distant il faut donc ajouter la directive **ForwardToSyslog=yes** au fichier de configuration de journald, **/etc/systemd/journald.conf**, puis configurer Rsyslog à envoyer les traces au serveur distant.
  
-  * **inactive (dead)** - le service est arrêté. +====5.Consultation des Journaux====
-  * **active(running** le service est démarré avec un ou plusieurs processus. +
-  * **active(exited)** - le service a terminé une configuration unique. +
-  * **active(waiting)** - le service est démarré mais en attente d'un évènement. +
-  * **activating** - le service est en cours d'activation. +
-  * **deactivating** - le service est en cours de désactivation. +
-  * **failed** - le service a rencontré une erreur fatale.+
  
-Il est possible de vérifier l'état en utilisant le commande **systemctl is-active** :+L'utilisation de la commande **journalctl** permet la consultation des journaux :
  
 <code> <code>
-[root@centos8 ~]# systemctl is-active httpd.service +[root@redhat9 ~]# journalctl 
-inactive+Sep 28 15:36:59 redhat9.ittraining.loc kernel: Linux version 5.14.0-427.37.1.el9_4.x86_64 (mockbuild@x86-64-02.build.eng.rdu2.redhat.com) (gcc (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3), GNU ld version 2.35.2-43> 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: The list of certified hardware and cloud instances for Red Hat Enterprise Linux 9 can be viewed at the Red Hat Ecosystem Catalog, https://catalog.redhat.com. 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: Command line: BOOT_IMAGE=(hd0,msdos1)/vmlinuz-5.14.0-427.37.1.el9_4.x86_64 root=/dev/mapper/rhel-root ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/> 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers' 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers' 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers' 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format. 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: signal: max sigframe size: 1776 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-provided physical RAM map: 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x0000000000100000-0x00000000bffd9fff] usable 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x00000000bffda000-0x00000000bfffffff] reserved 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x0000000100000000-0x000000023fffffff] usable 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: NX (Execute Disable) protection: active 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: SMBIOS 2.8 present
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.1-0-g3208b098f51a-prebuilt.qemu.org 04/01/2014 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: Hypervisor detected: KVM 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: kvm-clock: Using msrs 4b564d01 and 4b564d00 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: kvm-clock: using sched offset of 269552729537899 cycles 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881590591483 ns 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: tsc: Detected 2099.998 MHz processor 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: e820: update [mem 0x00000000-0x00000fff] usable ==> reserved 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: e820: remove [mem 0x000a0000-0x000fffff] usable 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: last_pfn = 0x240000 max_arch_pfn = 0x400000000 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: MTRR map: 4 entries (3 fixed + 1 variable; max 19), built from 8 variable MTRRs 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WP  UC- WT   
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: last_pfn = 0xbffda max_arch_pfn = 0x400000000 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: found SMP MP-table at [mem 0x000f5bc0-0x000f5bcf] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: Using GB pages for direct mapping 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: RAMDISK: [mem 0x3149c000-0x34a45fff] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Early table checksum verification disabled 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: RSDP 0x00000000000F5980 000014 (v00 BOCHS ) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: RSDT 0x00000000BFFE300C 000038 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: FACP 0x00000000BFFE2DDE 000074 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: DSDT 0x00000000BFFDF040 003D9E (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: FACS 0x00000000BFFDF000 000040 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: APIC 0x00000000BFFE2E52 000090 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: SSDT 0x00000000BFFE2EE2 0000CA (v01 BOCHS  VMGENID  00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: HPET 0x00000000BFFE2FAC 000038 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: WAET 0x00000000BFFE2FE4 000028 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving FACP table memory at [mem 0xbffe2dde-0xbffe2e51] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving DSDT table memory at [mem 0xbffdf040-0xbffe2ddd] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving FACS table memory at [mem 0xbffdf000-0xbffdf03f] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving APIC table memory at [mem 0xbffe2e52-0xbffe2ee1] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving SSDT table memory at [mem 0xbffe2ee2-0xbffe2fab] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving HPET table memory at [mem 0xbffe2fac-0xbffe2fe3] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving WAET table memory at [mem 0xbffe2fe4-0xbffe300b] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: No NUMA configuration found 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: Faking a node at [mem 0x0000000000000000-0x000000023fffffff] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: NODE_DATA(0) allocated [mem 0x23ffd5000-0x23fffffff] 
 +lines 1-55
 </code> </code>
  
-Pour rendre l'état **active(running)**, utilisez la commande suivante :+<WRAP center round important 60%> 
 +**Important** : Notez que les messages importants sont en gras, par exemple les messages de niveaux **notice** ou **warning** et que les messages graves sont en rouge. 
 +</WRAP>
  
-<code> +====5.2 - Consultation des Journaux d'une Application Spécifique====
-[root@centos8 ~]# systemctl start httpd.service +
-</code>+
  
-Vérifiez ensuite l'état du service :+Pour consulter les entrées concernant une application spécifique, il suffit de passer l'exécutable, y compris son chemin complet, en argument à la commande journalctl 
  
 <code> <code>
-[root@centos8 ~]# systemctl is-active httpd.service +[root@redhat9 ~]# journalctl /sbin/crond 
-active+Sep 28 15:37:18 redhat9.ittraining.loc crond[1138]: (CRON) STARTUP (1.5.7) 
 +Sep 28 15:37:18 redhat9.ittraining.loc crond[1138]: (CRON) INFO (Syslog will be used instead of sendmail.) 
 +Sep 28 15:37:18 redhat9.ittraining.loc crond[1138]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 65% if used.) 
 +Sep 28 15:37:18 redhat9.ittraining.loc crond[1138]: (CRON) INFO (running with inotify support) 
 +</code>
  
-[root@centos8 ~]# systemctl status httpd.service +<WRAP center round important 60%> 
-● httpd.service - The Apache HTTP Server +**Important** Rappelez-vous que sous RHEL9 le répertoire **/sbin** est un lien symbolique vers **/usr/sbin**. 
-   Loadedloaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) +</WRAP>
-   Active: active (running) since Sun 2021-06-06 15:33:06 EDT; 14s ago +
-     Docs: man:httpd.service(8) +
- Main PID: 34382 (httpd) +
-   Status: "Running, listening on: port 80" +
-    Tasks: 213 (limit: 23719) +
-   Memory: 36.3M +
-   CGroup: /system.slice/httpd.service +
-           ├─34382 /usr/sbin/httpd -DFOREGROUND +
-           ├─34383 /usr/sbin/httpd -DFOREGROUND +
-           ├─34384 /usr/sbin/httpd -DFOREGROUND +
-           ├─34385 /usr/sbin/httpd -DFOREGROUND +
-           └─34386 /usr/sbin/httpd -DFOREGROUND+
  
-Jun 06 15:33:05 centos8.ittraining.loc systemd[1]: Starting The Apache HTTP Server... +====5.3 - Consultation des Journaux depuis le Dernier Démarrage====
-Jun 06 15:33:06 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server. +
-Jun 06 15:33:06 centos8.ittraining.loc httpd[34382]: Server configured, listening on: port 80 +
-</code>+
  
-Pour arrêter une Unité de serviceutilisez la commande suivante :+Pour consulter les entrées depuis le dernier démarrageil suffit d'utiliser l'option **-b** de la commande journalctl 
  
 <code> <code>
-[root@centos8 ~]# systemctl stop httpd.service +[root@redhat9 ~]# journalctl -b | more 
-[root@centos8 ~]# systemctl status httpd.service +Sep 28 15:36:59 redhat9.ittraining.loc kernel: Linux version 5.14.0-427.37.1.el9_4.x86_64 (mockbuild@x86-64-02.build.eng.rdu2.redhat.com) (gcc (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3), GNU ld version 2.35.2-43. 
-● httpd.service - The Apache HTTP Server +el9) #1 SMP PREEMPT_DYNAMIC Fri Sep 13 12:41:50 EDT 2024 
-   Loadedloaded (/usr/lib/systemd/system/httpd.service; enabled; vendor presetdisabled) +Sep 28 15:36:59 redhat9.ittraining.loc kernel: The list of certified hardware and cloud instances for Red Hat Enterprise Linux 9 can be viewed at the Red Hat Ecosystem Catalog, https://catalog.redhat.com. 
-   Activeinactive (dead) since Sun 2021-06-06 23:58:04 EDT; 8s ago +Sep 28 15:36:59 redhat9.ittraining.loc kernel: Command line: BOOT_IMAGE=(hd0,msdos1)/vmlinuz-5.14.0-427.37.1.el9_4.x86_64 root=/dev/mapper/rhel-root ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/m 
-     Docsman:httpd.service(8) +apper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet 
-  Process34382 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=0/SUCCESS+Sep 28 15:36:59 redhat9.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers' 
- Main PID34382 (code=exitedstatus=0/SUCCESS) +Sep 28 15:36:59 redhat9.ittraining.loc kernelx86/fpu: Supporting XSAVE feature 0x002: 'SSE registers' 
-   Status"Runninglistening onport 80" +Sep 28 15:36:59 redhat9.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers' 
- +Sep 28 15:36:59 redhat9.ittraining.loc kernel: x86/fpu: xstate_offset[2]:  576, xstate_sizes[2] 256 
-Jun 06 15:33:05 centos8.ittraining.loc systemd[1]: Starting The Apache HTTP Server... +Sep 28 15:36:59 redhat9.ittraining.loc kernel: x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format. 
-Jun 06 15:33:06 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server+Sep 28 15:36:59 redhat9.ittraining.loc kernel: signal: max sigframe size: 1776 
-Jun 06 15:33:06 centos8.ittraining.loc httpd[34382]: Server configured, listening onport 80 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-provided physical RAM map: 
-Jun 06 23:58:02 centos8.ittraining.loc systemd[1]: Stopping The Apache HTTP Server... +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable 
-Jun 06 23:58:04 centos8.ittraining.loc systemd[1]: httpd.serviceSucceeded+Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved 
-Jun 06 23:58:04 centos8.ittraining.loc systemd[1]: Stopped The Apache HTTP Server.+Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x0000000000100000-0x00000000bffd9fff] usable 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x00000000bffda000-0x00000000bfffffff] reserved 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x0000000100000000-0x000000023fffffff] usable 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: NX (Execute Disableprotection: active 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: SMBIOS 2.8 present. 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: DMIQEMU Standard PC (i440FX + PIIX1996), BIOS rel-1.16.1-0-g3208b098f51a-prebuilt.qemu.org 04/01/2014 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: Hypervisor detected: KVM 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: kvm-clock: Using msrs 4b564d01 and 4b564d00 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: kvm-clock: using sched offset of 269552729537899 cycles 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffbmax_idle_ns881590591483 ns 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: tsc: Detected 2099.998 MHz processor 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: e820: update [mem 0x00000000-0x00000fffusable ==> reserved 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: e820: remove [mem 0x000a0000-0x000fffff] usable 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: last_pfn = 0x240000 max_arch_pfn = 0x400000000 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: MTRR map: 4 entries (3 fixed + variable; max 19), built from 8 variable MTRRs 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WP  UC- WT   
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: last_pfn = 0xbffda max_arch_pfn = 0x400000000 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: found SMP MP-table at [mem 0x000f5bc0-0x000f5bcf] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: Using GB pages for direct mapping 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: RAMDISK: [mem 0x3149c000-0x34a45fff] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Early table checksum verification disabled 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: RSDP 0x00000000000F5980 000014 (v00 BOCHS ) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: RSDT 0x00000000BFFE300C 000038 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: FACP 0x00000000BFFE2DDE 000074 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: DSDT 0x00000000BFFDF040 003D9E (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: FACS 0x00000000BFFDF000 000040 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: APIC 0x00000000BFFE2E52 000090 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: SSDT 0x00000000BFFE2EE2 0000CA (v01 BOCHS  VMGENID  00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: HPET 0x00000000BFFE2FAC 000038 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: WAET 0x00000000BFFE2FE4 000028 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving FACP table memory at [mem 0xbffe2dde-0xbffe2e51] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernelACPI: Reserving DSDT table memory at [mem 0xbffdf040-0xbffe2ddd] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving FACS table memory at [mem 0xbffdf000-0xbffdf03f] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving APIC table memory at [mem 0xbffe2e52-0xbffe2ee1] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving SSDT table memory at [mem 0xbffe2ee2-0xbffe2fab] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving HPET table memory at [mem 0xbffe2fac-0xbffe2fe3] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving WAET table memory at [mem 0xbffe2fe4-0xbffe300b] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: No NUMA configuration found 
 +--More-- 
 +[q]
 </code> </code>
  
-Pour désactiver un service au prochain démarrage du systèmeutilisez l'option **disable** :+<WRAP center round important 60%> 
 +**Important** : Notez que vous pouvez consulter les messages des démarrages précédentsil est possible d'utiliser les options **-b 1**, **-b 2** etc. 
 +</WRAP>
  
-<code> +====5.Consultation des Journaux d'une Priorité Spécifique====
-[root@centos8 ~]# systemctl disable httpd.service +
-Removed /etc/systemd/system/multi-user.target.wants/httpd.service. +
-[root@centos8 ~]# systemctl status httpd.service +
-● httpd.service - The Apache HTTP Server +
-   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) +
-   Active: inactive (dead) +
-     Docs: man:httpd.service(8)+
  
-Jun 06 15:33:05 centos8.ittraining.loc systemd[1]: Starting The Apache HTTP Server... +Pour consulter les entrées à partir d'une priorité spécifique et supérieuril suffit d'utiliser l'option **-p** de la commande journalctl en spécifiant la priorité concernée 
-Jun 06 15:33:06 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server. +
-Jun 06 15:33:06 centos8.ittraining.loc httpd[34382]: Server configuredlistening on: port 80 +
-Jun 06 23:58:02 centos8.ittraining.loc systemd[1]: Stopping The Apache HTTP Server... +
-Jun 06 23:58:04 centos8.ittraining.loc systemd[1]: httpd.service: Succeeded. +
-Jun 06 23:58:04 centos8.ittraining.loc systemd[1]: Stopped The Apache HTTP Server. +
-</code> +
- +
-===5.2 - Gestion d'Instances Multiples=== +
- +
-Systemd permet l'utilisation des gabarits (templates) des fichiers de configuration des Unités. De cette façon il est possible de faire coexister deux ou plusieurs instances du même service. Un gabarit est reconnaissable par le caractère **@** qui est placé juste avant le point dans le nom du fichier :+
  
 <code> <code>
-[root@centos8 ~]# cat /usr/lib/systemd/system/httpd@.service +[root@redhat9 ~]# journalctl -p warning 
-# This is a template for httpd instances+Sep 28 15:36:59 redhat9.ittraining.loc kernel:  #3 
-# See httpd@.service(8) for more information.+Sep 28 15:36:59 redhat9.ittraining.loc kernel: acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended configuration space under this bridge 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: device-mapper: core: CONFIG_IMA_DISABLE_HTABLE is disabled. Duplicate IMA measurements will not be recorded in the IMA log. 
 +Sep 28 15:37:00 redhat9.ittraining.loc systemd[1]: sys-module-fuse.device: Failed to enqueue SYSTEMD_WANTS= job, ignoring: Unit sys-fs-fuse-connections.mount not found. 
 +Sep 28 15:37:00 redhat9.ittraining.loc kernel: sd 0:0:0:0: Power-on or device reset occurred 
 +Sep 28 15:37:10 redhat9.ittraining.loc lvm[696]: PV /dev/sda2 online, VG rhel is complete. 
 +Sep 28 15:37:12 redhat9.ittraining.loc avahi-daemon[752]: WARNING: No NSS support for mDNS detected, consider installing nss-mdns! 
 +Sep 28 15:37:16 redhat9.ittraining.loc kernel: Warning: Unmaintained driver is detected: ip_set 
 +Sep 28 15:37:20 redhat9.ittraining.loc kernel: block dm-0: the capability attribute has been deprecated. 
 +Sep 28 15:37:23 redhat9.ittraining.loc /usr/sbin/irqbalance[754]: Cannot change IRQ 28 affinity: Input/output error 
 +Sep 28 15:37:23 redhat9.ittraining.loc /usr/sbin/irqbalance[754]: IRQ 28 affinity is now unmanaged 
 +Sep 28 15:37:23 redhat9.ittraining.loc /usr/sbin/irqbalance[754]: Cannot change IRQ 30 affinity: Input/output error 
 +Sep 28 15:37:23 redhat9.ittraining.loc /usr/sbin/irqbalance[754]: IRQ 30 affinity is now unmanaged 
 +Sep 28 15:37:23 redhat9.ittraining.loc /usr/sbin/irqbalance[754]: Cannot change IRQ 29 affinity: Input/output error 
 +Sep 28 15:37:23 redhat9.ittraining.loc /usr/sbin/irqbalance[754]: IRQ 29 affinity is now unmanaged 
 +Sep 28 15:37:23 redhat9.ittraining.loc /usr/sbin/irqbalance[754]: Cannot change IRQ 0 affinity: Input/output error 
 +Sep 28 15:37:23 redhat9.ittraining.loc /usr/sbin/irqbalance[754]: IRQ 0 affinity is now unmanaged 
 +Sep 28 15:37:23 redhat9.ittraining.loc org.gnome.Shell.desktop[1802]: pci id for fd 13: 1234:1111, driver (null) 
 +Sep 28 15:37:23 redhat9.ittraining.loc org.gnome.Shell.desktop[1802]: MESA-LOADER: failed to open bochs-drm: /usr/lib64/dri/bochs-drm_dri.so: cannot open shared object file: No such file or directory (search p> 
 +Sep 28 15:37:25 redhat9.ittraining.loc /usr/libexec/gdm-wayland-session[1793]: dbus-daemon[1793]: [session uid=42 pid=1793] Activating service name='org.a11y.Bus' requested by ':1.4' (uid=42 pid=1802 comm="/us> 
 +Sep 28 15:37:25 redhat9.ittraining.loc /usr/libexec/gdm-wayland-session[1793]: dbus-daemon[1793]: [session uid=42 pid=1793] Successfully activated service 'org.a11y.Bus' 
 +Sep 28 15:37:27 redhat9.ittraining.loc /usr/libexec/gdm-wayland-session[1793]: dbus-daemon[1793]: [session uid=42 pid=1793] Activating service name='org.freedesktop.portal.IBus' requested by ':1.6' (uid=42 pid> 
 +Sep 28 15:37:27 redhat9.ittraining.loc /usr/libexec/gdm-wayland-session[1793]: dbus-daemon[1793]: [session uid=42 pid=1793] Successfully activated service 'org.freedesktop.portal.IBus' 
 +Sep 28 15:37:27 redhat9.ittraining.loc /usr/libexec/gdm-wayland-session[1793]: dbus-daemon[1793]: [session uid=42 pid=1793] Activating service name='org.freedesktop.impl.portal.PermissionStore' requested by ':> 
 +Sep 28 15:37:27 redhat9.ittraining.loc /usr/libexec/gdm-wayland-session[1793]: dbus-daemon[1793]: [session uid=42 pid=1793] Successfully activated service 'org.freedesktop.impl.portal.PermissionStore' 
 +Sep 28 15:37:28 redhat9.ittraining.loc wireplumber[1859]: Failed to set scheduler settings: Operation not permitted 
 +Sep 28 15:37:28 redhat9.ittraining.loc /usr/libexec/gdm-wayland-session[1793]: dbus-daemon[1793]: [session uid=42 pid=1793] Activating service name='org.gnome.Shell.Notifications' requested by ':1.3' (uid=42 p> 
 +Sep 28 15:37:28 redhat9.ittraining.loc /usr/libexec/gdm-wayland-session[1825]: dbus-daemon[1825]: Activating service name='org.a11y.atspi.Registry' requested by ':1.0' (uid=42 pid=1802 comm="/usr/bin/gnome-she> 
 +Sep 28 15:37:28 redhat9.ittraining.loc /usr/libexec/gdm-wayland-session[1825]: dbus-daemon[1825]: Successfully activated service 'org.a11y.atspi.Registry' 
 +Sep 28 15:37:28 redhat9.ittraining.loc wireplumber[1859]: GetManagedObjects() failed: org.freedesktop.DBus.Error.NameHasNoOwner 
 +Sep 28 15:37:28 redhat9.ittraining.loc gnome-shell[1802]: Realizing HW cursor failed: drmModeAddFB does not support format 'AR24' (0x34325241) 
 +Sep 28 15:37:28 redhat9.ittraining.loc /usr/libexec/gdm-wayland-session[1793]: dbus-daemon[1793]: [session uid=42 pid=1793] Activating service name='org.freedesktop.systemd1' requested by ':1.16' (uid=42 pid=1> 
 +Sep 28 15:37:28 redhat9.ittraining.loc /usr/libexec/gdm-wayland-session[1793]: dbus-daemon[1793]: [session uid=42 pid=1793] Successfully activated service 'org.gnome.Shell.Notifications' 
 +Sep 28 15:37:28 redhat9.ittraining.loc /usr/libexec/gdm-wayland-session[1793]: dbus-daemon[1793]: [session uid=42 pid=1793] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1> 
 +Sep 28 15:37:28 redhat9.ittraining.loc gsd-sharing[1908]: Failed to StopUnit service: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.systemd1 exited with status 1 
 +Sep 28 15:37:28 redhat9.ittraining.loc gsd-sharing[1908]: Failed to StopUnit service: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.systemd1 exited with status 1 
 +Sep 28 15:37:28 redhat9.ittraining.loc gsd-sharing[1908]: Failed to StopUnit service: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.systemd1 exited with status 1 
 +Sep 28 15:37:28 redhat9.ittraining.loc org.gnome.Shell.desktop[1831]: Failed to initialize glamor, falling back to sw 
 +Sep 28 15:37:28 redhat9.ittraining.loc gnome-shell[1802]: Realizing HW cursor failed: drmModeAddFB does not support format 'AR24' (0x34325241) 
 +Sep 28 15:37:29 redhat9.ittraining.loc dbus-broker[751]: A security policy denied :1.25 to send method call /org/freedesktop/PackageKit:org.freedesktop.DBus.Properties.GetAll to :1.33. 
 +Sep 28 15:37:29 redhat9.ittraining.loc dbus-broker[751]: A security policy denied :1.25 to send method call /org/freedesktop/PackageKit:org.freedesktop.DBus.Properties.GetAll to :1.33. 
 +Sep 28 15:37:29 redhat9.ittraining.loc /usr/libexec/gdm-wayland-session[1793]: dbus-daemon[1793]: [session uid=42 pid=1793] Activating service name='org.gnome.Shell.Screencast' requested by ':1.23' (uid=42 pid> 
 +Sep 28 15:37:30 redhat9.ittraining.loc gnome-shell[1802]: ATK Bridge is disabled but a11y has already been enabled. 
 +Sep 28 15:37:30 redhat9.ittraining.loc /usr/libexec/gdm-wayland-session[1793]: dbus-daemon[1793]: [session uid=42 pid=1793] Activating service name='org.freedesktop.portal.IBus' requested by ':1.33' (uid=42 pi> 
 +Sep 28 15:37:30 redhat9.ittraining.loc /usr/libexec/gdm-wayland-session[1793]: dbus-daemon[1793]: [session uid=42 pid=1793] Successfully activated service 'org.freedesktop.portal.IBus' 
 +Sep 28 15:37:30 redhat9.ittraining.loc /usr/libexec/gdm-wayland-session[1793]: dbus-daemon[1793]: [session uid=42 pid=1793] Activating service name='org.gnome.ScreenSaver' requested by ':1.25' (uid=42 pid=1928> 
 +Sep 28 15:37:30 redhat9.ittraining.loc gsd-media-keys[1923]: Failed to grab accelerator for keybinding settings:hibernate 
 +Sep 28 15:37:30 redhat9.ittraining.loc gsd-media-keys[1923]: Failed to grab accelerator for keybinding settings:playback-repeat 
 +Sep 28 15:37:30 redhat9.ittraining.loc org.gnome.Shell.desktop[2153]: The XKEYBOARD keymap compiler (xkbcomp) reports: 
 +Sep 28 15:37:30 redhat9.ittraining.loc org.gnome.Shell.desktop[2153]: > Warning:          Unsupported maximum keycode 708, clipping. 
 +Sep 28 15:37:30 redhat9.ittraining.loc org.gnome.Shell.desktop[2153]: >                   X11 cannot support keycodes above 255. 
 +Sep 28 15:37:30 redhat9.ittraining.loc org.gnome.Shell.desktop[2153]: Errors from xkbcomp are not fatal to the X server 
 +Sep 28 15:37:30 redhat9.ittraining.loc /usr/libexec/gdm-wayland-session[1793]: dbus-daemon[1793]: [session uid=42 pid=1793] Successfully activated service 'org.gnome.ScreenSaver' 
 +Sep 28 15:37:30 redhat9.ittraining.loc /usr/libexec/gdm-wayland-session[1793]: dbus-daemon[1793]: [session uid=42 pid=1793] Successfully activated service 'org.gnome.Shell.Screencast' 
 +Sep 28 15:39:43 redhat9.ittraining.loc /usr/sbin/irqbalance[754]: Cannot change IRQ 27 affinity: Input/output error 
 +lines 1-55 
 +</code>
  
-[Unit] +Les priorités reconnues par Journald sont :
-Description=The Apache HTTP Server +
-After=network.target remote-fs.target nss-lookup.target +
-Documentation=man:httpd@.service(8)+
  
-[Service] +^ Niveau ^ Priorité ^ Description ^ 
-Type=notify +| 0 | emerg | Système inutilisable | 
-Environment=LANG=C +| 1 | alert | Action immédiate requise | 
-Environment=HTTPD_INSTANCE=%i +| 2 | crit | Condition critique atteinte | 
-ExecStartPre=/bin/mkdir -m 710 -p /run/httpd/instance-%i +| 3 | err | Erreurs rencontrées | 
-ExecStartPre=/bin/chown root.apache /run/httpd/instance-%i +| 4 | warning | Avertissements présentés | 
-ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND -f conf/%i.conf +| 5 | notice | Condition normale message important | 
-ExecReload=/usr/sbin/httpd $OPTIONS -k graceful -f conf/%i.conf +| 6 | info | Condition normale message simple | 
-# Send SIGWINCH for graceful stop +| 7 | debug | Condition normale message de débogage | 
-KillSignal=SIGWINCH +
-KillMode=mixed +
-PrivateTmp=true+
  
-[Install] +====5.5 - Consultation des Journaux d'une Plage de Dates ou d'Heures====
-WantedBy=multi-user.target +
-</code>+
  
-Une instance créée à partir de ce gabarit devrait avoir un nom sous la forme suivante :+Pour consulter les entrées d'une plage de dates ou d'heures, il suffit de passer cette plage en argument à la commande journalctl 
  
 <code> <code>
-httpd@<nom_instance>.service+[root@redhat9 ~]# journalctl --since 03:45 --until now 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: Linux version 5.14.0-427.37.1.el9_4.x86_64 (mockbuild@x86-64-02.build.eng.rdu2.redhat.com) (gcc (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3), GNU ld version 2.35.2-43> 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: The list of certified hardware and cloud instances for Red Hat Enterprise Linux 9 can be viewed at the Red Hat Ecosystem Catalog, https://catalog.redhat.com. 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: Command line: BOOT_IMAGE=(hd0,msdos1)/vmlinuz-5.14.0-427.37.1.el9_4.x86_64 root=/dev/mapper/rhel-root ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/> 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers' 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers' 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers' 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format. 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: signal: max sigframe size: 1776 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-provided physical RAM map: 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x0000000000100000-0x00000000bffd9fff] usable 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x00000000bffda000-0x00000000bfffffff] reserved 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: BIOS-e820: [mem 0x0000000100000000-0x000000023fffffff] usable 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: NX (Execute Disable) protection: active 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: SMBIOS 2.8 present. 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.1-0-g3208b098f51a-prebuilt.qemu.org 04/01/2014 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: Hypervisor detected: KVM 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: kvm-clock: Using msrs 4b564d01 and 4b564d00 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: kvm-clock: using sched offset of 269552729537899 cycles 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881590591483 ns 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: tsc: Detected 2099.998 MHz processor 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: e820: update [mem 0x00000000-0x00000fff] usable ==> reserved 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: e820: remove [mem 0x000a0000-0x000fffff] usable 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: last_pfn = 0x240000 max_arch_pfn = 0x400000000 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: MTRR map: 4 entries (3 fixed + 1 variable; max 19), built from 8 variable MTRRs 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WP  UC- WT   
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: last_pfn = 0xbffda max_arch_pfn = 0x400000000 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: found SMP MP-table at [mem 0x000f5bc0-0x000f5bcf] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: Using GB pages for direct mapping 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: RAMDISK: [mem 0x3149c000-0x34a45fff] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Early table checksum verification disabled 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: RSDP 0x00000000000F5980 000014 (v00 BOCHS ) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: RSDT 0x00000000BFFE300C 000038 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: FACP 0x00000000BFFE2DDE 000074 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: DSDT 0x00000000BFFDF040 003D9E (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: FACS 0x00000000BFFDF000 000040 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: APIC 0x00000000BFFE2E52 000090 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: SSDT 0x00000000BFFE2EE2 0000CA (v01 BOCHS  VMGENID  00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: HPET 0x00000000BFFE2FAC 000038 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: WAET 0x00000000BFFE2FE4 000028 (v01 BOCHS  BXPC     00000001 BXPC 00000001) 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving FACP table memory at [mem 0xbffe2dde-0xbffe2e51] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving DSDT table memory at [mem 0xbffdf040-0xbffe2ddd] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving FACS table memory at [mem 0xbffdf000-0xbffdf03f] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving APIC table memory at [mem 0xbffe2e52-0xbffe2ee1] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving SSDT table memory at [mem 0xbffe2ee2-0xbffe2fab] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving HPET table memory at [mem 0xbffe2fac-0xbffe2fe3] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: ACPI: Reserving WAET table memory at [mem 0xbffe2fe4-0xbffe300b] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: No NUMA configuration found 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: Faking a node at [mem 0x0000000000000000-0x000000023fffffff] 
 +Sep 28 15:36:59 redhat9.ittraining.loc kernel: NODE_DATA(0) allocated [mem 0x23ffd5000-0x23fffffff] 
 +lines 1-55
 </code> </code>
  
-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é :+<WRAP center round important 60%> 
 +**Important** : Il est possible d'utiliser des mots clefs : **yesterday****today****tomorrow****now**
 +</WRAP>
  
-  * %n : est remplacé par le nom complet échappé de l'Unité. +====5.Consultation des Journaux en Live====
-  * %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 **%**.+
  
-Créez maintenant deux copies du fichier **/usr/lib/systemd/system/httpd@.service** :+Pour consulter les journaux en live, il suffit d'utiliser l'option **-f** de la commande journalctl 
  
 <code> <code>
-[root@centos8 ~]# cp /usr/lib/systemd/system/httpd@.service /usr/lib/systemd/system/httpd@instance01.service +[root@redhat9 ~]# journalctl -f 
-[root@centos8 ~]# cp /usr/lib/systemd/system/httpd@.service /usr/lib/systemd/system/httpd@instance02.service+Sep 28 15:41:02 redhat9.ittraining.loc systemd[2200]: Starting Mark boot as successful... 
 +Sep 28 15:41:03 redhat9.ittraining.loc systemd[2200]: Finished Mark boot as successful
 +Sep 28 15:42:29 redhat9.ittraining.loc PackageKit[1886]: daemon quit 
 +Sep 28 15:42:29 redhat9.ittraining.loc systemd[1]: packagekit.service: Deactivated successfully. 
 +Sep 28 15:43:02 redhat9.ittraining.loc systemd[1340]: Created slice User Background Tasks Slice. 
 +Sep 28 15:43:02 redhat9.ittraining.loc systemd[1340]: Starting Cleanup of User's Temporary Files and Directories... 
 +Sep 28 15:43:02 redhat9.ittraining.loc systemd[1340]: Finished Cleanup of User's Temporary Files and Directories. 
 +Sep 28 15:44:02 redhat9.ittraining.loc systemd[2200]: Created slice User Background Tasks Slice. 
 +Sep 28 15:44:02 redhat9.ittraining.loc systemd[2200]: Starting Cleanup of User's Temporary Files and Directories... 
 +Sep 28 15:44:02 redhat9.ittraining.loc systemd[2200]: Finished Cleanup of User's Temporary Files and Directories. 
 +^C
 </code> </code>
  
-Créez deux copies du fichier **/etc/httpd/conf/httpd.conf** :+====5.7 - Consultation des Journaux avec des Mots Clefs=== 
 + 
 +Pour consulter les mots clefs compris par Journald, tapez la commande **journalctl** puis appuyer **deux** fois sur la touche <key>Tab</key> :
  
 <code> <code>
-[root@centos8 ~]# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/instance01.conf +[root@redhat9 ~]# journalctl  
-[root@centos8 ~]# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/instance02.conf+_AUDIT_LOGINUID=                         DBUS_BROKER_MESSAGE_TYPE=                INVOCATION_ID=                           _PID=                                    _SYSTEMD_UNIT= 
 +_AUDIT_SESSION=                          DBUS_BROKER_MESSAGE_UNIX_FDS=            JOB_ID=                                  PRIORITY=                                _SYSTEMD_USER_SLICE= 
 +AVAILABLE=                               DBUS_BROKER_POLICY_TYPE=                 JOB_RESULT=                              REALMD_OPERATION=                        _SYSTEMD_USER_UNIT= 
 +AVAILABLE_PRETTY=                        DBUS_BROKER_RECEIVER_SECURITY_LABEL=     JOB_TYPE=                                _RUNTIME_SCOPE=                          THREAD_ID= 
 +_BOOT_ID=                                DBUS_BROKER_RECEIVER_UNIQUE_NAME=        JOURNAL_NAME=                            SEAT_ID=                                 TID= 
 +_CAP_EFFECTIVE=                          DBUS_BROKER_RECEIVER_WELL_KNOWN_NAME_0=  JOURNAL_PATH=                            _SELINUX_CONTEXT=                        TIMESTAMP_BOOTTIME= 
 +_CMDLINE=                                DBUS_BROKER_SENDER_SECURITY_LABEL=       _KERNEL_DEVICE=                          SESSION_ID=                              TIMESTAMP_MONOTONIC= 
 +CODE_FILE=                               DBUS_BROKER_SENDER_UNIQUE_NAME=          _KERNEL_SUBSYSTEM=                       _SOURCE_MONOTONIC_TIMESTAMP=             _TRANSPORT= 
 +CODE_FUNC=                               DBUS_BROKER_TRANSMIT_ACTION=             KERNEL_USEC=                             _SOURCE_REALTIME_TIMESTAMP=              _UDEV_DEVLINK= 
 +CODE_LINE=                               DISK_AVAILABLE=                          LEADER=                                  _STREAM_ID=                              _UDEV_DEVNODE= 
 +_COMM=                                   DISK_AVAILABLE_PRETTY=                   LIMIT=                                   SYSLOG_FACILITY=                         _UDEV_SYSNAME= 
 +CURRENT_USE=                             DISK_KEEP_FREE=                          LIMIT_PRETTY=                            SYSLOG_IDENTIFIER=                       _UID= 
 +CURRENT_USE_PRETTY=                      DISK_KEEP_FREE_PRETTY=                   _MACHINE_ID=                             SYSLOG_PID=                              UNIT= 
 +DBUS_BROKER_LOG_DROPPED=                 ERRNO=                                   MAX_USE=                                 SYSLOG_RAW=                              USER_ID= 
 +DBUS_BROKER_MESSAGE_DESTINATION=         _EXE=                                    MAX_USE_PRETTY=                          SYSLOG_TIMESTAMP=                        USER_INVOCATION_ID= 
 +DBUS_BROKER_MESSAGE_INTERFACE=           _GID=                                    MESSAGE=                                 _SYSTEMD_CGROUP=                         USERSPACE_USEC= 
 +DBUS_BROKER_MESSAGE_MEMBER=              GLIB_DOMAIN=                             MESSAGE_ID=                              _SYSTEMD_INVOCATION_ID=                  USER_UNIT= 
 +DBUS_BROKER_MESSAGE_PATH=                GLIB_OLD_LOG_API=                        NM_DEVICE=                               _SYSTEMD_OWNER_UID=                       
 +DBUS_BROKER_MESSAGE_SERIAL=              _HOSTNAME=                               NM_LOG_DOMAINS=                          _SYSTEMD_SESSION=                         
 +DBUS_BROKER_MESSAGE_SIGNATURE=           INITRD_USEC=                             NM_LOG_LEVEL=                            _SYSTEMD_SLICE=   
 </code> </code>
  
-Editez la directive **Listen** du fichier **/etc/httpd/conf/instance01.conf** et ajoutez la directive **PidFile** :+Pour voir la liste des processus dont les traces sont inclus dans les journaux du mots clefs, tapez la commande journalctl suivi par le nom d'un mot clef puis appuyer deux fois sur la touche <key>Tab</key> :
  
 <code> <code>
-[root@centos8 ~]# vi /etc/httpd/conf/instance01.conf  +[root@redhat9 ~]# journalctl _UID= 
-[root@centos8 ~]# more /etc/httpd/conf/instance01.conf  +0     1000  172   42    70    81    994   998  
-+  
-# This is the main Apache HTTP server configuration file.  It contains the +[root@redhat9 ~]# journalctl _COMM= 
-# configuration directives that give the server its instructions. +accounts-daemon  avahi-daemon     dbus-broker-lau  geoclue          httpd            lvm_scan         polkitd          sshd             systemd-journal  udisksd           
-# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information. +at-spi2-registr  bootctl          dbus-daemon      gnome-session-b  irqbalance       ModemManager     realmd           su               systemd-logind   wireplumber       
-# In particular, see  +auditctl         crond            dracut-cmdline   gnome-shell      iscsiadm         mtp-probe        rsyslogd         (systemd       systemd-modules  wpa_supplicant    
-# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html> +auditd           cupsd            fsck.xfs         gsd-media-keys   kdumpctl         NetworkManager   rtkit-daemon     systemd          systemd-udevd    xkbcomp           
-# for a discussion of each configuration directive. +augenrules       dbus-broker      gdm-session-wor  gsd-sharing      lvm              packagekitd      spice-vdagent    systemd-hiberna  udevadm          Xwayland   
-+</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 names: If 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'.+
  
-# +=====LAB #6 - Le Serveur d'Horloge=====
-# ServerRoot: The 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"+
  
-+====6.1 - Introduction====
-# 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 specific IP addresses as shown below to  +
-# prevent Apache from glomming onto all bound IP addresses. +
-+
-#Listen 12.34.56.78:80 +
-Listen 8008 +
-PidFile /var/run/httpd/instance01.pid+
  
-+Dans le cas d'un serveur de réseau, il est souvent important de maintenir l'heure de la machine à l'heure exacte pour des raisons de simplification de synchronisation avec des portables ou bien des systèmes de fichiers externesPour accomplir cette tâche, nous utilisons les services de serveurs de temps publics disponibles sur Internet sur lesquels nous synchronisons l'horloge de notre serveurDe même, les machines de notre réseau peuvent se synchroniser ensuite avec l'heure de notre serveur
-# 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 `LoadModulelines at this location so the +
-# directives contained in it are actually available _before_ they are used. +
-# Statically compiled modules (those listed by `httpd -l') do not need +
-# to be loaded here. +
-+
-# Example: +
-# LoadModule foo_module modules/mod_foo.so +
---More--(19%) +
-</code> +
  
-Editez la directive **Listen** du fichier **/etc/httpd/conf/instance02.conf**  et ajoutez la directive **PidFile** :+Le protocole utilisé s'appelle **NTP ****Network Time Protocol **) qui utilise le port **123**. Celui-ci, permet la synchronisation avec plusieurs serveurs publics. Les serveurs de temps de racine s'appellent des serveurs de **Strate 1**. En dessous se trouvent des serveurs de Strate 2, Strate 3 etc..
  
-<code+<WRAP center round important
-[root@centos8 ~]# vi /etc/httpd/conf/instance02.conf  +**Important** - La commande **ntpdate**, utilisée pour synchroniser l'horloge **sans** utiliser le démon **ntpd** est maintenant remplacée par l'option **-q** de la commande **ntp**Lors de l'utilisation de **ntpdate**, le démon **ntpd** doit être arrêtéSi ntpdate constatait que l'erreur de l'horloge local était supérieur à 0,5 secondescelle-ci appelait la routine **settimeofday()** tandis que si l'erreur était inférieur à 0,5 secondes, elle appelait la routine **adjtime()**. 
-[root@centos8 ~]# more /etc/httpd/conf/instance02.conf  +</WRAP>
-+
-# 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 particularsee  +
-# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html> +
-# for a discussion of each configuration directive. +
-+
-# See the httpd.conf(5) man page for more information on this configuration, +
-# and httpd.service(8on 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 names: If 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 *notbegin +
-# 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'.+
  
-+Linux utilise le fuseau d'horaire **UTC** (//Coordinated Universal Time//) en interneLinux doit donc être capable de traduire entre l'UTC et l'heure locale et vice versaLinux utilise le fichier **/etc/localtime** pour connaître l'heure locale :
-# ServerRoot: The 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"+
  
-+<code
-# Listen: Allows you to bind Apache to specific IP addresses and/or +[root@redhat9 ~]ls -l /etc/localtime 
-# ports, instead of the default. See also the <VirtualHost+lrwxrwxrwx1 root root 34 Oct 19  2023 /etc/localtime -> ../usr/share/zoneinfo/Europe/Paris
-directive. +
-+
-# Change this to Listen on specific IP addresses as shown below to  +
-# prevent Apache from glomming onto all bound IP addresses. +
-+
-#Listen 12.34.56.78:80 +
-Listen 8009  +
-PidFile /var/run/httpd/instance02.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. +
-# Statically compiled modules (those listed by `httpd -l') do not need +
-# to be loaded here. +
-+
-# Example: +
-# LoadModule foo_module modules/mod_foo.so +
---More--(19%)+
 </code> </code>
  
-Démarrez les deux services :+Ce fichier peut être un fichier ordinaire ou bien un lien symbolique pointant vers un de sfichiers dans le répertoire **/usr/share/zoneinfo** :
  
 <code> <code>
-[root@centos8 ~]# systemctl start httpd@instance01.service +[root@redhat9 ~]# ls /usr/share/zoneinfo
-[root@centos8 ~]# systemctl status httpd@instance01.service +Africa      Asia       Canada   Cuba   EST      Factory  GMT+     Hongkong  Iran         Japan              Libya   MST7MDT  Pacific   posixrules  ROC        tzdata.zi  UTC           zone.tab 
-● httpd@instance01.service - The Apache HTTP Server +America     Atlantic   CET      EET    EST5EDT  GB       GMT-0      HST       iso3166.tab  Kwajalein          MET     Navajo   Poland    PRC         ROK        UCT        WET           Zulu 
-   Loaded: loaded (/usr/lib/systemd/system/httpd@instance01.service; disabled; vendor preset: disabled) +Antarctica  Australia  Chile    Egypt  Etc      GB-Eire  GMT0       Iceland   Israel       leapseconds        Mexico  NZ       Portugal  PST8PDT     Singapore  Universal  W-SU 
-   Active: active (running) since Mon 2021-06-07 01:40:43 EDT; 7s ago +Arctic      Brazil     CST6CDT  Eire   Europe   GMT      Greenwich  Indian    Jamaica      leap-seconds.list  MST     NZ-CHAT  posix     right       Turkey     US         zone1970.tab 
-     Docs: man:httpd@.service(8) +</code>
-  Process: 43854 ExecStartPre=/bin/chown root.apache /run/httpd/instance-instance01 (code=exited, status=0/SUCCESS) +
-  Process: 43852 ExecStartPre=/bin/mkdir -m 710 -p /run/httpd/instance-instance01 (code=exited, status=0/SUCCESS) +
- Main PID: 43856 (httpd) +
-   Status: "Started, listening on: port 8008" +
-    Tasks: 213 (limit: 23719) +
-   Memory: 43.6M +
-   CGroup: /system.slice/system-httpd.slice/httpd@instance01.service +
-           ├─43856 /usr/sbin/httpd -DFOREGROUND -f conf/instance01.conf +
-           ├─43857 /usr/sbin/httpd -DFOREGROUND -f conf/instance01.conf +
-           ├─43858 /usr/sbin/httpd -DFOREGROUND -f conf/instance01.conf +
-           ├─43859 /usr/sbin/httpd -DFOREGROUND -f conf/instance01.conf +
-           └─43860 /usr/sbin/httpd -DFOREGROUND -f conf/instance01.conf+
  
-Jun 07 01:40:43 centos8.ittraining.loc systemd[1]: Starting The Apache HTTP Server... +Pour connaître le fuseau d'horaire localutilisez la commande **date** :
-Jun 07 01:40:43 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server. +
-Jun 07 01:40:43 centos8.ittraining.loc httpd[43856]: Server configuredlistening on: port 8008 +
-[root@centos8 ~]# systemctl start httpd@instance02.service +
-[root@centos8 ~]# systemctl status httpd@instance02.service +
-● httpd@instance02.service - The Apache HTTP Server +
-   Loaded: loaded (/usr/lib/systemd/system/httpd@instance02.service; disabled; vendor preset: disabled) +
-   Active: active (running) since Mon 2021-06-07 01:36:45 EDT; 4min 24s ago +
-     Docs: man:httpd@.service(8) +
-  Process: 43568 ExecStartPre=/bin/chown root.apache /run/httpd/instance-instance02 (code=exited, status=0/SUCCESS) +
-  Process: 43566 ExecStartPre=/bin/mkdir -m 710 -p /run/httpd/instance-instance02 (code=exited, status=0/SUCCESS) +
- Main PID: 43569 (httpd) +
-   Status: "Running, listening on: port 8009" +
-    Tasks: 213 (limit: 23719) +
-   Memory: 43.6M +
-   CGroup/system.slice/system-httpd.slice/httpd@instance02.service +
-           ├─43569 /usr/sbin/httpd -DFOREGROUND -f conf/instance02.conf +
-           ├─43571 /usr/sbin/httpd -DFOREGROUND -f conf/instance02.conf +
-           ├─43572 /usr/sbin/httpd -DFOREGROUND -f conf/instance02.conf +
-           ├─43573 /usr/sbin/httpd -DFOREGROUND -f conf/instance02.conf +
-           └─43574 /usr/sbin/httpd -DFOREGROUND -f conf/instance02.conf+
  
-Jun 07 01:36:45 centos8.ittraining.loc systemd[1]: Starting The Apache HTTP Server... +<code> 
-Jun 07 01:36:45 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server. +[root@redhat9 ~]# date 
-Jun 07 01:36:45 centos8.ittraining.loc httpd[43569]Server configured, listening onport 8009+Sat Sep 28 03:55:32 PM CEST 2024
 </code> </code>
  
-===5.3 Interdire la Modification du Statut d'un Service===+<WRAP center round important> 
 +**Important** Vous pouvez consulter la liste des codes des zones à l'adresse **[[http://www.timeanddate.com/library/abbreviations/timezones/]]**. 
 +</WRAP>
  
-Il est possible d'interdire la modification en utilisant la commande **systemctl mask**:+Le fuseau d'horaire peut être consulté en usilisant la commande **timedatectl** :
  
 <code> <code>
-[root@centos8 ~]# systemctl status httpd.service +[root@redhat9 ~]# timedatectl 
-● httpd.service The Apache HTTP Server +               Local time: Sat 2024-09-28 15:57:01 CEST 
-   Loadedloaded (/usr/lib/systemd/system/httpd.service; disabled; vendor presetdisabled) +           Universal timeSat 2024-09-28 13:57:01 UTC 
-   Activeinactive (dead+                 RTC timeSat 2024-09-28 13:57:01 
-     Docsman:httpd.service(8)+                Time zone: Europe/Paris (CEST, +0200
 +System clock synchronizedno 
 +              NTP service: inactive 
 +          RTC in local TZ: no 
 +</code>
  
-Jun 07 18:27:25 centos8.ittraining.loc httpd[58535]: Server configured, listening on: port 80 +La commande **timedatectl** peut être utilisée pour modifier le fuseau d'horaire en utilisant l'option **set-timezone** :
-Jun 07 18:27:29 centos8.ittraining.loc systemd[1]: Stopping The Apache HTTP Server... +
-Jun 07 18:27:30 centos8.ittraining.loc systemd[1]: httpd.service: Succeeded. +
-Jun 07 18:27:30 centos8.ittraining.loc systemd[1]: Stopped The Apache HTTP Server. +
-Jun 07 18:27:32 centos8.ittraining.loc systemd[1]: Starting The Apache HTTP Server... +
-Jun 07 18:27:32 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server. +
-Jun 07 18:27:32 centos8.ittraining.loc httpd[58760]: Server configured, listening on: port 80 +
-Jun 07 18:27:34 centos8.ittraining.loc systemd[1]: Stopping The Apache HTTP Server... +
-Jun 07 18:27:36 centos8.ittraining.loc systemd[1]: httpd.service: Succeeded. +
-Jun 07 18:27:36 centos8.ittraining.loc systemd[1]: Stopped The Apache HTTP Server.+
  
-[root@centos8 ~]# systemctl mask httpd.service +<code> 
-Created symlink /etc/systemd/system/httpd.service → /dev/null.+[root@redhat9 ~]# timedatectl set-timezone America/Phoenix
  
-[root@centos8 ~]# systemctl enable httpd.service +[root@redhat9 ~]# timedatectl 
-Failed to enable unitUnit file /etc/systemd/system/httpd.service is masked.+               Local timeSat 2024-09-28 07:05:43 MST 
 +           Universal time: Sat 2024-09-28 14:05:43 UTC 
 +                 RTC time: Sat 2024-09-28 14:05:43 
 +                Time zone: America/Phoenix (MST, -0700) 
 +System clock synchronized: no 
 +              NTP service: inactive 
 +          RTC in local TZ: no
  
-[root@centos8 ~]# systemctl start httpd.service +[root@redhat9 ~]# timedatectl set-timezone Europe/Paris 
-Failed to start httpd.serviceUnit httpd.service is masked.+[root@redhat9 ~]# timedatectl 
 +               Local timeSat 2024-09-28 16:06:35 CEST 
 +           Universal time: Sat 2024-09-28 14:06:35 UTC 
 +                 RTC time: Sat 2024-09-28 14:06:35 
 +                Time zone: Europe/Paris (CEST, +0200) 
 +System clock synchronized: no 
 +              NTP service: inactive 
 +          RTC in local TZ: no
 </code> </code>
  
-Pour autoriser de nouveau les modifications, il convient d'utiliser la commande **systemctl unmask** :+L'option **set-time** de la commande **timedatectl** permet de modifier l'heure du système. Le format doit être **AAAA-MM-JJ hh:mm:ss**. 
 + 
 +Vous pouvez aussi modifier le fuseau d'horaire à l'aide de la commande **tzselect** :
  
 <code> <code>
-[root@centos8 ~]# systemctl unmask httpd.service +[root@redhat9 ~]# tzselect 
-Removed /etc/systemd/system/httpd.service.+Please identify a location so that time zone rules can be set correctly
 +Please select a continent, ocean, "coord", or "TZ". 
 +1) Africa                                                            5) Atlantic Ocean                                                   9) Pacific Ocean 
 +2) Americas                                                          6) Australia                                                       10) coord - I want to use geographical coordinates. 
 +3) Antarctica                                                        7) Europe                                                          11) TZ - I want to specify the timezone using the Posix TZ format. 
 +4) Asia                                                              8) Indian Ocean 
 +#? ^C 
 +</code> 
  
-[root@centos8 ~]# systemctl enable httpd.service +Il est est possible de modifier le fuseau d'horaire uniquement pour la session en cours et dans le shell courant :
-Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.+
  
-[root@centos8 ~]# systemctl start httpd.service +<code> 
- +[root@redhat9 ~]# date 
-[root@centos8 ~]# systemctl status httpd.service +Sat Sep 28 03:59:46 PM CEST 2024 
-● httpd.service - The Apache HTTP Server +[root@redhat9 ~]# export TZ=:/usr/share/zoneinfo/Europe/London 
-   Loadedloaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) +[root@redhat9 ~]# date 
-   Active: active (running) since Mon 2021-06-07 18:30:59 EDT; 5s ago +Sat Sep 28 02:59:54 PM BST 2024 
-     Docsman:httpd.service(8) +[root@redhat9 ~]# export TZ=:/usr/share/zoneinfo/Europe/Paris 
- Main PID59101 (httpd) +[root@redhat9 ~]# date 
-   Status: "Started, listening on: port 80" +Sat Sep 28 04:00:06 PM CEST 2024
-    Tasks: 213 (limit: 23719) +
-   Memory: 39.4M +
-   CGroup: /system.slice/httpd.service +
-           ├─59101 /usr/sbin/httpd -DFOREGROUND +
-           ├─59102 /usr/sbin/httpd -DFOREGROUND +
-           ├─59103 /usr/sbin/httpd -DFOREGROUND +
-           ├─59104 /usr/sbin/httpd -DFOREGROUND +
-           └─59105 /usr/sbin/httpd -DFOREGROUND +
- +
-Jun 07 18:30:59 centos8.ittraining.loc systemd[1]: Starting The Apache HTTP Server... +
-Jun 07 18:30:59 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server. +
-Jun 07 18:31:00 centos8.ittraining.loc httpd[59101]Server configured, listening on: port 80+
 </code> </code>
  
-=====Arrêt du Système=====+====6.2 - Le Service chronyd====
  
-Sous RHEL / CentOS 8 les commandes **halt****poweroff**, **reboot** et **shutdown** sont des liens symboliques vers **/bin/systemctl** :+Sous RHEL 9le serveur d'horloge n'est pas activé par défaut :
  
 <code> <code>
-[root@centos8 ~]# ls -l /usr/sbin/shutdown /usr/sbin/halt /usr/sbin/poweroff /usr/sbin/reboot +[root@redhat9 ~]# systemctl status chronyd 
-lrwxrwxrwx1 root root 16 Apr  7 16:55 /usr/sbin/halt -> ../bin/systemctl +○ chronyd.service NTP client/server 
-lrwxrwxrwx. 1 root root 16 Apr  7 16:55 /usr/sbin/poweroff -> ../bin/systemctl +     Loadedloaded (/usr/lib/systemd/system/chronyd.service; disabled; presetenabled) 
-lrwxrwxrwx1 root root 16 Apr  7 16:55 /usr/sbin/reboot -> ../bin/systemctl +     Activeinactive (dead) 
-lrwxrwxrwx. 1 root root 16 Apr  7 16:55 /usr/sbin/shutdown -> ../bin/systemctl+       Docs: man:chronyd(8) 
 +             man:chrony.conf(5)
 </code> </code>
  
-La manière recommendée d'utiliser ces commandes est donc :+Pour activer ce serveur, utilisez l'option **set-ntp yes** de la commande **timedatectl** :
  
-  * systemctl halt +<code> 
-  * systemctl poweroff +[root@redhat9 ~]# timedatectl set-ntp yes
-  * systemctl reboot +
-  * systemctl shutdown+
  
-Il est cependant toujours possibles d'utiliser les commandes **halt****poweroff**, **reboot** et **shutdown**.+[root@redhat9 ~]# timedatectl 
 +               Local time: Sat 2024-09-28 16:53:46 CEST 
 +           Universal time: Sat 2024-09-28 14:53:46 UTC 
 +                 RTC time: Sat 2024-09-28 14:53:46 
 +                Time zone: Europe/Paris (CEST+0200) 
 +System clock synchronized: yes 
 +              NTP service: active 
 +          RTC in local TZ: no 
 +</code>
  
-====La Commande shutdown====+Vérifiez ensuite que le service **chronyd** est démarré :
  
-Lors de l'arrêt de la machineLinux procède, entre autre, aux tâches suivantes :+<code> 
 +[root@redhat9 ~]# systemctl status chronyd 
 +● chronyd.service - NTP client/server 
 +     Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; preset: enabled) 
 +     Active: active (running) since Sat 2024-09-28 16:53:41 CEST; 16s ago 
 +       Docs: man:chronyd(8) 
 +             man:chrony.conf(5) 
 +    Process: 2673 ExecStart=/usr/sbin/chronyd $OPTIONS (code=exitedstatus=0/SUCCESS) 
 +   Main PID: 2675 (chronyd) 
 +      Tasks: 1 (limit: 48800) 
 +     Memory: 1.3M 
 +        CPU: 45ms 
 +     CGroup/system.slice/chronyd.service 
 +             └─2675 /usr/sbin/chronyd -F 2
  
-  * Il previent les utilisateurs,  +Sep 28 16:53:41 redhat9.ittraining.loc systemd[1]: Starting NTP client/server... 
-  * Il arrête tous les services, +Sep 28 16:53:41 redhat9.ittraining.loc chronyd[2675]: chronyd version 4.5 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +NTS +SECHASH +IPV6 +DEBUG) 
-  * Il inscrit toutes les données sur disque, +Sep 28 16:53:41 redhat9.ittraining.loc chronyd[2675]: Loaded 0 symmetric keys 
-  * Il démonte les systèmes de fichiers.+Sep 28 16:53:41 redhat9.ittraining.loc chronyd[2675]: Using right/UTC timezone to obtain leap second data 
 +Sep 28 16:53:41 redhat9.ittraining.loc chronyd[2675]: Loaded seccomp filter (level 2) 
 +Sep 28 16:53:41 redhat9.ittraining.loc systemd[1]: Started NTP client/server. 
 +Sep 28 16:53:46 redhat9.ittraining.loc chronyd[2675]: Selected source 54.39.23.64 (2.rhel.pool.ntp.org) 
 +Sep 28 16:53:46 redhat9.ittraining.loc chronyd[2675]: System clock TAI offset set to 37 seconds 
 +</code>
  
-La commande utilisée pour arrêter le système est la commande **shutdown** +La commande **chronyc** permet de voir le statut de la synchronisation :
- +
-  shutdown [-t sec] [-HPrhkc] heure [message] +
- +
-===Options de la commande=== +
- +
-Les options de cette commande sont :+
  
 <code> <code>
-[root@centos8 ~]# shutdown --help +[root@redhat9 ~]# chronyc sources -v
-shutdown [OPTIONS...] [TIME] [WALL...] +
- +
-Shut down the system.+
  
-     --help      Show this help +  .-- Source mode  '^' = server, '=' = peer, '#' = local clock. 
-  ---halt      Halt the machine + / .Source state '*' = current best, '+' = combined, '-' = not combined, 
-  ---poweroff  Power-off the machine +| /             'x' = may be in error, '~' = too variable, '?' = unusable. 
-  ---reboot    Reboot the machine +||                                                 .xxxx [ yyyy ] +/zzzz 
-  -h             Equivalent to --poweroff, overridden by --halt +||      Reachability register (octal) -.            xxxx = adjusted offset, 
-  -k             Don't halt/power-off/reboot, just send warnings +||      Log2(Polling interval) --.      |          |  yyyy = measured offset, 
-     --no-wall   Don't send wall message before halt/power-off/reboot +||                                \              |  zzzz = estimated error. 
-  -            Cancel a pending shutdown+||                                    |           \ 
 +MS Name/IP address         Stratum Poll Reach LastRx Last sample                
 +=============================================================================== 
 +^* 64.ip-54-39-23.net            3     377    54    +24us[  +35us] +/2831us 
 +^rikku.vrillusions.com             377    55   -197us[ -186us] +/-   17ms 
 +^- rwhois.dargalsolutions.c>     2     377    59  -5891us[-5880us] +/-   68ms 
 +^ntp.pawdesigns.ca             3     377    55    +38us[  +49us] +/-   74ms
 </code> </code>
  
-L'option **heure** peut prendre plusieurs valeurs :+====6.3 - Le Fichier /etc/chrony.conf====
  
-^ Valeur ^ Description ^ +Le service **chronyd** maintient l'horloge matérielle locale (RTC), généralement inexacte, à la bonne heure en le synchronisant avec les serveurs NTP configurés. Si aucune connectivité réseau n'est disponiblechronyd 
-| hh:mm | L'heure à laquelle l'opération aura lieu | +calcule la dérive de l'horloge RTC, qui est enregistrée dans le fichier de dérive spécifié dans le fichier **/etc/chrony.conf**.
-| +m | Nombre de minutes avant que l'opération aura lieu. Si aucune valeur n'est spécifiée, la valeur par défaut est +1 | +
-| now | L'opération est immédiate. now est un alias de +0 |+
  
-<WRAP center round important 60%> +Les serveurs NTP configurés sont : **pool 2.rhel.pool.ntp.org iburst**. L'option **iburst** implique qu'après le démarrage initial du service 4 requêtes sont formulées pour une synchronisation initiale plus exacte.
-**Important** : Si l'opération est programmée pour dans moins de 5 minutes, les connexions supplémentaires sont interdites, y comprises les tentatives de connexion de root +
-</WRAP>+
  
-L'option **-t** est utilisée pour accorder un temps de grâce :+Le protocole NTP utilise le port 123. Les serveurs de temps de racine s'appellent des serveurs de **Stratum 0**. En dessous se trouvent des serveurs de Stratum 1, Stratum 2, Stratum 3 etc..
  
 <code> <code>
-[root@centos8 ~]# date && shutdown -t 60 -k +[root@redhat9 ~]# cat /etc/chrony.conf 
-Mon Jun  7 18:58:26 EDT 2021 +# Use public servers from the pool.ntp.org project. 
-Shutdown scheduled for Mon 2021-06-07 18:59:26 EDT, use 'shutdown -c' to cancel. +# Please consider joining the pool (https://www.pool.ntp.org/join.html). 
-</code>+pool 2.rhel.pool.ntp.org iburst
  
-==== La Commande reboot====+# Use NTP servers from DHCP. 
 +sourcedir /run/chrony-dhcp
  
-Cette commande redémarre le système.+# Record the rate at which the system clock gains/losses time. 
 +driftfile /var/lib/chrony/drift
  
-===Options de la commande===+# Allow the system clock to be stepped in the first three updates 
 +# if its offset is larger than 1 second. 
 +makestep 1.0 3
  
-Les options de cette commande sont :+# Enable kernel synchronization of the real-time clock (RTC). 
 +rtcsync
  
-<code> +# Enable hardware timestamping on all interfaces that support it. 
-[root@centos8 ~]reboot --help +#hwtimestamp *
-reboot [OPTIONS...] [ARG]+
  
-Reboot the system.+# Increase the minimum number of selectable sources required to adjust 
 +the system clock. 
 +#minsources 2
  
-     --help      Show this help +# Allow NTP client access from local network. 
-     --halt      Halt the machine +#allow 192.168.0.0/16
-  -p --poweroff  Switch off the machine +
-     --reboot    Reboot the machine +
-  -f --force     Force immediate halt/power-off/reboot +
-  -w --wtmp-only Don't halt/power-off/reboot, just write wtmp record +
-  -d --no-wtmp   Don't write wtmp record +
-     --no-wall   Don't send wall message before halt/power-off/reboot +
-</code>+
  
-==== La Commande halt====+# Serve time even if not synchronized to a time source. 
 +#local stratum 10
  
-Cette commande arrête le système.+# Require authentication (nts or key option) for all NTP sources. 
 +#authselectmode require
  
-===Options de la commande===+# Specify file containing keys for NTP authentication. 
 +keyfile /etc/chrony.keys
  
-Les options de cette commande sont :+# Save NTS keys and cookies. 
 +ntsdumpdir /var/lib/chrony
  
-<code> +# Insert/delete leap seconds by slewing instead of stepping. 
-[root@centos8 ~]halt --help +#leapsecmode slew
-halt [OPTIONS...]+
  
-Halt the system.+# Get TAI-UTC offset and leap seconds from the system tz database. 
 +leapsectz right/UTC
  
-     --help      Show this help +# Specify directory for log files. 
-     --halt      Halt the machine +logdir /var/log/chrony 
-  -p --poweroff  Switch off the machine + 
-     --reboot    Reboot the machine +# Select which information is logged. 
-  -f --force     Force immediate halt/power-off/reboot +#log measurements statistics tracking
-  -w --wtmp-only Don't halt/power-off/reboot, just write wtmp record +
-  -d --no-wtmp   Don't write wtmp record +
-     --no-wall   Don't send wall message before halt/power-off/reboot+
 </code> </code>
  
-==== La Commande poweroff==== 
  
-Cette commande arrête le système et coupe l'alimentation électrique.  
- 
-===Options de la commande=== 
- 
-Les options de cette commande sont : 
- 
-<code> 
-[root@centos8 ~]# poweroff --help 
-poweroff [OPTIONS...] 
- 
-Power off the system. 
- 
-     --help      Show this help 
-     --halt      Halt the machine 
-  -p --poweroff  Switch off the machine 
-     --reboot    Reboot the machine 
-  -f --force     Force immediate halt/power-off/reboot 
-  -w --wtmp-only Don't halt/power-off/reboot, just write wtmp record 
-  -d --no-wtmp   Don't write wtmp record 
-     --no-wall   Don't send wall message before halt/power-off/reboot 
-</code> 
  
 ----- -----
 Copyright © 2024 Hugh Norris. Copyright © 2024 Hugh Norris.
Menu