Différences

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

Lien vers cette vue comparative

Prochaine révision
Révision précédente
elearning:workbooks:centos:8:junior:l122 [2024/10/01 07:39] – created adminelearning:workbooks:centos:8:junior:l122 [2024/10/01 08:03] (Version actuelle) – created admin
Ligne 5: Ligne 5:
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
  
-======LCF602 - Gestion du Noyau et des Quotas======+======LCF602 - Gestion de la Journalisation======
  
 =====Contenu du Module===== =====Contenu du Module=====
  
-  * **LCF602 - Gestion du Noyau et des Quotas** +  * **LCF602 - Gestion de la Journalisation** 
-    * Contenu du Module +    * Présentation 
-    * Rôle du noyau +    * La Commande dmesg 
-    * LAB #1 - Modules +    * LAB #1 - Surveillance Sécuritaire 
-    LAB #2 Compilation et installation du noyau et des modules +      1.1 La Commande last 
-      * 2.1 - Déplacer /home +      * 1.2 - La Commande lastlog 
-      * 2.Préparer l'Environnement +      * 1.3 La Commande lastb 
-      * 2.Préparer l'Arborescence Source du Noyau +      * 1.Le Fichier /var/log/secure 
-        * Le Fichier .config +      * 1.Gestion des évènements audit 
-        * Le Fichier Makefile +        * Le fichier /var/log/audit/audit.log 
-      * 2.Paramétrage du noyau +        * auditd 
-      * 2.Compiler le Noyau +        * auditctl 
-      * 2.Installer le Nouveau Noyau +        * audispd 
-    * LAB #3 - Gestion des Quotas +        * La consultation des événements audit 
-      * 3.1 - La Commande quotacheck +          * La Commande aureport 
-      * 3.2 - La Commande edquota +          * La Commande ausearch 
-      * 3.3 - La Commande quotaon +    * Le fichier /var/log/messages 
-      * 3.4 - La Commande repquota +    * Applications 
-      * 3.5 - La Commande quota +    * LAB #2 - rsyslog 
-      * 3.6 - La Commande warnquota+      * 2.Priorités 
 +      * 2.Sous-systèmes applicatifs 
 +      * 2./etc/rsyslog.conf 
 +        * Modules 
 +        * Directives Globales 
 +        * Règles 
 +          * Sous-système applicatif.Priorité 
 +          * Sous-système applicatif!Priorité 
 +          * Sous-système applicatif=Priorité 
 +          * L'utilisation du caractère spécial * 
 +          * n Sous-systèmes avec la même priorité 
 +          * n Sélecteurs avec la même Action 
 +    * LAB #3 - La Commande logger 
 +    * LAB #4 - La Commande logrotate 
 +    * LAB #5 - La Journalisation avec journald 
 +      * 5.1 - Consultation des Journaux 
 +      * 5.2 - Consultation des Journaux d'une Application Spécifique 
 +      * 5.3 - Consultation des Journaux depuis le Dernier Démarrage 
 +      * 5.4 - Consultation des Journaux d'une Priorité Spécifique 
 +      * 5.5 - Consultation des Journaux d'une Plage de Dates ou d'Heures 
 +      * 5.6 - Consultation des Journaux en Live 
 +      * 5.7 - Consultation des Journaux avec des Mots Clefs
  
-=====Rôle du noyau=====+=====Présentation=====
  
-Le noyau ou //kernel// est la partie du système d'exploitation qui gère les entrées/sorties avec des périphériques. Dans certains cas il est préférable de recompiler le noyau de LinuxLa motivation de cette recompilation peut être :+La majorité des journaux du système et des applications se trouve dans le répertoire **/var/log**.
  
-  * la diminution de la taille du noyau, +<WRAP center round important 60%> 
-  * la prise en charge de nouveau matériel, +**Important** : Il est conseillé de déplacer le point de montage du répertoire **/var/log** sur une partition physique ou un volume logique à part. De 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èmeil existe un risque à ce que les journaux grossissent si vite qu'ils occupent toute l'espace disque librecréant ainsi un crash système. 
-  * l'ajout de fonctionnalités, +</WRAP> 
-  * l'optimisation du code+ 
-  * la correction de bogues, +=====La Commande /bin/dmesg===== 
-  * le besoin d'une fonctionnalité expérimentale. + 
-   +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 :
-Commencez par mettre à jour CentOS 8 :+
  
 <code> <code>
-[root@centos8 ~]# dnf update +[root@centos8 ~]# dmesg | more 
-... +[    0.000000] Linux version 4.18.0-240.22.1.el8_3.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (G 
-[root@centos8 ~]# reboot+CC)) #1 SMP Thu Apr 8 19:01:30 UTC 2021 
 +   0.000000] Command line: BOOT_IMAGE=(hd0,msdos1)/vmlinuz-4.18.0-240.22.1.el8_3.x86_64 root=UUID=4c0cc28c-0d59-45be-bd73-d292b80be33c ro cra 
 +shkernel=auto resume=UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 rhgb quiet 
 +[    0.000000x86/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] 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-0x00000000dffeffff] usable 
 +[    0.000000] BIOS-e820: [mem 0x00000000dfff0000-0x00000000dfffffff] ACPI data 
 +[    0.000000] BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved 
 +[    0.000000] BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved 
 +[    0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved 
 +[    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000011fffffff] usable 
 +[    0.000000] NX (Execute Disable) protection: active 
 +[    0.000000] SMBIOS 2.5 present. 
 +[    0.000000] DMI: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 
 +[    0.000000] Hypervisor detected: KVM 
 +--More--
 </code> </code>
  
-Identifiez ensuite le noyau utilisé par votre machine virtuelle :+Les option de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# uname -+[root@centos8 ~]# dmesg --help
-4.18.0-305.7.1.el8_4.x86_64 +
-</code>+
  
-=====LAB #1 - Modules=====+Usage: 
 + dmesg [options]
  
-Dans le cas d'une utilisation courante de Linux, il est cependant préférable de faire appel aux **modules**Les modules se trouvent dans le répertoire **/lib/modules/<version-du-noyau>** :+Display or control the kernel ring buffer.
  
-<code+Options: 
-[root@centos8 ~]# ls /lib/modules/`uname -r`/ + -C, --clear                 clear the kernel ring buffer 
-bls.conf           modules.builtin      modules.networking   System.map + -c, --read-clear            read and clear all messages 
-build              modules.builtin.bin  modules.order        updates + -D, --console-off           disable printing messages to console 
-config             modules.dep          modules.softdep      vdso + -E, --console-on            enable printing messages to console 
-kernel             modules.dep.bin      modules.symbols      vmlinuz + -F, --file <file          use the file instead of the kernel log buffer 
-modules.alias      modules.devname      modules.symbols.bin  weak-updates + -f, --facility <list>       restrict output to defined facilities 
-modules.alias.bin  modules.drm          source + -H, --human                 human readable output 
-modules.block      modules.modesetting  symvers.gz + -k, --kernel                display kernel messages 
-</code>+ -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 
 + -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 
 + -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.
  
-Les commandes pour manipuler les modules sont :+ -h, --help                  display this help 
 + -V, --version               display version
  
-  * insmod +Supported log facilities: 
-  * rmmod +    kern - kernel messages 
-  * lsmod +    user - random user-level messages 
-  * modprobe+    mail - mail system 
 +  daemon - system daemons 
 +    auth - security/authorization messages 
 +  syslog - messages generated internally by syslogd 
 +     lpr - line printer subsystem 
 +    news - network news subsystem
  
-Par exemple :+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
  
-<code> +For more details see dmesg(1).
-[root@centos8 ~]# lsmod +
-Module                  Size  Used by +
-xt_CHECKSUM            16384  1 +
-ipt_MASQUERADE         16384 +
-xt_conntrack           16384 +
-ipt_REJECT             16384 +
-nft_compat             20480  16 +
-nf_nat_tftp            16384  0 +
-nft_objref             16384 +
-nf_conntrack_tftp      16384  3 nf_nat_tftp +
-nft_counter            16384  33 +
-tun                    53248  1 +
-bridge                192512 +
-stp                    16384  1 bridge +
-llc                    16384  2 bridge,stp +
-nft_fib_inet           16384 +
-nft_fib_ipv4           16384  1 nft_fib_inet +
-nft_fib_ipv6           16384  1 nft_fib_inet +
-nft_fib                16384  3 nft_fib_ipv6,nft_fib_ipv4,nft_fib_inet +
-nft_reject_inet        16384  5 +
-nf_reject_ipv4         16384  2 nft_reject_inet,ipt_REJECT +
-nf_reject_ipv6         16384  1 nft_reject_inet +
-nft_reject             16384  1 nft_reject_inet +
-nft_ct                 20480  19 +
-nf_tables_set          49152  21 +
-nft_chain_nat          16384  12 +
-nf_nat                 45056  3 ipt_MASQUERADE,nf_nat_tftp,nft_chain_nat +
-nf_conntrack          172032  6 xt_conntrack,nf_nat,nf_conntrack_tftp,nft_ct,ipt_MASQUERADE,nf_nat_tftp +
-nf_defrag_ipv6         20480  1 nf_conntrack +
-nf_defrag_ipv4         16384  1 nf_conntrack +
-ip_set                 49152 +
-nf_tables             172032  414 nft_ct,nft_compat,nft_reject_inet,nft_fib_ipv6,nft_objref,nft_fib_ipv4,nft_counter,nft_chain_nat,nf_tables_set,nft_reject,nft_fib,nft_fib_inet +
-nfnetlink              16384  4 nft_compat,nf_tables,ip_set +
-sunrpc                540672 +
-ext4                  761856 +
-mbcache                16384  1 ext4 +
-jbd2                  131072  1 ext4 +
-virtio_balloon         20480 +
-pcspkr                 16384 +
-i2c_piix4              24576  0 +
-joydev                 24576 +
-ip_tables              28672  0 +
-xfs                  1515520 +
-libcrc32c              16384  4 nf_conntrack,nf_nat,nf_tables,xfs +
-sr_mod                 28672 +
-sd_mod                 53248 +
-cdrom                  65536  1 sr_mod +
-t10_pi                 16384  1 sd_mod +
-sg                     40960 +
-ata_generic            16384  0 +
-bochs_drm              16384  1 +
-drm_vram_helper        28672  1 bochs_drm +
-drm_kms_helper        233472  4 drm_vram_helper,bochs_drm +
-syscopyarea            16384  1 drm_kms_helper +
-sysfillrect            16384  1 drm_kms_helper +
-sysimgblt              16384  1 drm_kms_helper +
-fb_sys_fops            16384  1 drm_kms_helper +
-drm_ttm_helper         16384  1 drm_vram_helper +
-ttm                   114688  2 drm_vram_helper,drm_ttm_helper +
-drm                   569344  7 drm_kms_helper,drm_vram_helper,bochs_drm,drm_ttm_helper,ttm +
-ahci                   40960 +
-libahci                40960  1 ahci +
-virtio_net             53248 +
-net_failover           24576  1 virtio_net +
-ata_piix               36864 +
-serio_raw              16384  0 +
-failover               16384  1 net_failover +
-libata                270336  4 ata_piix,libahci,ahci,ata_generic +
-dm_mirror              28672  0 +
-dm_region_hash         20480  1 dm_mirror +
-dm_log                 20480  2 dm_region_hash,dm_mirror +
-dm_mod                151552  8 dm_log,dm_mirror +
-fuse                  151552  3+
 </code> </code>
  
-Pour ajouter un module, on peut utiliser la commande **insmod** ou **modprobe**. Cette dernière ajoute non seulement le module passé en argument mais également ses dépendances :+=====LAB #1 - Surveillance Sécuritaire=====
  
-<code> +====1.1 - La Commande last====
-[root@centos8 ~]# modprobe bonding +
-[root@centos8 ~]# lsmod | more +
-Module                  Size  Used by +
-bonding               196608 +
-xt_CHECKSUM            16384  1 +
-ipt_MASQUERADE         16384 +
-xt_conntrack           16384  1 +
-ipt_REJECT             16384 +
-nft_compat             20480  16 +
-nf_nat_tftp            16384  0 +
-nft_objref             16384 +
-nf_conntrack_tftp      16384  3 nf_nat_tftp +
-nft_counter            16384  33 +
-tun                    53248  1 +
-bridge                192512 +
-stp                    16384  1 bridge +
-llc                    16384  2 bridge,stp +
-nft_fib_inet           16384 +
-nft_fib_ipv4           16384  1 nft_fib_inet +
-nft_fib_ipv6           16384  1 nft_fib_inet +
-nft_fib                16384  3 nft_fib_ipv6,nft_fib_ipv4,nft_fib_inet +
-nft_reject_inet        16384  5 +
-nf_reject_ipv4         16384  2 nft_reject_inet,ipt_REJECT +
-nf_reject_ipv6         16384  1 nft_reject_inet +
---More-- +
-</code>+
  
-Pour supprimer un module, on peut utiliser la commande **rmmod** ou **modprobe -r**. Cette dernière essaie de supprimer les dépendances non-utilisées :+Cette commande indique les dates et heures des connexions des utilisateurs à partir du contenu du fichier **/var/log/wtmp** :
  
 <code> <code>
-[root@centos8 ~]# modprobe -r bonding +[root@centos8 ~]# last 
-[root@centos8 ~]# lsmod | more +trainee  pts/0        10.0.2.2         Thu Jun  3 09:01   still logged in 
-Module                  Size  Used by +reboot   system boot  4.18.0-240.22.1. Thu Jun  3 09:01   still running 
-xt_CHECKSUM            16384  1 +trainee  pts/0        10.0.2.2         Wed Jun  2 12:07 - crash  (20:54) 
-ipt_MASQUERADE         16384  3 +trainee  pts/0        10.0.2.2         Wed Jun  2 11:16 - 12:06  (00:50) 
-xt_conntrack           16384  1 +reboot   system boot  4.18.0-240.22.1. Wed Jun  2 11:12   still running 
-ipt_REJECT             16384  2 +trainee  pts/0        10.0.2.2         Wed Jun  2 11:13 - 11:14  (00:01) 
-nft_compat             20480  16 +reboot   system boot  4.18.0-240.22.1. Wed Jun  2 11:10 - 11:14  (00:04) 
-nf_nat_tftp            16384  0 +trainee  pts/       10.0.2.2         Wed Jun  2 11:08 - 11:12  (00:04) 
-nft_objref             16384  1 +reboot   system boot  4.18.0-240.22.1. Wed Jun  2 11:04 - 11:12  (00:07) 
-nf_conntrack_tftp      16384  3 nf_nat_tftp +trainee  pts/0        10.0.2.2         Wed Jun  2 06:40 - 11:06  (04:26) 
-nft_counter            16384  33 +trainee  pts/0        10.0.2.2         Wed Jun  2 06:39 - 06:39  (00:00) 
-tun                    53248  1 +reboot   system boot  4.18.0-240.22.1. Wed Jun  2 06:07 - 11:07  (04:59) 
-bridge                192512  0 +trainee  pts/1        10.0.2.2         Wed May 26 16:51 - crash (6+13:15) 
-stp                    16384  1 bridge +trainee  pts/0        10.0.2.2         Wed May 26 10:37 - 18:50  (08:13) 
-llc                    16384  bridge,stp +trainee  pts/0        10.0.2.2         Wed May 26 08:48 - 10:36  (01:48) 
-nft_fib_inet           16384  1 +trainee  tty1                          Wed May 26 08:47 - crash (6+21:19) 
-nft_fib_ipv4           16384  nft_fib_inet +reboot   system boot  4.18.0-240.22.1. Wed May 26 08:44 - 11:07 (7+02:22) 
-nft_fib_ipv6           16384  nft_fib_inet +trainee  pts/0        10.0.2.2         Wed Apr 21 07:23 - 19:14  (11:51) 
-nft_fib                16384  3 nft_fib_ipv6,nft_fib_ipv4,nft_fib_inet +trainee  pts/0        10.0.2.2         Tue Apr 20 23:13 - 07:22  (08:08) 
-nft_reject_inet        16384  5 +trainee  pts/                        Tue Apr 20 10:59 - 11:00  (00:00) 
-nf_reject_ipv4         16384  nft_reject_inet,ipt_REJECT +trainee  pts/0        10.0.2.2         Tue Apr 20 09:59 - 23:13  (13:13) 
-nf_reject_ipv6         16384  nft_reject_inet +trainee  pts/1        10.0.2.2         Tue Apr 20 04:10 - 04:29  (00:19) 
-nft_reject             16384  nft_reject_inet +trainee  pts/0        10.0.2.2         Tue Apr 20 02:21 - 09:57  (07:36) 
---More--+trainee  tty1                          Tue Apr 20 02:17 - crash (36+06:26) 
 +trainee  pts/0        10.0.2.2         Mon Apr 19 13:55 - 02:17  (12:22) 
 +trainee  pts/0        10.0.2.2         Mon Apr 19 12:05 - 13:47  (01:42) 
 +reboot   system boot  4.18.0-240.22.1. Mon Apr 19 12:05 - 11:07 (43+23:01) 
 +trainee  pts/0        10.0.2.2         Mon Apr 19 11:40 - crash  (00:24) 
 +reboot   system boot  4.18.0-147.8.1.e Mon Apr 19 11:37 - 11:07 (43+23:29) 
 +trainee  pts/0        10.0.2.2         Tue Sep  1 09:59 11:10  (01:10) 
 +reboot   system boot  4.18.0-147.8.1.e Tue Sep  1 09:58 11:10  (01:11) 
 +reboot   system boot  4.18.0-147.8.1.e Fri May  8 08:13 - 11:10 (116+02:56) 
 + 
 +wtmp begins Fri May  8 08:13:49 2020
 </code> </code>
  
-Les dépendances des modules sont résolues par la commande **modprobe** grâce aux fichier **/lib/modules/<version-du-noyau>/modules.dep**. Ce dernier peut être créé manuellement grâce à la commande **depmod** :+Les option de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# more /lib/modules/`uname -r`/modules.dep +[root@centos8 ~]# last --help
-kernel/arch/x86/events/amd/power.ko.xz: +
-kernel/arch/x86/events/intel/intel-uncore.ko.xz: +
-kernel/arch/x86/events/intel/intel-cstate.ko.xz: +
-kernel/arch/x86/events/rapl.ko.xz: +
-kernel/arch/x86/kernel/cpu/mce/mce-inject.ko.xz: +
-kernel/arch/x86/crypto/des3_ede-x86_64.ko.xz: kernel/crypto/des_generic.ko.xz +
-kernel/arch/x86/crypto/camellia-x86_64.ko.xz: +
-kernel/arch/x86/crypto/blowfish-x86_64.ko.xz: kernel/crypto/blowfish_common.ko.xz +
-kernel/arch/x86/crypto/twofish-x86_64.ko.xz: kernel/crypto/twofish_common.ko.xz +
-kernel/arch/x86/crypto/twofish-x86_64-3way.ko.xz: kernel/arch/x86/crypto/twofish-x86_64.ko. +
-xz kernel/crypto/twofish_common.ko.xz +
-kernel/arch/x86/crypto/chacha20-x86_64.ko.xz: kernel/crypto/chacha20_generic.ko.xz +
-kernel/arch/x86/crypto/serpent-sse2-x86_64.ko.xz: kernel/crypto/serpent_generic.ko.xz +
-kernel/arch/x86/crypto/ghash-clmulni-intel.ko.xz: +
-kernel/arch/x86/crypto/crc32c-intel.ko.xz: +
-kernel/arch/x86/crypto/crc32-pclmul.ko.xz: +
-kernel/arch/x86/crypto/sha512-ssse3.ko.xz: kernel/crypto/sha512_generic.ko.xz +
-kernel/arch/x86/crypto/crct10dif-pclmul.ko.xz: +
-kernel/arch/x86/crypto/poly1305-x86_64.ko.xz: kernel/crypto/poly1305_generic.ko.xz +
-kernel/arch/x86/crypto/camellia-aesni-avx-x86_64.ko.xz: kernel/arch/x86/crypto/camellia-x86 +
-_64.ko.xz +
-kernel/arch/x86/crypto/cast5-avx-x86_64.ko.xz: kernel/crypto/cast5_generic.ko.xz kernel/cry +
---More--(0%) +
-</code>+
  
-Il est possible d'obtenir des informations sur un module grâce à la commande **modinfo** :+Usage: 
 + last [options] [<username>...] [<tty>...]
  
-<code> +Show a listing of last logged in users.
-[root@centos8 ~]# modinfo bonding +
-filename:       /lib/modules/4.18.0-305.7.1.el8_4.x86_64/kernel/drivers/net/bonding/bonding.ko.xz +
-author:         Thomas Davis, tadavis@lbl.gov and many others +
-description:    Ethernet Channel Bonding Driver +
-license:        GPL +
-alias:          rtnl-link-bond +
-rhelversion:    8.4 +
-srcversion:     445F4CC9A2F7E64E3A87FD0 +
-depends:         +
-intree:         Y +
-name:           bonding +
-vermagic:       4.18.0-305.7.1.el8_4.x86_64 SMP mod_unload modversions  +
-sig_id:         PKCS#+
-signer:         CentOS kernel signing key +
-sig_key:        3B:5A:0A:B8:8E:4A:51:C0:AA:FF:97:FD:CB:94:D6:B6:D2:46:B8:17 +
-sig_hashalgo:   sha256 +
-signature:      B2:3A:20:BE:2B:F3:E0:5A:1A:74:0E:69:76:40:2A:D4:80:10:2C:5A: +
-                B7:F1:1E:7A:71:13:29:F0:0A:4A:28:EE:81:33:C8:C2:5C:BD:FF:E4: +
-                3F:A9:15:A3:9A:0E:A7:98:9E:99:06:23:10:47:D3:B2:48:B3:F1:61: +
-                BE:4B:B0:FC:62:B9:3B:D6:64:CC:E3:29:01:4D:91:92:32:FD:EB:54: +
-                44:F1:2C:1B:23:30:F1:3E:EE:69:EA:94:54:D9:A0:8D:16:53:F5:20: +
-                DE:38:A0:13:E8:2F:89:66:CB:11:D7:AA:30:37:7B:EC:DF:A1:69:29: +
-                7F:4E:80:4D:34:6E:F2:07:01:FA:18:23:94:58:10:C6:97:27:68:B9: +
-                D8:08:5E:9D:00:17:F4:1B:48:BE:CA:BF:5C:5A:A8:6D:36:EE:3F:95: +
-                BA:BE:59:82:EE:7B:CA:BB:32:1E:E3:05:ED:C9:C2:C8:10:64:B9:29: +
-                B8:09:4B:79:42:65:1A:FA:99:96:BA:7E:2D:6E:75:F1:91:0E:F4:9A: +
-                8F:11:10:9F:70:BD:35:06:BE:F0:4C:D8:AB:D5:C4:E1:B3:A2:2A:CA: +
-                58:CA:9E:16:1D:0C:BE:9C:37:A1:82:20:6F:24:CD:23:63:F7:F5:BC: +
-                6E:81:14:F0:52:DA:04:0E:9D:CC:17:60:2D:B0:D8:BD:6E:2C:AD:E7: +
-                50:48:49:B6:57:96:AC:FD:A4:29:33:01:43:92:32:88:A2:AC:CB:93: +
-                2F:C3:29:F3:01:77:84:00:AB:AA:C8:59:43:F1:DA:90:7B:5F:9A:A9: +
-                CA:60:97:34:85:5E:98:56:73:03:0D:D7:8D:A6:AB:51:D4:8C:92:91: +
-                0C:0A:BA:6B:92:01:16:FE:8B:86:80:11:5F:8E:21:BD:C2:2F:02:58: +
-                A6:CF:6C:E3:87:28:8B:4D:CE:54:8C:00:B3:F7:AE:9E:01:81:1E:83: +
-                AE:6D:58:B0:10:98:36:D9:69:76:E2:C0:E2:15:94:3B:D4:14:19:D9: +
-                59:86:75:31 +
-parm:           max_bonds:Max number of bonded devices (int) +
-parm:           tx_queues:Max number of transmit queues (default = 16) (int) +
-parm:           num_grat_arp:Number of peer notifications to send on failover event (alias of num_unsol_na) (int) +
-parm:           num_unsol_na:Number of peer notifications to send on failover event (alias of num_grat_arp) (int) +
-parm:           miimon:Link check interval in milliseconds (int) +
-parm:           updelay:Delay before considering link up, in milliseconds (int) +
-parm:           downdelay:Delay before considering link down, in milliseconds (int) +
-parm:           use_carrier:Use netif_carrier_ok (vs MII ioctls) in miimon; 0 for off, 1 for on (default) (int) +
-parm:           mode:Mode of operation; 0 for balance-rr, 1 for active-backup, 2 for balance-xor, 3 for broadcast, 4 for 802.3ad, 5 for balance-tlb, 6 for balance-alb (charp) +
-parm:           primary:Primary network device to use (charp) +
-parm:           primary_reselect:Reselect primary slave once it comes up; 0 for always (default), 1 for only if speed of primary is better, 2 for only on active slave failure (charp) +
-parm:           lacp_rate:LACPDU tx rate to request from 802.3ad partner; 0 for slow, 1 for fast (charp) +
-parm:           ad_select:802.3ad aggregation selection logic; 0 for stable (default), 1 for bandwidth, 2 for count (charp) +
-parm:           min_links:Minimum number of available links before turning on carrier (int) +
-parm:           xmit_hash_policy:balance-alb, balance-tlb, balance-xor, 802.3ad hashing method; 0 for layer 2 (default), 1 for layer 3+4, 2 for layer 2+3, 3 for encap layer 2+3, 4 for encap layer 3+4, 5 for vlan+srcmac (charp) +
-parm:           arp_interval:arp interval in milliseconds (int) +
-parm:           arp_ip_target:arp targets in n.n.n.n form (array of charp) +
-parm:           arp_validate:validate src/dst of ARP probes; 0 for none (default), 1 for active, 2 for backup, 3 for all (charp) +
-parm:           arp_all_targets:fail on any/all arp targets timeout; 0 for any (default), 1 for all (charp) +
-parm:           fail_over_mac:For active-backup, do not set all slaves to the same MAC; 0 for none (default), 1 for active, 2 for follow (charp) +
-parm:           all_slaves_active:Keep all frames received on an interface by setting active flag for all slaves; 0 for never (default), 1 for always. (int) +
-parm:           resend_igmp:Number of IGMP membership reports to send on link failure (int) +
-parm:           packets_per_slave:Packets to send per slave in balance-rr mode; 0 for a random slave, 1 packet per slave (default), >1 packets per slave. (int) +
-parm:           lp_interval:The number of seconds between instances where the bonding driver sends learning packets to each slaves peer switch. The default is 1(uint) +
-</code>+
  
-Dernièrementles fichiers dans le repertoire **/etc/modprobe.d** sont utilisés pour spécifier les options éventuelles à passer aux modules lors de leur chargement ainsi que les alias utilisés pour leur faire référence :+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
  
-<code> + -h, --help           display this help 
-[root@centos8 ~]# ls /etc/modprobe.d + -V, --version        display version
-firewalld-sysctls.conf  lockd.conf  nvdimm-security.conf  tuned.conf +
-kvm.conf                mlx4.conf   truescale.conf        vhost.conf+
  
-[root@centos8 ~]# cat /etc/modprobe.d/kvm.conf  +For more details see last(1).
-# Setting modprobe kvm_intel/kvm_amd nested = 1 +
-# only enables Nested Virtualization until the next reboot or +
-# module reloadUncomment the option applicable +
-# to your system below to enable the feature permanently. +
-+
-# User changes in this file are preserved across upgrades. +
-+
-# For Intel +
-#options kvm_intel nested=1 +
-+
-# For AMD +
-#options kvm_amd nested=1+
 </code> </code>
  
-=====LAB #2 - Compilation et installation du noyau et des modules=====+====1.2 - La Commande lastlog====
  
-Activez le dépôt **CentOS-Linux-PowerTools** en passant la directive **enabled** à **1** :+Cette commande indique les dates et heures de la connexion au système la plus récente des utilisateurs :
  
 <code> <code>
-[root@centos8 ~]# vi /etc/yum.repos.d/CentOS-Linux-PowerTools.repo  +[root@centos8 ~]# lastlog 
-[root@centos8 ~]# cat /etc/yum.repos.d/CentOS-Linux-PowerTools.repo  +Username         Port     From             Latest 
-# CentOS-Linux-PowerTools.repo +root             pts/0                     Thu Jun  3 09:01:46 -0400 2021 
-# +bin                                        **Never logged in** 
-# The mirrorlist system uses the connecting IP address of the client and the +daemon                                     **Never logged in** 
-# update status of each mirror to pick current mirrors that are geographically +adm                                        **Never logged in** 
-# close to the client.  You should use this for CentOS updates unless you are +lp                                         **Never logged in** 
-# manually picking other mirrors. +sync                                       **Never logged in** 
-# +shutdown                                   **Never logged in** 
-# If the mirrorlist does not work for you, you can try the commented out +halt                                       **Never logged in** 
-# baseurl line instead. +mail                                       **Never logged in** 
- +operator                                   **Never logged in** 
-[powertools] +games                                      **Never logged in** 
-name=CentOS Linux $releasever - PowerTools +ftp                                        **Never logged in** 
-mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=PowerTools&infra=$infra +nobody                                     **Never logged in** 
-#baseurl=http://mirror.centos.org/$contentdir/$releasever/PowerTools/$basearch/os/ +dbus                                       **Never logged in** 
-gpgcheck=1 +systemd-coredump                           **Never logged in** 
-enabled=1 +systemd-resolve                            **Never logged in** 
-gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial+tss                                        **Never logged in** 
 +polkitd                                    **Never logged in** 
 +unbound                                    **Never logged in** 
 +libstoragemgmt                             **Never logged in** 
 +cockpit-ws                                 **Never logged in** 
 +sssd                                       **Never logged in** 
 +setroubleshoot                             **Never logged in** 
 +sshd                                       **Never logged in** 
 +chrony                                     **Never logged in** 
 +tcpdump                                    **Never logged in** 
 +trainee          pts/0    10.0.2.2         Thu Jun  3 09:01:39 -0400 2021 
 +cockpit-wsinstance                           **Never logged in** 
 +rngd                                       **Never logged in** 
 +gluster                                    **Never logged in** 
 +qemu                                       **Never logged in** 
 +rpc                                        **Never logged in** 
 +rpcuser                                    **Never logged in** 
 +saslauth                                   **Never logged in** 
 +radvd                                      **Never logged in** 
 +dnsmasq                                    **Never logged in** 
 +fenestros2       pts/                    Tue Apr 20 15:20:26 -0400 2021 
 +fenestros1                                 **Never logged in** 
 +apache                                     **Never logged in**
 </code> </code>
  
-Installez maintenant les paquets nécessaires :+Les option de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# dnf groupinstall "Development Tools" +[root@centos8 ~]# lastlog --help 
-... +Usage: lastlog [options] 
-[root@centos8 ~]# dnf install asciidoc audit-libs-devel bash bc binutils binutils-devel bison diffutils elfutils elfutils-devel elfutils-libelf-devel findutils flex gawk gcc gettext gzip hmaccalc hostname make module-init-tools ncurses-devel net-tools newt-devel numactl-devel openssl patch pciutils-devel perl perl-ExtUtils-Embed pesign redhat-rpm-config rpm-build rpmdevtools sh-utils tar xmlto xz zlib-devel rpmdevtools + 
-...+Options: 
 +  -b, --before DAYS             print only lastlog records older than DAYS 
 +  -C, --clear                   clear lastlog record of an user (usable only with -u) 
 +  -h, --help                    display this help message and exit 
 +  -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> </code>
  
-====2.1 - Déplacer /home====+====1.3 La Commande lastb====
  
-<WRAP center round alert 60%> +Cette commande indique les dates et heures des connexions infructueuses des utilisateurs à partir du contenu du fichier **/var/log/btmp** :
-**Important** - Il n'est pas conseillé de compiler en tant que root pour des raisons de sécurité. Pour pouvoir utiliser le compte d'un utilisateur pour créer un nouveau noyau, celui-ci doit disposer de plus de 10 Go d'espace libre. +
-</WRAP>+
  
-<WRAP center round todo 60%+<code
-**A faire** **Déconnectez-vous** de votre session **CentOS8_SSH_10.0.2.45** et re-connectez-vous à la VM en tant que root en utilisant la connexion **CentOS8_ROOT_10.0.2.45**. +[root@centos8 ~]# lastb 
-</WRAP>+trainee  tty1                          Thu Jun  3 09:51 09:51  (00:00) 
 +trainee  tty1                          Thu Jun  3 09:51 09:51  (00:00) 
 +trqinee  tty1                          Thu Jun  3 09:51 09:51  (00:00) 
 + 
 +btmp begins Thu Jun  3 09:51:07 2021 
 +</code>
  
-Créez ensuite une seule partition sur **/dev/sdc** :+Les options de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# fdisk /dev/sdc+[root@centos8 ~]# lastb --help
  
-Welcome to fdisk (util-linux 2.32.1). +Usage: 
-Changes will remain in memory only, until you decide to write them. + lastb [options] [<username>...] [<tty>...]
-Be careful before using the write command.+
  
-Device does not contain recognized partition table. +Show listing of last logged in users.
-Created a new DOS disklabel with disk identifier 0xc321702b.+
  
-Command (m for help)n +Options
-Partition type + -<number>            how many lines to show 
-   p   primary (0 primary0 extended4 free) + -a--hostlast       display hostnames in the last column 
-     extended (container for logical partitions) + -d--dns            translate the IP number back into a hostname 
-Select (default p)+ -f, --file <file>    use a specific file instead of /var/log/btmp 
 + -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
  
-Using default response p. + -h--help           display this help 
-Partition number (1-4default 1):  + -V, --version        display version
-First sector (2048-41943039default 2048):  +
-Last sector, +sectors or +size{K,M,G,T,P} (2048-41943039, default 41943039): +
  
-Created a new partition of type 'Linux' and of size 20 GiB. +For more details see last(1).
- +
-Command (m for help): w +
-The partition table has been altered. +
-Calling ioctl(to re-read partition table. +
-Syncing disks.+
 </code> </code>
  
-Créez maintenant un système de fichiers ext4 sur **/dev/sdc1** :+====1.4 - Le Fichier /var/log/secure====
  
-<code> +Sous RHEL/CentOS ce fichier contient la journalisation des opérations de gestion des authentifications :
-[root@centos8 ~]# mkfs.ext4 /dev/sdc1 +
-mke2fs 1.45.6 (20-Mar-2020) +
-Discarding device blocks: done                             +
-Creating filesystem with 16776960 4k blocks and 4194304 inodes +
-Filesystem UUID: dc92c0d7-919b-4fff-8719-53e9e7e628dd +
-Superblock backups stored on blocks +
-        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,  +
-        4096000, 7962624, 11239424+
  
-Allocating group tablesdone                             +<code> 
-Writing inode tablesdone                             +[root@centos8 ~]# tail -n 15 /var/log/secure 
-Creating journal (65536 blocks): done +Jun  3 09:01:20 centos8 sshd[905]: Server listening on :: port 22. 
-Writing superblocks and filesystem accounting informationdone +Jun  3 09:01:39 centos8 sshd[1585]: Accepted password for trainee from 10.0.2.2 port 52734 ssh2 
 +Jun  3 09:01:39 centos8 systemd[1590]: pam_unix(systemd-user:session): session opened for user trainee by (uid=0) 
 +Jun  3 09:01:39 centos8 sshd[1585]: pam_unix(sshd:session): session opened for user trainee by (uid=0) 
 +Jun  3 09:01:46 centos8 su[1627]: pam_systemd(su-l:session): Cannot create session: Already running in a session or user slice 
 +Jun  3 09:01:46 centos8 su[1627]: pam_unix(su-l:session): session opened for user root by trainee(uid=1000) 
 +Jun  3 09:51:05 centos8 login[1158]: pam_unix(login:auth): check pass; user unknown 
 +Jun  3 09:51:05 centos8 login[1158]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=tty1 ruser= rhost= 
 +Jun  3 09:51:07 centos8 login[1158]: FAILED LOGIN 1 FROM tty1 FOR trqinee, Authentication failure 
 +Jun  3 09:51:18 centos8 unix_chkpwd[2400]: password check failed for user (trainee) 
 +Jun  3 09:51:18 centos8 login[1158]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=tty1 ruser= rhost=  user=trainee 
 +Jun  3 09:51:20 centos8 login[1158]: FAILED LOGIN 2 FROM tty1 FOR trainee, Authentication failure 
 +Jun  3 09:51:45 centos8 login[1158]: pam_unix(login:auth): check pass; user unknown 
 +Jun  3 09:51:45 centos8 login[1158]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=tty1 ruser= rhost= 
 +Jun  3 09:51:47 centos8 login[1158]FAILED LOGIN SESSION FROM tty1 FOR trainee  , Authentication failure
 </code> </code>
  
-Montez **/dev/sdc1** sur /mnt :+====1.5 - Gestion des Evénements audit====
  
-<code> +===Le fichier /var/log/audit/audit.log===
-[root@centos8 ~]# mount /dev/sdc1 /mnt +
-</code>+
  
-Copiez le contenu de /home vers /mnt :+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/CentOS par le paquet **audit**. Le système audit collectionne des informations telles :
  
-<code> +  * des appels système, 
-[root@centos8 ~]# cp -a /home//mnt +  des accès aux fichiers, 
-</code>+  * des informations en provenance de %%SELinux%%.
  
-Démontez /dev/sdc1 et déplacez /home vers /root :+Consultez maintenant le fichier **/var/log/audit.log** :
  
 <code> <code>
-[root@centos8 ~]# umount /mnt +[root@centos8 ~]# tail -n 15 /var/log/audit/audit.log 
-[root@centos8 ~]# mv /home /root+type=PROCTITLE msg=audit(1622728321.894:455): proctitle=2F7573722F7362696E2F63726F6E64002D6E 
 +type=USER_START msg=audit(1622728321.901:456): pid=2420 uid=0 auid=1000 ses=53 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" 
 +type=CRED_REFR msg=audit(1622728321.902:457): pid=2420 uid=0 auid=1000 ses=53 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_localuser,pam_unix acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" 
 +type=CRED_DISP msg=audit(1622728321.908:458): pid=2420 uid=0 auid=1000 ses=53 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_localuser,pam_unix acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" 
 +type=USER_END msg=audit(1622728321.910:459): pid=2420 uid=0 auid=1000 ses=53 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" 
 +type=SERVICE_STOP msg=audit(1622728330.965:460): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=fprintd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'UID="root" AUID="unset" 
 +type=USER_ACCT msg=audit(1622728381.954:461): pid=2439 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_access,pam_unix,pam_localuser acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="unset" 
 +type=CRED_ACQ msg=audit(1622728381.954:462): pid=2439 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_localuser,pam_unix acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="unset" 
 +type=LOGIN msg=audit(1622728381.954:463): pid=2439 uid=0 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 old-auid=4294967295 auid=1000 tty=(none) old-ses=4294967295 ses=54 res=1UID="root" OLD-AUID="unset" AUID="trainee" 
 +type=SYSCALL msg=audit(1622728381.954:463): arch=c000003e syscall=1 success=yes exit=4 a0=7 a1=7ffdcd7a6d50 a2=4 a3=0 items=0 ppid=1126 pid=2439 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=54 comm="crond" exe="/usr/sbin/crond" subj=system_u:system_r:crond_t:s0-s0:c0.c1023 key=(null)ARCH=x86_64 SYSCALL=write AUID="trainee" UID="root" GID="root" EUID="root" SUID="root" FSUID="root" EGID="root" SGID="root" FSGID="root" 
 +type=PROCTITLE msg=audit(1622728381.954:463): proctitle=2F7573722F7362696E2F63726F6E64002D6E 
 +type=USER_START msg=audit(1622728381.960:464): pid=2439 uid=0 auid=1000 ses=54 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" 
 +type=CRED_REFR msg=audit(1622728381.962:465): pid=2439 uid=0 auid=1000 ses=54 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_localuser,pam_unix acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" 
 +type=CRED_DISP msg=audit(1622728381.966:466): pid=2439 uid=0 auid=1000 ses=54 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_localuser,pam_unix acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" 
 +type=USER_END msg=audit(1622728381.968:467): pid=2439 uid=0 auid=1000 ses=54 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee"
 </code> </code>
  
-Identifiez l'UUID de /dev/sdc1 :+La gestion des événements audit se repose sur trois exécutables :
  
-<code> +===auditd===
-[root@centos8 ~]# ls -l /dev/disk/by-uuid/ | grep sdc1 +
-lrwxrwxrwx. 1 root root 10 Jul 19 12:02 f76d6b66-985b-4a91-af9c-4987e8c1443c -> ../../sdc +
-[root@centos8 ~]#  +
-</code>+
  
-Editez le fichier **/etc/fstab** et ajoutez une ligne pour /dev/sdc1 :+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** :
  
 <code> <code>
-[root@centos8 ~]# vi /etc/fstab +[root@centos8 ~]# cat /etc/audit/auditd.conf
-[root@centos8 ~]# cat /etc/fstab +
 # #
-/etc/fstab +This file controls the configuration of the audit daemon
-# Created by anaconda on Wed Jun 16 06:21:32 2021+
 # #
-# Accessible filesystems, by reference, are maintained under '/dev/disk/'+ 
-# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info. +local_events = yes 
-# +write_logs = yes 
-# After editing this file, run 'systemctl daemon-reload' to update systemd +log_file = /var/log/audit/audit.log 
-units generated from this file. +log_group = root 
-+log_format = ENRICHED 
-/dev/mapper/cl_centos8-root /                       xfs     defaults        0 +flush = INCREMENTAL_ASYNC 
-UUID=1c04981e-5317-4b73-9695-3ce25246835d /boot                   ext4    defaults        1 2 +freq = 50 
-/dev/mapper/cl_centos8-swap swap                    swap    defaults        0 0 +max_log_file = 
-UUID=f76d6b66-985b-4a91-af9c-4987e8c1443c /home     ext4          defaults            1 2+num_logs = 5 
 +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 = 400 
 +overflow_action = SYSLOG 
 +max_restarts = 10 
 +plugin_dir = /etc/audit/plugins.d
 </code> </code>
  
-Créez le point de montage /home :+Les option de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# mkdir /home+[root@centos8 ~]# auditd --help 
 +auditd: unrecognized option '--help' 
 +Usage: auditd [-f] [-l] [-n] [-s disable|enable|nochange] [-c <config_file>]
 </code> </code>
  
-Montez /dev/sdc1 :+===auditctl=== 
 + 
 +Cet exécutable est utilisé pour configurer les règles du système audit. Au démarrage, auditctl lit et applique les règles contunues dans le fichier **/etc/audit/audit.rules** :
  
 <code> <code>
-[root@centos8 ~]# mount -a +[root@centos8 ~]# cat /etc/audit/audit.rules 
-[root@centos8 ~]# mount +## This file is automatically generated from /etc/audit/rules.d 
-sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel) +-D 
-proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) +-b 8192 
-devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=1882880k,nr_inodes=470720,mode=755) +-
-securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime) +--backlog_wait_time 60000 
-tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel) +
-devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000) +
-tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755) +
-tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,mode=755) +
-cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd) +
-pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime,seclabel) +
-bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700) +
-cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,hugetlb) +
-cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,memory) +
-cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpu,cpuacct) +
-cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,rdma) +
-cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,pids) +
-cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpuset) +
-cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,perf_event) +
-cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,freezer) +
-cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,blkio) +
-cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,net_cls,net_prio) +
-cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,devices) +
-none on /sys/kernel/tracing type tracefs (rw,relatime,seclabel) +
-configfs on /sys/kernel/config type configfs (rw,relatime) +
-/dev/mapper/cl_centos8-root on / type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota) +
-selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime) +
-mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel) +
-hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel,pagesize=2M) +
-debugfs on /sys/kernel/debug type debugfs (rw,relatime,seclabel) +
-systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=40,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=6022) +
-fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime) +
-/dev/sda1 on /boot type ext4 (rw,relatime,seclabel) +
-sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime) +
-tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=382500k,mode=700,uid=1000,gid=1000) +
-tmpfs on /run/user/42 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=382500k,mode=700,uid=42,gid=42) +
-gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000) +
-tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=382500k,mode=700) +
-gvfsd-fuse on /run/user/0/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0) +
-/dev/sdc1 on /home type ext4 (rw,relatime,seclabel)+
 </code> </code>
  
-Notez la taille de /home :+Les options de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# df -h +[root@centos8 ~]# auditctl --help 
-Filesystem                   Size  Used Avail Use% Mounted on +usage: auditctl [options] 
-devtmpfs                     1.8G      1.8G   0% /dev +    -a <l,a>            Append rule to end of <l>ist with <a>ction 
-tmpfs                        1.9G      1.9G   0% /dev/shm +    -A <l,a>            Add rule at beginning of <l>ist with <a>ction 
-tmpfs                        1.9G  9.4M  1.9G   1% /run +    -b <backlog>        Set max number of outstanding audit buffers 
-tmpfs                        1.9G      1.9G   0% /sys/fs/cgroup +                        allowed Default=64 
-/dev/mapper/cl_centos8-root   28G  5.2G   23G  19% / +    -c                  Continue through errors in rules 
-/dev/sda1                    976M  289M  620M  32% /boot +    -C f=f              Compare collected fields if available: 
-tmpfs                        374M   16K  374M   1% /run/user/1000 +                        Field name, operator(=,!=), field name 
-tmpfs                        374M  1.2M  373M   1% /run/user/42 +    -d <l,a>            Delete rule from <l>ist with <a>ction 
-/dev/sdc1                     63G   67M   60G   1% /home+                        l=task,exit,user,exclude 
 +                        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 
 +    -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
 </code> </code>
  
-<WRAP center round todo 60%> +===La consultation des événements audit=== 
-**A faire** - **Déconnectez-vous** de votre session **CentOS8_ROOT_10.0.2.45** et re-connectez-vous à la VM en tant que trainee en utilisant la connexion **CentOS8_SSH_10.0.2.45**+ 
-</WRAP>+La consultation des événements audit se fait en utilisant les commandes **ausearch** et **aureport** :
  
-====2.2 - Préparer l'Environnement====+==La Commande aureport==
  
-Pour créer l'arborescence de l'environnement de création de paquets dans /home/trainee, utilisez la commande **rpmdev-setuptree** :+Cette commande est utilisée pour générer des rapports :
  
 <code> <code>
-[trainee@centos8 ~]$ rpmdev-setuptree +[root@centos8 ~]# aureport
-...> +
-[trainee@centos8 ~]$ ls -laR rpmbuild/ +
-rpmbuild/: +
-total 28 +
-drwxrwxr-x.  7 trainee trainee 4096 Jul 19 12:10 . +
-drwxr-xr-x. 17 trainee trainee 4096 Jul 19 12:10 .. +
-drwxrwxr-x.  2 trainee trainee 4096 Jul 19 12:10 BUILD +
-drwxrwxr-x.  2 trainee trainee 4096 Jul 19 12:10 RPMS +
-drwxrwxr-x.  2 trainee trainee 4096 Jul 19 12:10 SOURCES +
-drwxrwxr-x.  2 trainee trainee 4096 Jul 19 12:10 SPECS +
-drwxrwxr-x.  2 trainee trainee 4096 Jul 19 12:10 SRPMS+
  
-rpmbuild/BUILD: +Summary Report 
-total 8 +====================== 
-drwxrwxr-x. 2 trainee trainee 4096 Jul 19 12:10 . +Range of time in logs: 05/08/2020 08:13:52.320 06/03/2021 10:20:02.028 
-drwxrwxr-x. 7 trainee trainee 4096 Jul 19 12:10 .. +Selected time for report: 05/08/2020 08:13:52 - 06/03/2021 10:20:02.028 
- +Number of changes in configuration: 46 
-rpmbuild/RPMS+Number of changes to accounts, groups, or roles: 56 
-total +Number of logins: 21 
-drwxrwxr-x. 2 trainee trainee 4096 Jul 19 12:10 . +Number of failed logins: 5 
-drwxrwxr-x. 7 trainee trainee 4096 Jul 19 12:10 .. +Number of authentications50 
- +Number of failed authentications: 
-rpmbuild/SOURCES+Number of users3 
-total 8 +Number of terminals: 10 
-drwxrwxr-x. 2 trainee trainee 4096 Jul 19 12:10 . +Number of host names: 4 
-drwxrwxr-x. 7 trainee trainee 4096 Jul 19 12:10 .. +Number of executables22 
- +Number of commands: 11 
-rpmbuild/SPECS+Number of files0 
-total 8 +Number of AVC's0 
-drwxrwxr-x. 2 trainee trainee 4096 Jul 19 12:10 . +Number of MAC events: 35 
-drwxrwxr-x. 7 trainee trainee 4096 Jul 19 12:10 .. +Number of failed syscalls0 
- +Number of anomaly events: 7 
-rpmbuild/SRPMS+Number of responses to anomaly events0 
-total 8 +Number of crypto events287 
-drwxrwxr-x. 2 trainee trainee 4096 Jul 19 12:10 . +Number of integrity events: 0 
-drwxrwxr-x. 7 trainee trainee 4096 Jul 19 12:10 ..+Number of virt events0 
 +Number of keys: 0 
 +Number of process IDs616 
 +Number of events6030
 </code> </code>
  
-Téléchargez le rpm source du noyau :+Les options de cette commande sont :
  
 <code> <code>
-[trainee@centos8 ~]$ uname -a +[root@centos8 ~]# aureport --help 
-Linux centos8.ittraining.loc 4.18.0-305.7.1.el8_4.x86_64 #1 SMP Tue Jun 29 21:55:12 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux+usage: aureport [options] 
 + -a,--avc Avc report 
 + -au,--auth Authentication report 
 + --comm Commands run report 
 + -c,--config Config change report 
 + -cr,--crypto Crypto report 
 + -e,--event Event report 
 + -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 
 + -l,--login Login report 
 + -k,--key Key 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>
  
-[trainee@centos8 ~]$ cat /etc/centos-release +==La Commande ausearch==
-CentOS Linux release 8.4.2105+
  
-[trainee@centos8 ~]$ wget https://vault.centos.org/8.4.2105/BaseOS/Source/SPackages/kernel-4.18.0-305.7.1.el8_4.src.rpm +Cette commande est utilisée pour rechercher des événementsPar exemplepour rechercher les événements liés à un utilisateur représenté par son UID :
---2021-07-14 02:54:14--  https://vault.centos.org/8.4.2105/BaseOS/Source/SPackages/kernel-4.18.0-305.7.1.el8_4.src.rpm +
-Resolving vault.centos.org (vault.centos.org)... 81.171.33.1942a05:d014:10:7803:4af1:9320:7050:d28e +
-Connecting to vault.centos.org (vault.centos.org)|81.171.33.194|:443... connected. +
-HTTP request sent, awaiting response... 200 OK +
-Length: 123000617 (117M) [application/x-rpm] +
-Saving to: ‘kernel-4.18.0-305.7.1.el8_4.src.rpm’ +
- +
-kernel-4.18.0-305.7.1. 100%[===========================>] 117.30M  1.49MB/   in 79s      +
- +
-2021-07-14 02:55:33 (1.49 MB/s) - ‘kernel-4.18.0-305.7.1.el8_4.src.rpm’ saved [123000617/123000617] +
-</code> +
- +
-Installez maintenant les dépendances pour le rpm source en tant que root :+
  
 <code> <code>
-[trainee@centos8 ~]su - +[root@centos8 ~]# ausearch -ui 1000 | more 
-Mot de passe fenestros+---- 
 +time->Tue Sep  1 11:05:28 2020 
 +type=USER_AUTH msg=audit(1598972728.209:77): pid=1633 uid=1000 auid=1000 ses=1 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=localhost.locald 
 +omain addr=? terminal=pts/0 res=success' 
 +---
 +time->Tue Sep  1 11:05:28 2020 
 +type=USER_ACCT msg=audit(1598972728.214:78): pid=1633 uid=1000 auid=1000 ses=1 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=localh 
 +ost.localdomain addr=? terminal=pts/0 res=success' 
 +---- 
 +time->Tue Sep  1 11:05:28 2020 
 +type=CRED_ACQ msg=audit(1598972728.218:79): pid=1633 uid=1000 auid=1000 ses=1 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=localhost.localdomain ad 
 +dr=? terminal=pts/0 res=success' 
 +---- 
 +time->Tue Sep  1 11:05:28 2020 
 +type=USER_START msg=audit(1598972728.223:80): pid=1633 uid=1000 auid=1000 ses=1 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=localhost.localdomain addr=? terminal=pts/0 res=success' 
 +---- 
 +time->Tue Sep  1 11:10:13 2020 
 +type=USER_END msg=audit(1598973013.687:87): pid=1633 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask, 
 +pam_xauth acct="root" exe="/usr/bin/su" hostname=localhost.localdomain addr=? terminal=pts/0 res=success' 
 +---- 
 +time->Tue Sep  1 11:10:13 2020 
 +type=CRED_DISP msg=audit(1598973013.687:88): pid=1633 uid=1000 auid=1000 ses=1 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=localhost.localdomain a 
 +ddr=? terminal=pts/0 res=success' 
 +---- 
 +time->Mon Apr 19 11:48:01 2021 
 +type=USER_AUTH msg=audit(1618847281.847:77): pid=1768 uid=1000 auid=1000 ses=1 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=centos8.ittraini 
 +ng.loc addr=? terminal=pts/0 res=success' 
 +---- 
 +time->Mon Apr 19 11:48:01 2021 
 +type=USER_ACCT msg=audit(1618847281.847:78): pid=1768 uid=1000 auid=1000 ses=1 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=centos 
 +8.ittraining.loc addr=? terminal=pts/0 res=success' 
 +---- 
 +time->Mon Apr 19 11:48:01 2021 
 +type=CRED_ACQ msg=audit(1618847281.847:79): pid=1768 uid=1000 auid=1000 ses=1 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=centos8.ittraining.loc a 
 +ddr=? terminal=pts/0 res=success' 
 +---- 
 +time->Mon Apr 19 11:48:01 2021 
 +type=USER_START msg=audit(1618847281.883:80): pid=1768 uid=1000 auid=1000 ses=1 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=centos8.ittraining.loc addr=? terminal=pts/0 res=success' 
 +---- 
 +time->Mon Apr 19 12:04:39 2021 
 +type=USER_END msg=audit(1618848279.544:541): pid=1768 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask 
 +,pam_xauth acct="root" exe="/usr/bin/su" hostname=centos8.ittraining.loc addr=? terminal=pts/0 res=success' 
 +---- 
 +time->Mon Apr 19 12:04:39 2021 
 +type=CRED_DISP msg=audit(1618848279.544:542): pid=1768 uid=1000 auid=1000 ses=1 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=centos8.ittraining.loc 
 + addr=? terminal=pts/0 res=success' 
 +---- 
 +time->Mon Apr 19 12:05:57 2021 
 +type=USER_AUTH msg=audit(1618848357.204:69): pid=4892 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:authentication grantors=? acct="root" exe="/usr/bin/su" hostname=centos8.ittraining.loc  
 +addr=? terminal=pts/0 res=failed' 
 +---- 
 +time->Mon Apr 19 12:06:03 2021 
 +type=USER_AUTH msg=audit(1618848363.134:70): pid=4901 uid=1000 auid=1000 ses=1 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=centos8.ittraini 
 +ng.loc addr=? terminal=pts/0 res=success' 
 +---- 
 +--More-- 
 +</code> 
  
-[root@centos8 ~]# dnf install yum-utils +Les options de cette commande sont :
-... +
- +
-[root@centos8 ~]# yum-builddep /home/trainee/kernel-4.18.0-305.7.1.el8_4.src.rpm  +
-... +
-</code> +
- +
-Installez maintenant le paquet **kernel-4.18.0-305.7.1.el8_4.src.rpm** :+
  
 <code> <code>
-[root@centos8 ~]# exit +[root@centos8 ~]# ausearch --help 
-logout +usage: ausearch [options] 
-[trainee@centos8 ~]$ rpm -Uvh kernel-4.18.0-305.7.1.el8_4.src.rpm + -a,--event <Audit event id> search based on audit event id 
-Updating / installing... + --arch <CPU> search based on the CPU architecture 
-   1:kernel-4.18.0-305.7.1.el8_4      warning: user mockbuild does not exist using root + -c,--comm  <Comm name> search based on command line name 
-warning: group mockbuild does not exist using root + --checkpoint <checkpoint file> search from last complete event 
-warning: user mockbuild does not exist using root + --debug Write malformed events that are skipped to stderr 
-warning: group mockbuild does not exist using root + -e,--exit  <Exit code or errno> search based on syscall exit code 
-warning: user mockbuild does not exist using root + -f,--file  <File name> search based on file name 
-warning: group mockbuild does not exist using root + --format [raw|default|interpret|csv|text] results format options 
-warning: user mockbuild does not exist using root + -ga,--gid-all <all Group id> search based on All group ids 
-warning: group mockbuild does not exist using root + -ge,--gid-effective <effective Group id>  search based on Effective 
-warning: user mockbuild does not exist using root + group id 
-warning: group mockbuild does not exist using root + -gi,--gid <Group Id> search based on group id 
-warning: user mockbuild does not exist using root + -h,--help help 
-warning: group mockbuild does not exist using root + -hn,--host <Host Name> search based on remote host name 
-warning: user mockbuild does not exist using root + -i,--interpret Interpret results to be human readable 
-warning: group mockbuild does not exist using root + -if,--input <Input File name> use this file instead of current logs 
-warning: user mockbuild does not exist using root + --input-logs Use the logs even if stdin is a pipe 
-warning: group mockbuild does not exist using root + --just-one Emit just one event 
-warning: user mockbuild does not exist using root + -k,--key  <key string> search based on key field 
-warning: group mockbuild does not exist - using root + -l, --line-buffered Flush output on every line 
-warning: user mockbuild does not exist using root + -m,--message  <Message type> search based on message type 
-warning: group mockbuild does not exist using root + -n,--node  <Node name> search based on machine's name 
-warning: user mockbuild does not exist using root + -o,--object  <SE Linux Object context> search based on context of object 
-warning: group mockbuild does not exist - using root + -p,--pid  <Process id> search based on process id 
-warning: user mockbuild does not exist using root + -pp,--ppid <Parent Process id> search based on parent process id 
-warning: group mockbuild does not exist using root + -r,--raw output is completely unformatted 
-warning: user mockbuild does not exist using root + -sc,--syscall <SysCall name> search based on syscall name or number 
-warning: group mockbuild does not exist - using root + -se,--context <SE Linux context> search based on either subject or 
-warning: user mockbuild does not exist using root + object 
-warning: group mockbuild does not exist using root + --session <login session id> search based on login session id 
-warning: user mockbuild does not exist using root + -su,--subject <SE Linux context> search based on context of the Subject 
-warning: group mockbuild does not exist using root + -sv,--success <Success Value> search based on syscall or event 
-warning: user mockbuild does not exist using root + success value 
-warning: group mockbuild does not exist using root + -te,--end [end date[end time] ending date & time for search 
-warning: user mockbuild does not exist using root + -ts,--start [start date] [start time] starting data & time for search 
-warning: group mockbuild does not exist using root + -tm,--terminal <TerMinal> search based on terminal 
-warning: user mockbuild does not exist using root + -ua,--uid-all <all User id> search based on All user id's 
-warning: group mockbuild does not exist using root + -ue,--uid-effective <effective User id>  search based on Effective 
-warning: user mockbuild does not exist using root + user id 
-warning: group mockbuild does not exist using root + -ui,--uid <User Id> search based on user id 
-warning: user mockbuild does not exist using root + -ul,--loginuid <login id> search based on the User's Login id 
-warning: group mockbuild does not exist using root + -uu,--uuid <guest UUID> search for events related to the virtual 
-warning: user mockbuild does not exist using root + machine with the given UUID. 
-warning: group mockbuild does not exist using root + -v,--version version 
-warning: user mockbuild does not exist using root + -vm,--vm-name <guest name> search for events related to the virtual 
-warning: group mockbuild does not exist using root + machine with the name. 
-warning: user mockbuild does not exist using root + -w,--word string matches are whole word 
-warning: group mockbuild does not exist using root + -x,--executable <executable name>  search based on executable name
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist - using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-################################# [100%+
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist - using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root +
-warning: user mockbuild does not exist using root +
-warning: group mockbuild does not exist using root+
 </code> </code>
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important** - Les erreurs sont sans importance.+**Important** : Pour plus d'information concernant le système audit, consultez les manuels de **auditd**, **auditctl**, **audispd**, **aureport** et **ausearch**.
 </WRAP> </WRAP>
  
-====2.3 - Préparer l'Arborescence Source du Noyau====+=====Le fichier /var/log/messages=====
  
-Naviguez vers le repertoire **~/rpmbuild/SPECS** et utilisez la commande **rpmbuild** pour préparer l'arborescence source du noyau :+Ce fichier contient la plupart des messages du système :
  
 <code> <code>
-[trainee@centos7 ~]$ cd ~/rpmbuild/SPECS +[root@centos8 ~]# tail -n 15 /var/log/messages 
-[trainee@centos7 SPECS]$ rpmbuild -bp --target=$(uname -m) kernel.spec +Jun  3 10:15:01 centos8 systemd[1]: session-76.scope: Succeeded. 
-...+Jun  3 10:16:01 centos8 systemd[1]: Started Session 77 of user trainee
 +Jun  3 10:16:01 centos8 systemd[1]: session-77.scope: Succeeded. 
 +Jun  3 10:17:01 centos8 systemd[1]: Started Session 78 of user trainee. 
 +Jun  3 10:17:01 centos8 systemd[1]: session-78.scope: Succeeded. 
 +Jun  3 10:18:01 centos8 systemd[1]: Started Session 79 of user trainee. 
 +Jun  3 10:18:01 centos8 systemd[1]: session-79.scope: Succeeded. 
 +Jun  3 10:19:01 centos8 systemd[1]: Started Session 80 of user trainee. 
 +Jun  3 10:19:01 centos8 systemd[1]: session-80.scope: Succeeded
 +Jun  3 10:20:02 centos8 systemd[1]: Started Session 81 of user trainee. 
 +Jun  3 10:20:02 centos8 systemd[1]: session-81.scope: Succeeded. 
 +Jun  3 10:21:01 centos8 systemd[1]: Started Session 82 of user trainee. 
 +Jun  3 10:21:01 centos8 systemd[1]: session-82.scope: Succeeded. 
 +Jun  3 10:22:01 centos8 systemd[1]: Started Session 83 of user trainee. 
 +Jun  3 10:22:01 centos8 systemd[1]: session-83.scope: Succeeded.
 </code> </code>
  
-A l'issu du processus, examinez l'arborescence :+=====Applications===== 
 + 
 +Certaines applications consignent leurs journaux dans des répertoires spécifiques. Par exemple : 
 + 
 +   * cups, 
 +   * httpd, 
 +   * samba, 
 +   * ...
  
 <code> <code>
-[trainee@centos8 SPECS]ls -la ~/rpmbuild/BUILD/kernel-4.18.0-305.7.1.el8_4/linux-4.18.0-305.7.1.el8.x86_64+[root@centos8 ~]ls -/var/log 
-total 812 +total 2448 
-drwxr-xr-x.  26 trainee trainee   4096 Jul 14 03:13 . +drwxr-xr-x. 2 root   root      280 May  8  2020 anaconda 
-drwxr-xr-x.   3 trainee trainee   4096 Jul 14 03:12 .. +drwx------. 2 root   root       23 Apr 23  2020 audit 
-drwxr-xr-x.  27 trainee trainee   4096 Jul 14 03:13 arch +-rw-------. 1 root   root        0 Jun  10:16 boot.log 
-drwxr-xr-x.   3 trainee trainee   4096 Jun 14 10:33 block +-rw-------. 1 root   root    19710 Apr 19 13:44 boot.log-20210419 
-drwxr-xr-x.   2 trainee trainee   4096 Jul 14 03:13 certs +-rw-------. 1 root   root     9548 May 26 09:35 boot.log-20210526 
--rw-r--r--.   trainee trainee  13079 Jun 14 10:33 .clang-format +-rw-------. 1 root   root     9491 Jun  2 07:40 boot.log-20210602 
--rw-r--r--.   trainee trainee     59 Jun 14 10:33 .cocciconfig +-rw-------. 1 root   root    38555 Jun  3 10:16 boot.log-20210603 
-drwxr-xr-x.   2 trainee trainee   4096 Jul 14 03:13 configs +-rw-rw----. 1 root   utmp     1152 Jun  3 09:51 btmp 
--rw-r--r--.   trainee trainee    423 Jun 14 10:33 COPYING-4.18.0 +-rw-rw----. 1 root   utmp      384 May 26 10:37 btmp-20210602 
--rw-r--r--.   trainee trainee  98651 Jun 14 10:33 CREDITS +drwxr-xr-x. 2 chrony chrony      6 Nov 19  2019 chrony 
-drwxr-xr-x.   4 trainee trainee   4096 Jun 14 10:33 crypto +-rw-------. 1 root   root    35397 Jun  10:22 cron 
-drwxr-xr-x119 trainee trainee   4096 Jul 14 03:13 Documentation +-rw-------. 1 root   root     5652 Apr 19 13:01 cron-20210419 
-drwxr-xr-x137 trainee trainee   4096 Jun 14 10:33 drivers +-rw-------. 1 root   root    16279 May 26 09:01 cron-20210526 
-drwxr-xr-x.   trainee trainee   4096 Jul 14 03:13 firmware +-rw-------. 1 root   root     5117 Jun  07:01 cron-20210602 
-drwxr-xr-x 73 trainee trainee   4096 Jun 14 10:33 fs +-rw-------. 1 root   root    13577 Jun  10:12 dnf.librepo.log 
--rw-r--r--.   trainee trainee     68 Jun 14 10:33 .get_maintainer.conf +-rw-r--r--. 1 root   root    43871 Apr 19 13:15 dnf.librepo.log-20210419 
--rw-r--r--.   trainee trainee     31 Jun 14 10:33 .get_maintainer.ignore +-rw-------. 1 root   root    89109 May 26 08:54 dnf.librepo.log-20210526 
--rw-r--r--.   trainee trainee     76 Jun 14 10:33 .gitattributes +-rw-------. 1 root   root    17737 Jun  2 07:18 dnf.librepo.log-20210602 
--rw-r--r--.   trainee trainee   1639 Jun 14 10:33 .gitlab-ci-private.yml +-rw-r--r--. 1 root   root   749350 Jun  10:12 dnf.log 
--rw-r--r--.   trainee trainee   1668 Jun 14 10:33 .gitlab-ci.yml +-rw-r--r--. 1 root   root   138497 Jun  10:12 dnf.rpm.log 
-drwxr-xr-x 30 trainee trainee   4096 Jun 14 10:33 include +-rw-r-----. 1 root   root     3808 Jun  3 09:01 firewalld 
-drwxr-xr-x.   trainee trainee   4096 Jun 14 10:33 init +drwxr-xr-x. 2 root   root        6 Nov  3  2020 glusterfs 
-drwxr-xr-x.   2 trainee trainee   4096 Jun 14 10:33 ipc +-rw-------. 1 root   root      510 Jun  3 09:58 hawkey.log 
--rw-r--r--.   trainee trainee   2245 Jun 14 10:33 Kbuild +-rw-r--r--. 1 root   root      561 Apr 19 12:13 hawkey.log-20210419 
--rw-r--r--.   trainee trainee    575 Jun 14 10:33 Kconfig +-rw-------. 1 root   root     3927 May 26 08:54 hawkey.log-20210526 
-drwxr-xr-x 19 trainee trainee   4096 Jul 14 03:13 kernel +-rw-------. 1 root   root      306 Jun  2 06:17 hawkey.log-20210602 
-drwxr-xr-x.  20 trainee trainee  12288 Jul 14 03:13 lib +-rw-rw-r--. 1 root   utmp   293168 Jun  3 09:01 lastlog 
-drwxr-xr-x.   5 trainee trainee   4096 Jun 14 10:33 LICENSES +drwx------. 3 root   root       18 Apr 19 12:07 libvirt 
--rw-r--r--.   trainee trainee   9559 Jun 14 10:33 .mailmap +-rw-------. 1 root   root        0 Jun  2 07:40 maillog 
--rw-r--r--.   trainee trainee 471696 Jun 14 10:33 MAINTAINERS +-rw-------. 1 root   root        0 May  8  2020 maillog-20210419 
--rw-r--r--.   trainee trainee  61558 Jun 14 10:33 Makefile +-rw-------. root   root        0 Apr 19 13:44 maillog-20210526 
--rw-r--r--.   trainee trainee   1324 Jun 14 10:33 Makefile.rhelver +-rw-------. 1 root   root        0 May 26 09:35 maillog-20210602 
--rw-r--r--.   trainee trainee      0 Jul 14 03:13 .mismatches +-rw-------. 1 root   root   452404 Jun  10:22 messages 
-drwxr-xr-x.   3 trainee trainee   4096 Jun 14 10:33 mm +-rw-------. 1 root   root   397916 Apr 19 13:15 messages-20210419 
-drwxr-xr-x.  72 trainee trainee   4096 Jun 14 10:33 net +-rw-------1 root   root   173289 May 26 09:19 messages-20210526 
--rw-r--r--.   trainee trainee    800 Jun 14 10:33 README +-rw-------. 1 root   root   123100 Jun  2 07:38 messages-20210602 
-drwxr-xr-x 28 trainee trainee   4096 Jun 14 10:33 samples +drwx------. 2 root   root        6 May  8  2020 private 
--rw-r--r--.   trainee trainee      Jul 14 03:12 .scmversion +drwx------. 3 root   root       17 Aug 17  2020 samba 
-drwxr-xr-x.  14 trainee trainee   4096 Jul 14 03:13 scripts +-rw-------. 1 root   root     6554 Jun  3 09:51 secure 
-drwxr-xr-x 10 trainee trainee   4096 Jun 14 10:33 security +-rw-------. 1 root   root    10835 Apr 19 12:07 secure-20210419 
-drwxr-xr-x.  26 trainee trainee   4096 Jun 14 10:33 sound +-rw-------. root   root    11884 May 26 08:49 secure-20210526 
-drwxr-xr-x.  33 trainee trainee   4096 Jun 14 10:33 tools +-rw-------. 1 root   root     3633 Jun  2 06:40 secure-20210602 
-drwxr-xr-x.   trainee trainee   4096 Jul 14 03:13 usr +-rw-------. 1 root   root        Jun  2 07:40 spooler 
-drwxr-xr-x.   4 trainee trainee   4096 Jun 14 10:33 virt+-rw-------. 1 root   root        0 May  8  2020 spooler-20210419 
 +-rw-------. 1 root   root        0 Apr 19 13:44 spooler-20210526 
 +-rw-------. 1 root   root        0 May 26 09:35 spooler-20210602 
 +drwxr-x---2 sssd   sssd      270 Jun  10:16 sssd 
 +drwxr-xr-x. 3 root   root       21 Apr 19 12:07 swtpm 
 +drwxr-xr-x. 2 root   root       23 Jan  4 11:24 tuned 
 +-rw-rw-r--. 1 root   utmp    34176 Jun  3 09:51 wtmp
 </code> </code>
  
-===Le Fichier .config===+=====LAB #2 - rsyslog=====
  
-Changez de répertoire de travail :+**rsyslog**, le successeur de syslog, centralise les journaux du système grâce au daemon **rsyslog**. 
  
-<code> +rsyslog apporte des améliorations par rapport à syslogd : 
-[trainee@centos8 SPECS]$ cd ~/rpmbuild/BUILD/kernel-*/linux-*/ +
-</code>+
  
-Copiez le fichier **configs/kernel-4.18.0-`uname -m`.config** vers **.config** dans le répertoire courant :+  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
  
-<code> +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**.
-[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ cp configs/kernel-4.18.0-`uname -m`.config .config +
-</code>+
  
-Mettez à jour le fichier .config par rapport à la configuration actuelle du noyau :+rsyslog décide ensuite de l'**action** à entreprendre concernant les informations transmises : 
 + 
 +  * 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/CentOS, le daemon rsyslog est configuré par l'édition du fichier **/etc/sysconfig/rsyslog** :
  
 <code> <code>
-[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ make oldconfig +[root@centos8 ~]# cat /etc/sysconfig/rsyslog 
-scripts/kconfig/conf  --oldconfig Kconfig +Options for rsyslogd 
-+Syslogd options are deprecated since rsyslog v3
-configuration written to .config +If you want to use them, switch to compatibility mode 2 by "-c 2" 
-#+# See rsyslogd(8) for more details 
 +SYSLOGD_OPTIONS=""
 </code> </code>
  
-<WRAP center round important 60%> +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 :
-**Important** - Cette commande lit le fichier .config du noyau actuel et le compare avec celui des sources du noyau. S'il existent des nouvelles configurations à effectuer dans les sources du noyau, la commande vous pose des questions. +
-</WRAP>+
  
-La configuration du noyau se trouve dans un fichier dénommé **.config**. Le fichier **.config** est généré par une des trois commandes suivantes et ne doit **pas** être édité manuellement :+^ Directive ^ Version ^ 
 +| SYSLOGD_OPTIONS="-c 4" | Mode natif - aucune compatibilité | 
 +| SYSLOGD_OPTIONS="-c 2" | rsyslog V2 - mode compatibilité | 
 +| SYSLOGD_OPTIONS="-c 0" | syslogd |
  
-  * make config +====2.1 - Priorités====
-  * make menuconfig +
-  * make xconfig +
-   +
-Exécutez la commande **make menuconfig** :+
  
-<code> +La **Priorité** permet d'indiquer à rsyslog l'importance des informations :
-[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ make menuconfig +
-  UPD     scripts/kconfig/.mconf-cfg +
-  HOSTCC  scripts/kconfig/mconf.o +
-  HOSTCC  scripts/kconfig/lxdialog/checklist.o +
-  HOSTCC  scripts/kconfig/lxdialog/inputbox.o +
-  HOSTCC  scripts/kconfig/lxdialog/menubox.o +
-  HOSTCC  scripts/kconfig/lxdialog/textbox.o +
-  HOSTCC  scripts/kconfig/lxdialog/util.o +
-  HOSTCC  scripts/kconfig/lxdialog/yesno.o +
-  HOSTLD  scripts/kconfig/mconf +
-scripts/kconfig/mconf  Kconfig +
-+
-# using defaults found in /boot/config-4.18.0-305.7.1.el8_4.x86_64 +
-+
-</code>+
  
-Dans l'interface, vous pouvez constater la présence de lignes correspondantes à des fonctionalités suivies par une lettre ou une valeur. Dans le cas d'une lettre, la signification est la suivante :+^ 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 | 
 +| 6 | info | Condition normale - message simple | 
 +| 7 | debug | Condition normale - message de débogage | 
  
-  * **y**, +====2.2 - Sous-systèmes applicatifs====
-    * la fonctionalité est incluse dans le noyau monolithique ou dans le cas d'une dépendance d'un module, dans le module concerné, +
-  * **m**, +
-    * la fonctionalité est incluse en tant que module, +
-  * **n**, +
-    * la fonctionalité n'est pas incluse.+
  
-<WRAP center round important 60%> +Le **Sous-système applicatif**, aussi appelé **facility**, permet d'indiquer à rsyslog le type de programme qui envoie les informations :
-**Important** - Cette commande permet la modification de la configuration du noyau. +
-</WRAP> +
-  +
-Sauvegardez simplement la configuration actuelle et sortez de l'interface :+
  
-<code> +^ Fonction ^ Description ^ 
-*** End of the configuration. +| auth/auth-priv | Message de sécurité / autorisation | 
-*** Execute 'maketo start the build or try 'make help'. +| cron | Message de cron ou at | 
-</code>+| 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 |
  
-Vérifiez que le fichier **.config** a été" créé par l'exécution de makeconfig : 
  
-<code> +====2./etc/rsyslog.conf====
-[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ ls -a +
-.      certs          configs         Documentation  .get_maintainer.conf    .gitlab-ci.yml  Kbuild   LICENSES     Makefile.rhelver  README       security  virt +
-..     .clang-format  COPYING-4.18.0  drivers        .get_maintainer.ignore  include         Kconfig  .mailmap     .mismatches       samples      sound +
-arch   .cocciconfig   CREDITS         firmware       .gitattributes          init            kernel   MAINTAINERS  mm                .scmversion  tools +
-block  .config        crypto          fs             .gitlab-ci-private.yml  ipc             lib      Makefile     net               scripts      usr +
-</code>+
  
-Consultez ce fichier :+rsyslog est configuré par le fichier **/etc/rsyslog.conf** :
  
 <code> <code>
-[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ more .config +[root@centos8 ~]# cat /etc/rsyslog.conf 
-# +rsyslog configuration file
-# Automatically generated file; DO NOT EDIT. +
-# Linux/x86 4.18.0 Kernel Configuration +
-#+
  
-+For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html 
-Compilergcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) +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
-CONFIG_64BIT=y +
-CONFIG_X86_64=y +
-CONFIG_X86=y +
-CONFIG_INSTRUCTION_DECODER=y +
-CONFIG_OUTPUT_FORMAT="elf64-x86-64" +
-CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig" +
-CONFIG_LOCKDEP_SUPPORT=y +
-CONFIG_STACKTRACE_SUPPORT=y +
-CONFIG_MMU=y +
-CONFIG_ARCH_MMAP_RND_BITS_MIN=28 +
-CONFIG_ARCH_MMAP_RND_BITS_MAX=32 +
-CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 +
-CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 +
-CONFIG_GENERIC_ISA_DMA=y +
-CONFIG_GENERIC_BUG=y +
-CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y +
-CONFIG_GENERIC_HWEIGHT=y +
-CONFIG_ARCH_MAY_HAVE_PC_FDC=y +
-CONFIG_GENERIC_CALIBRATE_DELAY=y +
-CONFIG_ARCH_HAS_CPU_RELAX=y +
-CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y +
-CONFIG_ARCH_HAS_FILTER_PGPROT=y +
-CONFIG_HAVE_SETUP_PER_CPU_AREA=y +
-CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y +
-CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y +
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y +
-CONFIG_ARCH_SUSPEND_POSSIBLE=y +
-CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y +
-CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +
-CONFIG_ZONE_DMA32=y +
-CONFIG_AUDIT_ARCH=y +
-CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y +
-CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +
-CONFIG_HAVE_INTEL_TXT=y +
-CONFIG_X86_64_SMP=y +
---More--(0%) +
-</code>+
  
-===Le Fichier Makefile===+#### MODULES ####
  
-Le fichier **Makefile** contient le nom du noyau et spécifie les informations suivantes :+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 
 +       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
  
-  * VERSION, +# Provides UDP syslog reception 
-  * PATCHLEVEL, +# for parameters see http://www.rsyslog.com/doc/imudp.html 
-  * SUBLEVEL, +#module(load="imudp") # needs to be done just once 
-  * EXTRAVERSION.+#input(type="imudp" port="514")
  
-Les trois premières informations sont gérées par **kernel.org** et Linus Torvalds en personne tandis que l'EXTRAVERSION est gérée par Red Hat :+# Provides TCP syslog reception 
 +# for parameters see http://www.rsyslog.com/doc/imtcp.html 
 +#module(load="imtcp") # needs to be done just once 
 +#input(type="imtcp" port="514")
  
-<code> +#### GLOBAL DIRECTIVES ####
-[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ more Makefile +
-SPDX-License-Identifier: GPL-2.0 +
-VERSION = 4 +
-PATCHLEVEL = 18 +
-SUBLEVEL = 0 +
-EXTRAVERSION = +
-NAME = Merciless Moray+
  
-+Where to place auxiliary files 
-# DRM backport version +global(workDirectory="/var/lib/rsyslog")
-+
-RHEL_DRM_VERSION = 5 +
-RHEL_DRM_PATCHLEVEL = 9 +
-RHEL_DRM_SUBLEVEL 14+
  
-*DOCUMENTATION* +Use default timestamp format 
-# To see a list of typical targets execute "make help" +module(load="builtin:omfileTemplate="RSYSLOG_TraditionalFileFormat")
-# More info can be located in ./README +
-# Comments in this file are targeted only to the developer, do not +
-# expect to learn how to build the kernel reading this file.+
  
-That's our default target when none is given on the command line +Include all config files in /etc/rsyslog.d/ 
-PHONY :_all +include(file="/etc/rsyslog.d/*.conf" mode="optional")
-_all:+
  
-o Do not use make's built-in rules and variables +#### RULES ####
-  (this increases performance and avoids hard-to-debug behaviour); +
-o Look for make include files relative to root of kernel src +
-MAKEFLAGS += -rR --include-dir=$(CURDIR)+
  
-Avoid funny character set dependencies +Log all kernel messages to the console. 
-unexport LC_ALL +# Logging much else clutters up the screen. 
-LC_COLLATE=C +#kern.*                                                 /dev/console
-LC_NUMERIC=C +
-export LC_COLLATE LC_NUMERIC+
  
-Avoid interference with shell env settings +Log anything (except mail) of level info or higher. 
-unexport GREP_OPTIONS+# Don't log private authentication messages! 
 +*.info;mail.none;authpriv.none;cron.none                /var/log/messages
  
-Set RHEL variables +The authpriv file has restricted access. 
-# Use this spot to avoid future merge conflicts +authpriv.*                                              /var/log/secure
-include Makefile.rhelver+
  
-We are using a recursive build, so we need to do a little thinking +Log all the mail messages in one place. 
---Plus--(2%) +mail.*                                                  -/var/log/maillog
-</code>+
  
-<WRAP center round important 60%> 
-**Important** - La version 2.6 du noyau a vu le jour en **2003**. Les **SUBLEVEL** se suivaient régulièrement. Avec la version 2.6 du noyau, la valeur paire du **PATCHLEVEL** indiquait que le noyau était stable. Quand vous recompilez le noyau à partir des sources, vous devez modifier la valeur de l'EXTRAVERSION.  Le passage à la version 3.0 fut décidé par Linus Torvalds à l'occasion des 20 ans du noyau Linux. Depuis l'arrivée de la version 3 du noyau, la signification de la valeur de PATCHLEVEL paire et impaire a été abondonnée. 
-</WRAP> 
  
-====2.4 - Paramétrage du noyau====+# Log cron stuff 
 +cron.*                                                  /var/log/cron
  
-Insérez la sortie de la commande **uname -i** sur la première ligne du fichier .config :+# Everybody gets emergency messages 
 +*.emerg                                                 :omusrmsg:*
  
-<code> +Save news errors of level crit and higher in a special file. 
-[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ uname -i +uucp,news.crit                                          /var/log/spooler
-x86_64 +
-[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ vi .config +
-[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ head .config +
-x86_64 +
-+
-# Automatically generated file; DO NOT EDIT+
-# Linux/x86 4.18.0 Kernel Configuration +
-#+
  
-+Save boot messages also to boot.log 
-# Compiler: gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) +local7.*                                                /var/log/boot.log
-+
-CONFIG_64BIT=y +
-</code>+
  
-Renommez le fichier .config en le plaçant dans le répertoire **~/rpmbuild/SOURCES/** : 
  
-<code> +# ### sample forwarding rule ### 
-[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ cp .config ~/rpmbuild/SOURCES/config-`uname -m`-generic +#action(type="omfwd"   
-[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ ls ~/rpmbuild/SOURCES +# An on-disk queue is created for this actionIf the remote host is 
-centos-ca-secureboot.der  cpupower.config            filter-x86_64.sh                           kernel-s390x.config                mod-extra.list           Module.kabi_s390x +# down, messages are spooled to disk and sent when it is up again
-centos-dup.x509           cpupower.service           generate_all_configs.sh                    kernel-s390x-debug.config          mod-internal.list        Module.kabi_x86_64 +#queue.filename="fwdRule1"       # unique name prefix for spool files 
-centos-kpatch.x509        debrand-rh-i686-cpu.patch  generate_bls_conf.sh                       kernel-s390x-zfcpdump.config       mod-sign.sh              parallel_xz.sh +#queue.maxdiskspace="1g"         # 1gb space limit (use as much as possible) 
-centos.pem                debrand-rh_taint.patch     kernel-aarch64.config                      kernel-x86_64.config               Module.kabi_aarch64      process_configs.sh +#queue.saveonshutdown="on"       # save messages to disk on shutdown 
-centossecureboot001.der   debrand-single-cpu.patch   kernel-aarch64-debug.config                kernel-x86_64-debug.config         Module.kabi_dup_aarch64  x509.genkey +#queue.type="LinkedList"         # run asynchronously 
-centossecureboot201.der   filter-aarch64.sh          kernel-abi-stablelists-4.18.0-305.tar.bz2  kvm_stat.logrotate                 Module.kabi_dup_ppc64le +#action.resumeRetryCount="-1"    # infinite retries if host is down 
-centossecurebootca2.der   filter-modules.sh          kernel-kabi-dw-4.18.0-305.tar.bz2          linux-4.18.0-305.7.1.el8_4.tar.xz  Module.kabi_dup_s390x +# Remote Logging (we use TCP for reliable delivery) 
-check-kabi                filter-ppc64le.sh          kernel-ppc64le.config                      linux-kernel-test.patch            Module.kabi_dup_x86_64 +# remote_host is: name/ip, e.g192.168.0.1, port optional e.g10514 
-config-x86_64-generic     filter-s390x.sh            kernel-ppc64le-debug.config                mod-blacklist.sh                   Module.kabi_ppc64le+#Target="remote_host" Port="XXX" Protocol="tcp")
 </code> </code>
  
-Copiez le contenu du répertoire **configs** vers le répertoire **~/rpmbuild/SOURCES/** :+Ce fichier est divisé en 3 parties :
  
-<code> +  * **Modules**, 
-[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ cp configs/~/rpmbuild/SOURCES+    Section traitant le chargement des modules offrant des fonctionnalités étendues à rsyslog, 
-</code>+  * **Directives Globales** (//Global Directives//), 
 +    * Section traitant les options de comportement global du service rsyslog, 
 +  * **Règles** (//Rules//), 
 +    * Section traitant les règles de configuration des journaux. Les règles au format syslogd gardent le même format. Les nouvelles règles, compatibles seulement avec rsyslog commencent par **module**.
  
-Editez la directive **buildid** dans le fichier **~/rpmbuild/SPECS/kernel.spec** :+===Modules===
  
-<code> +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 :
-[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ cd ~/rpmbuild/SPECS+
  
-[trainee@centos8 SPECS]$ vi kernel.spec+^ Module ^ Fonction ^ 
 +| 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** |
  
-[trainee@centos8 SPECS]$ head -n 50 kernel.spec +Dans le fichier **/etc/rsyslog.conf** nous pouvons constater que les inputs **module(load="imuxsock" SysSock.Use="off")** et **module(load="imjournal" StateFile="imjournal.state")** sont activés :
-# We have to override the new %%install behavior because, well... the kernel is special. +
-%global __spec_install_pre %{___build_pre}+
  
-# At the time of this writing (2019-03), RHEL8 packages use w2.xzdio +<file> 
-# compression for rpms (xz, level 2)+..
-Kernel has several large (hundreds of mbytes) rpms, they take ~5 mins +#### MODULES ####
-to compress by single-threaded xz. Switch to threaded compression, +
-and from level 2 to 3 to keep compressed sizes close to "w2" results. +
-# +
-NB: if default compression in /usr/lib/rpm/redhat/macros ever changes, +
-this one might need tweaking (e.g. if default changes to w3.xzdio, +
-change below to w4T.xzdio): +
-%define _binary_payload w3T.xzdio+
  
-For a kernel released for public testing, released_kernel should be 1+module(load="imuxsock"   provides support for local system logging (e.g. via logger command) 
-For internal testing builds during development, it should be 0+       SysSock.Use="off"Turn off message reception via local log socket;  
-%global released_kernel 1+   # local messages are retrieved through imjournal now
 +module(load="imjournal"     # provides access to the systemd journal 
 +       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
  
-%global distro_build 305+# 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")
  
-Sign the x86_64 kernel for secure boot authentication +Provides TCP syslog reception 
-%ifarch x86_64 aarch64 +# for parameters see http://www.rsyslog.com/doc/imtcp.html 
-%global signkernel 1 +#module(load="imtcp") # needs to be done just once 
-%else +#input(type="imtcp" port="514") 
-%global signkernel 0 +... 
-%endif+</file>
  
-# Sign modules on all arches +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 :
-%global signmodules 1+
  
-# Compress modules only for architectures that build modules +<file> 
-%ifarch noarch +... 
-%global zipmodules 0 +# Provides UDP syslog reception 
-%else +# for parameters see http://www.rsyslog.com/doc/imudp.html 
-%global zipmodules 1 +module(load="imudp") # needs to be done just once 
-%endif+input(type="imudp" port="514")
  
-%if %{zipmodules} +# Provides TCP syslog reception 
-%global zipsed -e 's/\.ko$/\.ko.xz/' +# for parameters see http://www.rsyslog.com/doc/imtcp.html 
-%endif+module(load="imtcp") # needs to be done just once 
 +input(type="imtcp" port="514"
 +... 
 +</file>
  
-%define buildid .i2tch+<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>
  
-%define rpmversion 4.18.0 +Pour envoyer l'ensemble des traces de journalisation vers un serveur rsyslog distant, il convient de décommenter et modifier une ligne dans la section suivante du fichier **/etc/rsyslog.conf** :
-%define pkgrelease 305.7.1.el8_4+
  
-allow pkg_release to have configurable %%{?dist} tag +<file> 
-%define specrelease 305.7.1%{?dist}+... 
 +### 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="514" Protocol="tcp"
 +... 
 +</file>
  
-%define pkg_release %{specrelease}%{?buildid} +<WRAP center round important 60%
-</code>+**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.5 - Compiler le Noyau====+===Directives Globales===
  
-La compilation du noyau peut prendre beaucoup de temps (~5 heures)La commande utilisée est la suivante :+Les directives dans cette section servent à configurer le comportement de rsyslogPar exemple, nous pouvons constater la présence de la directive suivante :
  
-<code+<file
-[trainee@centos7 SPECS]$ rpmbuild -bb --target=`uname -m` kernel.spec 2> build-err.log | tee build-out.log & +module(load="builtin:omfile" Template="RSYSLOG_TraditionalFileFormat") 
-</code>+</file>
  
-<WRAP center round important 60%> +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.
-**Important** - La compilation peut prendre des heures. Arrêtez donc le processus avec les touches ^C. Arrêtez ensuite votre VM. Demandez à votre formateur de démarrer la VM contenant le noyau déjà compilé. +
-</WRAP>+
  
-A l'issu du processus, les RPMs se trouvent dans le répertoire **/home/trainee/rpmbuild/RPMS/x86_64/** :+===Règles===
  
-<code> +Chaque règle prend la forme suivante :
-... +
-Wrote/home/trainee/rpmbuild/RPMS/x86_64/kernel-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-headers-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-cross-headers-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-debuginfo-common-x86_64-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/perf-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/perf-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/python3-perf-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/python3-perf-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-tools-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-tools-libs-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-tools-libs-devel-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-tools-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/bpftool-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/bpftool-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-selftests-internal-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-debug-core-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-debug-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-debug-devel-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-debug-modules-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-debug-modules-extra-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-debug-modules-internal-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-debug-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-core-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-devel-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-modules-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-modules-extra-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-modules-internal-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-ipaclones-internal-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.rkOgfs+
  
-[1] Done                    rpmbuild -bb --target=`uname -m` kernel.spec 2> build-err.log | tee build-out.log +<file> 
-</code>+Sélecteur[; ...]  [-] Action 
 +</file>
  
-<code> +Un Sélecteur est défini d'une des façons suivantes :
-[trainee@centos8 SPECS]$ cd ../RPMS +
-[trainee@centos8 RPMS]$ ls +
-x86_64 +
-[trainee@centos8 RPMS]$ cd x86_64/ +
-[trainee@centos8 x86_64]$ ls +
-bpftool-4.18.0-305.7.1.el8.i2tch.x86_64.rpm                 kernel-debuginfo-common-x86_64-4.18.0-305.7.1.el8.i2tch.x86_64.rpm  kernel-selftests-internal-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-bpftool-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm       kernel-debug-modules-4.18.0-305.7.1.el8.i2tch.x86_64.rpm            kernel-tools-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-kernel-4.18.0-305.7.1.el8.i2tch.x86_64.rpm                  kernel-debug-modules-extra-4.18.0-305.7.1.el8.i2tch.x86_64.rpm      kernel-tools-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-kernel-core-4.18.0-305.7.1.el8.i2tch.x86_64.rpm             kernel-debug-modules-internal-4.18.0-305.7.1.el8.i2tch.x86_64.rpm   kernel-tools-libs-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-kernel-cross-headers-4.18.0-305.7.1.el8.i2tch.x86_64.rpm    kernel-devel-4.18.0-305.7.1.el8.i2tch.x86_64.rpm                    kernel-tools-libs-devel-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-kernel-debug-4.18.0-305.7.1.el8.i2tch.x86_64.rpm            kernel-headers-4.18.0-305.7.1.el8.i2tch.x86_64.rpm                  perf-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-kernel-debug-core-4.18.0-305.7.1.el8.i2tch.x86_64.rpm       kernel-ipaclones-internal-4.18.0-305.7.1.el8.i2tch.x86_64.rpm       perf-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-kernel-debug-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm  kernel-modules-4.18.0-305.7.1.el8.i2tch.x86_64.rpm                  python3-perf-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-kernel-debug-devel-4.18.0-305.7.1.el8.i2tch.x86_64.rpm      kernel-modules-extra-4.18.0-305.7.1.el8.i2tch.x86_64.rpm            python3-perf-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-kernel-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm        kernel-modules-internal-4.18.0-305.7.1.el8.i2tch.x86_64.rpm +
-</code>+
  
-Notez que la génération du nouveau noyau peut consommer jusqu'à 21 Go d'espace disque :+==Sous-système applicatif.Priorité==
  
-<code> +Dans ce cas on ne tient compte que des messages de priorité égale ou supérieure à la Priorité indiquée.
-[trainee@centos8 x86_64]$ df -h +
-Filesystem                   Size  Used Avail Use% Mounted on +
-devtmpfs                     1.8G      1.8G   0% /dev +
-tmpfs                        1.9G      1.9G   0% /dev/shm +
-tmpfs                        1.9G  9.4M  1.9G   1% /run +
-tmpfs                        1.9G      1.9G   0% /sys/fs/cgroup +
-/dev/mapper/cl_centos8-root   28G  5.5G   23G  20% / +
-/dev/sda1                    976M  289M  620M  32% /boot +
-tmpfs                        374M   24K  374M   1% /run/user/1000 +
-tmpfs                        374M  1.2M  373M   1% /run/user/42 +
-/dev/sdc1                     63G   21G   39G  35% /home +
-</code>+
  
-====2.6 Installer le Nouveau Noyau====+==Sous-système applicatif!Priorité==
  
-Installez maintenant les paquets **kernel***. L'installation du noyau peut prendre beaucoup de temps (~2 heures)La commande utilisée est la suivante : :+Dans ce cas on ne tient compte que des messages de priorité inférieure à la Priorité indiquée.
  
-<code> +==Sous-système applicatif=Priorité==
-[root@centos8 x86_64]# dnf localinstall kernel-*.rpm +
-Last metadata expiration check: 2:25:32 ago on Tue 20 Jul 2021 08:37:00 EDT. +
-Dependencies resolved. +
-=============================================================================================================================================================================================================== +
- Package                                                       Architecture                          Version                                                 Repository                                   Size +
-=============================================================================================================================================================================================================== +
-Installing: +
- kernel                                                        x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                5.9 M +
- kernel-core                                                   x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 36 M +
- kernel-cross-headers                                          x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 11 M +
- kernel-debug                                                  x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                5.9 M +
- kernel-debug-core                                             x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 63 M +
- kernel-debug-debuginfo                                        x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                683 M +
- kernel-debug-devel                                            x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 19 M +
- kernel-debug-modules                                          x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 54 M +
- kernel-debug-modules-extra                                    x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                7.2 M +
- kernel-debug-modules-internal                                 x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                6.3 M +
- kernel-debuginfo                                              x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                570 M +
- kernel-debuginfo-common-x86_64                                x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 75 M +
- kernel-devel                                                  x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 18 M +
- kernel-ipaclones-internal                                     x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 20 M +
- kernel-modules                                                x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 28 M +
- kernel-modules-extra                                          x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                6.5 M +
- kernel-modules-internal                                       x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                6.1 M +
- kernel-selftests-internal                                     x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 19 M +
- kernel-tools-debuginfo                                        x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                6.2 M +
- kernel-tools-libs-devel                                       x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                5.9 M +
-Downgrading: +
- kernel-headers                                                x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                7.1 M +
- kernel-tools                                                  x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                6.1 M +
- kernel-tools-libs                                             x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                5.9 M+
  
-Transaction Summary +Dans ce cas on ne tient compte que des messages de priorité égale à la Priorité indiquée.
-=============================================================================================================================================================================================================== +
-Install    20 Packages +
-Downgrade   3 Packages+
  
-Total size: 1.6 G +==L'utilisation du caractère spécial *==
-Is this ok [y/N]: y +
-</code>+
  
-A l'issu de l'installationre-démarrez la VM :+La valeur du Sous-système applicatif et/ou de la Priorité peut également être *****. Dans ce castoutes les valeurs possibles du **Sous-système applicatif** et/ou de la **Priorité** sont concernées, par exemple **cron.***.
  
-<code> +==n Sous-systèmes avec la même priorité==
-[root@centos7 ~]# reboot +
-</code>+
  
-Connectez-vous en tant que trainee et devenez root. Listez ensuite les noyaux installés :+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**.
  
-<code> +==n Sélecteurs avec la même Action==
-[root@centos8 ~]# rpm -qa | grep kernel +
-kernel-modules-4.18.0-305.3.1.el8.x86_64 +
-kernel-tools-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-headers-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-debug-core-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-modules-internal-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-modules-4.18.0-305.7.1.el8_4.x86_64 +
-kernel-debug-modules-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-devel-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-tools-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-tools-libs-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-debug-modules-internal-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-cross-headers-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-core-4.18.0-305.7.1.el8_4.x86_64 +
-kernel-devel-4.18.0-305.7.1.el8_4.x86_64 +
-kernel-debuginfo-common-x86_64-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-debug-modules-extra-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-debug-devel-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-tools-libs-devel-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-modules-extra-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-4.18.0-305.7.1.el8_4.x86_64 +
-kernel-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-core-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-selftests-internal-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-debug-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-debug-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-4.18.0-305.3.1.el8.x86_64 +
-kernel-core-4.18.0-305.3.1.el8.x86_64 +
-kernel-modules-4.18.0-305.7.1.el8.i2tch.x86_64 +
-kernel-ipaclones-internal-4.18.0-305.7.1.el8.i2tch.x86_64 +
-</code>+
  
-Constatez l'entrée **saved-entry** du fichier **/boot/grub2/grubenv** :+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 ~]# grep i2tch /boot/grub2/grubenv  
-saved_entry=95bd69e34a7444a7b58cb74fbfb86df2-4.18.0-305.7.1.el8.i2tch.x86_64 
-</code> 
  
-Dernièrement, vérifiez l'utilisation du nouveau noyau :+<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 ~]uname -+
-4.18.0-305.7.1.el8.i2tch.x86_64 +
-</code>+
  
-=====LAB #3 - Gestion des Quotas=====+La commande **/usr/bin/logger** permet d'intégrer des informations dans rsyslog. Ceci peut s'avérer utile dans des scripts bash.
  
-Sous Linux il est possible de mettre en place des quotas par utilisateur et par groupe. Ceci étant, Linux ne sait  pas gérer des quotas par répertoire, uniquement des  +La syntaxe de la commande est :
-quotas par partition. L'administrateur met souvent des quotas en place sur l'arborescence de /home pour limiter l'espace de stockage occupé par les utilisateurs.+
  
-Déconnectez-vous et reconnectez-vous **directement** en tant que root :+<file> 
 +logger -p Sous-système applicatif.Priorité message 
 +</file> 
 + 
 +Par exemple saisissez la commande suivante :
  
 <code> <code>
-root@computeXX:~# ssh -l root 10.0.2.45 +[root@centos8 ~]# logger -p user.info Linux est super
-root@10.0.2.45's password: fenestros +
-Activate the web console with: systemctl enable --now cockpit.socket +
- +
-Last login: Wed Jul 21 11:14:31 2021 +
-[root@centos8 ~]# +
 </code> </code>
  
-Avant de mettre en place des quotas, configurer SELINUX en mode **permissive** afin de ne pas avoir d'erreurs de ce dernier :+Consultez la fin de votre syslog :
  
 <code> <code>
-[root@centos8 ~]# getenforce +[root@centos8 ~]# tail /var/log/messages 
-Enforcing +Jun  3 12:55:01 centos8 systemd[1]: session-237.scope: Succeeded. 
-[root@centos8 ~]# setenforce permissive +Jun  3 12:56:01 centos8 systemd[1]: Started Session 238 of user trainee. 
-[root@centos8 ~]# getenforce +Jun  3 12:56:01 centos8 systemd[1]: session-238.scope: Succeeded. 
-Permissive +Jun  3 12:57:01 centos8 systemd[1]: Started Session 239 of user trainee. 
-[root@centos8 ~]+Jun  3 12:57:01 centos8 systemd[1]: session-239.scope: Succeeded. 
 +Jun  3 12:58:01 centos8 systemd[1]: Started Session 240 of user trainee. 
 +Jun  3 12:58:01 centos8 systemd[1]: session-240.scope: Succeeded. 
 +Jun  3 12:58:55 centos8 trainee[5139]: Linux est super 
 +Jun  3 12:59:01 centos8 systemd[1]: Started Session 241 of user trainee. 
 +Jun  3 12:59:01 centos8 systemd[1]: session-241.scope: Succeeded.
 </code> </code>
  
-Editez ensuite le fichier /etc/sysconfig/selinux ainsi :+Les options de la commande logger sont :
  
 <code> <code>
-[root@centos8 ~]# vi /etc/sysconfig/selinux +[root@centos8 ~]# logger --help
-[root@centos8 ~]# cat /etc/sysconfig/selinux+
  
-# This file controls the state of SELinux on the system. +Usage
-# SELINUX= can take one of these three values+ logger [options] [<message>]
-#     enforcing - SELinux security policy is enforced. +
-#     permissive - SELinux prints warnings instead of enforcing. +
-#     disabled - No SELinux policy is loaded. +
-SELINUX=permissive +
-# SELINUXTYPE= can take one of these three values: +
-#     targeted - Targeted processes are protected, +
-#     minimum - Modification of targeted policy. Only selected processes are protected.  +
-#     mls - Multi Level Security protection. +
-SELINUXTYPE=targeted+
  
-</code>+Enter messages into the system log.
  
-Commencez par vérifiez que le paquet **quota** est bien installé :+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
  
-<code> + -h, --help               display this help 
-[root@centos8 ~]# rpm -qa | grep quota + -V, --version            display version 
-quota-4.04-12.el8.x86_64 + 
-quota-nls-4.04-12.el8.noarch+For more details see logger(1).
 </code> </code>
  
-Editez le fichier **/etc/fstab** en ajoutant les options **usrquota** et **grpquota** à la ligne **/home** :+=====LAB #4 - La Commande logrotate===== 
 + 
 +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 ~]# vi /etc/fstab +[root@centos8 ~]# cat /etc/logrotate.conf 
-[root@centos8 ~]cat /etc/fstab+see "man logrotate" for details 
 +# rotate log files weekly 
 +weekly
  
-+keep 4 weeks worth of backlogs 
-# /etc/fstab +rotate 4
-# Created by anaconda on Wed Jun 16 06:21:32 2021 +
-+
-# Accessible filesystems, by reference, are maintained under '/dev/disk/'+
-# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info. +
-+
-# After editing this file, run 'systemctl daemon-reload' to update systemd +
-# units generated from this file. +
-+
-/dev/mapper/cl_centos8-root /                       xfs     defaults        0 0 +
-UUID=1c04981e-5317-4b73-9695-3ce25246835d /boot                   ext4    defaults        1 2 +
-/dev/mapper/cl_centos8-swap swap                    swap    defaults        0 0 +
-UUID=f76d6b66-985b-4a91-af9c-4987e8c1443c /home     ext4          defaults,usrquota,grpquota            1 2 +
-</code>+
  
-Redémarrez la VM :+# create new (empty) log files after rotating old ones 
 +create
  
-<code> +use date as a suffix of the rotated file 
-[root@centos8 ~]reboot +dateext
-</code>+
  
-Reconnectez-vous **directement** en tant que root :+# uncomment this if you want your log files compressed 
 +#compress
  
-<code> +RPM packages drop log rotation information into this directory 
-root@computeXX:~ssh -l root 10.0.2.45 +include /etc/logrotate.d
-root@10.0.2.45's password: fenestros +
-Activate the web console with: systemctl enable --now cockpit.socket+
  
-Last login: Wed Jul 21 11:19:46 2021 +system-specific logs may be also be configured here.
-[root@centos8 ~]+
 </code> </code>
  
-Vérifiez ensuite que les options **usrquota** et **grpquota** soient prises en compte :+Dans la première partie de ce fichier on trouve des directives pour :
  
-<code> +  * remplacer les fichiers journaux chaque semaine 
-[root@centos8 ~]# cat /etc/mtab | grep /home +  * garder 4 archives des fichiers journaux 
-/dev/sdc1 /home ext4 rw,seclabel,relatime,quota,usrquota,grpquota 0 0 +  * créer un nouveau fichier log une fois le précédent archivé 
-</code>+  * comprimer les archives créées.
  
-====3.1 - La Commande quotacheck====+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.
  
-Pour activer les quotas sur /home, il convient d'utiliser la commande **quotacheck** :+La deuxième partie du fichier concerne des configurations spécifiques pour certains fichiers journaux.
  
-<code+<WRAP center round important 60%
-[root@centos8 ~]# quotacheck -cugvm -f /dev/sdc1 +**Important** Notez que la compression des fichiers de journalisation n'est pas activée par défaut
-quotacheck: Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown. +</WRAP>
-quotacheck: Scanning /dev/sdc1 [/home] done +
-quotacheck: Cannot stat old user quota file /home/aquota.user: No such file or directory. Usage will not be subtracted. +
-quotacheck: Cannot stat old group quota file /home/aquota.group: No such file or directory. Usage will not be subtracted. +
-quotacheck: Cannot stat old user quota file /home/aquota.user: No such file or directory. Usage will not be subtracted. +
-quotacheck: Cannot stat old group quota file /home/aquota.group: No such file or directory. Usage will not be subtracted. +
-quotacheck: Checked 6763 directories and 129772 files +
-quotacheck: Old file not found. +
-quotacheckOld file not found+
-</code>+
  
-Les options de la commande quotacheck sont :+Les options de la commande logrotate sont :
  
 <code> <code>
-[root@centos8 ~]# quotacheck --help +[root@centos8 ~]# logrotate --help 
-Utility for checking and repairing quota files+Usage: logrotate [OPTION...] <configfile> 
-quotacheck [-gucbfinvdmMR] [-F <quota-format>] filesystem|-a+  -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 
 +  -v, --verbose             Display messages during rotation 
 +  -l, --log=logfile         Log file or 'syslog' to log to syslog 
 +      --version             Display version information
  
--u, --user                check user files +Help options: 
--g, --group               check group files +  -?, --help                Show this help message 
--c, --create-files        create new quota files +      --usage               Display brief usage message
--b, --backup              create backups of old quota files +
--f, --force               force check even if quotas are enabled +
--i, --interactive         interactive mode +
--n, --use-first-dquot     use the first copy of duplicated structure +
--v, --verbose             print more information +
--d, --debug               print even more messages +
--m, --no-remount          do not remount filesystem read-only +
--M, --try-remount         try remounting filesystem read-only, +
-                          continue even if it fails +
--R, --exclude-root        exclude root when checking all filesystems +
--F, --format=formatname   check quota files of specific format +
--a, --all                 check all filesystems +
--h, --help                display this message and exit +
--V, --version             display version information and exit +
- +
-Bugs to jack@suse.cz+
 </code> </code>
  
-Les quotas ont été activés et les fichier **aquota.user** et **aquota.group** ont été créés dans le répertoire /home :+=====LAB #5 - La Journalisation avec journald=====
  
-<code> +Sous RHEL/CentOS 8, 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** :
-[root@centos8 ~]# ls -la /home +
-total 40 +
-drwxr-xr-x 4 root    root     4096 Jul 21 11:27 . +
-dr-xr-xr-x. 17 root    root      224 Jul 19 12:05 .. +
--rw-------.  1 root    root     7168 Jul 21 11:27 aquota.group +
--rw-------.  1 root    root     7168 Jul 21 11:27 aquota.user +
-drwx------.  2 root    root    16384 Jul 19 12:02 lost+found +
-drwxr-xr-x. 17 trainee trainee  4096 Jul 21 11:22 trainee  +
-</code> +
- +
-Créez maintenant un utilisateur **fenestros** avec le mot de passe **fenestros** :+
  
 <code> <code>
-[root@centos8 ~]# groupadd fenestros && useradd fenestros -c FenestrOs -d /home/fenestros -g fenestros -s /bin/bash +[root@centos8 ~]# ls -/run/log/journal
-[root@centos8 ~]# passwd fenestros +total 0 
-Changing password for user fenestros. +drwxr-s---+ 2 root systemd-journal 60 Jun  3 09:01 de79af4f226d480fa7d3fec4cabbf97a
-New password:  +
-BAD PASSWORD: The password contains the user name in some form +
-Retype new password:  +
-passwdall authentication tokens updated successfully.+
 </code> </code>
  
-====3.2 - La Commande edquota====+A l'extinction de la machine les journaux sont **effacés**.
  
-Mettez en place maintenant un quota de 10Mo pour l'utilisateur **fenestros** :+Pour rendre les journaux permenants, il faut créer le répertoire **/var/log/journal** :
  
 <code> <code>
-[root@centos8 ~]# edquota -u fenestros -/home+[root@centos8 ~]# mkdir /var/log/journal 
 +[root@centos8 ~]# ls -l /var/log/journal/ 
 +total 0 
 +[root@centos8 ~]# systemctl restart systemd-journald 
 +[root@centos8 ~]# ls -l /run/log/journal/ 
 +ls: cannot access '/run/log/journal/': No such file or directory 
 +[root@centos8 ~]# ls -l /var/log/journal/ 
 +total 0 
 +drwxr-xr-x. 2 root root 28 Jun  3 13:03 de79af4f226d480fa7d3fec4cabbf97a
 </code> </code>
  
-L'éditeur **vi** se lance et vous obtiendrez un résultat similaire à celui-ci :+Journald ne peut pas envoyer les traces à un autre ordinateur. Pour utiliser un serveur de journalisation distant il faut donc inclure la directive **ForwardToSyslog=yes** dans le fichier de configuration de journald, **/etc/systemd/journald.conf**, puis configurer Rsyslog à envoyer les traces au serveur distant :
  
-<file+<code
-Disk quotas for user fenestros (uid 1001): +[root@centos8 ~]# cat /etc/systemd/journald.conf 
-  Filesystem                   blocks       soft       hard     inodes     soft     hard + This file is part of systemd. 
-  /dev/sdc1                                  0          0          0        0        0 +# 
-</file>+ 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. 
 +# You can change settings by editing this file. 
 +# Defaults can be restored by simply deleting this file. 
 +
 +# See journald.conf(5) for details.
  
-Modifiez ce fichier ainsi :+[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 
 +ForwardToSyslog=yes 
 +#ForwardToKMsg=no 
 +#ForwardToConsole=no 
 +#ForwardToWall=yes 
 +#TTYPath=/dev/console 
 +#MaxLevelStore=debug 
 +#MaxLevelSyslog=debug 
 +#MaxLevelKMsg=notice 
 +#MaxLevelConsole=info 
 +#MaxLevelWall=emerg 
 +#LineMax=48K 
 +</code>
  
-<file> +====5.1 - Consultation des Journaux====
-Disk quotas for user fenestros (uid 1001): +
-  Filesystem                   blocks       soft       hard     inodes     soft     hard +
-  /dev/sdc1                               8000      10000          0        0        0 +
-</file>+
  
-Sauvegardez et quittez le fichier. +L'utilisation de la commande **journalctl** permet la consultation des journaux :
- +
-Les options de la commande **edquota** sont :+
  
 <code> <code>
-[root@centos8 ~]# edquota --help +[root@centos8 ~]# journalctl 
-edquotaUsage: +-- Logs begin at Thu 2021-06-03 09:01:10 EDT, end at Thu 2021-06-03 13:08:01 EDT. -- 
-        edquota [-rm] [-u] [-F formatname] [-p username] [-f filesystem] username ... +Jun 03 09:01:10 centos8.ittraining.loc kernel: Linux version 4.18.0-240.22.1.el8_3.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Thu Apr 8 19:01:30 UTC 2021 
-        edquota [-rm] -g [-F formatname] [-p groupname] [-f filesystemgroupname ... +Jun 03 09:01:10 centos8.ittraining.loc kernel: Command line: BOOT_IMAGE=(hd0,msdos1)/vmlinuz-4.18.0-240.22.1.el8_3.x86_64 root=UUID=4c0cc28c-0d59-45be-bd73-d292b80be33c ro crashkernel=auto resume=UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4> 
-        edquota [-rm] -[-F formatname] [-p projectname] [-f filesystemprojectname ..+Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers' 
-        edquota [-u|g|-P] [-F formatname] [-f filesystem-t +Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers' 
-        edquota [-u|g|-P] [-F formatname] [-f filesystem-T username|groupname|projectname ... +Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers' 
- +Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256 
--u, --user                    edit user data +Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format
--g, --group                   edit group data +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-provided physical RAM map: 
--P, --project                 edit project data +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009fbffusable 
--r, --remote                  edit remote quota (via RPC) +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffffreserved 
--m, --no-mixed-pathnames      trim leading slashes from NFSv4 mountpoints +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffffreserved 
--F, --format=formatname       edit quotas of a specific format +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x0000000000100000-0x00000000dffeffffusable 
--p--prototype=name          copy data from a prototype user/group +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000dfff0000-0x00000000dfffffffACPI data 
-    --always-resolve          always try to resolve nameeven if it is +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fffreserved 
-                              composed only of digits +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fffreserved 
--f--filesystem=filesystem   edit data only on a specific filesystem +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffffreserved 
--t--edit-period             edit grace period +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x0000000100000000-0x000000011fffffffusable 
--T--edit-times              edit grace time of a user/group +Jun 03 09:01:10 centos8.ittraining.loc kernel: NX (Execute Disable) protection: active 
--h--help                    display this help text and exit +Jun 03 09:01:10 centos8.ittraining.loc kernel: SMBIOS 2.5 present
--V, --version                 display version information and exit +Jun 03 09:01:10 centos8.ittraining.loc kernel: DMI: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 
- +Jun 03 09:01:10 centos8.ittraining.loc kernel: Hypervisor detected: KVM 
-Bugs tojack@suse.cz+Jun 03 09:01:10 centos8.ittraining.loc kernel: kvm-clock: Using msrs 4b564d01 and 4b564d00 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: kvm-clock: cpu 0msr 114801001, primary cpu clock 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: kvm-clock: using sched offset of 5675771878 cycles 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffbmax_idle_ns: 881590591483 ns 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: tsc: Detected 1190.400 MHz processor 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: e820: update [mem 0x00000000-0x00000fff] usable ==> reserved 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: e820: remove [mem 0x000a0000-0x000fffff] usable 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: last_pfn = 0x120000 max_arch_pfn = 0x400000000 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: MTRR default type: uncachable 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: MTRR variable ranges disabled: 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: Disabled 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/PAT: MTRRs disabledskipping PAT initialization too. 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: CPU MTRRs all blank virtualized system. 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/PAT: Configuration [0-7]: WB  WT  UCUC  WB  WT  UCUC   
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: last_pfn = 0xdfff0 max_arch_pfn = 0x400000000 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: found SMP MP-table at [mem 0x0009fff0-0x0009ffff] 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: kexec: Reserving the low 1M of memory for crashkernel 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a010000x114a01fff] PGTABLE 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a020000x114a02fff] PGTABLE 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a03000, 0x114a03fff] PGTABLE 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a040000x114a04fff] PGTABLE 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a050000x114a05fff] PGTABLE 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a060000x114a06fff] PGTABLE 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a070000x114a07fff] PGTABLE 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a080000x114a08fff] PGTABLE 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a09000, 0x114a09fff] PGTABLE 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: RAMDISK: [mem 0x34e00000-0x366f7fff] 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: Early table checksum verification disabled 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: RSDP 0x00000000000E0000 000024 (v02 VBOX  ) 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: XSDT 0x00000000DFFF0030 00003C (v01 VBOX   VBOXXSDT 00000001 ASL  00000061) 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: FACP 0x00000000DFFF00F0 0000F4 (v04 VBOX   VBOXFACP 00000001 ASL  00000061) 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: DSDT 0x00000000DFFF0480 002325 (v02 VBOX   VBOXBIOS 00000002 INTL 20190509) 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: FACS 0x00000000DFFF0200 000040 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: FACS 0x00000000DFFF0200 000040 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: APIC 0x00000000DFFF0240 00006C (v02 VBOX   VBOXAPIC 00000001 ASL  00000061) 
 +lines 1-57
 </code> </code>
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important** - Pour mettre en place un quota par groupla procédure est similaire. Il suffit d'utiliser l'option -g de la commande edquota.+**Important** : Notez que les messages importants sont en graspar exemple les messages de niveaux **notice** ou **warning** et que les messages graves sont en rouge.
 </WRAP> </WRAP>
  
-====3.La Commande quotaon====+====5.Consultation des Journaux d'une Application Spécifique====
  
-Appliquez maintenant les quotas :+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 ~]# quotaon -a+[root@centos8 ~]# journalctl /sbin/anacron 
 +-- Logs begin at Thu 2021-06-03 09:01:10 EDT, end at Thu 2021-06-03 13:10:01 EDT. -- 
 +Jun 03 10:01:01 centos8.ittraining.loc anacron[2575]: Anacron started on 2021-06-03 
 +Jun 03 10:01:01 centos8.ittraining.loc anacron[2575]: Will run job `cron.daily' in 15 min. 
 +Jun 03 10:01:01 centos8.ittraining.loc anacron[2575]: Jobs will be executed sequentially 
 +Jun 03 10:16:01 centos8.ittraining.loc anacron[2575]: Job `cron.daily' started 
 +Jun 03 10:16:01 centos8.ittraining.loc anacron[2575]: Job `cron.daily' terminated 
 +Jun 03 10:16:01 centos8.ittraining.loc anacron[2575]: Normal exit (1 job run)
 </code> </code>
- 
-Les options de la commande **quotaon** sont : 
- 
-<code> 
-[root@centos8 ~]# quotaon --help 
-quotaon: Usage: 
-        quotaon [-guPvp] [-F quotaformat] [-x state] -a 
-        quotaon [-guPvp] [-F quotaformat] [-x state] filesys ... 
- 
--a, --all                turn quotas on for all filesystems 
--f, --off                turn quotas off 
--u, --user               operate on user quotas 
--g, --group              operate on group quotas 
--P, --project            operate on project quotas 
--p, --print-state        print whether quotas are on or off 
--x, --xfs-command=cmd    perform XFS quota command 
--F, --format=formatname  operate on specific quota format 
--v, --verbose            print more messages 
--h, --help               display this help text and exit 
--V, --version            display version information and exit 
-</code> 
- 
-De cette manière vous avez mis en place un quota **souple** pour fenestros de 8 000 Ko et un quota **stricte** de 10 000 Ko.  
- 
-Quand l'utilisateur fenestros aura dépassé le quota **souple**, il recevra un message d'avertissement. Quand il dépasse le quota **stricte**, il ne pourra plus enregistrer dans /home, sauf dans le cas où il supprime des fichiers pour retomber en dessous de la limite **stricte**. 
- 
-Il est à noter que vous pouvez soit mettre en place un quota en taille, soit mettre en place un quota basé sur le nombre d'inodes utilisés par l'utilisateur. 
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**important** - La commande pour désactivez les quotas est **quotaoff**. +**Important** : Rappelez-vous que sous RHEL/CentOS 8 le répertoire **/sbin** est un lien symbolique vers **/usr/sbin**.
 </WRAP> </WRAP>
  
-====3.La Commande repquota====+====5.Consultation des Journaux depuis le Dernier Démarrage====
  
-Pour visualiser les quotas utilisez la commande **repquota** :+Pour consulter les entrées depuis le dernier démarrage, il suffit d'utiliser l'option **-b** de la commande journalctl 
  
 <code> <code>
-[root@centos8 ~]# repquota /home +[root@centos8 ~]# journalctl -b | more 
-*** Report for user quotas on device /dev/sdc1 +-- Logs begin at Thu 2021-06-03 09:01:10 EDT, end at Thu 2021-06-03 13:11:01 EDT. -- 
-Block grace time: 7days; Inode grace time: 7days +Jun 03 09:01:10 centos8.ittraining.loc kernel: Linux version 4.18.0-240.22.1.el8_3.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 
-                        Block limits                File limits + 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Thu Apr 8 19:01:30 UTC 2021 
-User            used    soft    hard  grace    used  soft  hard  grace +Jun 03 09:01:10 centos8.ittraining.loc kernel: Command line: BOOT_IMAGE=(hd0,msdos1)/vmlinuz-4.18.0-240.22.1.el8_3.x86_64 root=UUID=4c0cc28 
----------------------------------------------------------------------- +c-0d59-45be-bd73-d292b80be33c ro crashkernel=auto resume=UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 rhgb quiet 
-root      --      20                          2                +Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers' 
-trainee   -- 21495888                     136532                      +Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers' 
-   +Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers' 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format. 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-provided physical RAM map: 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x0000000000100000-0x00000000dffeffff] usable 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000dfff0000-0x00000000dfffffff] ACPI data 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x0000000100000000-0x000000011fffffff] usable 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: NX (Execute Disable) protection: active 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: SMBIOS 2.5 present. 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: DMI: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: Hypervisor detected: KVM 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: kvm-clock: Using msrs 4b564d01 and 4b564d00 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: kvm-clock: cpu 0, msr 114801001, primary cpu clock 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: kvm-clock: using sched offset of 5675771878 cycles 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881 
 +590591483 ns 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: tsc: Detected 1190.400 MHz processor 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: e820: update [mem 0x00000000-0x00000fff] usable ==> reserved 
 +--More--
 </code> </code>
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important** Notez que l'utilisateur fenestros ne figure pas dans la liste. Sous RHEL / CentOSle quota n'est pas visible tant que l'utilisateur ne s'est pas connecté pour la première fois+**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> </WRAP>
  
-Les options de la commande **repquota** sont :+====5.4 - Consultation des Journaux d'une Priorité Spécifique==== 
 + 
 +Pour consulter les entrées à partir d'une priorité spécifique et supérieur, il suffit d'utiliser l'option **-p** de la commande journalctl en spécifiant la priorité concernée 
  
 <code> <code>
-[root@centos8 ~]# repquota --help +[root@centos8 ~]# journalctl -p warning 
-repquotaUtility for reporting quotas+-- Logs begin at Thu 2021-06-03 09:01:10 EDT, end at Thu 2021-06-03 13:12:01 EDT. -- 
-Usage+Jun 03 09:01:10 centos8.ittraining.loc kernel:  #2 
-repquota [-vugsi] [-c|C] [-t|n] [-F quotaformat] [-(default | xml | csv)] (-a | mntpoint)+Jun 03 09:01:10 centos8.ittraining.loc kernel #3 
 +Jun 03 09:01:10 centos8.ittraining.loc kernel: acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration > 
 +Jun 03 09:01:12 centos8.ittraining.loc kernel: e1000: E1000 MODULE IS NOT SUPPORTED 
 +Jun 03 09:01:12 centos8.ittraining.loc kernel: [drm:vmw_host_log [vmwgfx]] *ERROR* Failed to send host log message. 
 +Jun 03 09:01:12 centos8.ittraining.loc kernel: [drm:vmw_host_log [vmwgfx]] *ERROR* Failed to send host log message. 
 +Jun 03 09:01:18 centos8.ittraining.loc kernel: printk: systemd: 19 output lines suppressed due to ratelimiting 
 +Jun 03 09:01:20 centos8.ittraining.loc firewalld[874]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration> 
 +Jun 03 09:01:21 centos8.ittraining.loc systemd[1]: iscsi.service: Unit cannot be reloaded because it is inactive. 
 +Jun 03 09:01:24 centos8.ittraining.loc systemd[1]: iscsi.service: Unit cannot be reloaded because it is inactive. 
 +Jun 03 09:01:24 centos8.ittraining.loc systemd[1]: iscsi.service: Unit cannot be reloaded because it is inactive. 
 +Jun 03 09:01:26 centos8.ittraining.loc chronyd[850]: System clock wrong by 1.753498 seconds, adjustment started 
 +Jun 03 09:01:28 centos8.ittraining.loc chronyd[850]: System clock was stepped by 1.753498 seconds 
 +Jun 03 12:46:31 centos8.ittraining.loc chronyd[850]: System clock wrong by 47255.336542 seconds, adjustment started 
 +lines 1-15/15 (END) 
 +</code>
  
--v, --verbose               display also users/groups without any usage +Les priorités reconnues par Journald sont :
--u, --user                  display information about users +
--g, --group                 display information about groups +
--P, --project               display information about projects +
--s, --human-readable        show numbers in human friendly units (MB, GB, ...) +
--t, --truncate-names        truncate names to 9 characters +
--p, --raw-grace             print grace time in seconds since epoch +
--n, --no-names              do not translate uid/gid to name +
--i, --no-autofs             avoid autofs mountpoints +
--c, --cache                 translate big number of ids at once +
--C, --no-cache              translate ids one by one +
--F, --format=formatname     report information for specific format +
--O, --output=format         format output as xml or csv +
--a, --all                   report information for all mount points with quotas +
--h, --help                  display this help message and exit +
--V, --version               display version information and exit+
  
-Bugs to jack@suse.cz +^ Niveau ^ Priorité ^ Description ^ 
-</code>+| 0 | emerg | Système inutilisable | 
 +| 1 | alert | Action immédiate requise | 
 +| 2 | crit | Condition critique atteinte | 
 +| 3 | err | Erreurs rencontrées | 
 +| 4 | warning | Avertissements présentés | 
 +| 5 | notice | Condition normale - message important | 
 +| 6 | info | Condition normale - message simple | 
 +| 7 | debug | Condition normale - message de débogage | 
  
-====3.5 - La Commande quota====+====5.5 - Consultation des Journaux d'une Plage de Dates ou d'Heures====
  
-Pour visualiser les quotas d'un utilisateur spécifique, il convient d'utiliser la commande **quota** :+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>
-[root@centos8 ~]# quota fenestros +[root@centos8 ~]# journalctl --since 12:00 --until now 
-Disk quotas for user fenestros (uid 1001): no limited resources used +-- Logs begin at Thu 2021-06-03 09:01:10 EDT, end at Thu 2021-06-03 13:14:01 EDT. -- 
-[root@centos8 ~]# su fenestros +Jun 03 12:00:01 centos8.ittraining.loc systemd[1]: Started Session 181 of user trainee. 
-[fenestros@centos8 ~]$ touch test +Jun 03 12:00:01 centos8.ittraining.loc CROND[4238]: (traineeCMD (/bin/pwd > pwd.txt) 
-[fenestros@centos8 ~]$ exit +Jun 03 12:00:01 centos8.ittraining.loc systemd[1]: session-181.scope: Succeeded. 
-logout +Jun 03 12:01:01 centos8.ittraining.loc CROND[4251]: (root) CMD (run-parts /etc/cron.hourly) 
-[root@centos8 ~]# quota fenestros +Jun 03 12:01:01 centos8.ittraining.loc systemd[1]: Started Session 182 of user trainee. 
-Disk quotas for user fenestros (uid 1001):  +Jun 03 12:01:01 centos8.ittraining.loc run-parts[4255]: (/etc/cron.hourly) starting 0anacron 
-     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace +Jun 03 12:01:01 centos8.ittraining.loc CROND[4260]: (trainee) CMD (/bin/pwd > pwd.txt) 
-      /dev/sdc1          8000   10000                                       +Jun 03 12:01:01 centos8.ittraining.loc run-parts[4262]: (/etc/cron.hourly) finished 0anacron 
 +Jun 03 12:01:01 centos8.ittraining.loc systemd[1]: session-182.scope: Succeeded. 
 +Jun 03 12:02:01 centos8.ittraining.loc systemd[1]: Started Session 183 of user trainee. 
 +Jun 03 12:02:01 centos8.ittraining.loc CROND[4275]: (trainee) CMD (/bin/pwd > pwd.txt) 
 +Jun 03 12:02:01 centos8.ittraining.loc systemd[1]: session-183.scope: Succeeded. 
 +Jun 03 12:03:01 centos8.ittraining.loc systemd[1]: Started Session 184 of user trainee. 
 +Jun 03 12:03:01 centos8.ittraining.loc CROND[4289]: (trainee) CMD (/bin/pwd > pwd.txt) 
 +Jun 03 12:03:01 centos8.ittraining.loc systemd[1]: session-184.scope: Succeeded. 
 +Jun 03 12:04:01 centos8.ittraining.loc systemd[1]: Started Session 185 of user trainee. 
 +Jun 03 12:04:01 centos8.ittraining.loc CROND[4303]: (traineeCMD (/bin/pwd > pwd.txt) 
 +Jun 03 12:04:01 centos8.ittraining.loc systemd[1]: session-185.scope: Succeeded. 
 +Jun 03 12:05:01 centos8.ittraining.loc systemd[1]: Started Session 186 of user trainee. 
 +Jun 03 12:05:01 centos8.ittraining.loc CROND[4319]: (trainee) CMD (/bin/pwd > pwd.txt) 
 +Jun 03 12:05:01 centos8.ittraining.loc systemd[1]: session-186.scope: Succeeded. 
 +Jun 03 12:06:02 centos8.ittraining.loc systemd[1]: Started Session 187 of user trainee. 
 +Jun 03 12:06:02 centos8.ittraining.loc CROND[4332]: (trainee) CMD (/bin/pwd > pwd.txt) 
 +Jun 03 12:06:02 centos8.ittraining.loc systemd[1]: session-187.scope: Succeeded. 
 +Jun 03 12:07:01 centos8.ittraining.loc systemd[1]: Started Session 188 of user trainee. 
 +Jun 03 12:07:01 centos8.ittraining.loc CROND[4346]: (trainee) CMD (/bin/pwd > pwd.txt) 
 +Jun 03 12:07:01 centos8.ittraining.loc systemd[1]: session-188.scope: Succeeded. 
 +Jun 03 12:08:01 centos8.ittraining.loc systemd[1]: Started Session 189 of user trainee. 
 +Jun 03 12:08:01 centos8.ittraining.loc CROND[4360]: (trainee) CMD (/bin/pwd > pwd.txt) 
 +Jun 03 12:08:01 centos8.ittraining.loc systemd[1]: session-189.scope: Succeeded. 
 +lines 1-31
 </code> </code>
  
-Les options de la commande **quota** sont :+<WRAP center round important 60%> 
 +**Important** : Il est possible d'utiliser des mots clefs : **yesterday**, **today**, **tomorrow**, **now**. 
 +</WRAP>
  
-<code> +====5.Consultation des Journaux en Live====
-[root@centos8 ~]# quota --help +
-quota: Usage: quota [-guPqvswim] [-l | [-Q | -A]] [-F quotaformat] +
-        quota [-qvswim] [-l | [-Q | -A]] [-F quotaformat] -u username ... +
-        quota [-qvswim] [-l | [-Q | -A]] [-F quotaformat] -g groupname ... +
-        quota [-qvswugPQm] [-F quotaformat] -f filesystem ...+
  
--u--user                display quota for user +Pour consulter les journaux en liveil suffit d'utiliser l'option **-f** de la commande journalctl : 
--g, --group               display quota for group +
--P, --project             display quota for project +
--q, --quiet               print more terse message +
--v, --verbose             print more verbose message +
--s, --human-readable      display numbers in human friendly units (MB, GB...) +
-    --always-resolve      always try to translate name to id, even if it is +
-                          composed of only digits +
--w, --no-wrap             do not wrap long lines +
--p, --raw-grace           print grace time in seconds since epoch +
--l, --local-only          do not query NFS filesystems +
--Q, --quiet-refuse        do not print error message when NFS server does +
-                          not respond +
--i, --no-autofs           do not query autofs mountpoints +
--F, --format=formatname   display quota of a specific format +
--f, --filesystem-list     display quota information only for given filesystems +
--A, --all-nfs             display quota for all NFS mountpoints +
--m, --no-mixed-pathnames  trim leading slashes from NFSv4 mountpoints +
-    --show-mntpoint       show mount point of the file system in output +
-    --hide-device         do not show file system device in output +
--h, --help                display this help message and exit +
--V, --version             display version information and exit+
  
-Bugs to: jack@suse.cz+<code> 
 +[root@centos8 ~]# journalctl -f 
 +-- Logs begin at Thu 2021-06-03 09:01:10 EDT. -- 
 +Jun 03 13:13:08 centos8.ittraining.loc systemd[1]: Started dnf makecache. 
 +Jun 03 13:14:01 centos8.ittraining.loc systemd[1]: Started Session 256 of user trainee. 
 +Jun 03 13:14:01 centos8.ittraining.loc CROND[5391]: (trainee) CMD (/bin/pwd > pwd.txt) 
 +Jun 03 13:14:01 centos8.ittraining.loc systemd[1]: session-256.scope: Succeeded. 
 +Jun 03 13:15:01 centos8.ittraining.loc systemd[1]: Started Session 257 of user trainee. 
 +Jun 03 13:15:01 centos8.ittraining.loc CROND[5407]: (trainee) CMD (/bin/pwd > pwd.txt) 
 +Jun 03 13:15:01 centos8.ittraining.loc systemd[1]: session-257.scope: Succeeded. 
 +Jun 03 13:16:02 centos8.ittraining.loc systemd[1]: Started Session 258 of user trainee. 
 +Jun 03 13:16:02 centos8.ittraining.loc CROND[5420]: (trainee) CMD (/bin/pwd > pwd.txt) 
 +Jun 03 13:16:02 centos8.ittraining.loc systemd[1]: session-258.scope: Succeeded. 
 +^C
 </code> </code>
  
-====3.6 - La Commande warnquota==== +Ouvrez un deuxième terminal et saisissez la commande suivante :
- +
-La commande **warnquota** vérifie le ou les disques et envoie un message par mail à tout utilisateur qui a dépassé la limite soft. Elle est enrègle générale appelée par un job cron. Cependant elle peut aussi est appelée d'une manière intéractive. +
- +
-Sous RHEL/CentOS, warnquota n'est pas installé par défaut :+
  
 <code> <code>
-[root@centos8 ~]# which warnquota +[trainee@centos8 ~]$ logger -p user.info Linux est super
-/usr/bin/which: no warnquota in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)+
 </code> </code>
  
-Installez donc le paquet **quota-warnquota** +Retournez consulter le premier terminal :
  
 <code> <code>
-[root@centos7 ~]# dnf install quota-warnquota +[root@centos8 ~]# journalctl -f 
-...+-- Logs begin at Thu 2021-06-03 09:01:10 EDT. -- 
 +Jun 03 13:13:08 centos8.ittraining.loc systemd[1]: Started dnf makecache. 
 +Jun 03 13:14:01 centos8.ittraining.loc systemd[1]: Started Session 256 of user trainee. 
 +Jun 03 13:14:01 centos8.ittraining.loc CROND[5391]: (trainee) CMD (/bin/pwd > pwd.txt) 
 +Jun 03 13:14:01 centos8.ittraining.loc systemd[1]: session-256.scope: Succeeded. 
 +Jun 03 13:15:01 centos8.ittraining.loc systemd[1]: Started Session 257 of user trainee. 
 +Jun 03 13:15:01 centos8.ittraining.loc CROND[5407]: (trainee) CMD (/bin/pwd > pwd.txt) 
 +Jun 03 13:15:01 centos8.ittraining.loc systemd[1]: session-257.scope: Succeeded. 
 +Jun 03 13:16:02 centos8.ittraining.loc systemd[1]: Started Session 258 of user trainee. 
 +Jun 03 13:16:02 centos8.ittraining.loc CROND[5420]: (trainee) CMD (/bin/pwd > pwd.txt) 
 +Jun 03 13:16:02 centos8.ittraining.loc systemd[1]: session-258.scope: Succeeded. 
 +Jun 03 13:17:01 centos8.ittraining.loc systemd[1]: Started Session 259 of user trainee. 
 +Jun 03 13:17:01 centos8.ittraining.loc CROND[5436]: (trainee) CMD (/bin/pwd > pwd.txt) 
 +Jun 03 13:17:01 centos8.ittraining.loc systemd[1]: session-259.scope: Succeeded. 
 +Jun 03 13:17:19 centos8.ittraining.loc sshd[5439]: Accepted password for trainee from 10.0.2.2 port 39906 ssh2 
 +Jun 03 13:17:19 centos8.ittraining.loc systemd-logind[880]: New session 260 of user trainee. 
 +Jun 03 13:17:19 centos8.ittraining.loc systemd[1]: Started Session 260 of user trainee. 
 +Jun 03 13:17:19 centos8.ittraining.loc sshd[5439]: pam_unix(sshd:session): session opened for user trainee by (uid=0) 
 +Jun 03 13:17:34 centos8.ittraining.loc trainee[5470]: Linux est super 
 +Jun 03 13:17:34 centos8.ittraining.loc rsyslogd[1113]: imjournal: journal files changed, reloading...  [v8.1911.0-6.el8 try https://www.rsyslog.com/e/0 ] 
 +Jun 03 13:18:01 centos8.ittraining.loc systemd[1]: Started Session 261 of user trainee. 
 +Jun 03 13:18:01 centos8.ittraining.loc CROND[5481]: (trainee) CMD (/bin/pwd > pwd.txt) 
 +Jun 03 13:18:01 centos8.ittraining.loc systemd[1]: session-261.scope: Succeeded. 
 +^C
 </code> </code>
  
-Les options de la commande **warnquota** sont :+<WRAP center round important 60%> 
 +**Important** : Notez la présence de la ligne **Jun 03 13:17:34 centos8.ittraining.loc trainee[5470]: Linux est super**.  
 +</WRAP> 
 + 
 +====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 ~]# warnquota --help +[root@centos8 ~]# journalctl [tab] [tab] 
-warnquota: Usage: +_AUDIT_LOGINUID=              _HOSTNAME=                    NM_DEVICE=                    _SYSTEMD_SESSION= 
-  warnquota [-ugsid] [-F quotaformat] [-c configfile] [-q quotatabfile] [-a adminsfile] [filesystem...]+_AUDIT_SESSION=               INITRD_USEC=                  NM_LOG_DOMAINS=               _SYSTEMD_SLICE= 
 +AVAILABLE=                    INVOCATION_ID=                NM_LOG_LEVEL=                 _SYSTEMD_UNIT= 
 +AVAILABLE_PRETTY=             JOB_ID=                       N_RESTARTS=                   _SYSTEMD_USER_SLICE= 
 +_BOOT_ID=                     JOB_RESULT=                   _PID=                         _SYSTEMD_USER_UNIT= 
 +_CAP_EFFECTIVE=               JOB_TYPE=                     PRIORITY=                     TIMESTAMP_BOOTTIME= 
 +_CMDLINE=                     JOURNAL_NAME=                 SEAT_ID=                      TIMESTAMP_MONOTONIC= 
 +CODE_FILE=                    JOURNAL_PATH=                 _SELINUX_CONTEXT=             _TRANSPORT= 
 +CODE_FUNC=                    _KERNEL_DEVICE=               SESSION_ID=                   _UDEV_DEVNODE= 
 +CODE_LINE=                    _KERNEL_SUBSYSTEM=            _SOURCE_MONOTONIC_TIMESTAMP=  _UDEV_SYSNAME= 
 +_COMM=                        KERNEL_USEC=                  _SOURCE_REALTIME_TIMESTAMP=   _UID= 
 +CURRENT_USE=                  LEADER=                       SSSD_DOMAIN=                  UNIT= 
 +CURRENT_USE_PRETTY=           LIMIT=                        _STREAM_ID=                   USER_ID= 
 +DISK_AVAILABLE=               LIMIT_PRETTY=                 SYSLOG_FACILITY=              USER_INVOCATION_ID= 
 +DISK_AVAILABLE_PRETTY=        _MACHINE_ID=                  SYSLOG_IDENTIFIER=            USERSPACE_USEC= 
 +DISK_KEEP_FREE=               MAX_USE=                      SYSLOG_PID=                   USER_UNIT= 
 +DISK_KEEP_FREE_PRETTY=        MAX_USE_PRETTY=               _SYSTEMD_CGROUP=               
 +_EXE=                         MESSAGE=                      _SYSTEMD_INVOCATION_ID=        
 +_GID=                         MESSAGE_ID=                   _SYSTEMD_OWNER_UID=    
 +</code>
  
--u--user                      warn users +Pour voir la liste des processus dont les traces sont inclus dans les journaux du mots clefstapez la commande journalctl suivi par le nom d'un mot clef puis appuyer deux fois sur la touche <key>Tab</key> :
--g, --group                     warn groups +
--s, --human-readable            send information in more human friendly units +
--i, --no-autofs                 avoid autofs mountpoints +
--d, --no-details                do not send quota information itself +
--F, --format=formatname         use quotafiles of specific format +
--c, --config=config-file        non-default config file +
--q, --quota-tab=quotatab-file   non-default quotatab +
--a, --admins-file=admins-file   non-default admins file +
--h, --help                      display this help message and exit +
--v, --version                   display version information and exit+
  
-warnquota: Bugs to jack@suse.cz+<code> 
 +[root@centos8 ~]# journalctl _UID= 
 +0     1000  81    983   990   992   998    
 +[root@centos8 ~]# journalctl _COMM= 
 +anacron          dbus-daemon      kdumpctl         NetworkManager   smartd           sssd_nss         systemd-hiberna   
 +auditd           dnf              logger           polkitd          sm-notify        su               systemd-journal   
 +augenrules       dnsmasq          login            rngd             sshd             (systemd)        systemd-logind    
 +chronyd          dracut-cmdline   lvm              rsyslogd         sssd             systemd          systemd-udevd     
 +crond            firewalld        netcf-transacti  sh               sssd_be          systemd-fsck   
 </code> </code>
  
 ----- -----
 Copyright © 2024 Hugh Norris. Copyright © 2024 Hugh Norris.
Menu