Différences

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

Lien vers cette vue comparative

Prochaine révision
Révision précédente
elearning:workbooks:redhat:rh134:l103 [2024/09/26 13:26] – created adminelearning:workbooks:redhat:rh134:l103 [2024/10/22 10:15] (Version actuelle) admin
Ligne 1: Ligne 1:
 ~~PDF:LANDSCAPE~~ ~~PDF:LANDSCAPE~~
  
-Version : **2023.01**+Version : **2024.01**
  
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
  
-======LCF511 - Gestion des Paramètres du matériel et les Ressources====== +======RH13404 - Gestion de la Sécurité======
- +
-<code> +
-[root@centos8 ~]# sed -i 's/^mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* +
-[root@centos8 ~]# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* +
-</code>+
  
 =====Contenu du Module===== =====Contenu du Module=====
  
-  * **LCF511 - Gestion des Paramètres et les Ressources du Matériel**+  * **RH13404 - Gestion de la Sécurité**
     * Contenu du Module     * Contenu du Module
-    * Présentation des Fichiers Spéciaux  +    * LAB #1 - Les Droits Unix Avancés 
-    * LAB #1 - Découvrir le Matériel +      * 1.1 - Les ACL 
-      * 1.1 - La Commande lspci +      * 1.2 - Les Attributs Étendus 
-      * 1.2 - La Commande lsusb +    LAB #2 Mise en place de SELinux pour sécuriser le serveur 
-      * 1.3 - La Commande lsblk +      * 2.1 - Introducton 
-      * 1.4 - La Commande lsscsi +      * 2.Définitions 
-      * 1.5 - La Commande lscpu +        * Security Context 
-      * 1.6 - La Commande lshw +        Domains et Types 
-      * 1.7 - La Commande dmidecode +        Roles 
-      * 1.8 - La Commande smartctl +        Politiques de Sécurité 
-      * 1.9 - Les Commandes accton et dump-acct +        Langage de Politiques 
-      1.10 La Commande lastcomm +          * allow 
-      * 1.11 - La Commande sa +          * type 
-      * 1.12 La Commande ac +        type_transition 
-    * LAB #2 - La Commande sysctl +        Décisions de SELinux 
-      * 2.Répertoire /proc +          * Décisions d'Accès 
-        * Fichiers +          * Décisions de Transition 
-          Processeur +        Commandes SELinux 
-          Interruptions système +        * Les Etats de SELinux 
-          Canaux DMA +        Booléens 
-          Plages d'entrée/sortie +    * LAB #3 - Travailler avec SELinux 
-          * Périphériques +      * 3.1 - Copier et Déplacer des Fichiers 
-          * Modules +      * 3.2 - Vérifier les SC des Processus 
-          Statistiques de l'utilisation des disques +      * 3.3 - Visualiser la SC d'un Utilisateur 
-          Partitions +      * 3.4 - Vérifier la SC d'un fichier 
-          * Espaces de pagination +      * 3.4 - La commande chcon 
-          * Statistiques d'utilisation du processeur +      * 3.5 - La commande restorecon 
-          * Statistiques d'utilisation de la mémoire +      * 3.6 - Le fichier /.autorelabel 
-          Version du noyau +      * 3.7 - La commande semanage 
-        * Répertoires +      * 3.8 - La commande audit2allow 
-          ide/scsi +    * LAB #4 - Le Pare-feu Netfilter/iptables 
-          * acpi +      * 4.1 - La Configuration par firewalld 
-          * bus +      * 4.2 - La Configuration de Base de firewalld 
-          * net +      4.3 - La Commande firewall-cmd 
-          * sys +      4.4 - La Configuration Avancée de firewalld 
-      * 2.2 - Utilisation de la Commande sysctl        +      4.5 - Le mode Panic de firewalld
-    * LAB #3 - Interprétation des informations dans /proc +
-      * 3.1 - free +
-      * 3.2 - uptime ou w  +
-      * 3.3 - iostat +
-      * 3.4 - hdparm +
-      * 3.5 - vmstat +
-      * 3.6 - mpstat +
-      * 3.7 - sar +
-    * Modules usb +
-    * udev +
-      * La Commande udevadm +
-    * Système de fichiers /sys +
-    * LAB #4 - Limiter les Ressources +
-      * 4.1 - ulimit +
-      * 4.2 - Groupes de Contrôle +
-        * La Limitation de la Mémoire +
-        * La Commande cgcreate +
-        * La Commande cgdelete +
-        Le Fichier /etc/cgconfig.conf +
-        * La Commande cgconfigparser+
  
-=====Présentation des Fichiers Spéciaux=====+=====LAB #1 - Les Droits Unix Avancés=====
  
-Dans l'ordinateur les périphériques sont reliés à un **contrôleur** qui communique avec le processeur à l'aide d'un **bus**. Le contrôleur ainsi que les périphériques nécessitent des pilotes. Sous Linux, les pilotes sont généralement fournis sous la forme d'un **module**. Chaque périphérique est représenté par un **fichier spécial** dans le répertoire **/dev** et c'est dans ce fichier que le système trouve les informations nécessaires pour s'adresser au pilote.+====1.1 - Les ACL====
  
-<WRAP center round important 60%> +Au delà des droits étendus d'Unix, Linux utilise un système d'ACL pour permettre une meilleure gestion des droits sur des fichiers.
-**Important** : Les périphériques qui nécessitent à ce que l'ordinateur soit éteint afin des les brancher/débrancher sont appelés communément **Cold Plug Devices**. Les périphériques qui peuvent être brancher/débrancher à chaud sont appelés des **Hot Plug Devices**. +
-</WRAP>+
  
-Consultez le contenu du répertoire /dev :+Pour connaître les ACL positionnés sur un fichier, il convient d'utiliser la commande **getfacl** :
  
 <code> <code>
-[root@centos8 ~]# ls -l /dev | more +[root@redhat9 ~]# touch tux.jpg 
-total 0 + 
-crw-r--r-- 1 root root     10, 235 Jun 28 02:04 autofs +[root@redhat9 ~]# getfacl tux.jpg 
-drwxr-xr-x.  2 root root         180 Jun 28 02:04 block +# filetux.jpg 
-drwxr-xr-x. root root         100 Jun 28 02:04 bsg +# owner: root 
-drwxr-xr-x 3 root root          60 Jun 28 02:04 bus +# group: root 
-lrwxrwxrwx.  1 root root           3 Jun 28 02:04 cdrom -> sr0 +user::rw- 
-drwxr-xr-x 2 root root        2940 Jun 28 02:04 char +group::r-- 
-drwxr-xr-x.  2 root root          80 Jun 28 02:04 cl_centos8 +other::r--
-crw-------. root root      5,   1 Jun 28 02:04 console +
-lrwxrwxrwx.  1 root root          11 Jun 28 02:04 core -> /proc/kcore +
-drwxr-xr-x. 10 root root         200 Jun 28 02:04 cpu +
-crw-------.  1 root root     10,  62 Jun 28 02:04 cpu_dma_latency +
-drwxr-xr-x.  6 root root         120 Jun 28 02:04 disk +
-brw-rw----.  1 root disk    253,   0 Jun 28 02:04 dm-0 +
-brw-rw----.  1 root disk    253,   1 Jun 28 02:04 dm-1 +
-drwxr-xr-x.  3 root root          80 Jun 28 02:04 dri +
-crw-rw----.  1 root video    29,   0 Jun 28 02:04 fb0 +
-lrwxrwxrwx.  1 root root          13 Jun 28 02:04 fd -> /proc/self/fd +
-crw-rw-rw-.  1 root root      1,   7 Jun 28 02:04 full +
-crw-rw-rw-.  1 root root     10, 229 Jun 28 02:04 fuse +
-crw-------.  1 root root    245,   0 Jun 28 02:04 hidraw0 +
-crw-------.  1 root root     10, 228 Jun 28 02:04 hpet +
-drwxr-xr-x.  3 root root           0 Jun 28 02:04 hugepages +
-crw-------.  1 root root     10, 183 Jun 28 02:04 hwrng +
-lrwxrwxrwx.  1 root root          12 Jun 28 02:04 initctl -> /run/initctl +
-drwxr-xr-x.  4 root root         280 Jun 28 02:04 input +
-crw-r--r--.  1 root root      1,  11 Jun 28 02:04 kmsg +
-lrwxrwxrwx.  1 root root          28 Jun 28 02:04 log -> /run/systemd/journal/dev-log +
-crw-rw----.  1 root disk     10, 237 Jun 28 02:04 loop-control +
-crw-rw----.  1 root lp        6,   0 Jun 28 02:04 lp0 +
-crw-rw----.  1 root lp        6,   1 Jun 28 02:04 lp1 +
-crw-rw----.  1 root lp        6,   2 Jun 28 02:04 lp2 +
-crw-rw----.  1 root lp        6,   3 Jun 28 02:04 lp3 +
-drwxr-xr-x.  2 root root         100 Jun 28 02:04 mapper +
-crw-------.  1 root root     10, 227 Jun 28 02:04 mcelog +
-crw-r-----.  1 root kmem      1,   1 Jun 28 02:04 mem +
-drwxrwxrwt.  2 root root          40 Jun 28 02:04 mqueue +
-drwxr-xr-x.  2 root root          60 Jun 28 02:04 net +
-crw-rw-rw-.  1 root root      1,   3 Jun 28 02:04 null +
---More--+
 </code> </code>
  
-On peut noter dans la sortie de la commande que certains fichiers sont de type **bloc** (**b**)tandis que d'autre sont de type **caractère** (**c**). +Pour positionner des ACL sur un fichieril convient d'utiliser la commande **setfacl** :
  
 <code> <code>
-... +[root@redhat9 ~]# setfacl --set u::rwx,g::rx,o::-,u:trainee:rw tux.jpg 
-brw-rw----.  1 root disk      8  1 Jun 28 02:04 sda1 + 
-... +[root@redhat9 ~]# getfacl tux.jpg 
-crw-rw-rw-.  1 root tty       5,   0 Jun 28 02:04 tty +# file: tux.jpg 
-...+# owner: root 
 +# group: root 
 +user::rwx 
 +user:trainee:rw- 
 +group::r-
 +mask::rwx 
 +other::---
 </code> </code>
  
-La différence entre les deux repose sur le type de communication entre le système et le module. Dans le premier cas le système accède au périphérique par des coordonnées du bloc de données sur le support tandis que dans le deuxième cas la communication d'échange de données se fait octet par octet sans utiliser des tampons. +<WRAP center round important 60%> 
- +**Important** - Veuillez noter l'apparition de la ligne **mask**. Le mask indique les permissions maximales qui peuvent être acccordées à un utilisateur ou un groupe tiers
-Les deux informations clefs du fichier spécial sont situées à la place de la taille d'un fichier normal et se nomment le **majeur** et le **mineur** +</WRAP>
- +
-  * le **majeur** identifie le pilote du périphérique et donc son contrôleur, +
-  * le **mineur** identifie le périphérique ou une particularité du périphérique telle une partition d'un disque+
- +
-=====LAB #1 - Découvrir le Matériel===== +
- +
-====1.1 - La Commande lspci====+
  
-Cette commande vous renseigne sur les adaptateurs reliés aux bus PCI, AGP et PCI express :+Regardez maintenant l'effet des ACL sur un répertoire. Créez le répertoire /home/trainee/rep1 :
  
 <code> <code>
-[root@centos8 ~]# lspci +[root@redhat9 ~]# mkdir rep1
-00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02) +
-00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II] +
-00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II] +
-00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01) +
-00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03) +
-00:02.0 VGA compatible controller: Device 1234:1111 (rev 02) +
-00:03.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon +
-00:07.0 SATA controller: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] (rev 02) +
-00:12.0 Ethernet controller: Red Hat, Inc. Virtio network device +
-00:1e.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge +
-00:1f.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge+
 </code> </code>
  
-Pour obtenir de l'information sur un adaptateur spécifique, il convient d'utiliser la même commande avec l'option **-v** en spécifiant l'identifiant concerné :+Positionnez des ACL le répertoire avec la commande **setfacl** :
  
 <code> <code>
-[root@centos8 ~]# lspci --s 00:03.0 +[root@redhat9 ~]# setfacl --set d:u::r,d:g::-,d:o::- rep1
-00:03.0 Unclassified device [00ff]Red HatInc. Virtio memory balloon +
-        SubsystemRed Hat, Inc. Device 0005 +
-        Physical Slot+
-        Flagsbus master, fast devsel, latency 0, IRQ 10 +
-        I/O ports at e000 [size=64] +
-        Memory at fe400000 (64-bitprefetchable) [size=16K] +
-        Capabilities: [84] Vendor Specific Information: VirtIO: <unknown> +
-        Capabilities: [70] Vendor Specific Information: VirtIO: Notify +
-        Capabilities: [60] Vendor Specific Information: VirtIO: DeviceCfg +
-        Capabilities: [50] Vendor Specific Information: VirtIO: ISR +
-        Capabilities: [40] Vendor Specific InformationVirtIOCommonCfg +
-        Kernel driver in usevirtio-pci+
 </code> </code>
  
-ou :+Notez l'utilisation de la lettre **d** pour indiquer une permission //par défaut//
 + 
 +Créez maintenant un fichier appelé fichier1 dans /root/rep1 :
  
 <code> <code>
-[root@centos8 ~]# lspci -vv -s 00:03.0 +[root@redhat9 ~]# touch rep1/fichier1
-00:03.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon +
-        Subsystem: Red Hat, Inc. Device 0005 +
-        Physical Slot: 3 +
-        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx- +
-        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- +
-        Latency: 0 +
-        Interrupt: pin A routed to IRQ 10 +
-        Region 0: I/O ports at e000 [size=64] +
-        Region 4: Memory at fe400000 (64-bit, prefetchable) [size=16K] +
-        Capabilities: [84] Vendor Specific Information: VirtIO: <unknown> +
-                BAR=0 offset=00000000 size=00000000 +
-        Capabilities: [70] Vendor Specific Information: VirtIO: Notify +
-                BAR=4 offset=00003000 size=00001000 multiplier=00000004 +
-        Capabilities: [60] Vendor Specific Information: VirtIO: DeviceCfg +
-                BAR=4 offset=00002000 size=00001000 +
-        Capabilities: [50] Vendor Specific Information: VirtIO: ISR +
-                BAR=4 offset=00001000 size=00001000 +
-        Capabilities: [40] Vendor Specific Information: VirtIO: CommonCfg +
-                BAR=4 offset=00000000 size=00001000 +
-        Kernel driver in use: virtio-pci+
 </code> </code>
  
-===Options de la commande=== +Utilisez la commande **getfacl** pour visualiser le résultat :
- +
-Les options de cette commande sont :+
  
 <code> <code>
-[root@centos8 ~]# lspci --help +[root@redhat9 ~]# getfacl rep1 
-lspciinvalid option -- '-' +# file: rep1 
-Usagelspci [<switches>]+# owner: root 
 +# group: root 
 +user::rwx 
 +group::r-
 +other::r-x 
 +default:user::r-- 
 +default:group::--- 
 +default:other::---
  
-Basic display modes+[root@redhat9 ~]# getfacl rep1/fichier1 
--mm             Produce machine-readable output (single -m for an obsolete format) +# filerep1/fichier1 
--t              Show bus tree +# owner: root 
- +# group: root 
-Display options: +user::r-- 
--v              Be verbose (-vv or -vvv for higher verbosity) +group::--- 
--k              Show kernel drivers handling each device +other::---
--x              Show hex-dump of the standard part of the config space +
--xxx            Show hex-dump of the whole config space (dangerous; root only) +
--xxxx           Show hex-dump of the 4096-byte extended config space (root only) +
--b              Bus-centric view (addresses and IRQ's as seen by the bus) +
--D              Always show domain numbers +
--P              Display bridge path in addition to bus and device number +
--PP             Display bus path in addition to bus and device number +
- +
-Resolving of device ID's to names: +
--n              Show numeric ID's +
--nn             Show both textual and numeric ID's (names & numbers) +
--q              Query the PCI ID database for unknown ID's via DNS +
--qq             As above, but re-query locally cached entries +
--Q              Query the PCI ID database for all ID's via DNS +
- +
-Selection of devices: +
--s [[[[<domain>]:]<bus>]:][<slot>][.[<func>]]   Show only devices in selected slots +
--d [<vendor>]:[<device>][:<class>             Show only devices with specified ID's +
- +
-Other options: +
--i <file>       Use specified ID database instead of /usr/share/hwdata/pci.ids +
--p <file>       Look up kernel modules in a given file instead of default modules.pcimap +
--M              Enable `bus +
 </code> </code>
  
-====1.2 - La Commande lsusb====+Notez que le fichier créé possède les ACL positionnés sur le répertoire rep1.
  
-Cette commande vous renseigne sur les adaptateurs reliés au bus usb :+Dernièrement, les systèmes de sauvegarde classiques sous Linux ne peuvent pas sauvegarder les ACL, sauf l'outil **star**. Si vous n'utilisez pas **star**, il convient donc de sauvegarder les ACL dans un fichier grâce à la commande suivante :
  
 <code> <code>
-[root@centos8 ~]# lsusb +[root@redhat9 ~]# cd rep1 
-Bus 001 Device 002: ID 0627:0001 Adomax Technology Co., Ltd  + 
-Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub+[root@redhat9 rep1]# getfacl -R --skip-base . > backup.acl
  
-[root@centos8 ~]# lsusb -vt +[root@redhat9 rep1]# cat backup.acl 
-/ Bus 01.Port 1Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M +# file: . 
-    |__ Port 1Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M+# ownerroot 
 +# grouproot 
 +user::rwx 
 +group::r-x 
 +other::r-x 
 +default:user::r-- 
 +default:group::--- 
 +default:other::---
 </code> </code>
  
-===Options de la commande===+La restauration des ACL se fait avec la commande **setfacl** :
  
-Les options de cette commande sont :+  # setfacl --restore=backup.acl [Entrée]
  
-<code> +==Options des Commandes===
-[root@centos8 ~]# lsusb --help +
-Usage: lsusb [options]... +
-List USB devices +
-  -v, --verbose +
-      Increase verbosity (show descriptors) +
-  -s [[bus]:][devnum] +
-      Show only devices with specified device and/or +
-      bus numbers (in decimal) +
-  -d vendor:[product] +
-      Show only devices with the specified vendor and +
-      product ID numbers (in hexadecimal) +
- .LAB#1 +
-  -D device +
-      Selects which device lsusb will examine +
-  -t, --tree +
-      Dump the physical USB device hierarchy as a tree +
-  -V, --version +
-      Show version of program +
-  -h, --help +
-      Show usage and help +
-</code>+
  
-====1.3 - La Commande lsblk==== +Les options de la commande **getfacl** sont :
- +
-Cette commande vous rensigne sur les partitions des disques :+
  
 <code> <code>
-[root@centos8 ~]# lsblk +[root@redhat9 rep1]# getfacl --help 
-NAME                MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT +getfacl 2.3.-- get file access control lists 
-sda                   8:   0   32G  0 disk  +Usagegetfacl [-aceEsRLPtpndvh] file ..
-├─sda1                8:      1G  0 part /boot +  -a, --access            display the file access control list only 
-└─sda2                8:2    0   31G  0 part  +  -d, --default           display the default access control list only 
-  ├─cl_centos8-root 253:0    0 27.8G  0 lvm  / +  -c, --omit-header       do not display the comment header 
-  └─cl_centos8-swap 253:1    0  3.2G  0 lvm  [SWAP] +  -e, --all-effective     print all effective rights 
-sdb                   8:16      4G  0 disk  +  -E, --no-effective      print no effective rights 
-sdc                   8:32     64G  0 disk  +  -s, --skip-base         skip files that only have the base entries 
-└─sdc1                8:33     64G  0 part /home +  -R, --recursive         recurse into subdirectories 
-sdd                   8:48     32G  0 disk  +  -L, --logical           logical walk, follow symbolic links 
-sr0                  11:0    1 1024M  0 rom  +  -P, --physical          physical walk, do not follow symbolic links 
- +  -t, --tabular           use tabular output format 
-[root@centos8 ~]# lsblk -l +  -n, --numeric           print numeric user/group identifiers 
-NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT +      --one-file-system   skip files on different filesystems 
-sda               8:   0   32G  0 disk  +  -p, --absolute-names    don't strip leading '/' in pathnames 
-sda1              8:1    0    1G  0 part /boot +  -v, --version           print version and exit 
-sda2              8:2    0   31G  0 part  +  -h, --help              this help text
-sdb               8:16      4G  0 disk  +
-sdc               8:32   0   64G  0 disk  +
-sdc1              8:33     64G  0 part /home +
-sdd               8:48     32G  0 disk  +
-sr0              11:0    1 1024M  0 rom   +
-cl_centos8-root 253:0    0 27.8G  0 lvm  / +
-cl_centos8-swap 253:1    0  3.2G  0 lvm  [SWAP]+
 </code> </code>
  
-===Options de la commande=== +Les options de la commande **setfacl** sont :
- +
-Les options de cette commande sont :+
  
 <code> <code>
-[root@centos8 ~]# lsblk --help+[root@redhat9 rep1]# setfacl --help 
 +setfacl 2.3.1 -- set file access control lists 
 +Usage: setfacl [-bkndRLP] { -m|-M|-x|-X ... } file ... 
 +  -m, --modify=acl        modify the current ACL(s) of file(s) 
 +  -M, --modify-file=file  read ACL entries to modify from file 
 +  -x, --remove=acl        remove entries from the ACL(s) of file(s) 
 +  -X, --remove-file=file  read ACL entries to remove from file 
 +  -b, --remove-all        remove all extended ACL entries 
 +  -k, --remove-default    remove the default ACL 
 +      --set=acl           set the ACL of file(s), replacing the current ACL 
 +      --set-file=file     read ACL entries to set from file 
 +      --mask              do recalculate the effective rights mask 
 +  -n, --no-mask           don't recalculate the effective rights mask 
 +  -d, --default           operations apply to the default ACL 
 +  -R, --recursive         recurse into subdirectories 
 +  -L, --logical           logical walk, follow symbolic links 
 +  -P, --physical          physical walk, do not follow symbolic links 
 +      --restore=file      restore ACLs (inverse of `getfacl -R') 
 +      --test              test mode (ACLs are not modified) 
 +  -v, --version           print version and exit 
 +  -h, --help              this help text 
 +</code>
  
-Usage: +====1.2 - Les Attributs Etendus====
- lsblk [options] [<device> ...]+
  
-List information about block devices.+Les attributs s'ajoutent aux caractéristiques classiques d'un fichier dans un système de fichiers Ext2/Ext3/Ext4, JFS, ReiserFS, XFS et Btrfs.
  
-Options: +Les principaux attributs sont :
- -a, --all            print all devices +
- -b, --bytes          print SIZE in bytes rather than in human readable format +
- -d, --nodeps         don't print slaves or holders +
- -D, --discard        print discard capabilities +
- -z, --zoned          print zone model +
- -e, --exclude <list> exclude devices by major number (default: RAM disks) +
- -f, --fs             output info about filesystems +
- -i, --ascii          use ascii characters only +
- -I, --include <list> show only devices with specified major numbers +
- -J, --json           use JSON output format +
- -l, --list           use list format output +
- -T, --tree           use tree format output +
- -m, --perms          output info about permissions +
- -n, --noheadings     don't print headings +
- -o, --output <list>  output columns +
- -O, --output-all     output all columns +
- -p, --paths          print complete device path +
- -P, --pairs          use key="value" output format +
- -r, --raw            use raw output format +
- -s, --inverse        inverse dependencies +
- -S, --scsi           output info about SCSI devices +
- -t, --topology       output info about topology +
- -x, --sort <column>  sort output by <column>+
  
- -h, --help           display this help +^ Attribut ^ Description ^ 
- -V--version        display version+| a | Fichier journal uniquement l'ajout de données au fichier est permis. Le fichier ne peut pas détruit | 
 +| i | Le fichier ne peut ni être modifiéni être détruit, ni être déplacé. Le placement d'un lien sur le fichier n'est pas permis | 
 +| s | Le fichier sera physiquement détruit lors de sa suppression | 
 +| D | Répertoire synchrone | 
 +| S | Fichier synchrone | 
 +| A | La date et l'heure de dernier accès ne seront pas mises à jour |
  
-Available output columns: +<WRAP center round important 60%> 
-        NAME  device name +**Important** Un fichier synchrone et un répertoire synchrone impliquent que les modifications seront immédiatement inscrites sur disque
-       KNAME  internal kernel device name +</WRAP>
-     MAJ:MIN  major:minor device number +
-      FSTYPE  filesystem type +
-  MOUNTPOINT  where the device is mounted +
-       LABEL  filesystem LABEL +
-        UUID  filesystem UUID +
-    PARTTYPE  partition type UUID +
-   PARTLABEL  partition LABEL +
-    PARTUUID  partition UUID +
-   PARTFLAGS  partition flags +
-          RA  read-ahead of the device +
-          RO  read-only device +
-          RM  removable device +
-     HOTPLUG  removable or hotplug device (usb, pcmcia, ...) +
-       MODEL  device identifier +
-      SERIAL  disk serial number +
-        SIZE  size of the device +
-       STATE  state of the device +
-       OWNER  user name +
-       GROUP  group name +
-        MODE  device node permissions +
-   ALIGNMENT  alignment offset +
-      MIN-IO  minimum I/O size +
-      OPT-IO  optimal I/O size +
-     PHY-SEC  physical sector size +
-     LOG-SEC  logical sector size +
-        ROTA  rotational device +
-       SCHED  I/O scheduler name +
-     RQ-SIZE  request queue size +
-        TYPE  device type +
-    DISC-ALN  discard alignment offset +
-   DISC-GRAN  discard granularity +
-    DISC-MAX  discard max bytes +
-   DISC-ZERO  discard zeroes data +
-       WSAME  write same max bytes +
-         WWN  unique storage identifier +
-        RAND  adds randomness +
-      PKNAME  internal parent kernel device name +
-        HCTL  Host:Channel:Target:Lun for SCSI +
-        TRAN  device transport type +
-  SUBSYSTEMS  de-duplicated chain of subsystems +
-         REV  device revision +
-      VENDOR  device vendor +
-       ZONED  zone model+
  
-For more details see lsblk(8). +Les commandes associées avec les attributs sont :
-</code>+
  
-====1.4 - La Commande lsscsi====+Commande ^ description ^ 
 +| chattr | Modifie les attributs | 
 +| lsattr | Visualise les attributs |
  
-Cette commmande vous renseigne sur les périphériques SCSI et NVMe :+Pour mieux comprendre, créez le répertoire **/root/attributs/rep** :
  
 <code> <code>
-[root@centos8 ~]# lsscsi +[root@redhat9 rep1]# cd .. 
-[1:0:0:0]    cd/dvd  QEMU     QEMU DVD-ROM     2.5+  /dev/sr0  +[root@redhat9 ~]# mkdir -p attributs/rep
-[2:0:0:0]    disk    ATA      QEMU HARDDISK    2.5+  /dev/sda  +
-[3:0:0:0   disk    ATA      QEMU HARDDISK    2.5+  /dev/sdb  +
-[4:0:0:0]    disk    ATA      QEMU HARDDISK    2.5+  /dev/sdc  +
-[5:0:0:0]    disk    ATA      QEMU HARDDISK    2.5+  /dev/sdd +
 </code> </code>
  
-===Options de la commande=== +Créez ensuite les fichier **fichier** et **rep/fichier1** :
- +
-Les options de cette commande sont :+
  
 <code> <code>
-[root@centos8 ~]# man lsscsi  +[root@redhat9 ~]# touch attributs/fichier 
-[root@centos8 ~]# lsscsi --help +[root@redhat9 ~]# touch attributs/rep/fichier1
-Usage: lsscsi   [--brief] [--classic] [--controllers] [--device] [--generic] +
-                [--help] [--hosts] [--kname] [--list] [--long] [--long-unit] +
-                [--lunhex] [--no-nvme] [--pdt] [--protection] [--prot-mode] +
-                [--scsi_id] [--size] [--sz-lbs] [--sysfsroot=PATH] [--transport] +
-                [--unit] [--verbose] [--version] [--wwn]  [<h:c:t:l>+
-  where: +
-    --brief|-b        tuple and device name only +
-    --classic|-c      alternate output similar to 'cat /proc/scsi/scsi' +
-    --controllers|-C   synonym for --hosts since NVMe controllers treated +
-                       like SCSI hosts +
-    --device|-d       show device node's major + minor numbers +
-    --generic|-g      show scsi generic device name +
-    --help|-h         this usage information +
-    --hosts|-H        lists scsi hosts rather than scsi devices +
-    --kname|-k        show kernel name instead of device node name +
-    --list|-L         additional information output one +
-                      attribute=value per line +
-    --long|-l         additional information output +
-    --long-unit|-U    print LU name in full, use twice to prefix with +
-                      '.naa', 'eui.', 'uuid.' or 't10.' +
-    --lunhex|-x       show LUN part of tuple as hex number in T10 format; +
-                      use twice to get full 16 digit hexadecimal LUN +
-    --no-nvme|-N      exclude NVMe devices from output +
-    --pdt|-D          show the peripheral device type in hex +
-    --protection|-p   show target and initiator protection information +
-    --protmode|-P     show negotiated protection information mode +
-    --scsi_id|-i      show udev derived /dev/disk/by-id/scsi* entry +
-    --size|-s         show disk size, (once for decimal (e.g. 3 GB), +
-                      twice for power of two (e.g. 2.7 GiB), +
-                      thrice for number of blocks)) +
-    --sysfsroot=PATH|-y PATH    set sysfs mount point to PATH (def: /sys) +
-    --sz-lbs|-S       show size as a number of logical blocks; if used twice +
-                      adds comma followed by logical block size in bytes +
-    --transport|-t    transport information for target or, if '--hosts' +
-                      given, for initiator +
-    --unit|-u         logical unit (LU) name (aka WWN for ATA/SATA) +
-    --verbose|-v      output path names where data is found +
-    --version|-V      output version string and exit +
-    --wwn|-w          output WWN for disks (from /dev/disk/by-id/wwn*) +
-    <h:c:t:l>         filter output list (def: '*:*:*:*' (all)). Meaning: +
-                      <host_num:controller:target:lun> or for NVMe: +
-                      <'N':ctl_num:cntlid:namespace_id> +
- +
-List SCSI devices or hosts, followed by NVMe namespaces or controllers. +
-Many storage devices (e.g. SATA disks and USB attached storage) use SCSI +
-command sets and hence are also listed by this utility. Hyphenated long +
-options can also take underscore (and vice versa).+
 </code> </code>
  
-====1.5 - La Commande lscpu==== +Modifiez les attributs d'une manière récursive sur le répertoire **attributs** :
- +
-Cett commande vous renseigne sur l'architecture des CPUs :+
  
 <code> <code>
-[root@centos8 ~]# lscpu +[root@redhat9 ~]# chattr +i -R attributs/
-Architecture:        x86_64 +
-CPU op-mode(s):      32-bit, 64-bit +
-Byte Order:          Little Endian +
-CPU(s):              8 +
-On-line CPU(s) list: 0-7 +
-Thread(s) per core:  1 +
-Core(s) per socket: +
-Socket(s):           2 +
-NUMA node(s):        1 +
-Vendor ID:           GenuineIntel +
-BIOS Vendor ID:      QEMU +
-CPU family:          6 +
-Model:               158 +
-Model name:          Intel(R) Xeon(R) CPU E3-1270 v6 @ 3.80GHz +
-BIOS Model name:     pc-i440fx-7.0 +
-Stepping:            9 +
-CPU MHz:             3791.998 +
-BogoMIPS:            7583.99 +
-Virtualization:      VT-x +
-Hypervisor vendor:   KVM +
-Virtualization type: full +
-L1d cache:           32K +
-L1i cache:           32K +
-L2 cache:            4096K +
-L3 cache:            16384K +
-NUMA node0 CPU(s):   0-7 +
-Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 xsaves arat umip md_clear arch_capabilities+
 </code> </code>
  
-===Options de la commande=== +Visualisez les attributs de l'arborescence **attributs** :
- +
-Les options de cette commande sont :+
  
 <code> <code>
-[root@centos8 ~]# lscpu --help+[root@redhat9 ~]# lsattr -R attributs 
 +----i----------------- attributs/rep
  
-Usage+attributs/rep
- lscpu [options]+----i----------------- attributs/rep/fichier1
  
-Display information about the CPU architecture.+----i----------------- attributs/fichier 
 +</code>
  
-Options: +<WRAP center round important 60%
- -a, --all               print both online and offline CPUs (default for -e) +**Important** Notez que l'attribut **e** sous Ext4 indique l'utilisation des **Extents**. Cet attribut ne peut pas être enlever avec la commande **chattr**. Les Extents seront couverts dans le cours **Gestion des Disquesdes Systèmes de Fichiers et le Swap**. 
- -b, --online            print online CPUs only (default for -p) +</WRAP>
- -c, --offline           print offline CPUs only +
- -J, --json              use JSON for default or extended format +
- -e, --extended[=<list>] print out an extended readable format +
- -p--parse[=<list>   print out a parsable format +
- -s, --sysroot <dir    use specified directory as system root +
- -x, --hex               print hexadecimal masks rather than lists of CPUs +
- -y, --physical          print physical instead of logical IDs+
  
- -h, --help              display this help +Essayez maintenant de déplacer le fichier **fichier**. Vous obtiendrez un résultat similaire à celui-ci :
- -V, --version           display version+
  
-Available output columns: +<code> 
-           CPU  logical CPU number +[root@redhat9 ~]# cd attributs; mv /root/attributs/fichier /root/attributs/rep/fichier 
-          CORE  logical core number +mv: cannot move '/root/attributs/fichier' to '/root/attributs/rep/fichier': Operation not permitted
-        SOCKET  logical socket number +
-       CLUSTER  logical cluster number +
-          NODE  logical NUMA node number +
-          BOOK  logical book number +
-        DRAWER  logical drawer number +
-         CACHE  shows how caches are shared between CPUs +
-  POLARIZATION  CPU dispatching mode on virtual hardware +
-       ADDRESS  physical address of a CPU +
-    CONFIGURED  shows if the hypervisor has allocated the CPU +
-        ONLINE  shows if Linux currently makes use of the CPU +
-        MAXMHZ  shows the maximum MHz of the CPU +
-        MINMHZ  shows the minimum MHz of the CPU +
- +
-For more details see lscpu(1).+
 </code> </code>
  
-====1.6 La Command lshw====+=====LAB #2 Mise en place de SELinux pour sécuriser le serveur=====
  
-Cette commande vous renseigne sur le matériel selon la **classe** de celui-ciCommencez par visualiser les périphériques et leurs classes répectives :+====2.1 - Introducton====
  
-<code> +L'approche %%SELinux%% (//Security Enhanced Linux//à la sécurité est une approche de type **TE**Elle essaie aussi d'intégrer les notions des approches de type **RBAC**, **MAC** et **MLS** sous la forme de **MCS** 
-[root@centos8 ~]# lshw -businfo +ur 
-Bus info          Device      Class      Description +^ Type de Sécurité ^ Nom ^ Description ^ 
-==================================================== +| TE |  //Type enforcement//  | Chaque objet a une étiquette appelé //type// pour un fichier et //domaine// pour un processusLa politique de sécurité définit l'interaction entre les types et les domaines
-                              system     Standard PC (i440FX + PIIX, 1996) +| RBAC |  //Role Based Access Control//  | Un utilisateur a un ou plusieurs rôlesLes droits sont attribués aux rôles| 
-                              bus        Motherboard +| MAC |  //Mandatory Access Control//  | L'accès aux objets est en fonction de la classification de l'objet (Très secret, Secret, Confidentiel, Public)L'administrateur définit la politique de sécurité et les utilisateurs s'y conforment| 
-                              memory     96KiB BIOS +| MLS |  //Multi-Level Security//  | Les politiques de sécurité imposent que qu'un sujet doit dominer un objet pour pouvoir le lire tandis que l'objet doit dominer le sujet pour que ce dernier puisse y écrire. |
-cpu@0                         processor  Intel(R) Xeon(R) CPU E3-1270 v6 @ 3.80GHz +
-cpu@1                         processor  Intel(R) Xeon(R) CPU E3-1270 v6 @ 3.80GHz +
-                              memory     16GiB System Memory +
-                              memory     DIMM RAM [empty] +
-pci@0000:00:00.0              bridge     440FX - 82441FX PMC [Natoma] +
-pci@0000:00:01.0              bridge     82371SB PIIX3 ISA [Natoma/Triton II] +
-                              input      PnP device PNP0303 +
-                              input      PnP device PNP0f13 +
-                              storage    PnP device PNP0700 +
-                              system     PnP device PNP0b00 +
-pci@0000:00:01.1  scsi1       storage    82371SB PIIX3 IDE [Natoma/Triton II] +
-scsi@1:0.0.0      /dev/cdrom  disk       QEMU DVD-ROM +
-pci@0000:00:01.2              bus        82371SB PIIX3 USB [Natoma/Triton II] +
-usb@1             usb1        bus        UHCI Host Controller +
-usb@1:          input5      input      QEMU QEMU USB Tablet +
-pci@0000:00:01.3              bridge     82371AB/EB/MB PIIX4 ACPI +
-pci@0000:00:02.0  /dev/fb0    display    bochs-drmdrmfb +
-pci@0000:00:03.0              generic    Virtio memory balloon +
-virtio@0                      generic    Virtual I/O device +
-pci@0000:00:07.0  scsi2       storage    82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Contr +
-scsi@2:0.0.0      /dev/sda    disk       34GB QEMU HARDDISK +
-scsi@2:0.0.0,   /dev/sda1   volume     1GiB EXT4 volume +
-scsi@2:0.0.0,2    /dev/sda2   volume     30GiB Linux LVM Physical Volume partition +
-scsi@3:0.0.0      /dev/sdb    disk       4294MB QEMU HARDDISK +
-scsi@4:0.0.0      /dev/sdc    disk       68GB QEMU HARDDISK +
-scsi@4:0.0.0,1    /dev/sdc1   volume     63GiB EXT4 volume +
-scsi@5:0.0.0      /dev/sdd    disk       34GB QEMU HARDDISK +
-pci@0000:00:12.0              network    Virtio network device +
-virtio@1          ens18       network    Ethernet interface +
-pci@0000:00:13.0              network    Virtio network device +
-virtio@2          ens19       network    Ethernet interface +
-pci@0000:00:1e.0              bridge     QEMU PCI-PCI bridge +
-pci@0000:00:1f.0              bridge     QEMU PCI-PCI bridge +
-                  input0      input      Power Button +
-                  input1      input      AT Translated Set 2 keyboard +
-                  input3      input      VirtualPS/2 VMware VMMouse +
-                  input4      input      VirtualPS/2 VMware VMMouse +
-                  input6      input      PC Speaker +
-</code>+
  
-Consultez maintenant le matériel de la classe **system** :+Même quand le modèle %%SELinux%% de sécurité est actif, la sécurité type DAC est toujours active. Cependant dans le cas où la sécurité du type DAC autorise une action, %%SELinux%% va évaluer cette action par rapport à ses propres règles avant de l'autoriser.
  
-<code> +%%SELinux%% évalue toujours des **//actions//** tentées par des **//sujets//** sur des **//objets//**. 
-[root@centos8 ~]# lshw -c system +
-centos8.ittraining.loc       +
-    description: Computer +
-    product: Standard PC (i440FX + PIIX, 1996) +
-    vendor: QEMU +
-    version: pc-i440fx-7.0 +
-    width: 64 bits +
-    capabilities: smbios-2.8 dmi-2.8 smp vsyscall32 +
-    configuration: boot=normal uuid=95bd69e3-4a74-44a7-b58c-b74fbfb86df2 +
-  *-pnp00:03 +
-       product: PnP device PNP0b00 +
-       physical id: 3 +
-       capabilities: pnp +
-       configuration: driver=rtc_cmos +
-</code>+
  
-Consultez maintenant le matériel des autres classes principales :+Dans le contexte de %%SELinux%% :
  
-<code> +  * un **//sujet//** est toujours un **processus**, 
-[root@centos8 ~]# lshw -c memory +  * un **//objet//** peut être un fichier, un répertoire, un autre processus ou une ressource système, 
-  *-firmware                 +  * une **//action//** est une **permission**.
-       description: BIOS +
-       vendor: SeaBIOS +
-       physical id: 0 +
-       version: rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org +
-       date: 04/01/2014 +
-       size: 96KiB +
-  *-memory +
-       description: System Memory +
-       physical id: 1000 +
-       size: 16GiB +
-       capabilities: ecc +
-       configuration: errordetection=multi-bit-ecc +
-     *-bank +
-          description: DIMM RAM [empty] +
-          vendor: QEMU +
-          physical id: 0 +
-          slot: DIMM 0+
  
-[root@centos8 ~]# lshw -c video +Chaque **//classe d'objet//** possède un jeu de permissions possibles ou **//actions//** qui peuvent être uniques à la classe ou bien **héritées** d'autres classes.
-  *-display                  +
-       description: VGA compatible controller +
-       product: bochs-drmdrmfb +
-       physical id: 2 +
-       bus info: pci@0000:00:02.0 +
-       logical name: /dev/fb0 +
-       version: 02 +
-       width: 32 bits +
-       clock: 33MHz +
-       capabilities: vga_controller rom fb +
-       configuration: depth=32 driver=bochs-drm latency=0 resolution=1280,800 +
-       resources: irq:0 memory:fd000000-fdffffff memory:fea90000-fea90fff memory:c0000-dffff+
  
 +====2.2 - Définitions====
  
-[root@centos8 ~]# lshw -c storage +===Security Context===
-  *-pnp00:02                 +
-       product: PnP device PNP0700 +
-       physical id: 2 +
-       capabilities: pnp +
-  *-ide +
-       description: IDE interface +
-       product: 82371SB PIIX3 IDE [Natoma/Triton II] +
-       vendor: Intel Corporation +
-       physical id: 1.1 +
-       bus info: pci@0000:00:01.1 +
-       logical name: scsi1 +
-       version: 00 +
-       width: 32 bits +
-       clock: 33MHz +
-       capabilities: ide isa_compat_mode bus_master emulated +
-       configuration: driver=ata_piix latency=+
-       resources: irq:0 ioport:1f0(size=8) ioport:3f6 ioport:170(size=8) ioport:376 ioport:e0c0(size=16) +
-  *-sata +
-       description: SATA controller +
-       product: 82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] +
-       vendor: Intel Corporation +
-       physical id: 7 +
-       bus info: pci@0000:00:07.0 +
-       logical name: scsi2 +
-       logical name: scsi3 +
-       logical name: scsi4 +
-       logical name: scsi5 +
-       version: 02 +
-       width: 32 bits +
-       clock: 33MHz +
-       capabilities: sata msi ahci_1.0 bus_master cap_list emulated +
-       configuration: driver=ahci latency=0 +
-       resources: irq:30 ioport:e060(size=32) memory:fea91000-fea91fff+
  
 +%%SELinux%% associe un //Security Context// (SC) à chaque **//objet//** et **//sujet//** du système. 
  
-[root@centos8 ~]# lshw -c disk +Un SC prend la forme **identité:rôle:type:niveau** :
-  *-cdrom                    +
-       description: DVD reader +
-       product: QEMU DVD-ROM +
-       vendor: QEMU +
-       physical id: 0.0.0 +
-       bus info: scsi@1:0.0.0 +
-       logical name: /dev/cdrom +
-       logical name: /dev/sr0 +
-       version: 2.5+ +
-       capabilities: removable audio dvd +
-       configuration: ansiversion=5 status=nodisc +
-  *-disk:+
-       descriptionATA Disk +
-       productQEMU HARDDISK +
-       physical id: 0 +
-       bus info: scsi@2:0.0.0 +
-       logical name: /dev/sda +
-       version: 2.5+ +
-       serial: QM00005 +
-       size: 32GiB (34GB) +
-       capabilities: partitioned partitioned:dos +
-       configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 signature=b39ec5c8 +
-  *-disk:1 +
-       description: ATA Disk +
-       product: QEMU HARDDISK +
-       physical id: 1 +
-       bus info: scsi@3:0.0.0 +
-       logical name: /dev/sdb +
-       version: 2.5+ +
-       serial: QM00007 +
-       size: 4GiB (4294MB) +
-       configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 +
-  *-disk:2 +
-       description: ATA Disk +
-       product: QEMU HARDDISK +
-       physical id: 2 +
-       bus info: scsi@4:0.0.0 +
-       logical name: /dev/sdc +
-       version: 2.5+ +
-       serial: QM00009 +
-       size: 64GiB (68GB) +
-       capabilities: partitioned partitioned:dos +
-       configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 signature=45352f44 +
-  *-disk:3 +
-       description: ATA Disk +
-       product: QEMU HARDDISK +
-       physical id: 3 +
-       bus info: scsi@5:0.0.0 +
-       logical name: /dev/sdd +
-       version: 2.5+ +
-       serial: QM00011 +
-       size: 32GiB (34GB) +
-       configurationansiversion=5 logicalsectorsize=512 sectorsize=512+
  
 +^ Nom ^ Descriptions ^
 +| Identité | Le nom du propriétaire de l'objet. Une identité est associée à des rôles. Par défaut l'utilisateur à une identité de **user_u**. |
 +| Rôle | Essentiellement appliqué aux processus, le rôle est appelé une domaine. Dans le cas d'un rôle de fichier, celui-ci est toujours **object_r**. Un rôle se termine généralement par **_r**. |
 +| Type | Définit la classification de sécurité de l'objet. Un type se termine généralement par **_t**.|
 +| Niveau | Un niveau est un attribut de MLS et MCS. Une plage MLS est une paire de niveaux exprimée en utilisant la syntaxe //niveaubas-niveauhaut//. Chaque niveau est une paire exprimée en tant que sensibilitéhaut-sensibilitébas:catégoriehaut:catégoriebas par exemple s0-s0:c0.c1023. Il est important de noter que s0-s0 s'exprime aussi s0 et c0, c1, c2, c3 est exprimé c0.c3. |
  
-[root@centos8 ~]# lshw -c volume +Sous RedHat 9, le fichier **/etc/selinux/targeted/setrans.conf** contient la correspondance entre les niveaux et leurs valeurs compréhensibles par l'utilisateur :
-  *-volume:                +
-       description: EXT4 volume +
-       vendor: Linux +
-       physical id: 1 +
-       bus info: scsi@2:0.0.0,+
-       logical name: /dev/sda1 +
-       logical name: /boot +
-       version: 1.0 +
-       serial: 1c04981e-5317-4b73-9695-3ce25246835d +
-       size: 1GiB +
-       capacity: 1GiB +
-       capabilities: primary bootable journaled extended_attributes large_files huge_files dir_nlink recover 64bit extents ext4 ext2 initialized +
-       configuration: created=2021-06-16 12:21:27 filesystem=ext4 lastmountpoint=/boot modified=2022-11-10 07:12:41 mount.fstype=ext4 mount.options=rw,seclabel,relatime mounted=2022-11-10 07:12:41 state=mounted +
-  *-volume:1 +
-       description: Linux LVM Physical Volume partition +
-       physical id: 2 +
-       bus info: scsi@2:0.0.0,+
-       logical name: /dev/sda2 +
-       serial: kOJTuY-TbBA-JSvU-vhkb-rvpz-QoPt-bIKe2e +
-       size: 30GiB +
-       capacity: 30GiB +
-       capabilities: primary multi lvm2 +
-  *-volume +
-       description: EXT4 volume +
-       vendor: Linux +
-       physical id: 1 +
-       bus info: scsi@4:0.0.0,+
-       logical name: /dev/sdc1 +
-       logical name: /home +
-       version: 1.0 +
-       serial: f76d6b66-985b-4a91-af9c-4987e8c1443c +
-       size: 63GiB +
-       capacity: 63GiB +
-       capabilities: primary journaled extended_attributes large_files huge_files dir_nlink recover 64bit extents ext4 ext2 initialized +
-       configuration: created=2021-07-19 18:02:13 filesystem=ext4 lastmountpoint=/home modified=2022-11-10 15:34:07 mount.fstype=ext4 mount.options=rw,seclabel,relatime mounted=2022-11-10 15:34:07 state=mounted+
  
-[root@centos8 ~]# lshw -c network +<code> 
-  *-network:               +[root@redhat9 attributs]# cat /etc/selinux/targeted/setrans.conf 
-       description: Ethernet controller +# 
-       product: Virtio network device +# Multi-Category Security translation table for SELinux 
-       vendor: Red Hat, Inc+ 
-       physical id: 12 +# Uncomment the following to disable translation libary 
-       bus info: pci@0000:00:12.0 +# disable=1 
-       version: 00 +# 
-       width: 64 bits +# Objects can be categorized with 0-1023 categories defined by the admin. 
-       clock: 33MHz +# Objects can be in more than one category at a time. 
-       capabilities: msix bus_master cap_list rom +# Categories are stored in the system as c0-c1023.  Users can use this 
-       configuration: driver=virtio-pci latency=0 +# table to translate the categories into a more meaningful output
-       resources: irq:10 ioport:e080(size=32) memory:fea92000-fea92fff memory:fe404000-fe407fff memory:fea00000-fea3ffff +# Examples
-     *-virtio1 +# s0:c0=CompanyConfidential 
-          description: Ethernet interface +# s0:c1=PatientRecord 
-          physical id: 0 +# s0:c2=Unclassified 
-          bus info: virtio@+# s0:c3=TopSecret 
-          logical name: ens18 +# s0:c1,c3=CompanyConfidentialRedHat 
-          serial: 5e:3f:e8:43:d5:f9 +s0=SystemLow 
-          capabilities: ethernet physical +s0-s0:c0.c1023=SystemLow-SystemHigh 
-          configuration: autonegotiation=off broadcast=yes driver=virtio_net driverversion=1.0.0 ip=10.0.2.45 link=yes multicast=yes +s0:c0.c1023=SystemHigh
-  *-network:1 +
-       description: Ethernet controller +
-       product: Virtio network device +
-       vendor: Red Hat, Inc+
-       physical id13 +
-       bus infopci@0000:00:13.0 +
-       version00 +
-       width64 bits +
-       clock33MHz +
-       capabilitiesmsix bus_master cap_list rom +
-       configuration: driver=virtio-pci latency=0 +
-       resourcesirq:10 ioport:e0a0(size=32) memory:fea93000-fea93fff memory:fe408000-fe40bfff memory:fea40000-fea7ffff +
-     *-virtio2 +
-          descriptionEthernet interface +
-          physical id: 0 +
-          bus info: virtio@2 +
-          logical name: ens19 +
-          serial: ea:c8:86:9e:73:a6 +
-          capabilities: ethernet physical +
-          configuration: autonegotiation=off broadcast=yes driver=virtio_net driverversion=1.0.0 link=yes multicast=yes+
 </code> </code>
  
-===Options de la commande===+Dans le contexte d'un SC pour un **//sujet//**, le champ **identité** indique les privilèges de l'utilisateur %%SELinux%% utilisés par le **//sujet//**.
  
-Les options de cette commande sont :+Dans le contexte d'un SC pour un **//objet//**, le champ **identité** indique à quel utilisateur %%SELinux%% appartient l'**//objet//**.
  
-<code> +%%SELinux%% maintient sa propre liste d'utilisateurs, différente de la liste DAC de LinuxIl existe cependant une correspondance entre les deux listes de façon à ce que les utilisateurs MAC puissent être soumissent aux restrictions de %%SELinux%% :
-[root@centos8 ~]# lshw -h +
-Hardware Lister (lshw) - B.02.19.2 +
-usagelshw [-format] [-options ...] +
-       lshw -version+
  
-        -version        print program version (B.02.19.2)+<code> 
 +[root@redhat9 attributs]# /usr/sbin/semanage login -l
  
-format can be +Login Name           SELinux User         MLS/MCS Range        Service
-        -html           output hardware tree as HTML +
-        -xml            output hardware tree as XML +
-        -json           output hardware tree as a JSON object +
-        -short          output hardware paths +
-        -businfo        output bus information+
  
-options can be +__default__          unconfined_u         s0-s0:c0.c1023       * 
-        -dump filename  displays output and dump collected information into a file (SQLite database) +root                 unconfined_u         s0-s0:c0.c1023       *
-        -class CLASS    only show a certain class of hardware +
-        -C CLASS        same as '-class CLASS' +
-        -c CLASS        same as '-class CLASS' +
-        -disable TEST   disable a test (like pci, isapnp, cpuid, etc) +
-        -enable TEST    enable a test (like pci, isapnp, cpuid, etc+
-        -quiet          don't display status +
-        -sanitize       sanitize output (remove sensitive information like serial numbers, etc.) +
-        -numeric        output numeric IDs (for PCI, USB, etc.) +
-        -notime         exclude volatile attributes (timestamps) from output+
 </code> </code>
  
-====1.7 - La Commande dmidecode====+===Domains et Types===
  
-La commande **dmidecode** lit la table **DMI** (//Desktop Management Interface//) aussi appelée **SMBIOS** (//System Management BIOS//) et fourni les informations sur :+Le **Domain** est l'endroit d'exécution d'un processus. Chaque processus a un **Domain**. Le **Domain** détermine les accès du processus.
  
-  l'état du matériel actuel, +Le **Domain** contient des **//objets//** et des **//sujets//** qui interagissent ensemble. Ce modèleoù chaque **//sujet//** se voit attribué à un **Domain** et où uniquement certaines opérations sont permises, est appelé **//Type Enforcement//**.
-  les extensions possibles.+
  
-<code> +Dans %%SELinux%% on utilise le mot :
-[root@centos8 ~]# dmidecode +
-# dmidecode 3.2 +
-Getting SMBIOS data from sysfs. +
-SMBIOS 2.8 present. +
-11 structures occupying 511 bytes. +
-Table at 0x000F5870.+
  
-Handle 0x0000DMI type 0, 24 bytes +  * **Domain** pour un processus
-BIOS Information +  * **Type** pour un fichier.
-        Vendor: SeaBIOS +
-        Version: rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org +
-        Release Date: 04/01/2014 +
-        Address: 0xE8000 +
-        Runtime Size: 96 kB +
-        ROM Size: 64 kB +
-        Characteristics: +
-                BIOS characteristics not supported +
-                Targeted content distribution is supported +
-        BIOS Revision: 0.0+
  
-Handle 0x0100, DMI type 1, 27 bytes +===Roles===
-System Information +
-        Manufacturer: QEMU +
-        Product Name: Standard PC (i440FX + PIIX, 1996) +
-        Version: pc-i440fx-5.2 +
-        Serial Number: Not Specified +
-        UUID: 95bd69e3-4a74-44a7-b58c-b74fbfb86df2 +
-        Wake-up Type: Power Switch +
-        SKU Number: Not Specified +
-        Family: Not Specified+
  
-Handle 0x0300, DMI type 3, 22 bytes +Un **Rôle** est comme un utilisateur dans le système de sécurité DAC de Linux. Chaque utilisateur autorisé peut assumer l'identité du **Rôle** afin d'exécuter les commandes liées au **Rôle**.
-Chassis Information +
-        Manufacturer: QEMU +
-        Type: Other +
-        Lock: Not Present +
-        Version: pc-i440fx-5.+
-        Serial Number: Not Specified +
-        Asset Tag: Not Specified +
-        Boot-up State: Safe +
-        Power Supply State: Safe +
-        Thermal State: Safe +
-        Security Status: Unknown +
-        OEM Information: 0x00000000 +
-        Height: Unspecified +
-        Number Of Power Cords: Unspecified +
-        Contained Elements: 0 +
-        SKU Number: Not Specified+
  
-Handle 0x0400, DMI type 4, 42 bytes +===Politiques de Sécurité===
-Processor Information +
-        Socket Designation: CPU 0 +
-        Type: Central Processor +
-        Family: Other +
-        Manufacturer: QEMU +
-        ID: 61 0F 00 00 FF FB 8B 07 +
-        Version: pc-i440fx-5.2 +
-        Voltage: Unknown +
-        External Clock: Unknown +
-        Max Speed: 2000 MHz +
-        Current Speed: 2000 MHz +
-        Status: Populated, Enabled +
-        Upgrade: Other +
-        L1 Cache Handle: Not Provided +
-        L2 Cache Handle: Not Provided +
-        L3 Cache Handle: Not Provided +
-        Serial Number: Not Specified +
-        Asset Tag: Not Specified +
-        Part Number: Not Specified +
-        Core Count: 4 +
-        Core Enabled: 4 +
-        Thread Count: 1 +
-        Characteristics: None+
  
-Handle 0x0401, DMI type 4, 42 bytes +Une politique de sécurité définit les SC de chaque applicationElle définit des droits d'accès des domaines aux types. Il y a deux types de politique possible :
-Processor Information +
-        Socket Designation: CPU 1 +
-        Type: Central Processor +
-        Family: Other +
-        Manufacturer: QEMU +
-        ID: 61 0F 00 00 FF FB 8B 07 +
-        Version: pc-i440fx-5.+
-        Voltage: Unknown +
-        External Clock: Unknown +
-        Max Speed: 2000 MHz +
-        Current Speed: 2000 MHz +
-        Status: Populated, Enabled +
-        Upgrade: Other +
-        L1 Cache Handle: Not Provided +
-        L2 Cache Handle: Not Provided +
-        L3 Cache Handle: Not Provided +
-        Serial Number: Not Specified +
-        Asset Tag: Not Specified +
-        Part Number: Not Specified +
-        Core Count: 4 +
-        Core Enabled: 4 +
-        Thread Count: 1 +
-        CharacteristicsNone+
  
-Handle 0x1000, DMI type 16, 23 bytes +^ Politique ^ Description ^ 
-Physical Memory Array +| targeted | Les politiques de sécurité ne s'appliquent qu'à certaines applications | 
-        Location: Other +| mls | Multi Level Security protection |
-        Use: System Memory +
-        Error Correction Type: Multi-bit ECC +
-        Maximum Capacity: 4 GB +
-        Error Information Handle: Not Provided +
-        Number Of Devices: 1+
  
-Handle 0x1100, DMI type 17, 40 bytes +Les politiques de sécurité se trouvent dans le répertoire **/etc/selinux** :
-Memory Device +
-        Array Handle0x1000 +
-        Error Information Handle: Not Provided +
-        Total Width: Unknown +
-        Data Width: Unknown +
-        Size: 4 GB +
-        Form Factor: DIMM +
-        Set: None +
-        Locator: DIMM 0 +
-        Bank Locator: Not Specified +
-        Type: RAM +
-        Type Detail: Other +
-        Speed: Unknown +
-        Manufacturer: QEMU +
-        Serial Number: Not Specified +
-        Asset Tag: Not Specified +
-        Part Number: Not Specified +
-        Rank: Unknown +
-        Configured Memory Speed: Unknown +
-        Minimum Voltage: Unknown +
-        Maximum Voltage: Unknown +
-        Configured Voltage: Unknown+
  
-Handle 0x1300, DMI type 19, 31 bytes +<code> 
-Memory Array Mapped Address +[root@redhat9 attributs]# ls -lR /etc/selinux/ | more 
-        Starting Address0x00000000000 +/etc/selinux/
-        Ending Address: 0x000BFFFFFFF +total 8 
-        Range Size: 3 GB +-rw-r--r--. 1 root root 1187 Oct 19  2023 config 
-        Physical Array Handle: 0x1000 +-rw-r--r--. 1 root root 2668 Dec 14  2023 semanage.conf 
-        Partition Width1+drwxr-xr-x. 5 root root  133 Sep 25 12:04 targeted
  
-Handle 0x1301, DMI type 19, 31 bytes +/etc/selinux/targeted: 
-Memory Array Mapped Address +total 16 
-        Starting Address0x00100000000 +-rw-r--r--. 1 root root 2367 Jun  5 11:17 booleans.subs_dist 
-        Ending Address0x0013FFFFFFF +drwxr-xr-x. 4 root root 4096 Sep 25 11:58 contexts 
-        Range Size1 GB +drwxr-xr-x. 2 root root    6 Jun  5 11:17 logins 
-        Physical Array Handle0x1000 +drwxr-xr-x. 2 root root   23 Sep 25 12:04 policy 
-        Partition Width: 1+-rw-r--r--. 1 root root  607 Jun  5 11:17 setrans.conf 
 +-rw-r--r--. root root   73 Sep 25 12:04 seusers
  
-Handle 0x2000, DMI type 32, 11 bytes +/etc/selinux/targeted/contexts: 
-System Boot Information +total 72 
-        StatusNo errors detected +-rw-r--r--. 1 root root  262 Sep 25 11:58 customizable_types 
- +-rw-r--r--. 1 root root  195 Jun  5 11:17 dbus_contexts 
-Handle 0x7F00, DMI type 127, 4 bytes +-rw-r--r--. 1 root root 1111 Jun  5 11:17 default_contexts 
-End Of Table+-rw-r--r--. 1 root root  114 Jun  5 11:17 default_type 
 +-rw-r--r--. 1 root root   29 Jun  5 11:17 failsafe_context 
 +drwxr-xr-x. 2 root root 4096 Sep 25 12:04 files 
 +--More--
 </code> </code>
  
-===Options de la commande=== +Afin d'utiliser SELinux en ligne de commande sous RedHat 9, il est nécessaire d'installer le paquet **setools-console** :
- +
-Les options de cette commande sont :+
  
 <code> <code>
-[root@centos7 ~]# dmidecode --help +[root@redhat9 attributs]# dnf install setools-console -y
-Usage: dmidecode [OPTIONS] +
-Options are: +
- -d, --dev-mem FILE     Read memory from device FILE (default: /dev/mem) +
- -h, --help             Display this help text and exit +
- -q, --quiet            Less verbose output +
- -s, --string KEYWORD   Only display the value of the given DMI string +
- -t, --type TYPE        Only display the entries of given type +
- -u, --dump             Do not decode the entries +
-     --dump-bin FILE    Dump the DMI data to a binary file +
-     --from-dump FILE   Read the DMI data from a binary file +
- -V, --version          Display the version and exit+
 </code> </code>
  
-====1.8 - La Commande smartctl==== +Pour consulter les statistiques de la politique, il convient d'utiliser la commande **seinfo** :
- +
-**smartctl** contrôle le système SMART (Self-Monitoring, Analysis and Reporting Technology) intégré à la plupart des disques durs et disques SSD ATA/SATA et SCSI/SAS :+
  
 <code> <code>
-[root@centos8 ~]# smartctl --smart=on --saveauto=on --offlineauto=on /dev/sdb+[root@redhat9 attributs]# seinfo 
 +Statistics for policy file: /sys/fs/selinux/policy 
 +Policy Version:             33 (MLS enabled) 
 +Target Policy:              selinux 
 +Handle unknown classes:     allow 
 +  Classes:             135    Permissions:         457 
 +  Sensitivities:            Categories:         1024 
 +  Types:              5155    Attributes:          259 
 +  Users:                    Roles:                15 
 +  Booleans:            360    Cond. Expr.:         393 
 +  Allow:             65813    Neverallow:            0 
 +  Auditallow:          176    Dontaudit:          8692 
 +  Type_trans:       272792    Type_change:          94 
 +  Type_member:          37    Range_trans:        6164 
 +  Role allow:           40    Role_trans:          419 
 +  Constraints:          70    Validatetrans:         0 
 +  MLS Constrain:        72    MLS Val. Tran:         0 
 +  Permissives:              Polcap:                6 
 +  Defaults:              7    Typebounds:            0 
 +  Allowxperm:            0    Neverallowxperm:       0 
 +  Auditallowxperm:          Dontauditxperm:        0 
 +  Ibendportcon:          0    Ibpkeycon:             0 
 +  Initial SIDs:         27    Fs_use:               35 
 +  Genfscon:            109    Portcon:             665 
 +  Netifcon:              0    Nodecon:               0 
 +</code>
  
-[root@centos8 ~]# smartctl -a /dev/sdb +<WRAP center round important 50%> 
-smartctl 7.1 2020-04-05 r5049 [x86_64-linux-4.18.0-305.7.1.el8_4.x86_64] (local build) +**Important** : Notez ici le grand nombre de la catégorie **Dontaudit**
-Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org+</WRAP>
  
-=== START OF INFORMATION SECTION === +===Langage de Politiques===
-Device Model:     QEMU HARDDISK +
-Serial Number:    QM00007 +
-Firmware Version: 2.5+ +
-User Capacity:    4,294,967,296 bytes [4.29 GB] +
-Sector Size:      512 bytes logical/physical +
-Device is:        Not in smartctl database [for details use: -P showall] +
-ATA Version is:   ATA/ATAPI-7, ATA/ATAPI-5 published, ANSI NCITS 340-2000 +
-Local Time is:    Sun Nov 13 09:12:18 2022 CET +
-SMART support is: Available - device has SMART capability. +
-SMART support is: Enabled+
  
-=== START OF READ SMART DATA SECTION === +Un politique est composé de centaines de directives. Les principales directives sont :
-SMART overall-health self-assessment test resultPASSED+
  
-General SMART Values: +==allow==
-Offline data collection status:  (0x02) Offline data collection activity +
-                                        was completed without error. +
-                                        Auto Offline Data Collection: Disabled. +
-Self-test execution status:      (   0) The previous self-test routine completed +
-                                        without error or no self-test has ever  +
-                                        been run. +
-Total time to complete Offline  +
-data collection:                (  288) seconds. +
-Offline data collection +
-capabilities:                    (0x19) SMART execute Offline immediate. +
-                                        No Auto Offline data collection support. +
-                                        Suspend Offline collection upon new +
-                                        command. +
-                                        Offline surface scan supported. +
-                                        Self-test supported. +
-                                        No Conveyance Self-test supported. +
-                                        No Selective Self-test supported. +
-SMART capabilities:            (0x0003) Saves SMART data before entering +
-                                        power-saving mode. +
-                                        Supports SMART auto save timer. +
-Error logging capability:        (0x01) Error logging supported. +
-                                        No General Purpose Logging support. +
-Short self-test routine  +
-recommended polling time:        (   2) minutes. +
-Extended self-test routine +
-recommended polling time:        (  54) minutes.+
  
-SMART Attributes Data Structure revision number+**allow** autorise l'accès d'un processus d'un domaine à des fichiers appartenant à un type donné. Le format de la directive est :
-Vendor Specific SMART Attributes with Thresholds: +
-ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE +
-  1 Raw_Read_Error_Rate     0x0003   100   100   006    Pre-fail  Always             0 +
-  3 Spin_Up_Time            0x0003   100   100   000    Pre-fail  Always             16 +
-  4 Start_Stop_Count        0x0002   100   100   020    Old_age   Always             100 +
-  5 Reallocated_Sector_Ct   0x0003   100   100   036    Pre-fail  Always             0 +
-  9 Power_On_Hours          0x0003   100   100   000    Pre-fail  Always             1 +
- 12 Power_Cycle_Count       0x0003   100   100   000    Pre-fail  Always             0 +
-190 Airflow_Temperature_Cel 0x0003   069   069   050    Pre-fail  Always             31 (Min/Max 31/31)+
  
-SMART Error Log Version+  allow user_t domaine_t file (read execute getattr) ;
-No Errors Logged+
  
-SMART Self-test log structure revision number 1 +Dans cette directive :
-No self-tests have been logged.  [To run self-tests, usesmartctl -t]+
  
-Selective Self-tests/Logging not supported +  * user_t est le type de fichier, 
-</code>+  * domaine_t est le domaine des processus qui sont autorisés par allow, 
 +  * file (droit1 droit2 etc) est la liste des permissions accordées.
  
-===Options de la commande===+Les permissions possibles sont :
  
-Les options de cette commande sont :+  * read 
 +  * write 
 +  * append 
 +  * execute 
 +  * getattr 
 +  * setattr 
 +  * lock 
 +  * link 
 +  * unlink 
 +  * rename 
 +  * ioctl
  
-<code> +==type==
-[root@centos8 ~]# smartctl --help +
-smartctl 7.1 2020-04-05 r5049 [x86_64-linux-4.18.0-305.7.1.el8_4.x86_64] (local build) +
-Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org+
  
-Usage: smartctl [options] device+La directive **type** définit un type %%SELinux%%. Le type se termine généralement par **_t**.
  
-============================================ SHOW INFORMATION OPTIONS =====+**auditallow, dontaudit**
  
-  -h, --help, --usage +La directive **auditallow** demande l'écriture d'un message de type **avc** dans les journaux. Elle n'est associée à aucune restriction.
-         Display this help and exit+
  
-  -V--version--copyright, --license +L'inverse peut être obtenue avec **dontaudit**à savoircette directive demande à ce qu'il n'y ait pas de journalisation après une interdiction.
-         Print license, copyright, and version information and exit+
  
-  -i, --info +===type_transition===
-         Show identity information for device+
  
-  --identify[=[w][nvb]] +Normalement quand un fichier est créé, il hérite du SC du répertoire parent. De même quand un processus %%SELinux%% active un nouveau processus, ce dernier s'exécute dans le même domaine que son parent. La directive type_transition permet de modifier ce comportement.
-         Show words and bits from IDENTIFY DEVICE data                (ATA)+
  
-  -g NAME, --get=NAME +===Décisions de SELinux===
-        Get device setting: all, aam, apm, dsn, lookahead, security, +
-        wcache, rcache, wcreorder, wcache-sct+
  
-  -a, --all +Il existe deux types de décisions auxquelles %%SELinux%% doit faire face :
-         Show all SMART information for device+
  
-  -x, --xall +  * **Décisions d'Accès** 
-         Show all information for device+  * **Décisions de Transition**
  
-  --scan +==Décisions d'Accès==
-         Scan for devices+
  
-  --scan-open +Dans ce type de décision %%SELinux%% doit décider d'accorder ou non la permission à :
-         Scan for devices and try to open each device+
  
-================================== SMARTCTL RUN-TIME BEHAVIOR OPTIONS =====+  * un **//sujet//** de faire quelque chose à un **//objet//** existant, 
 +  * un **//sujet//** de créer de nouvelles choses dans le **Domain**. 
  
-  -j, --json[=[cgiosuv]] +==Décisions de Transition==
-         Print output in JSON format+
  
-  -q TYPE, --quietmode=TYPE                                           (ATA) +Dans ce type de décision %%SELinux%% doit décider d'accorder ou non la permission :
-         Set smartctl quiet mode to one oferrorsonly, silent, noserial+
  
-  -TYPE--device=TYPE +  d'invoquer un processus dans un **Domain** différent du **Domain** courant du **//sujet//**
-         Specify device type to one of: +  * de créer des **//objets//** dans différents **Types** que le répertoire parent de l'**//objet//**.
-         ata, scsi[+TYPE], nvme[,NSID], sat[,auto][,N][+TYPE], usbcypress[,X], usbjmicron[,p][,x][,N], usbprolific, usbsunplus, sntjmicron[,NSID], intelliprop,N[+TYPE], jmb39x,N[,sLBA][,force][+TYPE], marvell, areca,N/E, 3ware,N, hpt,L/M/N, megaraid,N, aacraid,H,L,ID, cciss,N, auto, test+
  
-  -T TYPE, --tolerance=TYPE                                           (ATA) +====Commandes SELinux====
-         Tolerance: normal, conservative, permissive, verypermissive+
  
-  -b TYPE, --badsum=TYPE                                              (ATA) +^ Commande ^ Description ^ 
-         Set action on bad checksum to one of: warn, exit, ignore+| chcon | Changer le SC d'un fichier | 
 +| audit2allow | Générer la source de la règle de sécurité à l'origine d'une erreur | 
 +| restorecon | Restaurer le SC par défaut à un ou plusieurs fichiers | 
 +| setfiles -n | Vérifier si les SC sont corrects 
 +| semodule | Gèrer les modules de politiques | 
 +| semodule -i | Installer un module de politiques | 
 +| checkmodule | Compiler un module | 
 +| semodule_package | Créer un module installable par semodule | 
 +| semanage | Administrer une politique | 
 +| audit2allow -M | Créer un module à partir d'un message d'audit | 
 +| sesearch | Recherche des règles %%SELinux%% | 
 +| seinfo | Effectuer des recherches dans la politique | 
 +| getsebool | Affiche l'état d'un booléen | 
 +| getsebool -a | Affiche l'état de l'ensemble des booléens | 
 +| sestatus -b | Affiche l'état de l'ensemble des booléens | 
 +| setsebool | Modifie l'état d'un booléen | 
 +| togglesebool | Bascule la valeur d'un booléen |
  
-  -r TYPE, --report=TYPE +====Les Etats de SELinux====
-         Report transactions (see man page)+
  
-  -n MODE[,STATUS], --nocheck=MODE[,STATUS]                           (ATA) +%%SELinux%% connait trois états :
-         No check ifnever, sleep, standby, idle (see man page)+
  
-============================== DEVICE FEATURE ENABLE/DISABLE COMMANDS =====+^ Etat ^ Description ^ 
 +| disabled | %%SELinux%% est inactif. | 
 +| permissive | %%SELinux%% est actif mais tout est permis. Des interdictions ne font que de générer des messages d'erreurs dans les logs. | 
 +| enforcing | %%SELinux%% est actif. |
  
-  -s VALUE, --smart=VALUE +L'examen du contenu du fichier **/selinux/enforce** révèle une de deux valeurs qui correspondent à l'**état** de %%SELinux%% :
-        Enable/disable SMART on device (on/off)+
  
-  -o VALUE, --offlineauto=VALUE                                       (ATA) +^ Valeur ^ Description ^ 
-        Enable/disable automatic offline testing on device (on/off)+| 0 | %%SELinux%% est en mode //permissive//
 +| 1 | %%SELinux%% est en mode //enforcing// |
  
-  -S VALUE, --saveauto=VALUE                                          (ATA) +La configuration de l'activation de %%SELinux%% ainsi que son état est effectuée grâce au fichier **/etc/selinux/config** :
-        Enable/disable Attribute autosave on device (on/off)+
  
-  -s NAME[,VALUE], --set=NAME[,VALUE] +<code> 
-        Enable/disable/change device setting: aam,[N|off], apm,[N|off], +[root@redhat9 attributs]# cat /etc/selinux/config
-        dsn,[on|off], lookahead,[on|off], security-freeze, +
-        standby,[N|off|now], wcache,[on|off], rcache,[on|off], +
-        wcreorder,[on|off[,p]], wcache-sct,[ata|on|off[,p]]+
  
-======================================= READ AND DISPLAY DATA OPTIONS =====+# This file controls the state of SELinux on the system. 
 +# SELINUXcan take one of these three values: 
 +#     enforcing - SELinux security policy is enforced. 
 +#     permissive - SELinux prints warnings instead of enforcing. 
 +#     disabled - No SELinux policy is loaded. 
 +# See also: 
 +# https://docs.fedoraproject.org/en-US/quick-docs/getting-started-with-selinux/#getting-started-with-selinux-selinux-states-and-modes 
 +
 +# NOTE: In earlier Fedora kernel builds, SELINUX=disabled would also 
 +# fully disable SELinux during boot. If you need a system with SELinux 
 +# fully disabled instead of SELinux running with no policy loaded, you 
 +# need to pass selinux=0 to the kernel command line. You can use grubby 
 +# to persistently set the bootloader to boot with selinux=0: 
 +
 +#    grubby --update-kernel ALL --args selinux=
 +
 +# To revert back to SELinux enabled: 
 +
 +#    grubby --update-kernel ALL --remove-args selinux 
 +
 +SELINUX=enforcing 
 +# SELINUXTYPEcan 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>
  
-  -H--health +Afin de connaître l'état de %%SELinux%%il convient d'utiliser la commande **getenforce** :
-        Show device SMART health status+
  
-  -c, --capabilities                                            (ATA, NVMe) +<code> 
-        Show device SMART capabilities+[root@redhat9 attributs]# getenforce 
 +Enforcing 
 +</code>
  
-  -A--attributes +Pour modifier l'état de %%SELinux%%il convient d'utiliser la commande **setenforce** :
-        Show device SMART vendor-specific Attributes and values+
  
-  -f FORMAT, --format=FORMAT                                          (ATA) +<code> 
-        Set output format for attributes: old, brief, hex[,id|val]+[root@redhat9 attributs]# setenforce permissive
  
-  -l TYPE, --log=TYPE +[root@redhat9 attributs]# getenforce 
-        Show device log. TYPE: error, selftest, selective, directory[,g|s], +Permissive 
-        xerror[,N][,error], xselftest[,N][,selftest], background, +</code>
-        sasphy[,reset], sataphy[,reset], scttemp[sts,hist], +
-        scttempint,N[,p], scterc[,N,M], devstat[,N], defects[,N], ssd, +
-        gplog,N[,RANGE], smartlog,N[,RANGE], nvmelog,N,SIZE+
  
-  -v N,OPTION , --vendorattribute=N,OPTION                            (ATA) +La commande **sestatus** vous informe sur la configuration de %%SELinux%% et notamment sur la version de la politique utilisée :
-        Set display OPTION for vendor Attribute N (see man page)+
  
-  -F TYPE, --firmwarebug=TYPE                                         (ATA+<code> 
-        Use firmware bug workaround+root@redhat9 attributs]# sestatus 
-        none, nologdir, samsung, samsung2, samsung3, xerrorlba, swapid+SELinux status:                 enabled 
 +SELinuxfs mount:                /sys/fs/selinux 
 +SELinux root directory:         /etc/selinux 
 +Loaded policy name:             targeted 
 +Current mode:                   permissive 
 +Mode from config file:          enforcing 
 +Policy MLS status:              enabled 
 +Policy deny_unknown status:     allowed 
 +Memory protection checking:     actual (secure
 +Max kernel policy version     33 
 +</code>
  
-  -P TYPE, --presets=TYPE                                             (ATA) +Les différentes versions de politiques évolue en même temps que le noyau Linux. 
-        Drive-specific presets: use, ignore, show, showall+
  
-  -B [+]FILE, --drivedb=[+]FILE                                       (ATA) +La commande sestatus peut aussi prendre l'option -v :
-        Read and replace [add] drive database from FILE +
-        [default is +/etc/smartmontools/smart_drivedb.h +
-         and then    /usr/share/smartmontools/drivedb.h]+
  
-============================================ DEVICE SELF-TEST OPTIONS =====+<code> 
 +[root@redhat9 attributs]# sestatus -
 +SELinux status:                 enabled 
 +SELinuxfs mount:                /sys/fs/selinux 
 +SELinux root directory:         /etc/selinux 
 +Loaded policy name:             targeted 
 +Current mode:                   permissive 
 +Mode from config file:          enforcing 
 +Policy MLS status:              enabled 
 +Policy deny_unknown status:     allowed 
 +Memory protection checking:     actual (secure) 
 +Max kernel policy version:      33
  
-  -t TEST, --test=TEST +Process contexts: 
-        Run testTESToffline, short, long, conveyance, force, vendor,N, +Current context:                unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 
-                        select,M-N, pending,N, afterselect,[on|off]+Init context                  system_u:system_r:init_t:s0 
 +/usr/sbin/sshd                  system_u:system_r:sshd_t:s0-s0:c0.c1023
  
-  -C, --captive +File contexts: 
-        Do test in captive mode (along with -t)+Controlling terminal:           unconfined_u:object_r:user_devpts_t:s0 
 +/etc/passwd                     system_u:object_r:passwd_file_t:s0 
 +/etc/shadow                     system_u:object_r:shadow_t:s0 
 +/bin/bash                       system_u:object_r:shell_exec_t:s0 
 +/bin/login                      system_u:object_r:login_exec_t:s0 
 +/bin/sh                         system_u:object_r:bin_t:s0 -> system_u:object_r:shell_exec_t:s0 
 +/sbin/agetty                    system_u:object_r:getty_exec_t:s0 
 +/sbin/init                      system_u:object_r:bin_t:s0 -> system_u:object_r:init_exec_t:s0 
 +/usr/sbin/sshd                  system_u:object_r:sshd_exec_t:s0 
 +</code>
  
-  -X, --abort +====Booléens====
-        Abort any non-captive test on device+
  
-=================================================== SMARTCTL EXAMPLES =====+Les booléens permettent à des ensembles de règles d'être utilisées d'une manière alternative.
  
-  smartctl --all /dev/sda                    (Prints all SMART information)+Pour visualiser l'état l'ensemble des booléens, il convient d'utiliser la commande **getsebool -a** :
  
-  smartctl --smart=on --offlineauto=on --saveauto=on /dev/sda +<code> 
-                                              (Enables SMART on first disk)+[root@redhat9 attributs]# getsebool -a | more 
 +abrt_anon_write --> off 
 +abrt_handle_event --> off 
 +abrt_upload_watch_anon_write --> on 
 +antivirus_can_scan_system --> off 
 +antivirus_use_jit --> off 
 +auditadm_exec_content --> on 
 +authlogin_nsswitch_use_ldap --> off 
 +authlogin_radius --> off 
 +authlogin_yubikey --> off 
 +awstats_purge_apache_log_files --> off 
 +boinc_execmem --> on 
 +cdrecord_read_content --> off 
 +cluster_can_network_connect --> off 
 +cluster_manage_all_files --> off 
 +cluster_use_execmem --> off 
 +cobbler_anon_write --> off 
 +cobbler_can_network_connect --> off 
 +cobbler_use_cifs --> off 
 +cobbler_use_nfs --> off 
 +collectd_tcp_network_connect --> off 
 +colord_use_nfs --> off 
 +condor_tcp_network_connect --> off 
 +conman_can_network --> off 
 +conman_use_nfs --> off 
 +container_connect_any --> off 
 +container_manage_cgroup --> off 
 +container_read_certs --> off 
 +container_use_cephfs --> off 
 +container_use_devices --> off 
 +container_use_dri_devices --> on 
 +container_use_ecryptfs --> off 
 +container_user_exec_content --> on 
 +cron_can_relabel --> off 
 +cron_system_cronjob_use_shares --> off 
 +cron_userdomain_transition --> on 
 +cups_execmem --> off 
 +cvs_read_shadow --> off 
 +daemons_dontaudit_scheduling --> on 
 +daemons_dump_core --> off 
 +daemons_enable_cluster_mode --> off 
 +daemons_use_tcp_wrapper --> off 
 +daemons_use_tty --> off 
 +dbadm_exec_content --> on 
 +dbadm_manage_user_files --> off 
 +dbadm_read_user_files --> off 
 +deny_bluetooth --> off 
 +deny_execmem --> off 
 +deny_ptrace --> off 
 +dhcpc_exec_iptables --> off 
 +dhcpd_use_ldap --> off 
 +dnsmasq_use_ipset --> off 
 +domain_can_mmap_files --> off 
 +--More-- 
 +</code>
  
-  smartctl --test=long /dev/sda          (Executes extended disk self-test)+ou la commande **sestatus -b** :
  
-  smartctl --attributes --log=selftest --quietmode=errorsonly /dev/sda +<code> 
-                                      (Prints Self-Test & Attribute errors) +[root@redhat9 attributs]# sestatus -b | more 
-  smartctl --all --device=3ware,2 /dev/sda +SELinux status:                 enabled 
-  smartctl --all --device=3ware,/dev/twe0 +SELinuxfs mount:                /sys/fs/selinux 
-  smartctl --all --device=3ware,/dev/twa0 +SELinux root directory:         /etc/selinux 
-  smartctl --all --device=3ware,/dev/twl0 +Loaded policy name:             targeted 
-          (Prints all SMART info for 3rd ATA disk on 3ware RAID controller) +Current mode:                   permissive 
-  smartctl --all --device=hpt,1/1/3 /dev/sda +Mode from config file:          enforcing 
-          (Prints all SMART info for the SATA disk attached to the 3rd PMPort +Policy MLS status:              enabled 
-           of the 1st channel on the 1st HighPoint RAID controller) +Policy deny_unknown status:     allowed 
-  smartctl --all --device=areca,3/1 /dev/sg2 +Memory protection checking:     actual (secure
-          (Prints all SMART info for 3rd ATA disk of the 1st enclosure +Max kernel policy version:      33
-           on Areca RAID controller+
-</code>+
  
-====1.9 Les Commandes accton et dump-acct====+Policy booleans: 
 +abrt_anon_write                             off 
 +abrt_handle_event                           off 
 +abrt_upload_watch_anon_write                on 
 +antivirus_can_scan_system                   off 
 +antivirus_use_jit                           off 
 +auditadm_exec_content                       on 
 +authlogin_nsswitch_use_ldap                 off 
 +authlogin_radius                            off 
 +authlogin_yubikey                           off 
 +awstats_purge_apache_log_files              off 
 +boinc_execmem                               on 
 +cdrecord_read_content                       off 
 +cluster_can_network_connect                 off 
 +cluster_manage_all_files                    off 
 +cluster_use_execmem                         off 
 +cobbler_anon_write                          off 
 +cobbler_can_network_connect                 off 
 +cobbler_use_cifs                            off 
 +cobbler_use_nfs                             off 
 +collectd_tcp_network_connect                off 
 +colord_use_nfs                              off 
 +condor_tcp_network_connect                  off 
 +conman_can_network                          off 
 +conman_use_nfs                              off 
 +container_connect_any                       off 
 +container_manage_cgroup                     off 
 +container_read_certs                        off 
 +container_use_cephfs                        off 
 +container_use_devices                       off 
 +container_use_dri_devices                   on 
 +container_use_ecryptfs                      off 
 +container_user_exec_content                 on 
 +cron_can_relabel                            off 
 +cron_system_cronjob_use_shares              off 
 +cron_userdomain_transition                  on 
 +cups_execmem                                off 
 +cvs_read_shadow                             off 
 +daemons_dontaudit_scheduling                on 
 +daemons_dump_core                           off 
 +daemons_enable_cluster_mode                 off 
 +--More-- 
 +</code>
  
-Cette commande permet d'activer ou désactiver la comptabilisation des processus :+Pour fixer l'état d'un booléen, il convient d'utiliser la commande setsebool :
  
 <code> <code>
-[root@centos8 ~]# accton on +[root@redhat9 attributs]# setsebool antivirus_can_scan_system 1
-Turning on process accounting, file set to the default '/var/account/pacct'+
-[root@centos8 ~]# systemctl status psacct +
-● psacct.service - Kernel process accounting +
-   Loaded: loaded (/usr/lib/systemd/system/psacct.service; disabled; vendor preset: d> +
-   Active: inactive (dead) +
-...skipping... +
-● psacct.service - Kernel process accounting +
-   Loaded: loaded (/usr/lib/systemd/system/psacct.service; disabled; vendor preset: d> +
-   Active: inactive (dead)+
  
-[root@centos8 ~]# systemctl enable psacct +[root@redhat9 attributs]# getsebool antivirus_can_scan_system 
-Created symlink /etc/systemd/system/multi-user.target.wants/psacct.service → /usr/lib/systemd/system/psacct.service.+antivirus_can_scan_system --> on
  
-[root@centos8 ~]# systemctl start psacct+[root@redhat9 attributs]# setsebool antivirus_can_scan_system 0
  
-[root@centos8 ~]# systemctl status psacct +[root@redhat9 attributs]# getsebool antivirus_can_scan_system 
-● psacct.service Kernel process accounting +antivirus_can_scan_system --> off
-   Loaded: loaded (/usr/lib/systemd/system/psacct.service; enabled; vendor preset: di> +
-   Active: active (exited) since Sun 2022-11-13 09:35:16 CET; 4s ago +
-  Process: 39765 ExecStart=/usr/sbin/accton /var/account/pacct (code=exited, status=0> +
-  Process: 39763 ExecStartPre=/usr/libexec/psacct/accton-create (code=exited, status=> +
- Main PID: 39765 (code=exited, status=0/SUCCESS) +
- +
-Nov 13 09:35:16 centos8.ittraining.loc systemd[1]: Starting Kernel process accounting> +
-Nov 13 09:35:16 centos8.ittraining.loc accton[39765]: Turning on process accounting, > +
-Nov 13 09:35:16 centos8.ittraining.loc systemd[1]: Started Kernel process accounting.+
 </code> </code>
  
-Par contre le fichier **/var/account/pacct** ne peut pas être lu avec les utilitaires de consultation de fichiers texte :+=====LAB #3 - Travailler avec SELinux=====
  
 +Afin reconstruire la politique actuelle **sans** les règles **dontaudit**, utilisez la commande **semodule** :
 + 
 <code> <code>
-[root@centos8 ~]# cat /var/account/pacct +[root@redhat9 attributs]# semodule -DB
-#pcKaccton pcEusleep%$pcu,awk$pc-iksmtuned('pc6pgrep'&pc-`ksmtuned)&pc,Eksmtuned*&pcd,awk&pc-ksmtuned/.'pc`D$less.'pcDEsystemctl+pcEssleep107pcu,awk07pc-jksmtuned437pc6pgrep327pc-bksmtuned527pc,Gksmtuned627pcd,awk27pc-ksmtuned?9;pc2rpc-pipefs-gene=9;pc2nfs-server-geneA9;pcEsystemd-cryptseI9;pcEsystemd-system-G9;pcEsystemd-hibernaC9;pcEsystemd-fstab-gE:;pc(^readlinkM;;pc$dgrepJ<;pc?lvmconfigN@;pc&`selinuxenabled;9;pc?s+Hkdump-dep-gener<9;pc?k0lvm2-activation:9;pc?B+anaconda-generaH9;pc?Esystemd-rc-loca>9;pc?SIostree-system-gO@;pc$agrep@9;pc?B+selinux-autorelB9;pc?Esystemd-debug-gK9;pc?Esystemd-sysv-geL9;pc?Esystemd-veritysD9;pc?Esystemd-getty-gF9;pc?Esystemd-gpt-aut9;pc@OC(sd-executor)8;pc`AEsystemctlSDpc?,accton-createUDpcacctonUDpacctonRQDpc@Esystemd-tty-askQDpc@@EsystemctlTDpcEsystemd-cgroupsVDpcEsystemd-cgroupsZYIpc`C$lessYIpcaCE%systemctlǘpcGkworker/dying77pcEssleepdcspcu,awkcspc-iksmtunedgfspc6pgrepfespc-_ksmtunedhespc,Fksmtunediespcd,awkespc?-ksmtuned[root@centos8 ~]#+
 </code> </code>
  
-La commande **dump-acct** permet de voir son contenu mais pas de l'exploiter :+Vérifiez qu'il ne reste aucune règle de type **dontaudit** :
  
 <code> <code>
-[root@centos8 ~]# dump-acct /var/account/pacct +[root@redhat9 attributs]# seinfo 
-accton          |v3|     0.00|     0.00|     1.00|     0|     0|  4360.00|     0.00|   39715|   37763|S    |       0|pts/  |Sun Nov 13 09:33:52 2022 +Statistics for policy file: /sys/fs/selinux/policy 
-sleep           |v3|     0.00|     0.00|  6000.00|     0|     0|  7308.00|     0.00|   39712|    1022|           0|__      |Sun Nov 13 09:33:03 2022 +Policy Version            33 (MLS enabled) 
-awk             |v3|     0.00|     0.00|     0.00|     0|     0| 25512.00|     0.00|   39717|   39716|           0|__      |Sun Nov 13 09:34:03 2022 +Target Policy             selinux 
-ksmtuned        |v3|     0.00|     0.00|     0.00|     0|     0| 26632.00|     0.00|   39716|    1022| F         0|__      |Sun Nov 13 09:34:03 2022 +Handle unknown classes:     allow 
-pgrep           |v3|     0.00|     0.00|     0.00|     0|     0| 45104.00|     0.00|   39720|   39719|           1|__      |Sun Nov 13 09:34:03 2022 +  Classes:             135    Permissions        457 
-ksmtuned        |v3|     0.00|     0.00|     0.00|     0|     0| 26632.00|     0.00|   39719|   39718| F         1|__      |Sun Nov 13 09:34:03 2022 +  Sensitivities        1    Categories        1024 
-ksmtuned        |v3|     0.00|     0.00|     0.00|     0|     0| 26112.00|     0.00|   39721|   39718| F         0|__      |Sun Nov 13 09:34:03 2022 +  Types:              5145    Attributes         259 
-awk             |v3|     0.00|     0.00|     0.00|     0|     0| 25376.00|     0.00|   39722|   39718|           0|__      |Sun Nov 13 09:34:03 2022 +  Users                8    Roles               15 
-ksmtuned        |v3|     0.00|     0.00|     0.00|     0|     0| 26632.00|     0.00|   39718|    1022| F         0|__      |Sun Nov 13 09:34:03 2022 +  Booleans:            356    CondExpr.:         385 
-less            |v3|     0.00|     0.00|  1187.00|     0|     0|  9704.00|     0.00|   39727|   39726|S    |       0|pts/  |Sun Nov 13 09:34:47 2022 +  Allow:             65504    Neverallow:            0 
-systemctl       |v3|     0.00|     0.00|  1188.00|     0|     0| 93504.00|     0.00|   39726|   37763|S    |       3|pts/  |Sun Nov 13 09:34:47 2022 +  Auditallow:          176    Dontaudit:             0 
-sleep           |v3|     0.00|     0.00|  6000.00|     0|     0|  7308.00|     0.00|   39723|    1022|           0|__      |Sun Nov 13 09:34:03 2022 +  Type_trans:       271770    Type_change         94 
-awk             |v3|     0.00|     0.00|     0.00|     0|     0| 25512.00|     0.00|   39729|   39728|           0|__      |Sun Nov 13 09:35:03 2022 +  Type_member:          37    Range_trans       5931 
-ksmtuned        |v3|     0.00|     0.00|     0.00|     0|     0| 26632.00|     0.00|   39728|    1022| F         0|__      |Sun Nov 13 09:35:03 2022 +  Role allow:           40    Role_trans         417 
-pgrep           |v3|     0.00|     0.00|     0.00|     0|     0| 45104.00|     0.00|   39732|   39731|           1|__      |Sun Nov 13 09:35:03 2022 +  Constraints         70    Validatetrans        0 
-ksmtuned        |v3|     0.00|     0.00|     0.00|     0|     0| 26632.00|     0.00|   39731|   39730| F         1|__      |Sun Nov 13 09:35:03 2022 +  MLS Constrain:        72    MLS ValTran:         0 
-ksmtuned        |v3|     0.00|     0.00|     0.00|     0|     0| 26112.00|     0.00|   39733|   39730| F         0|__      |Sun Nov 13 09:35:03 2022 +  Permissives:              Polcap               6 
-awk             |v3|     0.00|     0.00|     0.00|     0|     0| 25376.00|     0.00|   39734|   39730|           0|__      |Sun Nov 13 09:35:03 2022 +  Defaults                Typebounds           0 
-ksmtuned        |v3|     0.00|     0.00|     0.00|     0|     0| 26632.00|     0.00|   39730|    1022| F         0|__      |Sun Nov 13 09:35:03 2022 +  Allowxperm:               Neverallowxperm:       0 
-rpc-pipefs-gene |v3|     0.00|     0.00|     0.00|     0|     0| 38752.00|     0.00|   39743|   39737|S    |       0|__      |Sun Nov 13 09:35:07 2022 +  Auditallowxperm:          Dontauditxperm:        0 
-nfs-server-gene |v3|     0.00|     0.00|     0.00|     0|     0| 38880.00|     0.00|   39741|   39737|S    |       0|__      |Sun Nov 13 09:35:07 2022 +  Ibendportcon:          0    Ibpkeycon:             0 
-systemd-cryptse |v3|     0.00|     0.00|     0.00|     0|     0| 90368.00|     0.00|   39745|   39737|S    |       0|__      |Sun Nov 13 09:35:07 2022 +  Initial SIDs        27    Fs_use              35 
-systemd-system- |v3|     0.00|     0.00|     0.00|     0|     0| 90368.00|     0.00|   39753|   39737|S    |       0|__      |Sun Nov 13 09:35:07 2022 +  Genfscon           109    Portcon            665 
-systemd-hiberna |v3|     0.00|     0.00|     0.00|     0|     0| 90368.00|     0.00|   39751|   39737|S    |       0|__      |Sun Nov 13 09:35:07 2022 +  Netifcon             0    Nodecon              0
-...+
 </code> </code>
  
-===Options de la commande===+====3.1 - Copier et Déplacer des Fichiers====
  
-Les options de cette commande sont :+Créez deux fichiers **file1** et **file2** en tant que l'utilisateur **trainee** puis visualisez les SC des fichiers :
  
 <code> <code>
-[root@centos8 ~]# dump-acct --help +[root@redhat9 attributs]# exit 
-Usage: dump-acct [-hrR] [-n <recs>] <files> +logout 
-          [--num <recs>] [--raw] [--reverse] [--help] + 
-          [--format <version>] [--byteswap] +[trainee@redhat9 ~]$ touch file1 file2
-          [--ahz <freq>]+
  
-The system's default process accounting file is /var/account/pacct.+[trainee@redhat9 ~]$ ls -Z file
 +unconfined_u:object_r:user_home_t:s0 file1 
 +unconfined_u:object_r:user_home_t:s0 file2
 </code> </code>
  
-====1.10 - La Commande lastcomm====+Notez que le type des deux fichiers est **user_home_t**.
  
-Cette commande vous renseigne sur l'historique et les statistiques des commandes par utilisateur :+Copiez maintenant le fichier **file1** vers **/tmp** en utilisant la commande **cp** et visualiser son SC :
  
 <code> <code>
-[root@centos8 ~]# lastcomm +[trainee@redhat9 ~]$ cp file1 /tmp
-bash              F    root     pts/0      0.00 secs Sun Nov 13 09:41 +
-gdbus                X root     pts/     0.00 secs Sun Nov 13 09:41 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:41 +
-awk                    root     __         0.00 secs Sun Nov 13 09:41 +
-kworker/dying        root     __         0.00 secs Sun Nov 13 09:30 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:41 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:41 +
-pgrep                  root     __         0.00 secs Sun Nov 13 09:41 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:41 +
-awk                    root     __         0.00 secs Sun Nov 13 09:41 +
-sleep                  root     __         0.00 secs Sun Nov 13 09:40 +
-kworker/dying        root     __         0.00 secs Sun Nov 13 09:07 +
-kworker/dying        root     __         0.00 secs Sun Nov 13 09:35 +
-kworker/dying        root     __         0.00 secs Sun Nov 13 09:07 +
-dump-acct              root     pts/     0.00 secs Sun Nov 13 09:40 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:40 +
-awk                    root     __         0.00 secs Sun Nov 13 09:40 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:40 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:40 +
-pgrep                  root     __         0.00 secs Sun Nov 13 09:40 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:40 +
-awk                    root     __         0.00 secs Sun Nov 13 09:40 +
-sleep                  root     __         0.00 secs Sun Nov 13 09:39 +
-dump-acct              root     pts/     0.00 secs Sun Nov 13 09:39 +
-man                    root     pts/     0.01 secs Sun Nov 13 09:38 +
-less                   root     pts/     0.00 secs Sun Nov 13 09:38 +
-kworker/dying        root     __         0.00 secs Sat Nov 12 19:37 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:39 +
-awk                    root     __         0.00 secs Sun Nov 13 09:39 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:39 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:39 +
-pgrep                  root     __         0.00 secs Sun Nov 13 09:39 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:39 +
-awk                    root     __         0.00 secs Sun Nov 13 09:39 +
-sleep                  root     __         0.00 secs Sun Nov 13 09:38 +
-man                  root     pts/     0.00 secs Sun Nov 13 09:38 +
-nroff                  root     pts/     0.00 secs Sun Nov 13 09:38 +
-groff                  root     pts/     0.00 secs Sun Nov 13 09:38 +
-grotty                 root     pts/     0.00 secs Sun Nov 13 09:38 +
-troff                  root     pts/     0.00 secs Sun Nov 13 09:38 +
-nroff                root     pts/     0.00 secs Sun Nov 13 09:38 +
-locale                 root     pts/     0.00 secs Sun Nov 13 09:38 +
-tbl                    root     pts/     0.00 secs Sun Nov 13 09:38 +
-preconv                root     pts/     0.00 secs Sun Nov 13 09:38 +
-man                  root     pts/     0.00 secs Sun Nov 13 09:38 +
-man                  root     pts/     0.00 secs Sun Nov 13 09:38 +
-man                  root     pts/     0.00 secs Sun Nov 13 09:38 +
-man                  root     pts/     0.00 secs Sun Nov 13 09:38 +
-man                  root     pts/     0.00 secs Sun Nov 13 09:38 +
-man                  root     pts/     0.00 secs Sun Nov 13 09:38 +
-man                  root     pts/     0.00 secs Sun Nov 13 09:38 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:38 +
-awk                    root     __         0.00 secs Sun Nov 13 09:38 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:38 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:38 +
-pgrep                  root     __         0.00 secs Sun Nov 13 09:38 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:38 +
-awk                    root     __         0.00 secs Sun Nov 13 09:38 +
-sleep                  root     __         0.00 secs Sun Nov 13 09:37 +
-dump-acct              root     pts/     0.00 secs Sun Nov 13 09:37 +
-kworker/dying        root     __         0.00 secs Sun Nov 13 09:05 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:37 +
-awk                    root     __         0.00 secs Sun Nov 13 09:37 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:37 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:37 +
-pgrep                  root     __         0.00 secs Sun Nov 13 09:37 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:37 +
-awk                    root     __         0.00 secs Sun Nov 13 09:37 +
-sleep                  root     __         0.00 secs Sun Nov 13 09:36 +
-cat                    root     pts/     0.00 secs Sun Nov 13 09:36 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:36 +
-awk                    root     __         0.00 secs Sun Nov 13 09:36 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:36 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:36 +
-pgrep                  root     __         0.00 secs Sun Nov 13 09:36 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:36 +
-awk                    root     __         0.00 secs Sun Nov 13 09:36 +
-sleep                  root     __         0.00 secs Sun Nov 13 09:35 +
-kworker/dying        root     __         0.00 secs Sun Nov 13 09:19 +
-systemctl        S     root     pts/     0.00 secs Sun Nov 13 09:35 +
-less                 root     pts/     0.00 secs Sun Nov 13 09:35 +
-systemd-cgroups        root     __         0.00 secs Sun Nov 13 09:35 +
-systemd-cgroups        root     __         0.00 secs Sun Nov 13 09:35 +
-systemctl        S     root     pts/     0.00 secs Sun Nov 13 09:35 +
-systemd-tty-ask  S     root     pts/     0.00 secs Sun Nov 13 09:35 +
-accton               root     __         0.00 secs Sun Nov 13 09:35 +
-accton                 root     __         0.00 secs Sun Nov 13 09:35 +
-accton-create    S     root     __         0.00 secs Sun Nov 13 09:35 +
-systemctl        S     root     pts/     0.00 secs Sun Nov 13 09:35 +
-(sd-executor)    SF    root     __         0.00 secs Sun Nov 13 09:35 +
-systemd-gpt-aut  S     root     __         0.00 secs Sun Nov 13 09:35 +
-systemd-getty-g  S     root     __         0.00 secs Sun Nov 13 09:35 +
-systemd-veritys  S     root     __         0.00 secs Sun Nov 13 09:35 +
-systemd-sysv-ge  S     root     __         0.00 secs Sun Nov 13 09:35 +
-systemd-debug-g  S     root     __         0.00 secs Sun Nov 13 09:35 +
-selinux-autorel  S     root     __         0.00 secs Sun Nov 13 09:35 +
-grep                   root     __         0.00 secs Sun Nov 13 09:35 +
-ostree-system-g  S     root     __         0.01 secs Sun Nov 13 09:35 +
-systemd-rc-loca  S     root     __         0.00 secs Sun Nov 13 09:35 +
-anaconda-genera  S     root     __         0.00 secs Sun Nov 13 09:35 +
-lvm2-activation  S     root     __         0.00 secs Sun Nov 13 09:35 +
-kdump-dep-gener  S     root     __         0.00 secs Sun Nov 13 09:35 +
-selinuxenabled         root     __         0.00 secs Sun Nov 13 09:35 +
-lvmconfig              root     __         0.00 secs Sun Nov 13 09:35 +
-grep                   root     __         0.00 secs Sun Nov 13 09:35 +
-readlink               root     __         0.00 secs Sun Nov 13 09:35 +
-systemd-fstab-g  S     root     __         0.00 secs Sun Nov 13 09:35 +
-systemd-hiberna  S     root     __         0.00 secs Sun Nov 13 09:35 +
-systemd-system-  S     root     __         0.00 secs Sun Nov 13 09:35 +
-systemd-cryptse  S     root     __         0.00 secs Sun Nov 13 09:35 +
-nfs-server-gene  S     root     __         0.00 secs Sun Nov 13 09:35 +
-rpc-pipefs-gene  S     root     __         0.00 secs Sun Nov 13 09:35 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:35 +
-awk                    root     __         0.00 secs Sun Nov 13 09:35 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:35 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:35 +
-pgrep                  root     __         0.00 secs Sun Nov 13 09:35 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:35 +
-awk                    root     __         0.00 secs Sun Nov 13 09:35 +
-sleep                  root     __         0.00 secs Sun Nov 13 09:34 +
-systemctl        S     root     pts/     0.00 secs Sun Nov 13 09:34 +
-less                 root     pts/     0.00 secs Sun Nov 13 09:34 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:34 +
-awk                    root     __         0.00 secs Sun Nov 13 09:34 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:34 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:34 +
-pgrep                  root     __         0.00 secs Sun Nov 13 09:34 +
-ksmtuned          F    root     __         0.00 secs Sun Nov 13 09:34 +
-awk                    root     __         0.00 secs Sun Nov 13 09:34 +
-sleep                  root     __         0.00 secs Sun Nov 13 09:33 +
-accton               root     pts/     0.00 secs Sun Nov 13 09:33+
  
-[root@centos8 ~]# lastcomm grep +[trainee@redhat9 ~]$ ls -Z /tmp/file1 
-grep                   root     pts/0      0.00 secs Sun Nov 13 09:46 +unconfined_u:object_r:user_tmp_t:s0 /tmp/file1
-grep                   root     pts/0      0.00 secs Sun Nov 13 09:45 +
-grep                   root     __         0.00 secs Sun Nov 13 09:35 +
-grep                   root     __         0.00 secs Sun Nov 13 09:35+
 </code> </code>
  
-===Options de la commande===+Notez que le fichier ainsi copié a hérité du **type** du répertoire parent, à savoir **tmp_t**.
  
-Les options de cette commande sont :+Déplacez maintenant le fichier **file2** dans le répertoire **/tmp** et contrôlez son SC :
  
 <code> <code>
-[root@centos8 ~]# lastcomm --help +[trainee@redhat9 ~]$ mv file2 /tmp
-Usage: lastcomm [-hpV] [-f file] [command] ... [user] ... [terminal] ... +
-       [--forwards] [--file <file>] [--strict-match] [--print-controls] +
-       [--user <name>] [--tty <name>] [--command <name>] [--debug] +
-       [--show-paging] [--pid] [--ahz <freq>] [--version] [--help]+
  
-The system's default process accounting file is /var/account/pacct.+[trainee@redhat9 ~]$ ls -Z /tmp/file2 
 +unconfined_u:object_r:user_home_t:s0 /tmp/file2
 </code> </code>
  
-====1.11 - La Commande sa====+Notez que la commande **mv** maintient le **type** d'origine.
  
-Cette commande vous renseigne sur les statistiques sur les processus lancés et leurs ressources systèmes:+====3.2 - Vérifier les SC des Processus==== 
 + 
 +Il convient d'utiliser l'option **Z** avec la commande **ps** :
  
 <code> <code>
-[root@centos8 ~]# sa -u egrep "root" +[trainee@redhat9 ~]$ ps auxZ more 
-root       0.00 cpu     1090k mem      0 io accton           +LABEL                           USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND 
-root       0.00 cpu     1827k mem      0 io sleep            +system_u:system_r:init_t:s0     root           1  0.0  0.2 175884 21416 ?        Ss   Oct21   0:47 /usr/lib/systemd/systemd rhgb --switched-root -- 
-root       0.00 cpu     6378k mem      0 io awk              +system --deserialize 31 
-root       0.00 cpu     6658k mem      0 io ksmtuned        * +system_u:system_r:kernel_t:s0   root           2  0.0  0.0      0     ?        S    Oct21   0:00 [kthreadd] 
-root       0.00 cpu    11276k mem      0 io pgrep            +system_u:system_r:kernel_t:s0   root           3  0.0  0.0      0     ?        I<   Oct21   0:00 [rcu_gp] 
-root       0.00 cpu     6658k mem      0 io ksmtuned        * +system_u:system_r:kernel_t:s0   root           4  0.0  0.0      0     ?        I<   Oct21   0:00 [rcu_par_gp] 
-root       0.00 cpu     6528k mem      0 io ksmtuned        * +system_u:system_r:kernel_t:s0   root           5  0.0  0.0      0            I<   Oct21   0:00 [slub_flushwq] 
-root       0.00 cpu     6344k mem      0 io awk              +system_u:system_r:kernel_t:s0   root           6  0.0  0.0      0     ?        I<   Oct21   0:00 [netns] 
-root       0.00 cpu     6658k mem      0 io ksmtuned        * +system_u:system_r:kernel_t:s0   root           8  0.0  0.0      0            I<   Oct21   0:00 [kworker/0:0H-events_highpri] 
-root       0.00 cpu     2426k mem      0 io less             +system_u:system_r:kernel_t:s0   root          10  0.0  0.0      0            I<   Oct21   0:00 [mm_percpu_wq] 
-root       0.00 cpu    23376k mem      0 io systemctl        +system_u:system_r:kernel_t:s0   root          12  0.0  0.0      0            I    Oct21   0:00 [rcu_tasks_kthre] 
-root       0.00 cpu     1827k mem      0 io sleep            +system_u:system_r:kernel_t:s0   root          13  0.0  0.0      0     ?        I    Oct21   0:00 [rcu_tasks_rude_] 
-root       0.00 cpu     6378k mem      0 io awk              +system_u:system_r:kernel_t:s0   root          14  0.0  0.0      0     ?        I    Oct21   0:00 [rcu_tasks_trace] 
-root       0.00 cpu     6658k mem      0 io ksmtuned        +system_u:system_r:kernel_t:s0   root          15  0.0  0.0      0            S    Oct21   0:00 [ksoftirqd/0] 
-root       0.00 cpu    11276k mem      0 io pgrep            +system_u:system_r:kernel_t:s0   root          16  0.0  0.0      0            I    Oct21   0:01 [rcu_preempt] 
-root       0.00 cpu     6658k mem      0 io ksmtuned        * +system_u:system_r:kernel_t:s0   root          17  0.0  0.0      0               Oct21   0:00 [migration/0] 
-root       0.00 cpu     6528k mem      0 io ksmtuned        * +system_u:system_r:kernel_t:s0   root          18  0.0  0.0      0            S    Oct21   0:00 [idle_inject/0
-root       0.00 cpu     6344k mem      0 io awk              +system_u:system_r:kernel_t:s0   root          20  0.0  0.0      0               Oct21   0:00 [cpuhp/0] 
-root       0.00 cpu     6658k mem      0 io ksmtuned        * +system_u:system_r:kernel_t:s0   root          21  0.0  0.0      0               Oct21   0:00 [cpuhp/1] 
-root       0.00 cpu     9688k mem      0 io rpc-pipefs-gene  +system_u:system_r:kernel_t:s0   root          22  0.0  0.0      0            S    Oct21   0:00 [idle_inject/1] 
-root       0.00 cpu     9720k mem      0 io nfs-server-gene  +system_u:system_r:kernel_t:s0   root          23  0.0  0.0      0            S    Oct21   0:00 [migration/1] 
-root       0.00 cpu    22592k mem      0 io systemd-cryptse  +system_u:system_r:kernel_t:s0   root          24  0.0  0.0      0     ?        S    Oct21   0:00 [ksoftirqd/1] 
-root       0.00 cpu    22592k mem      0 io systemd-system +system_u:system_r:kernel_t:s0   root          27  0.0  0.0      0     ?        S    Oct21   0:00 [cpuhp/2] 
-root       0.00 cpu    22592k mem      0 io systemd-hiberna  +system_u:system_r:kernel_t:s0   root          28  0.0  0.0      0            S    Oct21   0:00 [idle_inject/2] 
-root       0.00 cpu    22592k mem      0 io systemd-fstab- +system_u:system_r:kernel_t:s0   root          29  0.0  0.0      0            S    Oct21   0:00 [migration/2] 
-root       0.00 cpu     1098k mem      0 io readlink         +system_u:system_r:kernel_t:s0   root          30  0.0  0.0      0     ?        S    Oct21   0:00 [ksoftirqd/2] 
-root       0.00 cpu     2302k mem      0 io grep             +system_u:system_r:kernel_t:s0   root          32  0.0  0.0      0     ?        I<   Oct21   0:00 [kworker/2:0H-events_highpri] 
-root       0.00 cpu    16260k mem      0 io lvmconfig        +system_u:system_r:kernel_t:s0   root          33  0.0  0.0      0               Oct21   0:00 [cpuhp/3] 
-root       0.00 cpu     3350k mem      0 io selinuxenabled   +system_u:system_r:kernel_t:s0   root          34  0.0  0.0      0               Oct21   0:00 [idle_inject/3] 
-root       0.00 cpu     5862k mem      0 io kdump-dep-gener  +system_u:system_r:kernel_t:s0   root          35  0.0  0.0      0               Oct21   0:00 [migration/3] 
-root       0.00 cpu     8406k mem      0 io lvm2-activation  +--More--
-root       0.00 cpu     5764k mem      io anaconda-genera  +
-root       0.00 cpu    22592k mem      0 io systemd-rc-loca  +
-root       0.01 cpu    38192k mem      0 io ostree-system-g  +
-root       0.00 cpu     2302k mem      io grep             +
-root       0.00 cpu     5764k mem      0 io selinux-autorel  +
-root       0.00 cpu    22592k mem      io systemd-debug-g  +
-root       0.00 cpu    22592k mem      0 io systemd-sysv-ge  +
-root       0.00 cpu    22592k mem      0 io systemd-veritys  +
-root       0.00 cpu    22592k mem      io systemd-getty-g  +
-root       0.00 cpu    22592k mem      0 io systemd-gpt-aut  +
-root       0.00 cpu    63728k mem      0 io (sd-executor)   +
-root       0.00 cpu    23632k mem      0 io systemctl        +
-root       0.00 cpu     6496k mem      0 io accton-create    +
-root       0.00 cpu        0k mem      0 io accton           +
-root       0.00 cpu     1090k mem      io accton           +
-root       0.00 cpu    22592k mem      0 io systemd-tty-ask  +
-root       0.00 cpu    23376k mem      0 io systemctl        +
-root       0.00 cpu    22592k mem      0 io systemd-cgroups  +
-root       0.00 cpu    22592k mem      0 io systemd-cgroups  +
-root       0.00 cpu     2426k mem      io less             +
-root       0.00 cpu    23376k mem      0 io systemctl        +
-root       0.00 cpu        0k mem      0 io kworker/dying   +
-root       0.00 cpu     1827k mem      0 io sleep            +
-root       0.00 cpu     6378k mem      0 io awk              +
-root       0.00 cpu     6658k mem      0 io ksmtuned        * +
-root       0.00 cpu    11276k mem      io pgrep            +
-root       0.00 cpu     6658k mem      io ksmtuned        +
-root       0.00 cpu     6528k mem      0 io ksmtuned        * +
-root       0.00 cpu     6344k mem      0 io awk              +
-root       0.00 cpu     6658k mem      0 io ksmtuned        * +
-root       0.00 cpu     1828k mem      io cat              +
-root       0.00 cpu     1827k mem      io sleep            +
-root       0.00 cpu     6378k mem      0 io awk              +
-root       0.00 cpu     6658k mem      0 io ksmtuned        * +
-root       0.00 cpu    11276k mem      0 io pgrep            +
-root       0.00 cpu     6658k mem      0 io ksmtuned        * +
-root       0.00 cpu     6528k mem      0 io ksmtuned        * +
-root       0.00 cpu     6344k mem      io awk              +
-root       0.00 cpu     6658k mem      io ksmtuned        +
-root       0.00 cpu        0k mem      0 io kworker/dying   * +
-root       0.00 cpu     1994k mem      0 io dump-acct        +
-root       0.00 cpu     1827k mem      0 io sleep            +
-root       0.00 cpu     6378k mem      io awk              +
-root       0.00 cpu     6658k mem      io ksmtuned        +
-root       0.00 cpu    11276k mem      0 io pgrep            +
-root       0.00 cpu     6658k mem      0 io ksmtuned        * +
-root       0.00 cpu     6528k mem      0 io ksmtuned        * +
-root       0.00 cpu     6344k mem      io awk              +
-root       0.00 cpu     6658k mem      io ksmtuned        +
-root       0.00 cpu     4582k mem      0 io man             * +
-root       0.00 cpu     4804k mem      0 io man             * +
-root       0.00 cpu     4804k mem      0 io man             * +
-root       0.00 cpu     4804k mem      io man             * +
-root       0.00 cpu     4804k mem      io man             * +
-root       0.00 cpu     4804k mem      0 io man             * +
-root       0.00 cpu     4844k mem      0 io man             * +
-root       0.00 cpu     4186k mem      0 io preconv          +
-root       0.00 cpu     3476k mem      io tbl              +
-root       0.00 cpu     1831k mem      io locale           +
-root       0.00 cpu     3182k mem      0 io nroff           * +
-root       0.00 cpu     4186k mem      0 io troff            +
-root       0.00 cpu     3674k mem      0 io grotty           +
-root       0.00 cpu     3496k mem      0 io groff            +
-root       0.00 cpu     3182k mem      0 io nroff            +
-root       0.00 cpu     4804k mem      io man             * +
-root       0.00 cpu     1827k mem      0 io sleep            +
-root       0.00 cpu     6378k mem      0 io awk              +
-root       0.00 cpu     6658k mem      io ksmtuned        +
-root       0.00 cpu    11276k mem      io pgrep            +
-root       0.00 cpu     6658k mem      0 io ksmtuned        * +
-root       0.00 cpu     6528k mem      0 io ksmtuned        * +
-root       0.00 cpu     6344k mem      io awk              +
-root       0.00 cpu     6658k mem      io ksmtuned        +
-root       0.00 cpu        0k mem      0 io kworker/dying   +
-root       0.00 cpu     2426k mem      0 io less             +
-root       0.01 cpu     4770k mem      0 io man              +
-root       0.00 cpu     1994k mem      0 io dump-acct        +
-root       0.00 cpu     1827k mem      0 io sleep            +
-root       0.00 cpu     6378k mem      io awk              +
-root       0.00 cpu     6658k mem      io ksmtuned        +
-root       0.00 cpu    11276k mem      io pgrep            +
-root       0.00 cpu     6658k mem      io ksmtuned        * +
-root       0.00 cpu     6528k mem      0 io ksmtuned        * +
-root       0.00 cpu     6344k mem      0 io awk              +
-root       0.00 cpu     6658k mem      io ksmtuned        * +
-root       0.00 cpu     2094k mem      io dump-acct        +
-root       0.00 cpu        0k mem      0 io kworker/dying   +
-root       0.00 cpu        0k mem      io kworker/dying   +
-root       0.00 cpu        0k mem      0 io kworker/dying   * +
-root       0.00 cpu     1827k mem      0 io sleep            +
-root       0.00 cpu     6378k mem      io awk              +
-root       0.00 cpu     6658k mem      io ksmtuned        +
-root       0.00 cpu    11276k mem      io pgrep            +
-root       0.00 cpu     6658k mem      io ksmtuned        * +
-root       0.00 cpu     6528k mem      0 io ksmtuned        * +
-root       0.00 cpu        0k mem      0 io kworker/dying   * +
-root       0.00 cpu     6344k mem      io awk              +
-root       0.00 cpu     6658k mem      io ksmtuned        +
-root       0.00 cpu    93648k mem      io gdbus            +
-root       0.00 cpu     6888k mem      0 io bash            * +
-root       0.00 cpu     5410k mem      0 io lastcomm         +
-root       0.00 cpu     1827k mem      io sleep            +
-root       0.00 cpu     6378k mem      0 io awk              +
-root       0.00 cpu     6658k mem      io ksmtuned        +
-root       0.00 cpu    11276k mem      0 io pgrep            +
-root       0.00 cpu     6658k mem      0 io ksmtuned        * +
-root       0.00 cpu     6528k mem      io ksmtuned        * +
-root       0.00 cpu     6344k mem      io awk              +
-root       0.00 cpu     6658k mem      0 io ksmtuned        +
-root       0.00 cpu     4570k mem      0 io man             * +
-root       0.00 cpu     4804k mem      0 io man             * +
-root       0.00 cpu     4804k mem      0 io man             * +
-root       0.00 cpu     4804k mem      io man             * +
-root       0.00 cpu     4804k mem      io man             * +
-root       0.00 cpu     4804k mem      0 io man             * +
-root       0.00 cpu     4844k mem      0 io man             * +
-root       0.00 cpu     4186k mem      0 io preconv          +
-root       0.00 cpu     3476k mem      io tbl              +
-root       0.00 cpu     1831k mem      io locale           +
-root       0.00 cpu     3182k mem      0 io nroff           * +
-root       0.00 cpu     4186k mem      0 io troff            +
-root       0.00 cpu     3706k mem      0 io grotty           +
-root       0.00 cpu     3496k mem      0 io groff            +
-root       0.00 cpu     3182k mem      0 io nroff            +
-root       0.00 cpu     4804k mem      io man             * +
-root       0.00 cpu     1827k mem      io sleep            +
-root       0.00 cpu     6378k mem      0 io awk              +
-root       0.00 cpu     6658k mem      0 io ksmtuned        +
-root       0.00 cpu    11276k mem      0 io pgrep            +
-root       0.00 cpu     6658k mem      0 io ksmtuned        * +
-root       0.00 cpu     6528k mem      io ksmtuned        * +
-root       0.00 cpu     6344k mem      io awk              +
-root       0.00 cpu     6658k mem      0 io ksmtuned        +
-root       0.00 cpu     2426k mem      0 io less             +
-root       0.00 cpu     4770k mem      0 io man              +
-root       0.00 cpu     4604k mem      0 io man             * +
-root       0.00 cpu     4760k mem      io man             * +
-root       0.00 cpu     4804k mem      io man             * +
-root       0.00 cpu     4804k mem      0 io man             * +
-root       0.00 cpu     4804k mem      0 io man             * +
-root       0.00 cpu     4804k mem      0 io man             * +
-root       0.00 cpu     4804k mem      io man             * +
-root       0.00 cpu     4844k mem      io man             * +
-root       0.00 cpu     4186k mem      0 io preconv          +
-root       0.00 cpu     3476k mem      0 io tbl              +
-root       0.00 cpu     1831k mem      0 io locale           +
-root       0.00 cpu     3182k mem      0 io nroff           * +
-root       0.00 cpu     4186k mem      0 io troff            +
-root       0.00 cpu     3700k mem      io grotty           +
-root       0.00 cpu     3496k mem      0 io groff            +
-root       0.00 cpu     3182k mem      0 io nroff            +
-root       0.00 cpu     4804k mem      0 io man             * +
-root       0.00 cpu     1827k mem      0 io sleep            +
-root       0.00 cpu     6378k mem      0 io awk              +
-root       0.00 cpu     6658k mem      io ksmtuned        +
-root       0.00 cpu    11276k mem      io pgrep            +
-root       0.00 cpu     6658k mem      0 io ksmtuned        * +
-root       0.00 cpu     6528k mem      0 io ksmtuned        * +
-root       0.00 cpu     6344k mem      io awk              +
-root       0.00 cpu     6658k mem      io ksmtuned        +
-root       0.00 cpu     1827k mem      0 io sleep            +
-root       0.00 cpu     6378k mem      0 io awk              +
-root       0.00 cpu     6658k mem      0 io ksmtuned        * +
-root       0.00 cpu    11276k mem      io pgrep            +
-root       0.00 cpu     6658k mem      0 io ksmtuned        * +
-root       0.00 cpu     6528k mem      0 io ksmtuned        * +
-root       0.00 cpu     6344k mem      0 io awk              +
-root       0.00 cpu     6658k mem      0 io ksmtuned        * +
-root       0.00 cpu        0k mem      0 io kworker/dying   +
-root       0.00 cpu     2426k mem      0 io less             +
-root       0.00 cpu     4770k mem      0 io man              +
-root       0.00 cpu     5312k mem      io sa               +
-root       0.00 cpu     3034k mem      io grep             +
-root       0.00 cpu     5312k mem      0 io sa               +
-root       0.00 cpu     1827k mem      0 io sleep            +
-root       0.00 cpu     6378k mem      0 io awk              +
-root       0.00 cpu     6658k mem      0 io ksmtuned        +
-root       0.00 cpu    11276k mem      io pgrep            +
-root       0.00 cpu     6658k mem      0 io ksmtuned        * +
-root       0.00 cpu     6528k mem      0 io ksmtuned        * +
-root       0.00 cpu     6344k mem      0 io awk              +
-root       0.00 cpu     6658k mem      0 io ksmtuned        * +
-root       0.00 cpu        0k mem      0 io kworker/dying   *+
 </code> </code>
  
-===Options de la commande===+====3.3 - Visualiser la SC d'un Utilisateur====
  
-Les options de cette commande sont :+Utilisez l'option **-Z** avec la commande **id** :
  
 <code> <code>
-[root@centos8 ~]# sa --help+[trainee@redhat9 ~]$ id -
 +unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 
 +</code>
  
-                Usagesa [ options ] [ file ] +Notez que vous ne pouvez pas consulter le SC d'un autre utilisateur :
-                 +
-                options: [-abcdfiljkmnprstuDKP] [-v <num>] [--version] [--help] +
-                [--other-acct-file <name>] [--other-usracct-file <name>+
-                [--print-seconds] [--dont-read-summary-files] [--debug] +
-                 [--separate-times] [--other-savacct-file <name>] [--percentages] +
-                 [--print-ratio] [--print-users] [--merge] [--user-summary] [--group-summary] +
-                [--list-all-names] [--not-interactive] [--threshold <num>+
-                 [--sort-ksec] [--sort-tio] [--sort-sys-user-div-calls] [--sort-avio] +
-                 [--sort-cpu-avmem] [--sort-num-calls] [--sort-real-time] [--ahz hz] +
-       [--show-paging] [--show-paging-avg]+
  
-The system's default process accounting files are:+<code> 
 +[trainee@redhat9 ~]$ id root 
 +uid=0(root) gid=0(root) groups=0(root)
  
-  raw process accounting data: /var/account/pacct +[trainee@redhat9 ~]$ id -Z root 
-      summary by command name: /var/account/savacct +idcannot print security context when user specified
-          summary by username/var/account/usracct+
 </code> </code>
  
-====1.12 La Commande ac====+====3.Vérifier la SC d'un fichier====
  
-Cette commande vous renseigne sur les statistiques des temps de connexion des utilisateurs :+Il convient d'utiliser la commande ls avec l'option **-Z** :
  
 <code> <code>
-[root@centos8 ~]# ac -p +[trainee@redhat9 ~]$ cd /etc
-        trainee                            247.51 +
-        total      247.51+
  
-[root@centos8 ~]# ac -d +[trainee@redhat9 etc]$ ls -Z l* -d 
-Jun 16  total        6.41 +unconfined_u:object_r:ld_so_cache_t:s0 ld.so.cache                system_u:object_r:etc_t:s0 libssh 
-Jun 17  total       12.09 +            system_u:object_r:etc_t:s0 ld.so.conf                 system_u:object_r:etc_t:s0 libuser.conf 
-Jul 19  total        6.94 +            system_u:object_r:etc_t:s0 ld.so.conf.d            system_u:object_r:locale_t:s0 locale.conf 
-Jul 20  total       38.95 +            system_u:object_r:etc_t:s0 libaudit.conf           system_u:object_r:locale_t:s0 localtime 
-Sep  2  total        0.03 +            system_u:object_r:etc_t:s0 libblockdev                system_u:object_r:etc_t:s0 login.defs 
-Sep  3  total        0.01 +            system_u:object_r:etc_t:s0 libibverbs.d               system_u:object_r:etc_t:s0 logrotate.conf 
-Sep  5  total       11.01 +            system_u:object_r:etc_t:s0 libnl                      system_u:object_r:etc_t:s0 logrotate.d 
-Oct  9  total        0.92 +            system_u:object_r:etc_t:s0 libpaper.d                 system_u:object_r:etc_t:s0 lsm 
-Oct 11  total        4.17 +            system_u:object_r:etc_t:s0 libreport              system_u:object_r:lvm_etc_t:s0 lvm
-Oct 12  total        5.45 +
-Nov  7  total       19.40 +
-Nov  8  total       54.12 +
-Nov  9  total       67.32 +
-Nov 10  total        8.48 +
-Nov 11  total        3.01 +
-Today   total        9.23+
 </code> </code>
  
-===Options de la commande===+====3.5 - Troubleshooting SELinux====
  
-Les options de cette commande sont :+L'interprétation des messages journalisés de %%SELinux%% est souvent la clef d'un dépannage efficace et rapide.
  
-<code> +Si le démon **auditd** est démarré, les messages de %%SELinux%% sont consignés dans le fichier **/var/log/audit/audit.log**. Dans le cas contraire, les mêmes messages sont consignés dans le fichier **/var/log/messages**. Dans les deux cas, chaque message de %%SELinux%% contient le mot clef **AVC** : 
-[root@centos8 ~]# ac --help+
  
-Usage: ac [OPTION] ...+====3.6 - La commande chcon====
  
-OPTIONS: +La commande **chcon** permet de modifier //temporairement// une SC.
-  -d, --daily-totals        Print totals for each day +
-  -p, --individual-totals   Print time totals for each user +
-  -f, --file <file>         Read from <file> +
-  --complain                Print errors for whatever problem +
-  --reboots                 Count the time between login and reboot +
-  --supplants               Count the time between logins on the terminal +
-  --timewarps               Count the time between login and time warp +
-  --compatibility           Shortcut for --reboots --supplants --timewarps +
-  -a, --all-days            Do not skip days without login activity +
-  --tw-leniency <value>     Set the time warp leniency <value> in seconds +
-  --tw-suspicious <value>   Set the time warp suspicious <value> in seconds +
-  --print-year              Print year when displaying dates +
-  --print-zeros             Don't suppress zeros in category totals +
-  --debug                   Print verbose internal information +
-  -V, --version             Show version and exit +
-  -h, --help                Show help and exit+
  
-The system's default login accounting file is /var/log/wtmp. +Prenons le cas de la création d'un répertoire à la racine du système de fichiers afin d'y stocker les pages web du serveur apache :
-</code>+
  
-=====LAB #2 La commande sysctl=====+<code> 
 +[trainee@redhat9 etc]$ su - 
 +Password: fenestros
  
-====2.1 - Répertoire /proc====+[root@redhat9 ~]# mkdir /www 
 +[root@redhat9 ~]# touch /www/index.html 
 +</code>
  
-Le répertoire /proc contient des fichiers et des répertoires virtuels. Le contenu de ces fichiers est créé dynamiquement lors de la consultation. Seul root peut consulter la totalité des informations dans le répertoire /proc.+Installez maintenant le serveur Apache :
  
 <code> <code>
-[root@centos8 ~]# ls /proc +[root@redhat9 ~]# dnf install httpd
-1      16391  19    2212  2427  2622  431   59    84    999          mdstat +
-10     16476  1931  2215  2428  2659  432       842   acpi         meminfo +
-1007   16534  1956  2222  2431  2667  433   60    8465  buddyinfo    misc +
-11     16576  1960  2226  2432  2686  434   61    866   bus          modules +
-11805  16593  2     2230  2435  27    435   63    867   cgroups      mounts +
-12     16598  20    2237  2439  28    436   64    868   cmdline      mtrr +
-1219   16600  2007  2238  244   29    437   65    869   consoles     net +
-1228   16613  2029  2241  2443  3     44    6568  87    cpuinfo      pagetypeinfo +
-1232   16646  203   2244  2445  31    446   66    870   crypto       partitions +
-1234   16673  2034  2247  2449  32    45    67    871   devices      sched_debug +
-1235   16677  2037  2260  2451  33    46    674   872   diskstats    schedstat +
-1247   16711  2054  2262  2465  34    47    68    874   dma          scsi +
-13     16712  2062  2267  2472  35    4790  69    875   driver       self +
-1307   16729  21    2268  2473  37    49    70    878   execdomains  slabinfo +
-1339   16742  210   2274  2474  38    50    701   879   fb           softirqs +
-1356   17     2118  2275  2475  39    5076  71    880   filesystems  stat +
-14     1764   2121  2280  2476  4     51    714   884   fs           swaps +
-1441   180    2124  2287  2478  40    52    72    887   interrupts   sys +
-1443   181    2126  2292  2481  402   53    73    9     iomem        sysrq-trigger +
-1444   1817   2156  23    2484  41    532   74    901   ioports      sysvipc +
-1446   182    2160  2302  25    419   539   75    903   irq          thread-self +
-14977  1828   2164  2307  2536  420   55    76    9144  kallsyms     timer_list +
-15     1829   2165  2310  2539  421   568       916   kcore        tty +
-15067  183    2167  2330  2571  422   569   808   918   keys         uptime +
-1536   1845   2169  2332  2578  423   570   809   919   key-users    version +
-1553   185    2177  2349  2579  425   571   81    921   kmsg         vmallocinfo +
-15594  186    2187  2358  259   426   572   833   969   kpagecgroup  vmstat +
-15735  187    2190  2373  2593  427   573   835   986   kpagecount   zoneinfo +
-16     1880   2194  2384  26    428   574   837   989   kpageflags +
-16165  1883   22    239   2602  43    575   838   990   loadavg +
-16167  1888   2204  241   2608  430   576   839   993   locks+
 </code> </code>
  
-===Fichiers=== +Activez et démarrez le service **httpd** :
- +
-==Processeur==+
  
 <code> <code>
-[root@centos8 ~]# cat /proc/cpuinfo +[root@redhat9 ~]# systemctl status httpd 
-processor       0 +○ httpd.service - The Apache HTTP Server 
-vendor_id       : GenuineIntel +     Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; preset: disabled) 
-cpu family      15 +     Activeinactive (dead) 
-model           : 6 +       Docsman:httpd.service(8) 
-model name      : Common KVM processor +[root@redhat9 ~]# systemctl enable --now httpd 
-stepping        : 1 +Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service. 
-microcode       : 0x1 +[root@redhat9 ~]# systemctl status httpd 
-cpu MHz         1999.987 +● httpd.service - The Apache HTTP Server 
-cache size      16384 KB +     Loadedloaded (/usr/lib/systemd/system/httpd.service; enabled; presetdisabled) 
-physical id     : +     Activeactive (running) since Tue 2024-10-22 10:15:49 CEST; 3s ago 
-siblings        +       Docsman:httpd.service(8) 
-core id         0 +   Main PID101100 (httpd) 
-cpu cores       : +     Status"Started, listening onport 80" 
-apicid          0 +      Tasks177 (limit48800) 
-initial apicid  : 0 +     Memory34.5M 
-fpu             : yes +        CPU86ms 
-fpu_exception   : yes +     CGroup/system.slice/httpd.service 
-cpuid level     : 13 +             ├─101100 /usr/sbin/httpd -DFOREGROUND 
-wp              yes +             ├─101101 /usr/sbin/httpd -DFOREGROUND 
-flags           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti +             ├─101102 /usr/sbin/httpd -DFOREGROUND 
-bugs            cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit +             ├─101103 /usr/sbin/httpd -DFOREGROUND 
-bogomips        3999.97 +             └─101104 /usr/sbin/httpd -DFOREGROUND
-clflush size    64 +
-cache_alignment 128 +
-address sizes   : 40 bits physical, 48 bits virtual +
-power management:+
  
-processor       : 1 +Oct 22 10:15:49 redhat9.ittraining.loc systemd[1]Starting The Apache HTTP Server... 
-vendor_id       : GenuineIntel +Oct 22 10:15:49 redhat9.ittraining.loc httpd[101100]Server configuredlistening onport 80 
-cpu family      : 15 +Oct 22 10:15:49 redhat9.ittraining.loc systemd[1]Started The Apache HTTP Server.
-model           +
-model name      : Common KVM processor +
-stepping        : 1 +
-microcode       : 0x1 +
-cpu MHz         : 1999.987 +
-cache size      : 16384 KB +
-physical id     : 0 +
-siblings        : 4 +
-core id         : 1 +
-cpu cores       : 4 +
-apicid          : 1 +
-initial apicid  : 1 +
-fpu             : yes +
-fpu_exception   : yes +
-cpuid level     : 13 +
-wp              : yes +
-flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti +
-bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit +
-bogomips        : 3999.97 +
-clflush size    : 64 +
-cache_alignment : 128 +
-address sizes   : 40 bits physical, 48 bits virtual +
-power management: +
- +
-processor       : 2 +
-vendor_id       : GenuineIntel +
-cpu family      : 15 +
-model           : 6 +
-model name      : Common KVM processor +
-stepping        : 1 +
-microcode       : 0x1 +
-cpu MHz         1999.987 +
-cache size      : 16384 KB +
-physical id     : 0 +
-siblings        : 4 +
-core id         : 2 +
-cpu cores       : 4 +
-apicid          : 2 +
-initial apicid  : 2 +
-fpu             : yes +
-fpu_exception   : yes +
-cpuid level     : 13 +
-wp              : yes +
-flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti +
-bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit +
-bogomips        : 3999.97 +
-clflush size    : 64 +
-cache_alignment : 128 +
-address sizes   : 40 bits physical, 48 bits virtual +
-power management: +
- +
-processor       : 3 +
-vendor_id       : GenuineIntel +
-cpu family      : 15 +
-model           : 6 +
-model name      : Common KVM processor +
-stepping        : 1 +
-microcode       : 0x1 +
-cpu MHz         : 1999.987 +
-cache size      : 16384 KB +
-physical id     : 0 +
-siblings        : 4 +
-core id         : 3 +
-cpu cores       : 4 +
-apicid          : 3 +
-initial apicid  : 3 +
-fpu             : yes +
-fpu_exception   : yes +
-cpuid level     : 13 +
-wp              : yes +
-flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti +
-bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit +
-bogomips        : 3999.97 +
-clflush size    : 64 +
-cache_alignment : 128 +
-address sizes   : 40 bits physical, 48 bits virtual +
-power management: +
- +
-processor       : 4 +
-vendor_id       : GenuineIntel +
-cpu family      : 15 +
-model           : 6 +
-model name      : Common KVM processor +
-stepping        : 1 +
-microcode       : 0x1 +
-cpu MHz         1999.987 +
-cache size      : 16384 KB +
-physical id     : 1 +
-siblings        : 4 +
-core id         : 0 +
-cpu cores       : 4 +
-apicid          : 4 +
-initial apicid  : 4 +
-fpu             : yes +
-fpu_exception   : yes +
-cpuid level     : 13 +
-wp              : yes +
-flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti +
-bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit +
-bogomips        : 3999.97 +
-clflush size    : 64 +
-cache_alignment : 128 +
-address sizes   40 bits physical48 bits virtual +
-power management: +
- +
-processor       : 5 +
-vendor_id       GenuineIntel +
-cpu family      : 15 +
-model           +
-model name      : Common KVM processor +
-stepping        : 1 +
-microcode       : 0x1 +
-cpu MHz         : 1999.987 +
-cache size      : 16384 KB +
-physical id     : 1 +
-siblings        : 4 +
-core id         : 1 +
-cpu cores       : 4 +
-apicid          : 5 +
-initial apicid  : 5 +
-fpu             : yes +
-fpu_exception   : yes +
-cpuid level     : 13 +
-wp              : yes +
-flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti +
-bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit +
-bogomips        : 3999.97 +
-clflush size    : 64 +
-cache_alignment : 128 +
-address sizes   : 40 bits physical, 48 bits virtual +
-power management: +
- +
-processor       : 6 +
-vendor_id       : GenuineIntel +
-cpu family      : 15 +
-model           : 6 +
-model name      : Common KVM processor +
-stepping        : 1 +
-microcode       0x1 +
-cpu MHz         : 1999.987 +
-cache size      : 16384 KB +
-physical id     : 1 +
-siblings        : 4 +
-core id         : 2 +
-cpu cores       : 4 +
-apicid          : 6 +
-initial apicid  : 6 +
-fpu             : yes +
-fpu_exception   : yes +
-cpuid level     : 13 +
-wp              : yes +
-flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti +
-bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit +
-bogomips        : 3999.97 +
-clflush size    : 64 +
-cache_alignment : 128 +
-address sizes   : 40 bits physical, 48 bits virtual +
-power management: +
- +
-processor       : 7 +
-vendor_id       : GenuineIntel +
-cpu family      : 15 +
-model           : 6 +
-model name      : Common KVM processor +
-stepping        : 1 +
-microcode       : 0x1 +
-cpu MHz         : 1999.987 +
-cache size      : 16384 KB +
-physical id     : 1 +
-siblings        : 4 +
-core id         : 3 +
-cpu cores       : 4 +
-apicid          : 7 +
-initial apicid  : 7 +
-fpu             : yes +
-fpu_exception   : yes +
-cpuid level     : 13 +
-wp              : yes +
-flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti +
-bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit +
-bogomips        : 3999.97 +
-clflush size    : 64 +
-cache_alignment : 128 +
-address sizes   : 40 bits physical, 48 bits virtual +
-power management:+
 </code> </code>
  
-==Interruptions système==+Modifiez ensuite la directive **%%DocumentRoot%%** dans le fichier **/etc/httpd/conf/httpd.conf** :
  
 <code> <code>
-[root@centos8 ~]# cat /proc/interrupts +[root@redhat9 ~]# vi /etc/httpd/conf/httpd.conf
-           CPU0       CPU1       CPU2       CPU3       CPU4       CPU5       CPU6       CPU7        +
-  0:        109          0          0          0          0          0          0          0   IO-APIC   2-edge      timer +
-  1:          0          0          0          0          9          0          0          0   IO-APIC   1-edge      i8042 +
-  8:          0          0          0          0          0          1          0          0   IO-APIC   8-edge      rtc0 +
-  9:          0          0          0          0          0          0          0          0   IO-APIC   9-fasteoi   acpi +
- 10:          0          0          0          0      47098          0          0          0   IO-APIC  10-fasteoi   virtio0 +
- 11:          0          0         31          0          0          0          0          0   IO-APIC  11-fasteoi   uhci_hcd:usb1 +
- 12:          0          0          0         15          0          0          0          0   IO-APIC  12-edge      i8042 +
- 14:          0          0          0          0          0          0          0          0   IO-APIC  14-edge      ata_piix +
- 15:       7376          0        144          0          0          0          0      84588   IO-APIC  15-edge      ata_piix +
- 24:          0          0          0          0          0          0          0          0   PCI-MSI 294912-edge      virtio1-config +
- 25:          0          0          0          0          0       5640          0         16   PCI-MSI 294913-edge      virtio1-input.+
- 26:         36          0          0       5058          0          0          0          0   PCI-MSI 294914-edge      virtio1-output.0 +
- 27:          0      16008          0       9431          0          0          0          0   PCI-MSI 114688-edge      ahci[0000:00:07.0] +
-NMI:          0          0          0          0          0          0          0          0   Non-maskable interrupts +
-LOC:     870537     771900    1117711     288839     833717     502365     758229     405110   Local timer interrupts +
-SPU:          0          0          0          0          0          0          0          0   Spurious interrupts +
-PMI:          0          0          0          0          0          0          0          0   Performance monitoring interrupts +
-IWI:          0          0          0          0          2          0          0          0   IRQ work interrupts +
-RTR:          0          0          0          0          0          0          0          0   APIC ICR read retries +
-RES:     178171      67749      43116      65994      71361     118585      54139      53452   Rescheduling interrupts +
-CAL:      11095      11007      10841      10343      14679       9998      12165      12443   Function call interrupts +
-TLB:       2295       2297       2000       1728       2330       2338       1991       1861   TLB shootdowns +
-TRM:          0          0          0          0          0          0          0          0   Thermal event interrupts +
-THR:          0          0          0          0          0          0          0          0   Threshold APIC interrupts +
-DFR:          0          0          0          0          0          0          0          0   Deferred Error APIC interrupts +
-MCE:          0          0          0          0          0          0          0          0   Machine check exceptions +
-MCP:        288        288        288        288        288        288        288        288   Machine check polls +
-HYP:          0          0          0          0          0          0          0          0   Hypervisor callback interrupts +
-HRE:          0          0          0          0          0          0          0          0   Hyper-V reenlightenment interrupts +
-HVS:          0          0          0          0          0          0          0          0   Hyper-V stimer0 interrupts +
-ERR:          0 +
-MIS:          0 +
-PIN:          0          0          0          0          0          0          0          0   Posted-interrupt notification event +
-NPI:          0          0          0          0          0          0          0          0   Nested posted-interrupt event +
-PIW:          0          0          0          0          0          0          0          0   Posted-interrupt wakeup event+
 </code> </code>
  
-<WRAP center round important 60%+<file
-**Important** : Un pilote de périphérique demande au processeur de fournir un service en utilisant un IRQQuand la demande est faite, le processeur interrompe ses activités et passe le contrôle au pilote identifié par l'IRQTechniquement l'attribution d'un IRQ à un périphérique doit être exclusiveDans le cas où deux périphériques demandent un service en même temps, c'est le périphérique ayant l'IRQ le plus bas qui est prioritaire+[...
-</WRAP+#DocumentRoot "/var/www/html" 
 +DocumentRoot "/www" 
 +[...] 
 +</file>
  
-==Canaux DMA==+Ajoutez les section **<Directory "/www">**:
  
-<code+<file
-[root@centos8 ~]# cat /proc/dma +... 
- 4cascade +<Directory "/var/www"> 
-</code>+    AllowOverride None 
 +    # Allow open access: 
 +    Require all granted 
 +</Directory>
  
-==Plages d'entrée/sortie==+<Directory "/www"> 
 + Options Indexes FollowSymLinks 
 + AllowOverride None 
 + Require all granted 
 +</Directory>
  
-<code> +# Further relax access to the default document root: 
-root@centos8 ~]# cat /proc/ioports | more +<Directory "/var/www/html"
-0000-0cf7 PCI Bus 0000:00 +..
-  0000-001f : dma1 +</file>
-  0020-0021 : pic1 +
-  0040-0043 : timer0 +
-  0050-0053 : timer1 +
-  0060-0060 : keyboard +
-  0064-0064 : keyboard +
-  0070-0077 : rtc0 +
-  0080-008f : dma page reg +
-  00a0-00a1 : pic2 +
-  00c0-00df : dma2 +
-  00f0-00ff : fpu +
-  0170-0177 : 0000:00:01.1 +
-    0170-0177 : ata_piix +
-  01f0-01f7 : 0000:00:01.1 +
-    01f0-01f7 : ata_piix +
-  0376-0376 : 0000:00:01.1 +
-    0376-0376 : ata_piix +
-  03c0-03df : vga+ +
-  03f6-03f6 : 0000:00:01.1 +
-    03f6-03f6 : ata_piix +
---More-- +
-</code+
- +
-<WRAP center round alert 60%> +
-**Important** - Si deux périphériques ont le même port, les **deux** périphériques seront inutilisables+
-</WRAP>+
  
-==Périphériques==+Créez le fichier **/www/index.html** :
  
 <code> <code>
-[root@centos8 ~]# cat /proc/devices +[root@redhat9 ~]# vi /www/index.html
-Character devices: +
-  1 mem +
-  4 /dev/vc/0 +
-  4 tty +
-  4 ttyS +
-  5 /dev/tty +
-  5 /dev/console +
-  5 /dev/ptmx +
-  7 vcs +
- 10 misc +
- 13 input +
- 21 sg +
- 29 fb +
-128 ptm +
-136 pts +
-162 raw +
-180 usb +
-188 ttyUSB +
-189 usb_device +
-202 cpu/msr +
-203 cpu/cpuid +
-226 drm +
-244 aux +
-245 hidraw +
-246 usbmon +
-247 bsg +
-248 watchdog +
-249 ptp +
-250 pps +
-251 rtc +
-252 dax +
-253 tpm +
-254 gpiochip+
  
-Block devices: +[root@redhat9 ~]# cat /www/index.html 
-  8 sd +<html> 
-  9 md +<title> 
- 11 sr +This is a test 
- 65 sd +</title> 
- 66 sd +<body> 
- 67 sd +www test page 
- 68 sd +</body> 
- 69 sd +</html>
- 70 sd +
- 71 sd +
-128 sd +
-129 sd +
-130 sd +
-131 sd +
-132 sd +
-133 sd +
-134 sd +
-135 sd +
-253 device-mapper +
-254 mdp +
-259 blkext+
 </code> </code>
  
-==Modules==+Modifiez ensuite le propriétaire et le groupe du répertoire **/www** et son contenu :
  
 <code> <code>
-[root@centos8 ~]# cat /proc/modules | more +[root@redhat9 ~]# chown -R apache:apache /www
-xt_CHECKSUM 16384 1 - Live 0xffffffffc09a8000 +
-ipt_MASQUERADE 16384 3 - Live 0xffffffffc09a3000 +
-xt_conntrack 16384 1 - Live 0xffffffffc099e000 +
-ipt_REJECT 16384 2 - Live 0xffffffffc0999000 +
-nft_compat 20480 16 - Live 0xffffffffc0993000 +
-nf_nat_tftp 16384 0 - Live 0xffffffffc098b000 +
-nft_objref 16384 1 - Live 0xffffffffc0986000 +
-nf_conntrack_tftp 16384 3 nf_nat_tftp, Live 0xffffffffc0981000 +
-nft_counter 16384 33 - Live 0xffffffffc097c000 +
-tun 53248 1 - Live 0xffffffffc096e000 +
-bridge 192512 0 - Live 0xffffffffc093e000 +
-stp 16384 1 bridge, Live 0xffffffffc0939000 +
-llc 16384 2 bridge,stp, Live 0xffffffffc0930000 +
-nft_fib_inet 16384 1 - Live 0xffffffffc08f5000 +
-nft_fib_ipv4 16384 1 nft_fib_inet, Live 0xffffffffc08ed000 +
-nft_fib_ipv6 16384 1 nft_fib_inet, Live 0xffffffffc08e8000 +
-nft_fib 16384 3 nft_fib_inet,nft_fib_ipv4,nft_fib_ipv6, Live 0xffffffffc08e3000 +
-nft_reject_inet 16384 5 - Live 0xffffffffc08de000 +
-nf_reject_ipv4 16384 2 ipt_REJECT,nft_reject_inet, Live 0xffffffffc08d9000 +
-nf_reject_ipv6 16384 1 nft_reject_inet, Live 0xffffffffc08d4000 +
-nft_reject 16384 1 nft_reject_inet, Live 0xffffffffc08cf000 +
---More--+
 </code> </code>
  
-==Statistiques de l'utilisation  des disques==+Dernièrement, créez un fichier index.html **vide** dans le répertoire **/var/www/html/** :
  
 <code> <code>
-[root@centos8 ~]# cat /proc/diskstats +[root@redhat9 ~]# touch /var/www/html/index.html
-         0 sda 15481 112 1445637 154103 10272 2377 277530 890611 0 237219 1044714 0 0 0 0 +
-         1 sda1 402 3 66754 13349 31 18 392 4632 0 2824 17981 0 0 0 0 +
-         2 sda2 14915 109 1375516 140528 8450 2359 277138 869788 0 225416 1010316 0 0 0 0 +
-        16 sdb 230 0 5991 36 0 0 0 0 0 110 36 0 0 0 0 +
-  11       0 sr0 10 0 4 2 0 0 0 0 0 9 2 0 0 0 0 +
- 253       0 dm-0 11651 0 1364532 72138 12121 0 288727 1208138 0 227630 1280276 0 0 0 0 +
- 253       1 dm-1 104 0 4440 79 0 0 0 0 0 71 79 0 0 0 0+
 </code> </code>
  
-==Partitions==+Redémarrez maintenant le service httpd :
  
 <code> <code>
-[root@centos8 ~]# cat /proc/partitions +[root@redhat9 ~]# systemctl restart httpd.service
-major minor  #blocks  name +
- +
-          0   33554432 sda +
-          1    1048576 sda1 +
-          2   32504832 sda2 +
-         16    4194304 sdb +
-  11        0    1048575 sr0 +
- 253        0   29143040 dm-0 +
- 253        1    3358720 dm-1+
 </code> </code>
  
-==Espaces de pagination==+Installez le paquet **lynx** :
  
 <code> <code>
-[root@centos8 ~]# cat /proc/swaps +[root@redhat9 ~]# dnf install lynx -y
-Filename                                Type            Size    Used    Priority +
-/dev/dm-1                               partition       3358716 0       -2+
 </code> </code>
  
-==Statistiques d'utilisation du processeur==+Consultez le site localhost en utilisant **lynx** : 
  
 <code> <code>
-[root@centos8 ~]# cat /proc/loadavg +[root@redhat9 ~]# lynx localhost
-0.00 0.00 0.00 1/697 16936+
 </code> </code>
  
-==Statistiques d'utilisation de la mémoire==+La commande **sealert** possède à la fois une interface graphique **et** un mode en ligne de commande :
  
 <code> <code>
-[root@centos8 ~]# cat /proc/meminfo +[root@redhat9 ~]# sealert -a /var/log/audit/audit.log > /root/mylogfile.txt
-MemTotal:        3825032 kB +
-MemFree:         1862116 kB +
-MemAvailable:    2420560 kB +
-Buffers:            3300 kB +
-Cached:           750496 kB +
-SwapCached:            0 kB +
-Active:           315572 kB +
-Inactive:        1400260 kB +
-Active(anon):       1856 kB +
-Inactive(anon):   974728 kB +
-Active(file):     313716 kB +
-Inactive(file):   425532 kB +
-Unevictable:           0 kB +
-Mlocked:               0 kB +
-SwapTotal:       3358716 kB +
-SwapFree:        3358716 kB +
-Dirty:                 0 kB +
-Writeback:             0 kB +
-AnonPages:        962004 kB +
-Mapped:           261084 kB +
-Shmem:             14552 kB +
-KReclaimable:      46980 kB +
-Slab:             118396 kB +
-SReclaimable:      46980 kB +
-SUnreclaim:        71416 kB +
-KernelStack:       11280 kB +
-PageTables:        46532 kB +
-NFS_Unstable:          0 kB +
-Bounce:                0 kB +
-WritebackTmp:          0 kB +
-CommitLimit:     5271232 kB +
-Committed_AS:    5072744 kB +
-VmallocTotal:   34359738367 kB +
-VmallocUsed:           0 kB +
-VmallocChunk:          0 kB +
-Percpu:             5920 kB +
-HardwareCorrupted:     0 kB +
-AnonHugePages:    546816 kB +
-ShmemHugePages:        0 kB +
-ShmemPmdMapped:        0 kB +
-FileHugePages:         0 kB +
-FilePmdMapped:         0 kB +
-HugePages_Total:       0 +
-HugePages_Free:        0 +
-HugePages_Rsvd:        0 +
-HugePages_Surp:        0 +
-Hugepagesize:       2048 kB +
-Hugetlb:               0 kB +
-DirectMap4k:      173944 kB +
-DirectMap2M:     4020224 kB+
 </code> </code>
  
-==Version du noyau==+Consultez le fichier **/root/mylogfile.txt** :
  
 <code> <code>
-[root@centos8 ~]# cat /proc/version +[root@redhat9 ~]# more /root/mylogfile.txt
-Linux version 4.18.0-305.3.1.el8.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.4.1 20200928 (Red Hat 8.4.1-1) (GCC)) #1 SMP Tue Jun 1 16:14:33 UTC 2021 +
-</code>+
  
-===Répertoires===+found 24 alerts in /var/log/audit/audit.log 
 +--------------------------------------------------------------------------------
  
-==ide/scsi==+SELinux is preventing /usr/bin/pkla-check-authorization from using the noatsecure access on a process.
  
-Ce répertoire contient des répertoires dans lesquels se trouvent des informations sur la capacité, le type et la géométrie des disques.+*****  Plugin catchall (100confidence) suggests   **************************
  
-==acpi==+If you believe that pkla-check-authorization should be allowed noatsecure access on processes labeled policykit_auth_t by default. 
 +Then you should report this as a bug. 
 +You can generate a local policy module to allow this access. 
 +Do 
 +allow this access for now by executing: 
 +# ausearch -c 'pkla-check-auth' --raw | audit2allow -M my-pklacheckauth 
 +# semodule -X 300 -i my-pklacheckauth.pp
  
-Ce répertoire contient des informations sur la gestion de l'énérgie, les températures, les vitesses de ventilateurs, la charge des batteries. 
  
-==bus==+Additional Information: 
 +Source Context                system_u:system_r:policykit_t:s0 
 +Target Context                system_u:system_r:policykit_auth_t:s0 
 +Target Objects                /lib64/ld-linux-x86-64.so.2 [ process ] 
 +Source                        pkla-check-auth 
 +Source Path                   /usr/bin/pkla-check-authorization 
 +Port                          <Unknown> 
 +Host                          <Unknown> 
 +Source RPM Packages           polkit-pkla-compat-0.1-21.el9.x86_64 
 +Target RPM Packages           glibc-2.34-100.el9_4.3.x86_64 
 +SELinux Policy RPM            selinux-policy-targeted-38.1.35-2.el9_4.2.noarch 
 +Local Policy RPM              selinux-policy-targeted-38.1.35-2.el9_4.2.noarch 
 +Selinux Enabled               True 
 +Policy Type                   targeted 
 +Enforcing Mode                Permissive 
 +Host Name                     redhat9.ittraining.loc 
 +Platform                      Linux redhat9.ittraining.loc 
 +                              5.14.0-427.37.1.el9_4.x86_64 #1 SMP 
 +                              PREEMPT_DYNAMIC Fri Sep 13 12:41:50 EDT 2024 
 +                              x86_64 x86_64 
 +Alert Count                   10 
 +First Seen                    2024-10-22 10:01:01 CEST 
 +Last Seen                     2024-10-22 10:33:01 CEST 
 +Local ID                      344c2abc-bac6-4064-ae22-411f0ce680cd
  
-Ce répertoire contient un sous-répertoire par bus.+Raw Audit Messages 
 +type=AVC msg=audit(1729585981.217:17543): avc:  denied  { noatsecure } for  pid=102284 comm="polkitd" scontext=system_u:system_r:policykit_t:s0 tco 
 +ntext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1
  
-==net== 
  
-Ce répertoire contient des informations sur le réseau.+type=AVC msg=audit(1729585981.217:17543): avc:  denied  { rlimitinh } for  pid=102284 comm="pkla-check-auth" scontext=system_u:system_r:policykit_t 
 +:s0 tcontext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1
  
-==sys== 
  
-Ce répertoire contient des paramètres du noyau. Certains des fichiers dans ce répertoire sont accessibles en écriture par root en temps réel. Par exemple pour éviter des attaques réseau **%%DoS%%** utilisant la commande **ping**, saisissez la commande suivante :+--More--(1%
 +</code>
  
-  # echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all [Entrée] +Cherchez dans le fichier la chaine **Plugin catchall** de la section concernant apache :
- +
-Cette commande a pour résultat d'ignorer les reqûetes ping. +
- +
-====2.2 - Utilisation de la Commande sysctl==== +
- +
-Les fichiers dans le répertoire **/proc/sys** peuvent être administrés par la commande **sysctl** en temps réel.  +
- +
-La commande **sysctl** applique les règles consignés dans le fichier **/etc/sysctl.conf** au démarrage de la machine. +
- +
-Saisissez la commande :+
  
 <code> <code>
-[root@centos8 ~]# cat /etc/sysctl.conf +... 
-# sysctl settings are defined through files in +*****  Plugin catchall (100confidencesuggests   **************************
-# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/+
-+
-# Vendors settings live in /usr/lib/sysctl.d/+
-# To override a whole file, create a new file with the same in +
-# /etc/sysctl.d/ and put new settings there. To override +
-# only specific settings, add a file with a lexically later +
-# name in /etc/sysctl.d/ and put new settings there. +
-+
-# For more information, see sysctl.conf(5) and sysctl.d(5).+
  
-[root@centos8 ~]# ls -l /etc/sysctl.d/ +If you believe that httpd should have the net_admin capability by default
-total 0 +Then you should report this as a bug
-lrwxrwxrwx. 1 root root 14 Mar 16 15:42 99-sysctl.conf -> ../sysctl.conf +You can generate a local policy module to allow this access
-[root@centos8 ~]# ls -l /usr/lib/sysctl.d/ +Do 
-total 24 +allow this access for now by executing
--rw-r--r--. 1 root root 1810 Dec 22  2020 10-default-yama-scope.conf +# ausearch -c 'httpd' --raw | audit2allow -M my-httpd 
--rw-r--r--. 1 root root  524 Mar 16 15:42 50-coredump.conf +# semodule -X 300 -i my-httpd.pp
--rw-r--r--. 1 root root 1270 Mar 16 15:42 50-default.conf +
--rw-r--r--. 1 root root  246 Jun 15  2020 50-libkcapi-optmem_max.conf +
--rw-r--r--. 1 root root  636 Mar 16 15:42 50-pid-max.conf +
--rw-r--r--. 1 root root  499 Nov 26  2019 60-libvirtd.conf+
  
-[root@centos8 ~]# cat /usr/lib/sysctl.d/50-default.conf  
-#  This file is part of systemd. 
-# 
-#  systemd is free software; you can redistribute it and/or modify it 
-#  under the terms of the GNU Lesser General Public License as published by 
-#  the Free Software Foundation; either version 2.1 of the License, or 
-#  (at your option) any later version. 
  
-# See sysctl.d(5) and core(5) for documentation.+Additional Information: 
 +Source Context                system_u:system_r:httpd_t:s0 
 +Target Context                system_u:system_r:httpd_t:s0 
 +Target Objects                Unknown [ capability ] 
 +Source                        httpd 
 +Source Path                   /usr/sbin/httpd 
 +Port                          <Unknown> 
 +Host                          <Unknown> 
 +Source RPM Packages           httpd-core-2.4.57-11.el9_4.1.x86_64 
 +Target RPM Packages            
 +SELinux Policy RPM            selinux-policy-targeted-38.1.35-2.el9_4.2.noarch 
 +Local Policy RPM              selinux-policy-targeted-38.1.35-2.el9_4.2.noarch 
 +Selinux Enabled               True 
 +Policy Type                   targeted 
 +Enforcing Mode                Permissive 
 +Host Name                     redhat9.ittraining.loc 
 +Platform                      Linux redhat9.ittraining.loc 
 +                              5.14.0-427.37.1.el9_4.x86_64 #1 SMP 
 +                              PREEMPT_DYNAMIC Fri Sep 13 12:41:50 EDT 2024 
 +                              x86_64 x86_64 
 +Alert Count                   9 
 +First Seen                    2024-10-22 10:15:49 CEST 
 +Last Seen                     2024-10-22 10:32:34 CEST 
 +Local ID                      15ae5915-d5a6-4849-b0d1-e4829bfcb57e
  
-# To override settings in this file, create a local file in /etc +Raw Audit Messages 
-(e.g. /etc/sysctl.d/90-override.conf), and put any assignments +type=AVC msg=audit(1729585954.475:17532): avc:  denied  { net_admin } for  pid=101828 comm="httpd" capability=12  scontext=system_u:system_r:httpd_ 
-# there.+t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=capability permissive=1
  
-# System Request functionality of the kernel (SYNC) 
-# 
-# Use kernel.sysrq = 1 to allow all keys. 
-# See https://www.kernel.org/doc/html/latest/admin-guide/sysrq.html for a list 
-# of values and keys. 
-kernel.sysrq = 16 
  
-# Append the PID to the core filename +type=SYSCALL msg=audit(1729585954.475:17532): arch=x86_64 syscall=setsockopt success=yes exit=0 a0=9 a1=1 a2=20 a3=7ffeb581bbe4 items=0 ppid=1 pid= 
-kernel.core_uses_pid = 1+101828 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=httpd exe=/usr/sbin/httpd subj=system 
 +_u:system_r:httpd_t:s0 key=(null)ARCH=x86_64 SYSCALL=setsockopt AUID=unset UID=root GID=root EUID=root SUID=root FSUID=root EGID=root SGID=root FSG 
 +ID=root
  
-# https://bugzilla.redhat.com/show_bug.cgi?id=1689346 +Hashhttpd,httpd_t,httpd_t,capability,net_admin 
-kernel.kptr_restrict = 1+</code>
  
-# Source route verification +Ce message a été généré parce que le repertoire /www ainsi que le fichier index.html ne possèdent pas le **type** nécessaire pour que le service apache puisse les utiliser :
-net.ipv4.conf.all.rp_filter = 1+
  
-# Do not accept source routing +<code> 
-net.ipv4.conf.all.accept_source_route = 0 +[root@redhat9 ~]ls -Z /www/index.html 
- +unconfined_u:object_r:default_t:s0 /www/index.html
-Promote secondary addresses when the primary address is removed +
-net.ipv4.conf.all.promote_secondaries = 1 +
- +
-# Fair Queue CoDel packet scheduler to fight bufferbloat +
-net.core.default_qdisc = fq_codel +
- +
-# Enable hard and soft link protection +
-fs.protected_hardlinks = 1 +
-fs.protected_symlinks = 1+
 </code> </code>
- 
-Les options de la commande **sysctl** sont : 
  
 <code> <code>
-[root@centos8 ~]# sysctl --help+[root@redhat9 ~]# ls -Z /var/www/html/index.html 
 +unconfined_u:object_r:httpd_sys_content_t:s0 /var/www/html/index.html 
 +</code>
  
-Usage: +L'exemple ci-dessus nous montre clairement que le type pour **/www/index.html** est **default_t** or apache a besoin du type **httpd_sys_content_t** pour pouvoir accéder au fichier.
- sysctl [options] [variable[=value] ...]+
  
-Options: +Modifiez donc la SC de /www et /www/index.html en utilisant la commande **chcon** :
-  -a, --all            display all variables +
-  -A                   alias of -a +
-  -X                   alias of -a +
-      --deprecated     include deprecated parameters to listing +
-  -b, --binary         print value without new line +
-  -e, --ignore         ignore unknown variables errors +
-  -N, --names          print variable names without values +
-  -n, --values         print only values of the given variable(s) +
-  -p, --load[=<file> read values from file +
-  -f                   alias of -p +
-      --system         read values from all system directories +
-  -r, --pattern <expression> +
-                       select setting that match expression +
-  -q, --quiet          do not echo variable set +
-  -w, --write          enable writing a value to variable +
-  -o                   does nothing +
-  -x                   does nothing +
-  -d                   alias of -h+
  
- -h, --help     display this help and exit +<code> 
- -V, --version  output version information and exit+[root@redhat9 ~]# chcon -Rv --type=httpd_sys_content_t /www 
 +changing security context of '/www/index.html' 
 +changing security context of '/www'
  
-For more details see sysctl(8).+[root@redhat9 ~]# ls -Z /www/index.html 
 +unconfined_u:object_r:httpd_sys_content_t:s0 /www/index.html
 </code> </code>
  
-<WRAP center round important 60%> +Afin de maintenir ces SC lors d'une **restauration des SC par défaut**, il convient d'utiliser la commande **semanage** afin d'appliquer la modification d'une manière définitive :
-**Important** : Consultez la page de la traduction du manuel de **sysctl** **[[http://www.delafond.org/traducmanfr/man/man8/sysctl.8.html|ici]]** pour comprendre la commande. +
-</WRAP> +
- +
-=====LAB#3 - Interprétation des informations dans /proc===== +
- +
-Les informations brutes stockées dans /proc peuvent être interprétées grâce à l'utilisation des commandes dites de //gestion des performances//+
- +
-  free, +
-  uptime et w, +
-  * iostat, +
-  * hdparm, +
-  * vmstat, +
-  * mpstat, +
-  * sar. +
- +
-====3.1 - La Commande free==== +
- +
-La commande **free** permet de donner l’état de la mémoire totale, libre, partagée, swap et bufferisée. Saisissez donc la commande suivante :+
  
 <code> <code>
-[root@centos8 ~]# free -+[root@redhat9 ~]# semanage fcontext -a -t httpd_sys_content_t "/www(/.*)?"
-              total        used        free      shared  buff/cache   available +
-Mem:           3735        1135        1818          14         782        2363 +
-Swap:          3279                  3279+
 </code> </code>
  
-Dans le cas de cet exemple, nous pouvons constater que l’affichage montre :+Les options de la commande chcon sont :
  
-  * 3735 Mo de mémoire physique totale, +<code> 
-  * 1135 Mo de mémoire physique utilisée et 1818 Mo de mémoire physique libre, +[root@redhat9 ~]# chcon --help 
-  * 3279 Mo de mémoire swap totale et 0 Mo de swap utilisé+Usage: chcon [OPTION]... CONTEXT FILE... 
 +  or:  chcon [OPTION]... [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE... 
 +  or:  chcon [OPTION]... --reference=RFILE FILE... 
 +Change the SELinux security context of each FILE to CONTEXT. 
 +With --reference, change the security context of each FILE to that of RFILE.
  
-Les options de cette commande sont :+Mandatory arguments to long options are mandatory for short options too. 
 +      --dereference      affect the referent of each symbolic link (this is 
 +                         the default), rather than the symbolic link itself 
 +  -h, --no-dereference   affect symbolic links instead of any referenced file 
 +  -u, --user=USER        set user USER in the target security context 
 +  -r, --role=ROLE        set role ROLE in the target security context 
 +  -t, --type=TYPE        set type TYPE in the target security context 
 +  -l, --range=RANGE      set range RANGE in the target security context 
 +      --no-preserve-root  do not treat '/' specially (the default) 
 +      --preserve-root    fail to operate recursively on '/' 
 +      --reference=RFILE  use RFILE's security context rather than specifying 
 +                         a CONTEXT value 
 +  -R, --recursive        operate on files and directories recursively 
 +  -v, --verbose          output a diagnostic for every file processed
  
-<code> +The following options modify how a hierarchy is traversed when the -
-[root@centos8 ~]# free --help+option is also specified.  If more than one is specified, only the final 
 +one takes effect.
  
-Usage: +  -H                     if a command line argument is a symbolic link 
- free [options]+                         to a directory, traverse it 
 +  -L                     traverse every symbolic link to a directory 
 +                         encountered 
 +  -P                     do not traverse any symbolic links (default)
  
-Options: +      --help     display this help and exit 
- -b, --bytes         show output in bytes +      --version  output version information and exit
-     --kilo          show output in kilobytes +
-     --mega          show output in megabytes +
-     --giga          show output in gigabytes +
-     --tera          show output in terabytes +
-     --peta          show output in petabytes +
- -k, --kibi          show output in kibibytes +
- -m, --mebi          show output in mebibytes +
- -g, --gibi          show output in gibibytes +
-     --tebi          show output in tebibytes +
-     --pebi          show output in pebibytes +
- -h, --human         show human-readable output +
-     --si            use powers of 1000 not 1024 +
- -l, --lohi          show detailed low and high memory statistics +
- -t, --total         show total for RAM + swap +
- -s N, --seconds N   repeat printing every N seconds +
- -c N, --count N     repeat printing N times, then exit +
- -w, --wide          wide output+
  
-     --help     display this help and exit +GNU coreutils online help: <https://www.gnu.org/software/coreutils/> 
- -V, --version  output version information and exit +Full documentation <https://www.gnu.org/software/coreutils/chcon> 
- +or available locally via: info '(coreutilschcon invocation'
-For more details see free(1).+
 </code> </code>
  
-====3.Les Commandes uptime et w====+====3.La commande restorecon====
  
-Chacune des ces commandes indique la charge moyenne du ou des processeurs depuis 1 minute5 minutes et 15 minutes :+Pour illustrer l'utilisation de cette commandecréez les fichiers copy.html et move.html dans le répertoire /tmp :
  
 <code> <code>
-[root@centos8 ~]# uptime +[root@redhat9 ~]# cd /tmp ; touch copy.html move.html 
- 04:39:03 up 1 day,  2:34,  1 user,  load average: 0.00, 0.00, 0.00 + 
-  +[root@redhat9 tmp]# ls -Z | grep html 
-[root@centos8 ~]# w + unconfined_u:object_r:user_tmp_t:s0 copy.html 
- 04:39:04 up 1 day,  2:34,  1 user,  load average: 0.00, 0.00, 0.00 + unconfined_u:object_r:user_tmp_t:s0 move.html
-USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT +
-trainee  pts/0    10.0.2.1         03:58    0.00s  0.11s  0.02s sshd: trainee [priv]+
 </code> </code>
  
-Les valeurs **load average** ou //charge moyenne// indiquent le nombre moyen de processus en cours de traitement ou en attente pour la période concernée. +**Copiez** le fichier copy.html vers /var/www/html et **déplacez** le fichier move.html vers la même cible :
- +
-Par exemple si les valeurs sur un système muni d'un seul processeur étaient **3,48  4,00  3,85** ceci indiquerait que le processeur a du mal à traiter les processus mettant en moyenne : +
- +
-  * 2,48 processus en attente dans la dernière minute, +
-  * 3,00 processus en attente dans les dernières 5 minutes, +
-  * 2,85 processus en attente dans les dernières 15 minutes. +
- +
-Les options de ces commandes sont :+
  
 <code> <code>
-[root@centos8 ~]# uptime --help+[root@redhat9 tmp]# cp copy.html /var/www/html/
  
-Usage: +[root@redhat9 tmp]# mv move.html /var/www/html/
- uptime [options]+
  
-Options: +[root@redhat9 tmp]# ls -Z /var/www/html 
- -p, --pretty   show uptime in pretty format +unconfined_u:object_r:httpd_sys_content_t:s0 copy.html            unconfined_u:object_r:user_tmp_t:s0 move.html 
- -h, --help     display this help and exit +unconfined_u:object_r:httpd_sys_content_t:s0 index.html 
- -s, --since    system up since +</code>
- -V, --version  output version information and exit+
  
-For more details see uptime(1).+<WRAP center round important 50%> 
 +**Important** : Notez ici que copy.html a pris le type du répertoire de destination tandis que move.html retient le type obtenu lors de la création. 
 +</WRAP>
  
-[root@centos8 ~]# w --help+Restaurez maintenant la SC par défaut de move.html compte tenu de son emplacement en utilisant la commande **restorecon** :
  
-Usage: +<code> 
- [options]+[root@redhat9 tmp]# restorecon -v /var/www/html/move.html 
 +Relabeled /var/www/html/move.html from unconfined_u:object_r:user_tmp_t:s0 to unconfined_u:object_r:httpd_sys_content_t:s0
  
-Options: +[root@redhat9 tmp]# ls -Z /var/www/html 
- -h, --no-header     do not print header +unconfined_u:object_r:httpd_sys_content_t:s0 copy.html   unconfined_u:object_r:httpd_sys_content_t:s0 move.html 
- -u, --no-current    ignore current process username +unconfined_u:object_r:httpd_sys_content_t:s0 index.html
- -s, --short         short format +
- -f, --from          show remote hostname field +
- -o, --old-style     old style output +
- -i, --ip-addr       display IP address instead of hostname (if possible) +
- +
-     --help     display this help and exit +
- -V, --version  output version information and exit +
- +
-For more details see w(1).+
 </code> </code>
  
-====3.La Commande iostat====+====3.Le fichier /.autorelabel====
  
-La commande **iostat** affiche des statistiques sur l'utilisation des disques, des terminaux et des lecteurs de cartouche :+En cas de besoin il est intéressant de pouvoir restaurer les SC par défaut sur l'ensemble des objets du système. Cette procédure est très simple à mettre en oeuvre. Il convient de créer le fichier **.autorelabel** à la racine et de redémarrer le système :
  
 <code> <code>
-[root@centos8 ~]# iostat +[root@redhat9 tmp]# touch /.autorelabel
-bash: iostat: command not found... +
-Install package 'sysstat' to provide command 'iostat'? [N/y] y +
- +
- +
- * Waiting in queue...  +
-The following packages have to be installed: +
- lm_sensors-libs-3.4.0-22.20180522git70f7e08.el8.x86_64 Lm_sensors core libraries +
- sysstat-11.7.3-5.el8.x86_64    Collection of performance monitoring tools for Linux +
-Proceed with changes? [N/y] y +
- +
- +
- * Waiting in queue...  +
- * Waiting for authentication...  +
- * Waiting in queue...  +
- * Downloading packages...  +
- * Requesting data...  +
- * Testing changes...  +
- * Installing packages...  +
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_(8 CPU) +
- +
-avg-cpu:  %user   %nice %system %iowait  %steal   %idle +
-           0.03    0.00    0.03    0.01    0.00   99.93+
  
-Device             tps    kB_read/   kB_wrtn/   kB_read    kB_wrtn +[root@redhat9 tmp]# shutdown -r now
-sda               0.28         7.67         1.49     735338     142510 +
-sdb               0.00         0.03         0.00       2995          0 +
-scd0              0.00         0.00         0.00          2          0 +
-dm-0              0.26         7.25         1.55     694786     148837 +
-dm-1              0.00         0.02         0.00       2220          0+
 </code> </code>
  
-Au-dessous de la première ligne indiquant la version du noyau du système et son nom d'hôte ainsi que la date actuelle, iostat affiche une vue d'ensemble de l'utilisation CPU moyenne du système depuis le dernier démarrageLe rapport d'utilisation du CPU inclut les pourcentages suivants :+====3.9 - La commande semanage====
  
-  * **%user** - Pourcentage de temps passé en mode utilisateur (exécutant des applicationsetc.) +Pour illustrer l'utilisation de cette commandeconsidérez le besoin de mettre le service apache à l'écoute du port **8090** au lieu du port standard.
-  * **%nice** - Pourcentage de temps passé en mode utilisateur (pour les processus qui ont modifié leur priorité de programmation à l'aide de la commande nice) +
-  * **%system** - Pourcentage de temps passé en mode noyau +
-  * **%steal** - Pourcentage du temps passé par des CPU virtuels en attendant que l'hyperviseur s'occupe d'un autre CPU virtuel. +
-  * **%iowait** - Pourcentage du temps passé à attendre les entrées et les sorties des disques. +
-  * **%idle** - Pourcentage de temps passé en inactivité+
  
-Notez la valeur de **%iowait**Dans le cas où ce pourcentage est trop élévé, ceci indique que le processeur passe son temps à attendre les entrées et les sorties de disque. +%%SELinux%% gère aussi l'accès aux ports par les différents serveursLa liste complète des ports autorisés par serveur puet être visualiser à l'aide de la commande **semanage** :
- +
-Au-dessous du rapport d'utilisation du CPU de la sortie de la commande **iostat** figure le rapport d'utilisation des périphériques. Ce dernier contient une ligne pour chaque périphérique disque du système et inclut les informations suivantes : +
- +
-  * La spécification du périphérique. +
-  * Le nombre de transferts (ou opérations d'E/S) par seconde. +
-  * Le nombre de blocs de KB lus par seconde. +
-  * Le nombre de blocs de KB écrits par seconde. +
-  * Le nombre total de KB lus. +
-  * Le nombre total de KB écrits. +
-   +
-Dernièrement, pour voir les statistiques étendues des disques, utilisez la commande suivante :+
  
 <code> <code>
-[root@centos8 ~]# iostat -d -x +[trainee@redhat9 ~]$ su 
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        30/06/21        _x86_64_        (8 CPU)+Password: fenestros
  
-Device            r/s     w/    rkB/    wkB/  rrqm/  wrqm/ %rrqm  %wrqm r_await w_await aqu-sz rareq-sz wareq-sz  svctm  %util +[root@redhat9 ~]# semanage port -l | grep http 
-sda              0.20    0.16     11.67      1.81     0.00     0.03   0.48  17.45    6.79   69.99   0.01    58.28    11.33   9.13   0.33 +http_cache_port_t              tcp      8080, 8118, 8123, 10001-10010 
-sdb              0.00    0.00      0.02      0.00     0.00     0.00   0.00   0.00    0.13    0.00   0.00     8.81     0.00   0.51   0.00 +http_cache_port_t              udp      3130 
-scd0             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.20    0.00   0.00     0.20     0.00   0.90   0.00 +http_port_t                    tcp      80, 81, 443, 488, 8008, 8009, 8443, 9000 
-dm-0             0.12    0.19      3.98      1.90     0.00     0.00   0.00   0.00    4.18   79.07   0.02    32.88    10.07  10.34   0.32 +pegasus_http_port_t            tcp      5988 
-dm-1             0.00    0.00      0.01      0.00     0.00     0.00   0.00   0.00    0.76    0.00   0.00    21.35     0.00   0.68   0.00+pegasus_https_port_t           tcp      5989
 </code> </code>
  
-Les options de cette commande sont :+Notez par exemple que le serveur apache est autorisé d'utiliser les ports suivants :
  
-<code+<file
-[root@centos8 ~]# iostat --help +http_port_t                    tcp      80, 81443, 488, 8008, 8009, 8443, 9000 
-Usage: iostat [ options ] [ <interval> [ <count> ] ] +</file>
-Options are: +
-[ -c ] [ -d ] [ -h ] [ -k | -m ] [ -N ] [ -s ] [ -t ] [ -V ] [ -x ] [ -y ] [ -z ] +
-[ -j { ID | LABEL | PATH | UUID | ... } ] [ --human ] [ -o JSON ] +
-[ [ -H ] -g <group_name> ] [ -p [ <device> [,...] | ALL ] ] +
-[ <device> [...] | ALL ] +
-</code> +
- +
-====3.4 - La Commande hdparm====+
  
-Pour surveiller la vitesse des entrées et des sorties du disque, vous pouvez utiliser la commande **hdparm** :+Dans le cas où on souhaite qu'apache utilise le port **8090** par exemple, il est nécessaire de créer la règle adéquate avec la commande semanage :
  
 <code> <code>
-[root@centos8 ~]# hdparm -t /dev/sda +[root@redhat9 ~]# semanage port -a -t http_port_t -p tcp 8090
- +
-/dev/sda: +
- Timing buffered disk reads: 1410 MB in  3.00 seconds = 469.98 MB/sec+
 </code> </code>
  
-====3.5 - La Commande vmstat==== +Vous noterez que le port 8090 a été ajouté à la liste des ports reconnus comme valides par %%SELinux%% :
- +
-La commande **vmstat** affiche des statistiques sur la mémoire, la pagination et la charge ponctuelle du processeur :+
  
 <code> <code>
-[root@centos8 ~]# vmstat 1 10 +[root@redhat9 ~]# semanage port -l | grep http 
-procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----+http_cache_port_t              tcp      8080, 8118, 8123, 10001-10010 
- r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st +http_cache_port_t              udp      3130 
-      0 1765216   2256 866336    0    0            9   12  0  0 100  0  0 +http_port_t                    tcp      8090, 80, 81, 443, 488, 8008, 8009, 8443, 9000 
- 0  0      0 1765136   2256 866336    0    0           57   80   0 100  0  0 +pegasus_http_port_t            tcp      5988 
-  0      0 1765136   2256 866376    0    0           54   77  0  0 100  0  0 +pegasus_https_port_t           tcp      5989
-  0      0 1765136   2256 866376    0    0           66  100  0  0 100  0  0 +
-  0      0 1765136   2256 866376    0    0          103  125  0  0 100  0  0 +
-  0      0 1765108   2256 866376    0    0           64   86  0  0 100  0  0 +
-  0      0 1765108   2256 866376    0    0           62   88  0  0 100  0  0 +
-  0      0 1765108   2256 866376    0    0           68   97  0  0 100  0  0 +
- 0  0      0 1765108   2256 866376    0    0           60   88  0  0 100  0  0 +
- 0  0      0 1765108   2256 866376    0    0          177  251  0  0 100  0  0+
 </code> </code>
  
-La première ligne subdivise le champ en six catégories à savoir processus, mémoire, swap, E/S, système et CPU sur lesquelles elle donne des statistiques. La seconde ligne identifie de manière encore plus détaillée chacun des champs, permettant ainsi de parcourir simplement et rapidement l'ensemble des données lors de la recherche de statistiques spécifiques.+Les options **semanage** sont :
  
-Les champs relatifs aux processus sont les suivants :+[root@redhat9 ~]# semanage --help 
 +usagesemanage [-h] {import,export,login,user,port,ibpkey,ibendport,interface,module,node,fcontext,boolean,permissive,dontaudit} ...
  
-  * r — Le nombre de processus exécutables attendant d'avoir accès au CPU +semanage is used to configure certain elements of SELinux policy with-out requiring modification or recompilation from policy source.
-  * b — Le nombre de processus exécutables dans un état de veille qui ne peut être interrompu+
  
-Les champs relatifs à la mémoire sont les suivants :+positional arguments: 
 +  {import,export,login,user,port,ibpkey,ibendport,interface,module,node,fcontext,boolean,permissive,dontaudit} 
 +    import              Import local customizations 
 +    export              Output local customizations 
 +    login               Manage login mappings between linux users and SELinux confined users 
 +    user                Manage SELinux confined users (Roles and levels for an SELinux user) 
 +    port                Manage network port type definitions 
 +    ibpkey              Manage infiniband ibpkey type definitions 
 +    ibendport           Manage infiniband end port type definitions 
 +    interface           Manage network interface type definitions 
 +    module              Manage SELinux policy modules 
 +    node                Manage network node type definitions 
 +    fcontext            Manage file context mapping definitions 
 +    boolean             Manage booleans to selectively enable functionality 
 +    permissive          Manage process type enforcement mode 
 +    dontaudit           Disable/Enable dontaudit rules in policy
  
-  * swpd — La quantité de mémoire virtuelle utilisée +optional arguments: 
-  * free — La quantité de mémoire libre +  -h, --help            show this help message and exit
-  * buff — La quantité de mémoire utilisée par les tampons (ou buffers) +
-  * cache — La quantité de mémoire utilisée comme cache de pages+
  
-Les champs relatifs au swap sont les suivants :+====3.10 - La commande audit2allow====
  
-  * si — La quantité de mémoire chargée depuis le disque +La création d'un module de politique personnalisé se fait en utilisant la commande **audit2allow**. L'administrateur de sécurité à recours à la création de modules quand, et uniquement quand :
-  so — La quantité de mémoire déchargée sur le disque+
  
-Les champs relatifs aux Entrées/Sorties (E/S) sont les suivants :+  * la résolution du problème n'est pas possible en utilisant une des commandes précédemment citées, 
 +  * il n'existe pas de booléen capable de régler le problème.
  
-  * bi — Blocs envoyés vers un périphérique blocs +Pour illustrer l'utilisation de cette commande, créez un nouveau répertoire pour les documents d'apache ainsi que la page d'accueil :
-  * bo— Blocs reçus d'un périphérique blocs +
  
-Les champs relatifs au système sont les suivants :+<code> 
 +[root@redhat9 ~]# mkdir /www1
  
-  * in — Nombre d'interruptions par seconde +[root@redhat9 ~]# touch /www1/index.html 
-  * cs — Nombre de changements de contexte par seconde+</code>
  
-Les champs relatifs au CPU sont les suivants : +Éditez le fichier **/etc/httpd/conf/httpd.conf** :
- +
-  * us — Le pourcentage de temps pendant lequel le CPU exécute un code de niveau utilisateur +
-  sy — Le pourcentage de temps pendant lequel le CPU exécute un code de niveau système +
-  id — Le pourcentage de temps pendant lequel le CPU était inoccupé +
-  * wa — Attente d'E/+
- +
-Les options de cette commande sont :+
  
 <code> <code>
-[root@centos8 ~]# vmstat --help+[root@redhat9 ~]# vi /etc/httpd/conf/httpd.conf 
 +</code>
  
-Usage: +<file> 
- vmstat [options] [delay [count]]+[...] 
 +#DocumentRoot "/var/www/html" 
 +DocumentRoot "/www1" 
 +[...] 
 +</file>
  
-Options: +Ajoutez les section **<Directory "/www1">**:
- -a, --active           active/inactive memory +
- -f, --forks            number of forks since boot +
- -m, --slabs            slabinfo +
- -n, --one-header       do not redisplay header +
- -s, --stats            event counter statistics +
- -d, --disk             disk statistics +
- -D, --disk-sum         summarize disk statistics +
- -p, --partition <dev partition specific statistics +
- -S, --unit <char>      define display unit +
- -w, --wide             wide output +
- -t, --timestamp        show timestamp+
  
- -h, --help     display this help and exit +<file> 
- -V, --version  output version information and exit+... 
 +<Directory "/var/www"> 
 +    AllowOverride None 
 +    # Allow open access: 
 +    Require all granted 
 +</Directory>
  
-For more details see vmstat(8). +<Directory "/www1"> 
-</code>+ Options Indexes FollowSymLinks 
 + AllowOverride None 
 + Require all granted 
 +</Directory>
  
-<WRAP center round important 60%+# Further relax access to the default document root: 
-**Important** : Par défaut la commande vmstat affiche des informations depuis le démarrage du système+<Directory "/var/www/html"
-</WRAP>+..
 +</file>
  
-====3.6 - La Commande mpstat==== +Créez le fichier **/www1/index.html** :
- +
-La commande **mpstat** affiche des statistiques détaillées sur le CPU :+
  
 <code> <code>
-[root@centos8 ~]# mpstat +[root@redhat9 ~]# vi /www1/index.html
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_(8 CPU)+
  
-04:53:22     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle +[root@redhat9 ~]# cat /www1/index.html 
-04:53:22     all    0.03    0.00    0.01    0.02    0.01    0.01    0.00    0.00    0.00   99.92+<html> 
 +<title> 
 +This is a test 
 +</title> 
 +<body> 
 +www test page 
 +</body> 
 +</html>
 </code> </code>
  
-Dans le cas où vous avez plusieurs processeurs ou coeurs, vous pouvez visualiser ces mêmes informations par unité de traitement :+Modifiez ensuite le propriétaire et le groupe du répertoire **/www1** et son contenu :
  
 <code> <code>
-[root@centos8 ~]# mpstat -P ALL +[root@redhat9 ~]# chown -R apache:apache /www1
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_(8 CPU) +
- +
-04:54:28     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle +
-04:54:28     all    0.03    0.00    0.01    0.02    0.01    0.01    0.00    0.00    0.00   99.92 +
-04:54:28          0.03    0.00    0.01    0.00    0.01    0.00    0.00    0.00    0.00   99.94 +
-04:54:28          0.02    0.00    0.02    0.03    0.02    0.00    0.00    0.00    0.00   99.91 +
-04:54:28          0.02    0.00    0.01    0.01    0.01    0.04    0.00    0.00    0.00   99.90 +
-04:54:28          0.01    0.00    0.01    0.02    0.00    0.00    0.00    0.00    0.00   99.95 +
-04:54:28          0.05    0.00    0.02    0.03    0.01    0.00    0.00    0.00    0.00   99.88 +
-04:54:28          0.03    0.01    0.01    0.02    0.01    0.00    0.00    0.00    0.00   99.92 +
-04:54:28          0.02    0.00    0.02    0.01    0.01    0.00    0.00    0.00    0.00   99.95 +
-04:54:28          0.02    0.00    0.01    0.01    0.01    0.00    0.00    0.00    0.00   99.94+
 </code> </code>
  
-Pour afficher 5 jeux de statistiques à des intervales de 2 secondes pour tous les unités de traitement, il convient d'utiliser la commande suivante :+Redémarrez le service httpd :
  
 <code> <code>
-[root@centos8 ~]# mpstat -P ALL 2 5 +[root@redhat9 ~]# systemctl restart httpd.service
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_        (8 CPU) +
- +
-04:55:11     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle +
-04:55:13     all    0.00    0.00    0.00    0.00    0.00    0.00    0.06    0.00    0.00   99.94 +
-04:55:13          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:13          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:13          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:13          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:13          0.00    0.00    0.00    0.00    0.00    0.00    0.50    0.00    0.00   99.50 +
-04:55:13          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:13          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:13          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
- +
-04:55:13     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle +
-04:55:15     all    0.00    0.00    0.00    0.00    0.06    0.00    0.00    0.00    0.00   99.94 +
-04:55:15          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:15          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:15          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:15          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:15          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:15          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:15          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:15          0.00    0.00    0.00    0.00    0.50    0.00    0.00    0.00    0.00   99.50 +
- +
-04:55:15     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle +
-04:55:17     all    0.00    0.00    0.00    0.00    0.06    0.00    0.00    0.00    0.00   99.94 +
-04:55:17          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:17          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:17          0.00    0.00    0.00    0.00    0.50    0.00    0.00    0.00    0.00   99.50 +
-04:55:17          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:17          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:17          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:17          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:17          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
- +
-04:55:17     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle +
-04:55:19     all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:19          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:19          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:19          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:19          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:19          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:19          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:19          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:19          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
- +
-04:55:19     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle +
-04:55:21     all    0.06    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00   99.94 +
-04:55:21          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:21          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:21          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:21          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:21          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:21          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:21          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:21          0.50    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00   99.50 +
- +
-Average:     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle +
-Average:     all    0.01    0.00    0.00    0.00    0.02    0.00    0.01    0.00    0.00   99.95 +
-Average:          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-Average:          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-Average:          0.00    0.00    0.00    0.00    0.10    0.00    0.00    0.00    0.00   99.90 +
-Average:          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-Average:          0.00    0.00    0.00    0.00    0.00    0.00    0.10    0.00    0.00   99.90 +
-Average:          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-Average:          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-Average:          0.10    0.00    0.00    0.00    0.10    0.00    0.00    0.00    0.00   99.80+
 </code> </code>
  
-Les options de cette commande sont :+Consultez le site localhost en utilisant **lynx** 
  
 <code> <code>
-[root@centos8 ~]# mpstat --help +[root@redhat9 ~]# lynx --dump localhost 
-Usage: mpstat [ options ] [ <interval> [ <count> ] ] +                                  Red Hat Logo 
-Options are: +                       Red Hat Enterprise Linux Test Page
-[ -A ] [ -n ] [ -u ] [ -V ] [ -I { SUM | CPU | SCPU | ALL } ] +
-[ -N { <node_list> | ALL } ] [ -o JSON ] [ -P { <cpu_list> | ALL } ] +
-</code>+
  
-====3.7 - La Commande sar====+   This page is used to test the proper operation of the HTTP server after 
 +   it has been installedIf you can read this page, it means that the 
 +   HTTP server installed at this site is working properly. 
 +     __________________________________________________________________
  
-La commande **sar** (**S**ystem **A**ctivity **R**eporter) permet de surveiller toutes les ressources du système selon l'option qui est passée en argument à la commande. +If you are a member of the general public:
  
-Sous RHEL/CentOS 8 la commande **/usr/lib64/sa/sadc** permet de collecter les informations :+   The fact that you are seeing this page indicates that the website you 
 +   just visited is either experiencing problems, or is undergoing routine 
 +   maintenance.
  
-<code> +   If you would like to let the administrators of this website know that 
-[root@centos8 ~]# ls /usr/lib64/sa +   you've seen this page instead of the page you expected, you should send 
-sa1  sa2  sadc +   them e-mail. In general, mail sent to the name "webmaster" and directed 
-</code>+   to the website's domain should reach the appropriate person.
  
-Le script **/usr/lib64/sa/sa1** exécute la commande **sadc**Ce script prend deux options :+   For example, if you experienced problems while visiting 
 +   www.example.com, you should send e-mail to "webmaster@example.com".
  
-^ Option ^ Description ^ +   For information on Red Hat Enterprise Linux, please visit the [1]Red 
-| -t | L'intervalle entre les collectes | +   Hat, Inc. website. The documentation for Red Hat Enterprise Linux is 
-| -n | Nombre de collectes |+   [2]available on the Red Hat, Inc. website. 
 +     __________________________________________________________________
  
-Le script **/usr/lib64/sa/sa2** exécute la commande **sar** et consigne les informations dans un fichier au format **/var/log/sa/sar<jj>** :+If you are the website administrator:
  
-<code> +   You may now add content to the webroot directory. Note that until you 
-[root@centos8 ~]# ls /var/log/sa/ +   do so, people visiting your website will see this page, and not your 
-sa29  s+   content.
  
 +   For systems using the Apache HTTP Server: You may now add content to
 +   the directory /var/www/html/. Note that until you do so, people
 +   visiting your website will see this page, and not your content. To
 +   prevent this page from ever being used, follow the instructions in the
 +   file /etc/httpd/conf.d/welcome.conf.
  
-ar29 +   For systems using NGINX: You should now put your content in a location 
-</code>+   of your choice and edit the root configuration directive in the nginx 
 +   configuration file /etc/nginx/nginx.conf. 
 +   [3][ Powered by Red Hat Enterprise Linux ] [ Powered by Red Hat 
 +   Enterprise Linux ]
  
-Sous CentOS RHEL 8l'intervalle entre les collectes des informations est configuré par les **timers** de systemd au lieu des cron jobs :+   [4]Apache™ is a registered trademark of [5]the Apache Software 
 +   Foundation in the United States and/or other countries. 
 +   [6]NGINX™ is a registered trademark of [7]F5 NetworksInc..
  
-<code> +References
-[root@centos8 ~]# cat /usr/lib/systemd/system/sysstat-collect.timer +
-# /usr/lib/systemd/system/sysstat-collect.timer +
-# (C) 2014 Tomasz Torcz <tomek@pipebreaker.pl> +
-+
-# sysstat-11.7.3 systemd unit file: +
-#        Activates activity collector every 10 minutes +
- +
-[Unit] +
-Description=Run system activity accounting tool every 10 minutes +
- +
-[Timer] +
-OnCalendar=*:00/10+
  
-[Install] +   1. http://www.redhat.com/ 
-WantedBy=sysstat.service+   2. http://www.redhat.com/docs/manuals/enterprise/ 
 +   3. https://access.redhat.com/products/red-hat-enterprise-linux 
 +   4. https://apache.org/ 
 +   5. https://apache.org/ 
 +   6. https://nginx.com/ 
 +   7. https://www.f5.com/
 </code> </code>
  
-La valeur de **OnCalendar** indique un collecte toutes les dix minutes. +Notez que cette fois SELinux est en mode enforcing :
- +
-Pour modifier l'intervalle entre les collectes, il faut créer un fichier **override** dans le répertoire **/etc/systemd/system/** en utilisant la commande **systemctl edit**. En effet, il ne faut jamais éditer les fichiers dans le répertoire **/usr/lib/systemd/system** :+
  
 <code> <code>
-[root@centos8 ~]# systemctl edit sysstat-collect.timer +[root@redhat9 ~]# getenforce 
-[root@centos8 ~]# cat /etc/systemd/system/sysstat-collect.timer.d/override.conf  +Enforcing
-[Unit] +
-Description=Run system activity accounting tool every 2 minutes +
- +
-[Timer] +
-OnCalendar= +
-OnCalendar=*:00/+
-AccuracySec=0+
 </code> </code>
  
-<WRAP center round important 60%> +Le fichier **/var/log/audit/audit.log** contient maintenant des notifications de type **AVC** :
-**Important** : Notez la ligne **OnCalendar=** qui est necessaire afin de surcharger la valeur par défaut. +
-</WRAP> +
- +
-Vérifiez ensuite la prise en compte de la configuration :+
  
 <code> <code>
-[root@centos8 ~]# systemctl status sysstat-collect.timer +[root@redhat9 ~]# cat /var/log/audit/audit.log | grep AVC | tail 
-● sysstat-collect.timer - Run system activity accounting tool every 2 minutes +type=AVC msg=audit(1729587121.979:17697): avc:  denied  { noatsecure } for  pid=102767 comm="polkitd" scontext=system_u:system_r:policykit_t:s0 tcontext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1 
-   Loadedloaded (/usr/lib/systemd/system/sysstat-collect.timer; enabled; vendor presetdisabled+type=AVC msg=audit(1729587121.979:17697): avc:  denied  { rlimitinh } for  pid=102767 comm="pkla-check-auth" scontext=system_u:system_r:policykit_t:s0 tcontext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1 
-  Drop-In/etc/systemd/system/sysstat-collect.timer.d +type=AVC msg=audit(1729587121.979:17697): avc:  denied  { siginh } for  pid=102767 comm="pkla-check-auth" scontext=system_u:system_r:policykit_t:s0 tcontext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1 
-           └─override.conf +type=AVC msg=audit(1729587426.204:17741): avc:  denied  { net_admin } for  pid=102906 comm="systemd-tmpfile" capability=12  scontext=system_u:system_r:systemd_tmpfiles_t:s0 tcontext=system_u:system_r:systemd_tmpfiles_t:s0 tclass=capability permissive=1 
-   Activeactive (waitingsince Tue 2021-06-29 06:16:04 EDT; 3h 2min ago +type=AVC msg=audit(1729587481.218:17751): avc:  denied  { noatsecure } for  pid=102921 comm="polkitd" scontext=system_u:system_r:policykit_t:s0 tcontext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1 
-  TriggerTue 2021-06-29 09:20:00 EDT; 1min 19s left+type=AVC msg=audit(1729587481.218:17751): avc:  denied  { rlimitinh } for  pid=102921 comm="pkla-check-auth" scontext=system_u:system_r:policykit_t:s0 tcontext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1 
 +type=AVC msg=audit(1729587481.218:17751): avc:  denied  { siginh } for  pid=102921 comm="pkla-check-auth" scontext=system_u:system_r:policykit_t:s0 tcontext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1 
 +type=AVC msg=audit(1729587592.855:17788): avc:  denied  { siginh } for  pid=102990 comm="bash" scontext=system_u:system_r:init_t:s0 tcontext=system_u:system_r:initrc_t:s0 tclass=process permissive=1 
 +type=AVC msg=audit(1729588933.891:326): avc:  denied  { getattr } for  pid=2749 comm="httpd" path="/www1/index.html" dev="dm-0" ino=34189841 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:default_t:s0 tclass=file permissive=0 
 +type=AVC msg=audit(1729588933.891:327): avc:  denied  { getattr } for  pid=2749 comm="httpd" path="/www1/index.html" dev="dm-0" ino=34189841 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:default_t:s0 tclass=file permissive=0 
 +</code>
  
-Jun 29 06:16:04 centos8.ittraining.loc systemd[1]Started Run system activity accounting tool every 10 minutes. +A l'aide de la commande grep, il convient maintenant d'envoyer les messages d'erreurs en provenance du fichier **/var/log/audit/audit.log** sur l'entrée standard de la commande **audit2allow** afin de permettre celle-ci de créer des règles permettant l'autorisation de ce qui a été précédemment interdit par %%SELinux%% :
-</code>+
  
 <code> <code>
-[root@centos8 ~]# journalctl -g sysstat-collect.service +[root@redhat9 ~]# grep httpd_t /var/log/audit/audit.log | audit2allow -m httpdlocal > httpdlocal.te
--- Logs begin at Mon 2021-06-28 02:04:10 EDT, end at Tue 2021-06-29 09:18:00 EDT. -- +
-Jun 29 06:20:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 06:26:29 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 06:30:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 06:40:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 06:50:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:00:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:10:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:20:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:30:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:40:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:50:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:53:56 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:54:00 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:56:00 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:58:00 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 08:00:00 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-...+
 </code> </code>
  
-Saisissez la commande suivante :+L'examen du fichier **httpdlocal.te** révèle la création de ces règles :
  
 <code> <code>
-[root@centos8 ~]# sar +[root@redhat9 ~]# cat httpdlocal.te
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_        (8 CPU)+
  
-06:16:04     LINUX RESTART      (8 CPU)+module httpdlocal 1.0;
  
-06:20:33        CPU     %user     %nice   %system   %iowait    %steal     %idle +require { 
-06:26:29        all      0.03      0.00      0.03      0.00      0.00     99.94 +        type httpd_t; 
-06:30:33        all      0.02      0.00      0.03      0.00      0.00     99.95 +        type default_t; 
-06:40:33        all      0.02      0.00      0.03      0.00      0.00     99.94 +        class capability net_admin; 
-06:50:33        all      0.02      0.00      0.02      0.00      0.00     99.95 +        class file { getattr map open read }; 
-07:00:33        all      0.02      0.00      0.02      0.00      0.00     99.95 +}
-07:10:33        all      0.02      0.00      0.02      0.00      0.00     99.95 +
-07:20:33        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-07:30:33        all      0.02      0.01      0.03      0.00      0.00     99.94 +
-07:40:33        all      0.03      0.00      0.04      0.00      0.00     99.93 +
-07:50:33        all      0.03      0.00      0.03      0.00      0.00     99.94 +
-07:53:56        all      0.08      0.00      0.06      0.00      0.00     99.86 +
-07:54:00        all      0.09      0.00      0.06      0.00      0.00     99.85 +
-Average:        all      0.03      0.00      0.03      0.00      0.00     99.94+
  
-07:55:44     LINUX RESTART      (8 CPU)+#============= httpd_t ============== 
 +allow httpd_t default_t:file { getattr open read };
  
-07:56:00        CPU     %user     %nice   %system   %iowait    %steal     %idle +#!!!! This avc can be allowed using the boolean 'domain_can_mmap_files' 
-07:58:00        all      0.03      0.00      0.03      0.00      0.00     99.94 +allow httpd_t default_t:file map;
-08:00:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:02:00        all      0.02      0.00      0.03      0.00      0.00     99.94 +
-08:04:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-08:06:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-08:08:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:10:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-08:12:00        all      0.03      0.00      0.03      0.00      0.00     99.95 +
-08:14:00        all      0.02      0.00      0.03      0.01      0.00     99.94 +
-08:16:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-08:18:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-08:20:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:22:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-08:24:00        all      0.02      0.00      0.02      0.00      0.00     99.95 +
-08:26:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-08:28:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:30:00        all      0.02      0.05      0.05      0.00      0.00     99.87 +
-08:32:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:34:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:36:00        all      0.03      0.00      0.04      0.00      0.00     99.94 +
-08:38:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:40:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:42:00        all      0.02      0.00      0.03      0.00      0.00     99.94 +
-08:44:00        all      0.03      0.00      0.03      0.00      0.00     99.94 +
-08:46:00        all      0.02      0.00      0.03      0.00      0.00     99.94 +
-08:48:00        all      0.03      0.00      0.03      0.00      0.00     99.95 +
-08:50:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:52:00        all      0.02      0.00      0.06      0.00      0.00     99.92 +
-08:54:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-08:56:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:58:00        all      0.02      0.00      0.02      0.00      0.00     99.96 +
-09:00:00        all      0.07      0.00      0.05      0.00      0.00     99.88 +
-09:02:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-09:04:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-09:06:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-09:08:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-09:10:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-09:12:00        all      0.02      0.00      0.03      0.00      0.00     99.94+
  
-09:12:00        CPU     %user     %nice   %system   %iowait    %steal     %idle +#!!!! This avc has a dontaudit rule in the current policy 
-09:14:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +allow httpd_t self:capability net_admin;
-09:16:00        all      0.02      0.00      0.06      0.00      0.00     99.92 +
-09:18:00        all      0.03      0.00      0.03      0.00      0.00     99.95 +
-09:20:00        all      0.02      0.00      0.03      0.00      0.00     99.94 +
-Average       all      0.02      0.00      0.03      0.00      0.00     99.94+
 </code> </code>
  
-===Statistiques d'Utilisation du CPU=== +L'audit du fichier terminé, il faut maintenant utiliser audit2allow pour fabriquer un module de politique :
- +
-Visualisez maintenant les statistiques d'utilisation du CPU+
  
 <code> <code>
-[root@centos8 ~]# sar -u 5 3 +[root@redhat9 ~]# grep httpd_t /var/log/audit/audit.log | audit2allow -M httpdlocal 
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_        (8 CPU)+******************** IMPORTANT *********************** 
 +To make this policy package active, execute:
  
-09:22:52        CPU     %user     %nice   %system   %iowait    %steal     %idle +semodule -i httpdlocal.pp
-09:22:57        all      0.03      0.00      0.03      0.00      0.00     99.95 +
-09:23:02        all      0.03      0.00      0.03      0.00      0.00     99.95 +
-09:23:07        all      0.00      0.00      0.03      0.00      0.00     99.97 +
-Average:        all      0.02      0.00      0.03      0.00      0.00     99.96+
 </code> </code>
  
-D'avantage de statistiques peuvent être obtenues en utilisant l'option **ALL** :+Chargez maintenant le module dans la politique %%SELinux%% :
  
 <code> <code>
-[root@centos8 ~]# sar -u ALL 5 3 +[root@redhat9 ~]# semodule -i httpdlocal.pp
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_(8 CPU) +
- +
-01:49:14        CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle +
-01:49:19        all      0.03      0.00      0.00      0.00      0.00      0.03      0.00      0.00      0.00     99.95 +
-01:49:24        all      0.03      0.00      0.03      0.00      0.00      0.10      0.05      0.00      0.00     99.80 +
-01:49:29        all      0.00      0.00      0.00      0.25      0.00      0.10      0.05      0.00      0.00     99.60 +
-Average:        all      0.02      0.00      0.01      0.08      0.00      0.08      0.03      0.00      0.00     99.78+
 </code> </code>
  
-Pour consulter les statistiques d'un coeur spécifique, utilisez l'option **-P** :+Vérifiez que le module est chargé :
  
 <code> <code>
-[root@centos8 ~]# sar -u -P 1 5 3 +[root@redhat9 ~]# semodule -l | grep httpd 
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_        (8 CPU) +httpdlocal
- +
-01:51:52        CPU     %user     %nice   %system   %iowait    %steal     %idle +
-01:51:57          1      0.00      0.00      0.00      0.00      0.00    100.00 +
-01:52:02          1      0.20      0.00      0.00      0.00      0.00     99.80 +
-01:52:07          1      0.00      0.00      0.00      0.00      0.00    100.00 +
-Average:          1      0.07      0.00      0.00      0.00      0.00     99.93 +
-[root@centos8 ~]# sar -u -P 5 5 3 +
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_        (8 CPU) +
- +
-01:52:16        CPU     %user     %nice   %system   %iowait    %steal     %idle +
-01:52:21          5      0.00      0.00      0.00      0.00      0.00    100.00 +
-01:52:26          5      0.00      0.00      0.00      0.00      0.00    100.00 +
-01:52:31          5      0.00      0.00      0.00      0.00      0.00    100.00 +
-Average:          5      0.00      0.00      0.00      0.00      0.00    100.00+
 </code> </code>
  
-===Statistiques d'Utilisation de la Mémoire et du Swap=== +Consultez le site localhost en utilisant **lynx** : 
- +
-Utilisez l'option **-r** pour visualiser les statistiques concernant la mémoire :+
  
 <code> <code>
-[root@centos8 ~]# sar -r 5 3 +[root@redhat9 ~]# lynx --dump localhost 
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        30/06/21        _x86_64_(8 CPU) +   www test page
- +
-07:33:32    kbmemfree   kbavail kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty +
-07:33:37      1647240   2297232   2177792     56.94      3356    827396   5096432     70.94    359072   1486368         0 +
-07:33:42      1647232   2297224   2177800     56.94      3356    827396   5095788     70.93    359072   1486300         0 +
-07:33:47      1647232   2297224   2177800     56.94      3356    827396   5095788     70.93    359072   1486376         0 +
-Average:      1647235   2297227   2177797     56.94      3356    827396   5096003     70.94    359072   1486348         0+
 </code> </code>
  
-Utilisez l'option **-S** pour visualiser les statistiques concernant le Swap :+Les options **audit2allow** sont :
  
 <code> <code>
-[root@centos8 ~]# sar -S 5 3 +[root@redhat9 ~]# audit2allow --help 
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        30/06/21        _x86_64_(8 CPU)+Usage: audit2allow [options]
  
-07:31:58    kbswpfree kbswpused  %swpused  kbswpcad   %swpcad +Options: 
-07:32:03      3358716              0.00              0.00 +  --version             show program's version number and exit 
-07:32:08      3358716              0.00              0.00 +  -h, --help            show this help message and exit 
-07:32:13      3358716              0.00         0      0.00 +  -b, --boot            audit messages since last boot conflicts with -i 
-Average:      3358716         0      0.00              0.00+  -a, --all             read input from audit log - conflicts with -i 
 +  -p POLICY, --policy=POLICY 
 +                        Policy file to use for analysis 
 +  -d, --dmesg           read input from dmesg - conflicts with --all and 
 +                        --input 
 +  -i INPUT, --input=INPUT 
 +                        read input from <input> - conflicts with -a 
 +  -l, --lastreload      read input only after the last reload 
 +  -r, --requires        generate require statements for rules 
 +  -m MODULE, --module=MODULE 
 +                        set the module name - implies --requires 
 +  -M MODULE_PACKAGE, --module-package=MODULE_PACKAGE 
 +                        generate a module package - conflicts with -o and -m 
 +  -o OUTPUT, --output=OUTPUT 
 +                        append output to <filename>, conflicts with -M 
 +  -D, --dontaudit       generate policy with dontaudit rules 
 +  -R, --reference       generate refpolicy style output 
 +  -N, --noreference     do not generate refpolicy style output 
 +  -v, --verbose         explain generated output 
 +  -e, --explain         fully explain generated output 
 +  -t TYPE, --type=TYPE  only process messages with a type that matches this 
 +                        regex 
 +  --perm-map=PERM_MAP   file name of perm map 
 +  --interface-info=INTERFACE_INFO 
 +                        file name of interface information 
 +  -x, --xperms          generate extended permission rules 
 +  -w, --why             Translates SELinux audit messages into a description 
 +                        of why the access was denied
 </code> </code>
  
-===Statistiques des E/S===+=====LAB #4 - Le Pare-feu Netfilter/iptables======
  
-Utilisez l'option **-b** pour visualiser les statistiques concernant les E/S  :+**Netfilter** est composé de 5 //hooks// :
  
-<code> +  * NF_IP_PRE_ROUTING 
-[root@centos8 ~]# sar -b 5 3 +  * NF_IP_LOCAL_IN 
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_        (8 CPU)+  * NF_IP_LOCAL_OUT 
 +  * NF_IP_FORWARD 
 +  * NF_IP_POSTROUTING
  
-09:24:49          tps      rtps      wtps   bread/  bwrtn/+Ces hooks sont utilisés par deux branches, la première est celle concernée par les paquets qui entrent vers des services locaux :
-09:24:54         0.00      0.00      0.00      0.00      0.00 +
-09:24:59         1.20      0.00      1.20      0.00     20.20 +
-09:25:04         0.00      0.00      0.00      0.00      0.00 +
-Average:         0.40      0.00      0.40      0.00      6.73 +
-</code>+
  
-===Statistiques des E/S par Disque===+  * NF_IP_PRE_ROUTING > NF_IP_LOCAL_IN > NF_IP_LOCAL_OUT > NF_IP_POSTROUTING
  
-Utilisez l'option **-d** pour visualiser les statistiques concernant les E/S par disque :+tandis que la deuxième concerne les paquets qui traversent la passerelle:
  
-<code> +  * NF_IP_PRE_ROUTING NF_IP_FORWARD > NF_IP_POSTROUTING
-[root@centos8 ~]# sar -d 5 3 +
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_        (8 CPU)+
  
-09:25:45          DEV       tps     rkB/    wkB/  areq-sz    aqu-sz     await     svctm     %util +Si IPTABLES a été compilé en tant que module, son utilisation nécessite le chargement de plusieurs modules supplémentaires en fonction de la situation:
-09:25:50       dev8-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-09:25:50      dev8-16      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-09:25:50      dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-09:25:50     dev253-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-09:25:50     dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00+
  
-09:25:50          DEV       tps     rkB/    wkB/  areq-sz    aqu-sz     await     svctm     %util +  * iptable_filter 
-09:25:55       dev8-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +  * iptable_mangle 
-09:25:55      dev8-16      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +  * iptable_net 
-09:25:55      dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +  * etc
-09:25:55     dev253-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-09:25:55     dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00+
  
-09:25:55          DEV       tps     rkB/    wkB/  areq-sz    aqu-sz     await     svctm     %util +Netfilter est organisé en **tables**La commande **iptables** de netfilter permet d'insérer des **policies** dans les **chaines**:
-09:26:00       dev8-0      0.60      0.00      0.30      0.50      0.01     13.00     13.00      0.78 +
-09:26:00      dev8-16      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-09:26:00      dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-09:26:00     dev253-0      0.60      0.00      0.50      0.83      0.01     12.67     13.00      0.78 +
-09:26:00     dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00+
  
-Average:          DEV       tps     rkB/    wkB/  areq-sz    aqu-sz     await     svctm     %util +  * La table **FILTER** 
-Average:       dev8-0      0.20      0.00      0.10      0.50      0.00     13.00     13.00      0.26 +    * La chaîne INPUT 
-Average:      dev8-16      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +      * Concerne les paquets entrants 
-Average:      dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +        * PoliciesACCEPT, DROP, REJECT 
-Average    dev253-0      0.20      0.00      0.17      0.83      0.00     12.67     13.00      0.26 +    * La chaîne OUTPUT 
-Average:     dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +      * Concerne les paquets sortants 
-</code>+        * PoliciesACCEPT, DROP, REJECT 
 +    * La chaîne FORWARD 
 +      * Concerne les paquets traversant le par-feu
 +        * PoliciesACCEPT, DROP, REJECT
  
-La colonne **DEV** indentifie les disques par leurs majeurs et mineurs. Pour voir les informations avec les noms des disquesajoutez l'option **-p** :+Si aucune table n'est préciséec'est la table FILTER qui s'applique par défaut.
  
-<code> +  * La table **NAT** 
-[root@centos8 ~]# sar -p -5 3 +    * La chaîne PREROUTING 
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        30/06/21        _x86_64_        (8 CPU)+      * Permet de faire la translation d'adresse de destination 
 +        * Cibles: SNAT, DNAT, MASQUERADE 
 +    * La chaîne POSTROUTING 
 +      * Permet de faire la translation d'adresse de la source 
 +        * Cibles: SNAT, DNAT, MASQUERADE 
 +    * Le cas spécifique OUTPUT 
 +      * Permet la modification de la destination des paquets générés localement
  
-07:48:32          DEV       tps     rkB/    wkB/  areq-sz    aqu-sz     await     svctm     %util +  * La table **MANGLE** 
-07:48:37          sda      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +    * Permet le marquage de paquets générés localement (OUTPUT) et entrants (PREROUTING)
-07:48:37          sdb      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-07:48:37          sr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-07:48:37    cl_centos8-root      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-07:48:37    cl_centos8-swap      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00+
  
-07:48:37          DEV       tps     rkB/    wkB/  areq-sz    aqu-sz     await     svctm     %util +Les **policies** sont:
-07:48:42          sda      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-07:48:42          sdb      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-07:48:42          sr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-07:48:42    cl_centos8-root      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-07:48:42    cl_centos8-swap      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00+
  
-07:48:42          DEV       tps     rkB/    wkB/  areq-sz    aqu-sz     await     svctm     %util +  * ACCEPT 
-07:48:47          sda      0.40      0.00      0.40      1.00      0.02     56.00     56.50      2.26 +    * Permet d'accepter le paquet concerné 
-07:48:47          sdb      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +  * DROP 
-07:48:47          sr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +    * Permet de rejeter le paquet concerné sans générer un message d'erreur 
-07:48:47    cl_centos8-root      0.40      0.00      0.80      2.00      0.02     56.00     56.50      2.26 +  * REJECT 
-07:48:47    cl_centos8-swap      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00+    * Permet de rejeter le paquet concerné en générant une message d'erreur
  
-Average         DEV       tps     rkB/    wkB/  areq-sz    aqu-sz     await     svctm     %util +Les **cibles** sont:
-Average:          sda      0.13      0.00      0.13      1.00      0.01     56.00     56.50      0.75 +
-Average:          sdb      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-Average:          sr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-Average:    cl_centos8-root      0.13      0.00      0.27      2.00      0.01     56.00     56.50      0.75 +
-Average:    cl_centos8-swap      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-</code>+
  
-Les options de la commande sar sont :+  * SNAT 
 +    * Permet de modifier l'adresse source du paquet concerné 
 +  * DNAT 
 +    * Permet de modifier l'adresse de destination du paquet concerné 
 +  * MASQUERADE 
 +    * Permet de remplacer l'adresse IP privée de l'expéditeur par un socket public de la passerelle.
  
-<code> +IPTABLES peut être configuré soit par des outils tels shorewallsoit en utilisant des lignes de commandes ou un scriptDans ce dernier casla ligne prend la forme:
-[root@centos8 ~]# sar --help +
-Usage: sar [ options ] [ <interval> [ <count> ] ] +
-Main options and reports (report name between square brackets): +
-        -B      Paging statistics [A_PAGE] +
-        -b      I/O and transfer rate statistics [A_IO] +
-        -d      Block devices statistics [A_DISK] +
-        -F [ MOUNT ] +
-                Filesystems statistics [A_FS] +
-        -H      Hugepages utilization statistics [A_HUGE] +
-        -I { <int_list> | SUM | ALL } +
-                Interrupts statistics [A_IRQ] +
-        -m { <keyword> [,...] | ALL } +
-                Power management statistics [A_PWR_...] +
-                Keywords are: +
-                CPU     CPU instantaneous clock frequency +
-                FAN     Fans speed +
-                FREQ    CPU average clock frequency +
-                IN      Voltage inputs +
-                TEMP    Devices temperature +
-                USB     USB devices plugged into the system +
-        -n { <keyword> [,...] | ALL } +
-                Network statistics [A_NET_...] +
-                Keywords are: +
-                DEV     Network interfaces +
-                EDEV    Network interfaces (errors) +
-                NFS     NFS client +
-                NFSD    NFS server +
-                SOCK    Sockets (v4) +
-                IP      IP traffic      (v4) +
-                EIP     IP traffic      (v4) (errors) +
-                ICMP    ICMP traffic    (v4) +
-                EICMP   ICMP traffic    (v4) (errors) +
-                TCP     TCP traffic     (v4) +
-                ETCP    TCP traffic     (v4) (errors) +
-                UDP     UDP traffic     (v4) +
-                SOCK6   Sockets (v6) +
-                IP6     IP traffic      (v6) +
-                EIP6    IP traffic      (v6) (errors) +
-                ICMP6   ICMP traffic    (v6) +
-                EICMP6  ICMP traffic    (v6) (errors) +
-                UDP6    UDP traffic     (v6) +
-                FC      Fibre channel HBAs +
-                SOFT    Software-based network processing +
-        -q      Queue length and load average statistics [A_QUEUE] +
-        -r [ ALL ] +
-                Memory utilization statistics [A_MEMORY] +
-        -S      Swap space utilization statistics [A_MEMORY] +
-        -u [ ALL ] +
-                CPU utilization statistics [A_CPU] +
-        -v      Kernel tables statistics [A_KTABLES] +
-        -W      Swapping statistics [A_SWAP] +
-        -w      Task creation and system switching statistics [A_PCSW] +
-        -y      TTY devices statistics [A_SERIAL] +
-</code>+
  
-=====Modules usb=====+  # IPTABLES --action CHAINE --option1 --option2
  
-L'**USB** (//Universal Serial Bus//) est un bus de données qui peut offrir des taux de transfert jusqu'à 480Mb/s sous la version 2.0 et jusqu'à 4.8 Gb/s sous la version 3.0. Les modules nécessaires pour les contrôleurs USB sont :+Les actions sont:
  
-Version USB Module Nom Complet + Action   Abréviation   Déscription  
-|  1.0\1.1  **UHCI** | //Universal Controller Host Interface// +| - -append |  -A  Ajouter une règle à la fin de la chaîne spécifiée |  
-|  :::  **OHCI** | //Open Controller Host Interface// +| - -delete |  -D  Supprimer une règle en spécifiant son numéro ou la règle à supprimer |  
-|  2.0  **EHCI** //Enhanced Host Controller Interface// +| - -replace |  -R  Permet de remplacer la règle spécifée par son numéro  
-|  3.0  **XHCI** //Extensible Host Controller Interface// |+| - -insert |  -I  | Permet d'insérer une règle à l'endroit spécifié |  
 +| - -list |  -L  Permet d'afficher des règles | 
 +- -flush |  -F  | Permet de vider toutes les règles d'une chaîne |  
  
-Le tableau suivant liste les modules courrament chargés en fonction du périphérique utilisé :+Les options sont:
  
-Module Type de Périphérique ^  + Option   Abréviation  ^  Déscription  
-|  **usb_storage**  Supports de masse +| - -protocol |  -p  Permet de spécifier un protocol - tcp, udp, icmp, all |  
-|  **usbhid**  Periphériques HID (//Human Interface Device//+| - -source |  -s  Permet de spécifier une adresse source |  
- **snd-usb-audio**  Cartes son usb +| - -destination |  -d  Permet de spécifier une adresse de destination |  
-|  **usbvidéo**  Cartes vidéo et d'acquisition +| - -in-interface |  -i  Permet de spécifier une interface réseau d'entrée |  
-|  **irda-usb**  Périphériques infrarouges +| - -out-interface |  - Permet de spécifier une interface réseau de sortie 
-|  **usbnet**  Cartes réseaux usb |+| - -fragment |  -f  Permet de ne spécifier que les paquets fragmentés |   
 +| - -source-port |  -sport  | Permet de spécifier un port source ou une plage de ports source |  
 +| - -destination-port |  -dport  | Permet de spécifier un port de destination ou une plage de ports de destination |  
 +| - -tcp-flags |  s/o  | Permet de spécifier un flag TCP à matcher - SYN, ACK, FIN, RST, URG, PSH, ALL, NONE |  
 +| - -icmp-type |  s/o  | Permet de spécifier un type de paquet ICMP | 
 +| - -mac-source |  s/o  | Permet de spécifier une adresse MAC 
  
-Les modules peuvent être chargés par un des moyens suivants :+Les options spécifiques à NET sont:
  
-  * INITrd, +| - -to-destination |  s/o  | Permet de spécifier l'adresse de destination d'une translation |  
-  * Le processus init (systemd), +| - -to-source |  s/o  | Permet spécifier l'adresse source d'une translation | 
-  * kmod, d'une manière dynamique et transparente lors du branchement du périphérique, +
-  * udev, +
-  * manuellement.+
  
-=====udev=====+Les options spécifiques aux LOGS sont:
  
-Depuis le noyau Linux 2.6 Linux est capable de détecter des périphériques branchés à chaud. Cette technologie s'appelle le **//hotplugging//**. Le //hotplugging/est obtenu grâce à l'utilisation de trois composants :+| - -log-level |  s/o  | Permet de spécifier le niveau de logs |  
 +| - -log-prefix |  s/o  | Permet de spécifier un préfix pour les logs |
  
-  * Udev, +L'option spécifique au STATEFUL est:
-  * HAL, +
-  * Dbus.+
  
-Les rôles de chaque composant sont les suivants :+| - -state |  s/o  | Permet de spécifier l'état du paquet à vérifier | 
  
-  * Udev se charge de créer et supprimer d'une manière dynamique les nœuds dans le répertoire **/dev**, +Ce dernier cas fait référence au STATEFUL. Le STATEFUL est la capacité du par-feu à enregistrer dans une table spécifique, l'état des différentes connexions. Cette table s'appelle une **table d'état**. Le principe du fonctionnement de STATEFUL est simple, à savoirsi le paquet entrant appartient à une communication déjà établie, celui-ci n'est pas vérifié.
-  * HAL obtient des informations à partir d'Udev et créé un fichier au format XML représentant le périphérique branché. Il informe ensuite Nautilus en utilisant le Dbus, +
-  * Dbus joue le rôle d'un bus système qui est utilisé pour la communication inter-processus.+
  
-Lors de démarrage de Linux, Udev joue un rôle important :+Il existe 4 états:
  
-  * Au démarrage **tmpfs** est monté sur /dev, +  * NEW 
-  * Udev copie les éventuels nœuds statiques de **/lib/udev/devices** vers /dev, +    Le paquet concerne une nouvelle connexion et contient donc un flag SYN à 1 
-  le démon **udevd** collecte des données appelées **uevents** du noyau et cherche une règle correspondante dans le répertoire **/lib/udev/rules.d/**, +  * ESTABLISHED 
-  * Udev crée les nœuds et liens symboliques spécifiés dans la règle identifiée, +    Le paquet concerne une connexion déjà établie. Le paquet ne doit contenir **ni** flag SYN à 1, **ni** flag FIN à 1 
-  Udev stocke les règles contenues dans **/lib/udev/rules.d/*.rules** en mémoire, +  RELATED 
-  * En cas de modification des ces règles, Udev met à jour la mémoire.+    Le paquet est d'une connexion qui présente une relation avec une autre connexion 
 +  * INVALID 
 +    La paquet provient d'une connexion anormale.
  
-Udev repose sur le filesystem **sysfs** monté sur /sys qui permet de rendre les périphériques visibles à Udev dans l'//User Space//Par exemple, lors du branchement d'une clé USB, Udev crée **/dev/sdb1** automatiquement et utilise les informations contenues dans le fichier **/lib/modules/`uname -r`/modules.alias** pour trouver le pilote nécessaire :+====4.La Configuration par firewalld ====
  
-Le fichier de configuration principal d'Udev est **/etc/udev/udev.conf** :+Firewalld utilise des **zones** - des jeux de règles pré-définis dans lesquels sont placés les interfaces :
  
-<code> +  * **trusted** - un réseau fiableDans ce cas tous les ports sont autorisés, 
-[root@centos8 ~]# cat /etc/udev/udev.conf +  * **work**, **home**, **internal** - un réseau partiellement fiableDans ce cas quelques ports sont autorisés, 
-# see udev.conf(5) for details +  * **dmz**, **public**, **external** - un réseau non fiable. Dans ce cas peu de ports sont autorisés, 
-+  * **block****drop** - tout est interdit. La zone drop n'envoie pas de messages d'erreurs.
-# udevd is also started in the initrd.  When this file is modified you might +
-# also want to rebuild the initrdso that it will include the modified configuration.+
  
-#udev_log="info" +<WRAP center round important 50%> 
-</code>+**Important** - Une interface ne peut être que dans une zone à la fois tandis que plusieurs interfaces peuvent être dans la même zone. 
 +</WRAP>
  
-Les fichiers de règles se trouvent dans **/lib/udev/rules.d/** :+Le service firewalld doit toujours être lancé :
  
 <code> <code>
-[root@centos8 ~]# ls /lib/udev/rules.d/ +[root@redhat9 ~]# systemctl status firewalld.service 
-01-md-raid-creating.rules              70-uaccess.rules +● firewalld.service firewalld dynamic firewall daemon 
-10-dm.rules                            70-wacom.rules +     Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; preset: enabled) 
-11-dm-lvm.rules                        71-biosdevname.rules +     Active: active (running) since Tue 2024-10-22 11:02:04 CEST; 32min ago 
-11-dm-mpath.rules                      71-nvmf-iopolicy-netapp.rules +       Docs: man:firewalld(1) 
-11-dm-parts.rules                      71-prefixdevname.rules +   Main PID: 795 (firewalld) 
-13-dm-disk.rules                       71-seat.rules +      Tasks: (limit: 48800) 
-39-usbmuxd.rules                       73-idrac.rules +     Memory: 44.6M 
-40-elevator.rules                      73-seat-late.rules +        CPU: 510ms 
-40-libgphoto2.rules                    75-net-description.rules +     CGroup: /system.slice/firewalld.service 
-40-redhat.rules                        75-probe_mtd.rules +             └─795 /usr/bin/python3 -s /usr/sbin/firewalld --nofork --nopid 
-40-usb-blacklist.rules                 75-rdma-description.rules + 
-40-usb_modeswitch.rules                77-mm-cinterion-port-types.rules +Oct 22 11:02:01 redhat9.ittraining.loc systemd[1]: Starting firewalld dynamic firewall daemon... 
-50-udev-default.rules                  77-mm-dell-port-types.rules +Oct 22 11:02:04 redhat9.ittraining.loc systemd[1]: Started firewalld dynamic firewall daemon.
-60-alias-kmsg.rules                    77-mm-ericsson-mbm.rules +
-60-block.rules                         77-mm-fibocom-port-types.rules +
-60-cdrom_id.rules                      77-mm-haier-port-types.rules +
-60-drm.rules                           77-mm-huawei-net-port-types.rules +
-60-evdev.rules                         77-mm-longcheer-port-types.rules +
-60-fido-id.rules                       77-mm-mtk-port-types.rules +
-60-input-id.rules                      77-mm-nokia-port-types.rules +
-60-libfprint-2-autosuspend.rules       77-mm-pcmcia-device-blacklist.rules +
-60-net.rules                           77-mm-quectel-port-types.rules +
-60-persistent-alsa.rules               77-mm-sierra.rules +
-60-persistent-input.rules              77-mm-simtech-port-types.rules +
-60-persistent-storage.rules            77-mm-telit-port-types.rules +
-60-persistent-storage-tape.rules       77-mm-ublox-port-types.rules +
-60-persistent-v4l.rules                77-mm-usb-device-blacklist.rules +
-60-raw.rules                           77-mm-usb-serial-adapters-greylist.rules +
-60-rdma-ndd.rules                      77-mm-x22x-port-types.rules +
-60-rdma-persistent-naming.rules        77-mm-zte-port-types.rules +
-60-sensor.rules                        78-sound-card.rules +
-60-serial.rules                        80-drivers.rules +
-60-tpm-udev.rules                      80-iio-sensor-proxy.rules +
-61-gdm.rules                           80-libinput-device-groups.rules +
-61-gnome-bluetooth-rfkill.rules        80-mm-candidate.rules +
-61-gnome-settings-daemon-rfkill.rules  80-net-setup-link.rules +
-61-scsi-sg3_id.rules                   80-udisks2.rules +
-62-multipath.rules                     81-kvm-rhel.rules +
-63-fc-wwpn-id.rules                    84-nm-drivers.rules +
-63-md-raid-arrays.rules                85-nm-unmanaged.rules +
-63-scsi-sg3_symlink.rules              85-regulatory.rules +
-64-btrfs.rules                         90-alsa-restore.rules +
-64-md-raid-assembly.rules              90-bolt.rules +
-65-libwacom.rules                      90-fwupd-devices.rules +
-65-md-incremental.rules                90-iprutils.rules +
-65-sane-backends.rules                 90-libinput-fuzz-override.rules +
-66-kpartx.rules                        90-nm-thunderbolt.rules +
-68-del-part-nodes.rules                90-pulseaudio.rules +
-69-btattach-bcm.rules                  90-rdma-hw-modules.rules +
-69-cd-sensors.rules                    90-rdma-ulp-modules.rules +
-69-dm-lvm-metad.rules                  90-rdma-umad.rules +
-69-libmtp.rules                        90-vconsole.rules +
-69-md-clustered-confirm-device.rules   91-drm-modeset.rules +
-70-hypervfcopy.rules                   95-cd-devices.rules +
-70-hypervkvp.rules                     95-dm-notify.rules +
-70-hypervvss.rules                     95-upower-csr.rules +
-70-joystick.rules                      95-upower-hid.rules +
-70-mouse.rules                         95-upower-wup.rules +
-70-nvmf-autoconnect.rules              98-kexec.rules +
-70-power-switch.rules                  99-qemu-guest-agent.rules +
-70-printers.rules                      99-systemd.rules +
-70-spice-vdagentd.rules                99-vmware-scsi-udev.rules +
-70-touchpad.rules+
 </code> </code>
  
-<WRAP center round important 60%> +====4.La Configuration de Base de firewalld====
-**Important** : Il vous est possible d'ajouter des règles si besoin estDans ce cas, créez un fichier **99-local.rules** est éditez-le au lieu d'éditer les fichiers existants. +
-</WRAP>+
  
-Comme indique le nom de chaque fichier, le contenu est composé de règles à l'attention d'udev. Le fichier des règles par défaut est le **50-udev-default.rules** :+La configuration par défaut de firewalld se trouve dans **/usr/lib/firewalld** :
  
 <code> <code>
-[root@centos8 ~]# cat /lib/udev/rules.d/50-udev-default.rules | more +[root@redhat9 ~]# ls -l /usr/lib/firewalld/ 
-# do not edit this file, it will be overwritten on update+total 20 
 +drwxr-xr-x2 root root 4096 Sep 25 12:05 helpers 
 +drwxr-xr-x2 root root 4096 Sep 25 12:05 icmptypes 
 +drwxr-xr-x. 2 root root   23 Sep 25 12:05 ipsets 
 +drwxr-xr-x. 2 root root   33 Sep 25 12:05 policies 
 +drwxr-xr-x. 2 root root 8192 Sep 25 12:06 services 
 +drwxr-xr-x. 2 root root  184 Sep 25 12:05 zones
  
-run a command on remove events +[root@redhat9 ~]ls -l /usr/lib/firewalld/zones/ 
-ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" +total 40 
-ACTION=="remove", GOTO="default_end"+-rw-r--r--. 1 root root 312 Nov  6  2023 block.xml 
 +-rw-r--r--. 1 root root 306 Nov  6  2023 dmz.xml 
 +-rw-r--r--. 1 root root 304 Nov  6  2023 drop.xml 
 +-rw-r--r--. 1 root root 317 Nov  6  2023 external.xml 
 +-rw-r--r--. 1 root root 410 Nov  6  2023 home.xml 
 +-rw-r--r--. 1 root root 425 Nov  6  2023 internal.xml 
 +-rw-r--r--. 1 root root 729 Feb 22  2024 nm-shared.xml 
 +-rw-r--r--. 1 root root 356 Nov  6  2023 public.xml 
 +-rw-r--r--. 1 root root 175 Nov  6  2023 trusted.xml 
 +-rw-r--r--. 1 root root 352 Nov  6  2023 work.xml
  
-SUBSYSTEM=="virtio-ports", KERNEL=="vport*", ATTR{name}=="?*", SYMLINK+="virtio-ports/$attr{name}"+[root@redhat9 ~]# ls -/usr/lib/firewalld/services/ 
 +total 884 
 +-rw-r--r--. 1 root root 352 Nov  6  2023 afp.xml 
 +-rw-r--r--. 1 root root 399 Nov  6  2023 amanda-client.xml 
 +-rw-r--r--. 1 root root 427 Nov  6  2023 amanda-k5-client.xml 
 +-rw-r--r--. 1 root root 283 Nov  6  2023 amqps.xml 
 +-rw-r--r--. 1 root root 273 Nov  6  2023 amqp.xml 
 +-rw-r--r--. 1 root root 285 Nov  6  2023 apcupsd.xml 
 +-rw-r--r--. 1 root root 301 Nov  6  2023 audit.xml 
 +-rw-r--r--. 1 root root 436 Nov  6  2023 ausweisapp2.xml 
 +-rw-r--r--. 1 root root 320 Nov  6  2023 bacula-client.xml 
 +-rw-r--r--. 1 root root 346 Nov  6  2023 bacula.xml 
 +-rw-r--r--. 1 root root 390 Nov  6  2023 bareos-director.xml 
 +-rw-r--r--. 1 root root 255 Nov  6  2023 bareos-filedaemon.xml 
 +-rw-r--r--. 1 root root 316 Nov  6  2023 bareos-storage.xml 
 +-rw-r--r--. 1 root root 429 Nov  6  2023 bb.xml 
 +-rw-r--r--. 1 root root 339 Nov  6  2023 bgp.xml 
 +-rw-r--r--. 1 root root 275 Nov  6  2023 bitcoin-rpc.xml 
 +-rw-r--r--. 1 root root 307 Nov  6  2023 bitcoin-testnet-rpc.xml 
 +-rw-r--r--. 1 root root 281 Nov  6  2023 bitcoin-testnet.xml 
 +-rw-r--r--. 1 root root 244 Nov  6  2023 bitcoin.xml 
 +-rw-r--r--. 1 root root 410 Nov  6  2023 bittorrent-lsd.xml 
 +-rw-r--r--. 1 root root 222 Nov  6  2023 ceph-exporter.xml 
 +-rw-r--r--. 1 root root 294 Nov  6  2023 ceph-mon.xml 
 +-rw-r--r--. 1 root root 329 Nov  6  2023 ceph.xml 
 +-rw-r--r--. 1 root root 168 Nov  6  2023 cfengine.xml 
 +-rw-r--r--. 1 root root 234 Nov  6  2023 checkmk-agent.xml 
 +-rw-r--r--. 1 root root 211 Nov  6  2023 cockpit.xml 
 +-rw-r--r--. 1 root root 296 Nov  6  2023 collectd.xml 
 +-rw-r--r--. 1 root root 260 Nov  6  2023 condor-collector.xml 
 +-rw-r--r--. 1 root root 343 Nov  6  2023 cratedb.xml 
 +-rw-r--r--. 1 root root 296 Nov  6  2023 ctdb.xml 
 +-rw-r--r--. 1 root root 981 Nov  6  2023 dds-multicast.xml 
 +-rw-r--r--. 1 root root 947 Nov  6  2023 dds-unicast.xml 
 +-rw-r--r--. 1 root root 574 Nov  6  2023 dds.xml 
 +-rw-r--r--. 1 root root 305 Nov  6  2023 dhcpv6-client.xml 
 +-rw-r--r--. 1 root root 234 Nov  6  2023 dhcpv6.xml 
 +-rw-r--r--. 1 root root 227 Nov  6  2023 dhcp.xml 
 +-rw-r--r--. 1 root root 205 Nov  6  2023 distcc.xml 
 +-rw-r--r--. 1 root root 318 Nov  6  2023 dns-over-tls.xml 
 +-rw-r--r--. 1 root root 346 Nov  6  2023 dns.xml 
 +-rw-r--r--. 1 root root 374 Nov  6  2023 docker-registry.xml 
 +-rw-r--r--. 1 root root 391 Nov  6  2023 docker-swarm.xml 
 +-rw-r--r--. 1 root root 228 Nov  6  2023 dropbox-lansync.xml 
 +-rw-r--r--. 1 root root 338 Nov  6  2023 elasticsearch.xml 
 +-rw-r--r--. 1 root root 304 Nov  6  2023 etcd-client.xml 
 +-rw-r--r--. 1 root root 304 Nov  6  2023 etcd-server.xml 
 +-rw-r--r--. 1 root root 224 Nov  6  2023 finger.xml 
 +-rw-r--r--. 1 root root 270 Nov  6  2023 foreman-proxy.xml 
 +-rw-r--r--. 1 root root 408 Nov  6  2023 foreman.xml 
 +-rw-r--r--. 1 root root 709 Nov  6  2023 freeipa-4.xml 
 +-rw-r--r--. 1 root root 489 Nov  6  2023 freeipa-ldaps.xml 
 +-rw-r--r--. 1 root root 488 Nov  6  2023 freeipa-ldap.xml 
 +-rw-r--r--. 1 root root 242 Nov  6  2023 freeipa-replication.xml 
 +-rw-r--r--. 1 root root 657 Nov  6  2023 freeipa-trust.xml 
 +-rw-r--r--. 1 root root 361 Nov  6  2023 ftp.xml 
 +-rw-r--r--. 1 root root 292 Nov  6  2023 galera.xml 
 +-rw-r--r--. 1 root root 184 Nov  6  2023 ganglia-client.xml 
 +-rw-r--r--. 1 root root 176 Nov  6  2023 ganglia-master.xml 
 +-rw-r--r--. 1 root root 212 Nov  6  2023 git.xml 
 +-rw-r--r--. 1 root root 406 Nov  6  2023 gpsd.xml 
 +-rw-r--r--. 1 root root 218 Nov  6  2023 grafana.xml 
 +-rw-r--r--. 1 root root 119 Nov  6  2023 gre.xml 
 +-rw-r--r--. 1 root root 608 Nov  6  2023 high-availability.xml 
 +-rw-r--r--. 1 root root 336 Nov  6  2023 http3.xml 
 +-rw-r--r--. 1 root root 448 Nov  6  2023 https.xml 
 +-rw-r--r--. 1 root root 353 Nov  6  2023 http.xml 
 +-rw-r--r--. 1 root root 293 Nov  6  2023 ident.xml 
 +-rw-r--r--. 1 root root 372 Nov  6  2023 imaps.xml 
 +-rw-r--r--. 1 root root 327 Nov  6  2023 imap.xml 
 +-rw-r--r--. 1 root root 315 Nov  6  2023 ipfs.xml 
 +-rw-r--r--. 1 root root 454 Nov  6  2023 ipp-client.xml 
 +-rw-r--r--. 1 root root 427 Nov  6  2023 ipp.xml 
 +-rw-r--r--. 1 root root 895 Nov  6  2023 ipsec.xml 
 +-rw-r--r--. 1 root root 255 Nov  6  2023 ircs.xml 
 +-rw-r--r--. 1 root root 247 Nov  6  2023 irc.xml 
 +-rw-r--r--. 1 root root 264 Nov  6  2023 iscsi-target.xml 
 +-rw-r--r--. 1 root root 358 Nov  6  2023 isns.xml 
 +-rw-r--r--. 1 root root 213 Nov  6  2023 jenkins.xml 
 +-rw-r--r--. 1 root root 182 Nov  6  2023 kadmin.xml 
 +-rw-r--r--. 1 root root 272 Nov  6  2023 kdeconnect.xml 
 +-rw-r--r--. 1 root root 233 Nov  6  2023 kerberos.xml 
 +-rw-r--r--. 1 root root 384 Nov  6  2023 kibana.xml 
 +-rw-r--r--. 1 root root 249 Nov  6  2023 klogin.xml 
 +-rw-r--r--. 1 root root 221 Nov  6  2023 kpasswd.xml 
 +-rw-r--r--. 1 root root 182 Nov  6  2023 kprop.xml 
 +-rw-r--r--. 1 root root 242 Nov  6  2023 kshell.xml 
 +-rw-r--r--. 1 root root 308 Nov  6  2023 kube-apiserver.xml 
 +-rw-r--r--. 1 root root 204 Nov  6  2023 kube-api.xml 
 +-rw-r--r--. 1 root root 289 Nov  6  2023 kube-controller-manager-secure.xml 
 +-rw-r--r--. 1 root root 280 Nov  6  2023 kube-controller-manager.xml 
 +-rw-r--r--. 1 root root 560 Nov  6  2023 kube-control-plane-secure.xml 
 +-rw-r--r--. 1 root root 537 Nov  6  2023 kube-control-plane.xml 
 +-rw-r--r--. 1 root root 244 Nov  6  2023 kubelet-readonly.xml 
 +-rw-r--r--. 1 root root 212 Nov  6  2023 kubelet-worker.xml 
 +-rw-r--r--. 1 root root 239 Nov  6  2023 kubelet.xml 
 +-rw-r--r--. 1 root root 224 Nov  6  2023 kube-nodeport-services.xml 
 +-rw-r--r--. 1 root root 328 Nov  6  2023 kube-scheduler-secure.xml 
 +-rw-r--r--. 1 root root 319 Nov  6  2023 kube-scheduler.xml 
 +-rw-r--r--. 1 root root 374 Nov  6  2023 kube-worker.xml 
 +-rw-r--r--. 1 root root 232 Nov  6  2023 ldaps.xml 
 +-rw-r--r--. 1 root root 199 Nov  6  2023 ldap.xml 
 +-rw-r--r--. 1 root root 385 Nov  6  2023 libvirt-tls.xml 
 +-rw-r--r--. 1 root root 389 Nov  6  2023 libvirt.xml 
 +-rw-r--r--. 1 root root 269 Nov  6  2023 lightning-network.xml 
 +-rw-r--r--. 1 root root 468 Nov  6  2023 llmnr-client.xml 
 +-rw-r--r--. 1 root root 410 Nov  6  2023 llmnr-tcp.xml 
 +-rw-r--r--. 1 root root 463 Nov  6  2023 llmnr-udp.xml 
 +-rw-r--r--. 1 root root 519 Nov  6  2023 llmnr.xml 
 +-rw-r--r--. 1 root root 349 Nov  6  2023 managesieve.xml 
 +-rw-r--r--. 1 root root 432 Nov  6  2023 matrix.xml 
 +-rw-r--r--. 1 root root 424 Nov  6  2023 mdns.xml 
 +-rw-r--r--. 1 root root 245 Nov  6  2023 memcache.xml 
 +-rw-r--r--. 1 root root 334 Nov  6  2023 minidlna.xml 
 +-rw-r--r--. 1 root root 237 Nov  6  2023 mongodb.xml 
 +-rw-r--r--. 1 root root 473 Nov  6  2023 mosh.xml 
 +-rw-r--r--. 1 root root 211 Nov  6  2023 mountd.xml 
 +-rw-r--r--. 1 root root 296 Nov  6  2023 mqtt-tls.xml 
 +-rw-r--r--. 1 root root 287 Nov  6  2023 mqtt.xml 
 +-rw-r--r--. 1 root root 170 Nov  6  2023 mssql.xml 
 +-rw-r--r--. 1 root root 180 Nov  6  2023 ms-wbt.xml 
 +-rw-r--r--. 1 root root 242 Nov  6  2023 murmur.xml 
 +-rw-r--r--. 1 root root 171 Nov  6  2023 mysql.xml 
 +-rw-r--r--. 1 root root 250 Nov  6  2023 nbd.xml 
 +-rw-r--r--. 1 root root 309 Nov  6  2023 nebula.xml 
 +-rw-r--r--. 1 root root 262 Nov  6  2023 netbios-ns.xml 
 +-rw-r--r--. 1 root root 243 Nov  6  2023 netdata-dashboard.xml 
 +-rw-r--r--. 1 root root 342 Nov  6  2023 nfs3.xml 
 +-rw-r--r--. 1 root root 324 Nov  6  2023 nfs.xml 
 +-rw-r--r--. 1 root root 293 Nov  6  2023 nmea-0183.xml 
 +-rw-r--r--. 1 root root 247 Nov  6  2023 nrpe.xml 
 +-rw-r--r--. 1 root root 389 Nov  6  2023 ntp.xml 
 +-rw-r--r--. 1 root root 368 Nov  6  2023 nut.xml 
 +-rw-r--r--. 1 root root 335 Nov  6  2023 openvpn.xml 
 +-rw-r--r--. 1 root root 260 Nov  6  2023 ovirt-imageio.xml 
 +-rw-r--r--. 1 root root 343 Nov  6  2023 ovirt-storageconsole.xml 
 +-rw-r--r--. 1 root root 235 Nov  6  2023 ovirt-vmconsole.xml 
 +-rw-r--r--. 1 root root 869 Nov  6  2023 plex.xml 
 +-rw-r--r--. 1 root root 433 Nov  6  2023 pmcd.xml 
 +-rw-r--r--. 1 root root 474 Nov  6  2023 pmproxy.xml 
 +-rw-r--r--. 1 root root 544 Nov  6  2023 pmwebapis.xml 
 +-rw-r--r--. 1 root root 460 Nov  6  2023 pmwebapi.xml 
 +-rw-r--r--. 1 root root 357 Nov  6  2023 pop3s.xml 
 +-rw-r--r--. 1 root root 348 Nov  6  2023 pop3.xml 
 +-rw-r--r--. 1 root root 181 Nov  6  2023 postgresql.xml 
 +-rw-r--r--. 1 root root 509 Nov  6  2023 privoxy.xml 
 +-rw-r--r--. 1 root root 226 Nov  6  2023 prometheus-node-exporter.xml 
 +-rw-r--r--. 1 root root 213 Nov  6  2023 prometheus.xml 
 +-rw-r--r--. 1 root root 261 Nov  6  2023 proxy-dhcp.xml 
 +-rw-r--r--. 1 root root 262 Nov  6  2023 ps2link.xml 
 +-rw-r--r--. 1 root root 173 Nov  6  2023 ps3netsrv.xml 
 +-rw-r--r--. 1 root root 424 Nov  6  2023 ptp.xml 
 +-rw-r--r--. 1 root root 414 Nov  6  2023 pulseaudio.xml 
 +-rw-r--r--. 1 root root 297 Nov  6  2023 puppetmaster.xml 
 +-rw-r--r--. 1 root root 273 Nov  6  2023 quassel.xml 
 +-rw-r--r--. 1 root root 520 Nov  6  2023 radius.xml 
 +-rw-r--r--. 1 root root 183 Nov  6  2023 rdp.xml 
 +-rw-r--r--. 1 root root 212 Nov  6  2023 redis-sentinel.xml 
 +-rw-r--r--. 1 root root 268 Nov  6  2023 redis.xml 
 +-rw-r--r--. 1 root root 381 Nov  6  2023 RH-Satellite-6-capsule.xml 
 +-rw-r--r--. 1 root root 556 Nov  6  2023 RH-Satellite-6.xml 
 +-rw-r--r--. 1 root root 214 Nov  6  2023 rpc-bind.xml 
 +-rw-r--r--. 1 root root 213 Nov  6  2023 rquotad.xml 
 +-rw-r--r--. 1 root root 310 Nov  6  2023 rsh.xml 
 +-rw-r--r--. 1 root root 311 Nov  6  2023 rsyncd.xml 
 +-rw-r--r--. 1 root root 350 Nov  6  2023 rtsp.xml 
 +-rw-r--r--. 1 root root 329 Nov  6  2023 salt-master.xml 
 +-rw-r--r--. 1 root root 339 Nov  6  2023 samba-client.xml 
 +-rw-r--r--. 1 root root 782 Nov  6  2023 samba-dc.xml 
 +-rw-r--r--. 1 root root 382 Nov  6  2023 samba.xml 
 +-rw-r--r--. 1 root root 324 Nov  6  2023 sane.xml 
 +-rw-r--r--. 1 root root 283 Nov  6  2023 sips.xml 
 +-rw-r--r--. 1 root root 496 Nov  6  2023 sip.xml 
 +-rw-r--r--. 1 root root 299 Nov  6  2023 slp.xml 
 +-rw-r--r--. 1 root root 231 Nov  6  2023 smtp-submission.xml 
 +-rw-r--r--. 1 root root 577 Nov  6  2023 smtps.xml 
 +-rw-r--r--. 1 root root 550 Nov  6  2023 smtp.xml 
 +-rw-r--r--. 1 root root 359 Nov  6  2023 snmptls-trap.xml 
 +-rw-r--r--. 1 root root 390 Nov  6  2023 snmptls.xml 
 +-rw-r--r--. 1 root root 308 Nov  6  2023 snmptrap.xml 
 +-rw-r--r--. 1 root root 342 Nov  6  2023 snmp.xml 
 +-rw-r--r--. 1 root root 405 Nov  6  2023 spideroak-lansync.xml 
 +-rw-r--r--. 1 root root 275 Nov  6  2023 spotify-sync.xml 
 +-rw-r--r--. 1 root root 173 Nov  6  2023 squid.xml 
 +-rw-r--r--. 1 root root 421 Nov  6  2023 ssdp.xml 
 +-rw-r--r--. 1 root root 463 Nov  6  2023 ssh.xml 
 +-rw-r--r--. 1 root root 631 Nov  6  2023 steam-streaming.xml 
 +-rw-r--r--. 1 root root 287 Nov  6  2023 svdrp.xml 
 +-rw-r--r--. 1 root root 231 Nov  6  2023 svn.xml 
 +-rw-r--r--. 1 root root 297 Nov  6  2023 syncthing-gui.xml 
 +-rw-r--r--. 1 root root 414 Nov  6  2023 syncthing-relay.xml 
 +-rw-r--r--. 1 root root 350 Nov  6  2023 syncthing.xml 
 +-rw-r--r--. 1 root root 496 Nov  6  2023 synergy.xml 
 +-rw-r--r--. 1 root root 444 Nov  6  2023 syslog-tls.xml 
 +-rw-r--r--. 1 root root 329 Nov  6  2023 syslog.xml 
 +-rw-r--r--. 1 root root 393 Nov  6  2023 telnet.xml 
 +-rw-r--r--. 1 root root 252 Nov  6  2023 tentacle.xml 
 +-rw-r--r--. 1 root root 424 Nov  6  2023 tftp.xml 
 +-rw-r--r--. 1 root root 221 Nov  6  2023 tile38.xml 
 +-rw-r--r--. 1 root root 336 Nov  6  2023 tinc.xml 
 +-rw-r--r--. 1 root root 771 Nov  6  2023 tor-socks.xml 
 +-rw-r--r--. 1 root root 244 Nov  6  2023 transmission-client.xml 
 +-rw-r--r--. 1 root root 264 Nov  6  2023 upnp-client.xml 
 +-rw-r--r--. 1 root root 593 Nov  6  2023 vdsm.xml 
 +-rw-r--r--. 1 root root 475 Nov  6  2023 vnc-server.xml 
 +-rw-r--r--. 1 root root 443 Nov  6  2023 warpinator.xml 
 +-rw-r--r--. 1 root root 310 Nov  6  2023 wbem-https.xml 
 +-rw-r--r--. 1 root root 352 Nov  6  2023 wbem-http.xml 
 +-rw-r--r--. 1 root root 285 Nov  6  2023 wireguard.xml 
 +-rw-r--r--. 1 root root 355 Nov  6  2023 ws-discovery-client.xml 
 +-rw-r--r--. 1 root root 320 Nov  6  2023 ws-discovery-tcp.xml 
 +-rw-r--r--. 1 root root 375 Nov  6  2023 ws-discovery-udp.xml 
 +-rw-r--r--. 1 root root 357 Nov  6  2023 ws-discovery.xml 
 +-rw-r--r--. 1 root root 323 Nov  6  2023 wsmans.xml 
 +-rw-r--r--. 1 root root 316 Nov  6  2023 wsman.xml 
 +-rw-r--r--. 1 root root 329 Nov  6  2023 xdmcp.xml 
 +-rw-r--r--. 1 root root 509 Nov  6  2023 xmpp-bosh.xml 
 +-rw-r--r--. 1 root root 488 Nov  6  2023 xmpp-client.xml 
 +-rw-r--r--. 1 root root 264 Nov  6  2023 xmpp-local.xml 
 +-rw-r--r--. 1 root root 545 Nov  6  2023 xmpp-server.xml 
 +-rw-r--r--. 1 root root 314 Nov  6  2023 zabbix-agent.xml 
 +-rw-r--r--. 1 root root 315 Nov  6  2023 zabbix-server.xml 
 +-rw-r--r--. 1 root root 242 Nov  6  2023 zerotier.xml
  
-select "system RTC" or just use the first one +[root@redhat9 ~]ls -l /usr/lib/firewalld/icmptypes/ 
-SUBSYSTEM=="rtc", ATTR{hctosys}=="1", SYMLINK+="rtc" +total 180 
-SUBSYSTEM=="rtc", KERNEL=="rtc0", SYMLINK+="rtc", OPTIONS+="link_priority=-100"+-rw-r--r--. root root 385 Nov  6  2023 address-unreachable.xml 
 +-rw-r--r--. 1 root root 258 Nov  6  2023 bad-header.xml 
 +-rw-r--r--. 1 root root 293 Nov  6  2023 beyond-scope.xml 
 +-rw-r--r--. 1 root root 279 Nov  6  2023 communication-prohibited.xml 
 +-rw-r--r--. 1 root root 222 Nov  6  2023 destination-unreachable.xml 
 +-rw-r--r--. 1 root root 173 Nov  6  2023 echo-reply.xml 
 +-rw-r--r--. 1 root root 210 Nov  6  2023 echo-request.xml 
 +-rw-r--r--. 1 root root 261 Nov  6  2023 failed-policy.xml 
 +-rw-r--r--. 1 root root 280 Nov  6  2023 fragmentation-needed.xml 
 +-rw-r--r--. 1 root root 266 Nov  6  2023 host-precedence-violation.xml 
 +-rw-r--r--. 1 root root 257 Nov  6  2023 host-prohibited.xml 
 +-rw-r--r--. 1 root root 242 Nov  6  2023 host-redirect.xml 
 +-rw-r--r--. 1 root root 239 Nov  6  2023 host-unknown.xml 
 +-rw-r--r--. 1 root root 247 Nov  6  2023 host-unreachable.xml 
 +-rw-r--r--. 1 root root 229 Nov  6  2023 ip-header-bad.xml 
 +-rw-r--r--. 1 root root 355 Nov  6  2023 neighbour-advertisement.xml 
 +-rw-r--r--. 1 root root 457 Nov  6  2023 neighbour-solicitation.xml 
 +-rw-r--r--. 1 root root 250 Nov  6  2023 network-prohibited.xml 
 +-rw-r--r--. 1 root root 248 Nov  6  2023 network-redirect.xml 
 +-rw-r--r--. 1 root root 239 Nov  6  2023 network-unknown.xml 
 +-rw-r--r--. 1 root root 247 Nov  6  2023 network-unreachable.xml 
 +-rw-r--r--. 1 root root 239 Nov  6  2023 no-route.xml 
 +-rw-r--r--. 1 root root 328 Nov  6  2023 packet-too-big.xml 
 +-rw-r--r--. 1 root root 225 Nov  6  2023 parameter-problem.xml 
 +-rw-r--r--. 1 root root 233 Nov  6  2023 port-unreachable.xml 
 +-rw-r--r--. 1 root root 256 Nov  6  2023 precedence-cutoff.xml 
 +-rw-r--r--. 1 root root 249 Nov  6  2023 protocol-unreachable.xml 
 +-rw-r--r--. 1 root root 185 Nov  6  2023 redirect.xml 
 +-rw-r--r--. 1 root root 244 Nov  6  2023 reject-route.xml 
 +-rw-r--r--. 1 root root 241 Nov  6  2023 required-option-missing.xml 
 +-rw-r--r--. 1 root root 227 Nov  6  2023 router-advertisement.xml 
 +-rw-r--r--. 1 root root 223 Nov  6  2023 router-solicitation.xml 
 +-rw-r--r--. 1 root root 248 Nov  6  2023 source-quench.xml 
 +-rw-r--r--. 1 root root 236 Nov  6  2023 source-route-failed.xml 
 +-rw-r--r--. 1 root root 253 Nov  6  2023 time-exceeded.xml 
 +-rw-r--r--. 1 root root 233 Nov  6  2023 timestamp-reply.xml 
 +-rw-r--r--. 1 root root 228 Nov  6  2023 timestamp-request.xml 
 +-rw-r--r--. 1 root root 258 Nov  6  2023 tos-host-redirect.xml 
 +-rw-r--r--. 1 root root 257 Nov  6  2023 tos-host-unreachable.xml 
 +-rw-r--r--. 1 root root 272 Nov  6  2023 tos-network-redirect.xml 
 +-rw-r--r--. 1 root root 269 Nov  6  2023 tos-network-unreachable.xml 
 +-rw-r--r--. 1 root root 293 Nov  6  2023 ttl-zero-during-reassembly.xml 
 +-rw-r--r--. 1 root root 256 Nov  6  2023 ttl-zero-during-transit.xml 
 +-rw-r--r--. 1 root root 259 Nov  6  2023 unknown-header-type.xml 
 +-rw-r--r--. 1 root root 249 Nov  6  2023 unknown-option.xml 
 +</code>
  
-SUBSYSTEM=="usb"ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id", IMPORT{builtin}="hwdb --subsystem=usb" +Ces fichiers sont au format **xml**par exemple :
-ENV{MODALIAS}!="", IMPORT{builtin}="hwdb --subsystem=$env{SUBSYSTEM}"+
  
-ACTION!="add", GOTO="default_end"+<code> 
 +[root@redhat9 ~]# cat /usr/lib/firewalld/zones/home.xml 
 +<?xml version="1.0encoding="utf-8"?> 
 +<zone> 
 +  <short>Home</short> 
 +  <description>For use in home areas. You mostly trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description> 
 +  <service name="ssh"/> 
 +  <service name="mdns"/> 
 +  <service name="samba-client"/> 
 +  <service name="dhcpv6-client"/> 
 +  <service name="cockpit"/> 
 +  <forward/> 
 +</zone> 
 +</code>
  
-SUBSYSTEM=="tty", KERNEL=="ptmx", GROUP="tty", MODE="0666" +La configuration de firewalld ainsi que les définitions et règles personnalisées se trouvent dans **/etc/firewalld** :
-SUBSYSTEM=="tty", KERNEL=="tty", GROUP="tty", MODE="0666" +
-SUBSYSTEM=="tty", KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620" +
-SUBSYSTEM=="tty", KERNEL=="sclp_line[0-9]*", GROUP="tty", MODE="0620" +
-SUBSYSTEM=="tty", KERNEL=="ttysclp[0-9]*", GROUP="tty", MODE="0620" +
-SUBSYSTEM=="tty", KERNEL=="3270/tty[0-9]*", GROUP="tty", MODE="0620" +
-SUBSYSTEM=="vc", KERNEL=="vcs*|vcsa*", GROUP="tty" +
-KERNEL=="tty[A-Z]*[0-9]|ttymxc[0-9]*|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout"+
  
-SUBSYSTEM=="mem", KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640"+<code> 
 +[root@redhat9 ~]# ls -l /etc/firewalld/ 
 +total 8 
 +-rw-r--r--. 1 root root 2483 Nov  6  2023 firewalld.conf 
 +drwxr-x---. 2 root root    6 Nov  6  2023 helpers 
 +drwxr-x---. 2 root root    6 Nov  6  2023 icmptypes 
 +drwxr-x---. 2 root root    6 Nov  6  2023 ipsets 
 +-rw-r--r--. 1 root root  271 Nov  6  2023 lockdown-whitelist.xml 
 +drwxr-x---. 2 root root    6 Nov  6  2023 policies 
 +drwxr-x---. 2 root root    6 Nov  6  2023 services 
 +drwxr-x---. 2 root root   46 Nov  6  2023 zones
  
-SUBSYSTEM=="input", GROUP="input" +[root@redhat9 ~]# ls -l /etc/firewalld/zones/ 
-SUBSYSTEM=="input", KERNEL=="js[0-9]*", MODE="0664"+total 8 
 +-rw-r--r--. 1 root root 356 Oct 19  2023 public.xml 
 +-rw-r--r--. 1 root root 356 Oct 19  2023 public.xml.old
  
-SUBSYSTEM=="video4linux", GROUP="video" +[root@redhat9 ~]# ls -l /etc/firewalld/services/ 
-SUBSYSTEM=="graphics", GROUP="video" +total 0
-SUBSYSTEM=="drm", KERNEL!="renderD*", GROUP="video" +
-SUBSYSTEM=="dvb", GROUP="video" +
-SUBSYSTEM=="media", GROUP="video" +
-SUBSYSTEM=="cec", GROUP="video"+
  
-SUBSYSTEM=="drm", KERNEL=="renderD*", GROUP="render", MODE="0666" +[root@redhat9 ~]# ls -l /etc/firewalld/icmptypes
-SUBSYSTEM=="kfd", GROUP="render", MODE="0666" +total 0
- +
-SUBSYSTEM=="sound", GROUP="audio",+
-  OPTIONS+="static_node=snd/seq", OPTIONS+="static_node=snd/timer" +
---More--+
 </code> </code>
  
-Chaque règle prend la forme suivante :+Le fichier de configuration de firewalld est **/etc/firewalld/firewalld.conf** :
  
-KEY, [KEY, ...] NAME [, SYMLINK]+<code> 
 +[root@redhat9 ~]# cat /etc/firewalld/firewalld.conf 
 +# firewalld config file
  
-Chaque KEY est un champ au format **type=valeur** qui doit correspondre à un périphérique uniqueLa valeur de type peut prendre plusieurs formes :+# default zone 
 +# The default zone used if an empty zone string is used. 
 +# Defaultpublic 
 +DefaultZone=public
  
-^ Type ^ Description ^ Exemples ^ +# Clean up on exit 
-| BUS | Type de bus | usb, scsi, ide | +# If set to no or false the firewall configuration will not get cleaned up 
-| KERNEL | Le nom par défault du périphérique donné par le noyau | hda, ttyUSB0, lp0 | +# on exit or stop of firewalld
-| SUBSYSTEM | Le nom noyau du sous-système, généralement identique à la valeur du BUS | usb, scsi | +# Default: yes 
-| DRIVER | Le nom du pilote qui contrôle le périphérique | usb-storage | +CleanupOnExit=yes
-| ID | Le numéro du périphérique sur son bus | PCI bus id, USB id | +
-| PLACE | Ne concerne que les périphériques USB et donne la position topologique du périphérique sur son bus | S/O | +
-| SYSFS{filename} | Le nom du fichier dans /sys pour le périphérique. Ce fichier contient le fabricant, le label, le numéro de série et UUID du périphériqueLa vérification de jusqu'à 5 fichiers est possible par règle | S/O | +
-| PROGRAM | Ceci permet à Udev d'appeler un programme externe pour nommer un périphérique | S/O | +
-| RESULT | Valeur à comparer au résultat de PROGRAM | S/O |+
  
-NAME et SYMLINK sont utilisées pour stipuler ce que Udev doit faire avec le périphérique :+# Clean up kernel modules on exit 
 +# If set to yes or true the firewall related kernel modules will be 
 +# unloaded on exit or stop of firewalld. This might attempt to unload 
 +# modules not originally loaded by firewalld. 
 +# Defaultno 
 +CleanupModulesOnExit=no
  
-^ Type ^ Description ^ Exemples ^ +# Lockdown 
-| NAME | Le nome du nœud dans /dev | S/O | +# If set to enabled, firewall changes with the D-Bus interface will be limited 
-| SYMLINK | Le ou les lien(s) symbolique(s) qui pointe(nt) vers le NAME | S/O |+# to applications that are listed in the lockdown whitelist. 
 +# The lockdown whitelist file is lockdown-whitelist.xml 
 +# Default: no 
 +Lockdown=no
  
-====La commande udevadm====+# IPv6_rpfilter 
 +# Performs a reverse path filter test on a packet for IPv6. If a reply to the 
 +# packet would be sent via the same interface that the packet arrived on, the 
 +# packet will match and be accepted, otherwise dropped. 
 +# The rp_filter for IPv4 is controlled using sysctl. 
 +# Note: This feature has a performance impact. See man page FIREWALLD.CONF(5) 
 +# for details. 
 +# Default: yes 
 +IPv6_rpfilter=yes
  
-Pour obtenir de l'information sur un périphérique il convient d'utiliser la commande **udevadm** :+# IndividualCalls 
 +# Do not use combined -restore calls, but individual calls. This increases the 
 +# time that is needed to apply changes and to start the daemon, but is good for 
 +# debugging. 
 +# Defaultno 
 +IndividualCalls=no
  
-<code> +# LogDenied 
-[root@centos8 ~]udevadm info --query=all -n /dev/sda +Add logging rules right before reject and drop rules in the INPUT, FORWARD 
-P: /devices/pci0000:00/0000:00:07.0/ata3/host2/target2:0:0/2:0:0:0/block/sda +# and OUTPUT chains for the default rules and also final reject and drop rules 
-N: sda +# in zonesPossible values areall, unicast, broadcast, multicast and off
-S: disk/by-id/ata-QEMU_HARDDISK_QM00005 +# Defaultoff 
-S: disk/by-id/scsi-0ATA_QEMU_HARDDISK_QM00005 +LogDenied=off
-S: disk/by-id/scsi-1ATA_QEMU_HARDDISK_QM00005 +
-S: disk/by-id/scsi-SATA_QEMU_HARDDISK_QM00005 +
-S: disk/by-path/pci-0000:00:07.0-ata-1 +
-EDEVLINKS=/dev/disk/by-path/pci-0000:00:07.0-ata-1 /dev/disk/by-id/scsi-SATA_QEMU_HARDDISK_QM00005 /dev/disk/by-id/ata-QEMU_HARDDISK_QM00005 /dev/disk/by-id/scsi-0ATA_QEMU_HARDDISK_QM00005 /dev/disk/by-id/scsi-1ATA_QEMU_HARDDISK_QM00005 +
-EDEVNAME=/dev/sda +
-E: DEVPATH=/devices/pci0000:00/0000:00:07.0/ata3/host2/target2:0:0/2:0:0:0/block/sda +
-E: DEVTYPE=disk +
-E: ID_ATA=1 +
-E: ID_ATA_FEATURE_SET_SMART=1 +
-E: ID_ATA_FEATURE_SET_SMART_ENABLED=1 +
-E: ID_ATA_SATA=1 +
-E: ID_ATA_WRITE_CACHE=1 +
-E: ID_ATA_WRITE_CACHE_ENABLED=1 +
-E: ID_BUS=ata +
-E: ID_MODEL=QEMU_HARDDISK +
-E: ID_MODEL_ENC=QEMU\x20HARDDISK\x20\x20\x20 +
-E: ID_PART_TABLE_TYPE=dos +
-E: ID_PART_TABLE_UUID=b39ec5c8 +
-E: ID_PATH=pci-0000:00:07.0-ata-1 +
-E: ID_PATH_TAG=pci-0000_00_07_0-ata-1 +
-E: ID_REVISION=2.5+ +
-E: ID_SCSI=1 +
-E: ID_SCSI_INQUIRY=1 +
-E: ID_SERIAL=QEMU_HARDDISK_QM00005 +
-E: ID_SERIAL_SHORT=QM00005 +
-E: ID_TYPE=disk +
-E: ID_VENDOR=ATA +
-E: ID_VENDOR_ENC=ATA\x20\x20\x20\x20\x20 +
-E: MAJOR=8 +
-E: MINOR=0 +
-E: SCSI_IDENT_LUN_ATA=QEMU_HARDDISK_QM00005 +
-E: SCSI_IDENT_LUN_T10=ATA_QEMU_HARDDISK_QM00005 +
-E: SCSI_IDENT_LUN_VENDOR=QM00005 +
-E: SCSI_IDENT_SERIAL=QM00005 +
-E: SCSI_MODEL=QEMU_HARDDISK +
-E: SCSI_MODEL_ENC=QEMU\x20HARDDISK\x20\x20\x20 +
-E: SCSI_REVISION=2.5+ +
-E: SCSI_TPGS=0 +
-E: SCSI_TYPE=disk +
-E: SCSI_VENDOR=ATA +
-E: SCSI_VENDOR_ENC=ATA\x20\x20\x20\x20\x20 +
-E: SUBSYSTEM=block +
-E: TAGS=:systemd: +
-E: USEC_INITIALIZED=8735808 +
-</code>+
  
-===Les options de la commande===+# FirewallBackend 
 +# Selects the firewall backend implementation. 
 +# Choices are: 
 +#       - nftables (default) 
 +#       - iptables (iptables, ip6tables, ebtables and ipset) 
 +# Note: The iptables backend is deprecated. It will be removed in a future 
 +# release. 
 +FirewallBackend=nftables
  
-Les options de la commande udevadm sont :+# FlushAllOnReload 
 +# Flush all runtime rules on a reload. In previous releases some runtime 
 +# configuration was retained during a reload, namely; interface to zone 
 +# assignment, and direct rules. This was confusing to users. To get the old 
 +# behavior set this to "no"
 +# Defaultyes 
 +FlushAllOnReload=yes
  
-<code> +# RFC3964_IPv4 
-[root@centos8 ~]udevadm --help +As per RFC 3964, filter IPv6 traffic with 6to4 destination addresses that 
-udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]+# correspond to IPv4 addresses that should not be routed over the public 
 +# internet. 
 +# Defaults to "yes"
 +RFC3964_IPv4=yes 
 +</code>
  
-Send control commands or test the device manager.+====4.3 - La Commande firewall-cmd====
  
-Commands: +firewalld s'appuie sur netfilter. Pour cette raison, l'utilisation de firewall-cmd est incompatible avec l'utilisation des commandes iptables et system-config-firewall.
-  info          Query sysfs or the udev database +
-  trigger       Request events from the kernel +
-  settle        Wait for pending udev events +
-  control       Control the udev daemon +
-  monitor       Listen to kernel and udev events +
-  test          Test an event run +
-  test-builtin  Test a built-in command+
  
-[root@centos8 ~]# udevadm info --help +<WRAP center round important 50%> 
-udevadm info [OPTIONS] [DEVPATH|FILE]+**Important** - firewall-cmd est le front-end de firewalld en ligne de commande. Il existe aussi la commande **firewall-config** qui lance un outi de configuration graphique. 
 +</WRAP>
  
-Query sysfs or the udev database.+Pour obtenir la liste de toutes les zones prédéfinies, utilisez la commande suivante :
  
-  -h --help                   Print this message +<code> 
-  -V --version                Print version of the program +[root@redhat9 ~]# firewall-cmd --get-zones 
-  -q --query=TYPE             Query device information: +block dmz drop external home internal nm-shared public trusted work
-       name                     Name of device node +
-       symlink                  Pointing to node +
-       path                     sysfs device path +
-       property                 The device properties +
-       all                      All values +
-  -p --path=SYSPATH           sysfs device path used for query or attribute walk +
-  -n --name=NAME              Node or symlink name used for query or attribute walk +
-  -r --root                   Prepend dev directory to path names +
-  ---attribute-walk         Print all key matches walking along the chain +
-                              of parent devices +
-  -d --device-id-of-file=FILE Print major:minor of device containing this file +
-  -x --export                 Export key/value pairs +
-  -P --export-prefix          Export the key name with a prefix +
-  -e --export-db              Export the content of the udev database +
-  -c --cleanup-db             Clean up the udev database+
 </code> </code>
  
-=====Système de fichiers /sys===== +Pour obtenir la liste de toutes les services prédéfinis, utilisez la commande suivante :
- +
-Le système de fichiers virtuel **/sys** a été introduit avec le noyau Linux **2.6**. Son rôle est de décrire le matériel pour udev. +
- +
-Saisissez la commande suivante :+
  
 <code> <code>
-[root@centos8 ~]# ls -l /sys +[root@redhat9 ~]# firewall-cmd --get-services 
-total 0 +RH-Satellite-6 RH-Satellite-6-capsule afp amanda-client amanda-k5-client amqp amqps apcupsd audit ausweisapp2 bacula bacula-client bareos-director bareos-filedaemon bareos-storage bb bgp bitcoin bitcoin-rpc bitcoin-testnet bitcoin-testnet-rpc bittorrent-lsd ceph ceph-exporter ceph-mon cfengine checkmk-agent cockpit collectd condor-collector cratedb ctdb dds dds-multicast dds-unicast dhcp dhcpv6 dhcpv6-client distcc dns dns-over-tls docker-registry docker-swarm dropbox-lansync elasticsearch etcd-client etcd-server finger foreman foreman-proxy freeipa-4 freeipa-ldap freeipa-ldaps freeipa-replication freeipa-trust ftp galera ganglia-client ganglia-master git gpsd grafana gre high-availability http http3 https ident imap imaps ipfs ipp ipp-client ipsec irc ircs iscsi-target isns jenkins kadmin kdeconnect kerberos kibana klogin kpasswd kprop kshell kube-api kube-apiserver kube-control-plane kube-control-plane-secure kube-controller-manager kube-controller-manager-secure kube-nodeport-services kube-scheduler kube-scheduler-secure kube-worker kubelet kubelet-readonly kubelet-worker ldap ldaps libvirt libvirt-tls lightning-network llmnr llmnr-client llmnr-tcp llmnr-udp managesieve matrix mdns memcache minidlna mongodb mosh mountd mqtt mqtt-tls ms-wbt mssql murmur mysql nbd nebula netbios-ns netdata-dashboard nfs nfs3 nmea-0183 nrpe ntp nut openvpn ovirt-imageio ovirt-storageconsole ovirt-vmconsole plex pmcd pmproxy pmwebapi pmwebapis pop3 pop3s postgresql privoxy prometheus prometheus-node-exporter proxy-dhcp ps2link ps3netsrv ptp pulseaudio puppetmaster quassel radius rdp redis redis-sentinel rpc-bind rquotad rsh rsyncd rtsp salt-master samba samba-client samba-dc sane sip sips slp smtp smtp-submission smtps snmp snmptls snmptls-trap snmptrap spideroak-lansync spotify-sync squid ssdp ssh steam-streaming svdrp svn syncthing syncthing-gui syncthing-relay synergy syslog syslog-tls telnet tentacle tftp tile38 tinc tor-socks transmission-client upnp-client vdsm vnc-server warpinator wbem-http wbem-https wireguard ws-discovery ws-discovery-client ws-discovery-tcp ws-discovery-udp wsman wsmans xdmcp xmpp-bosh xmpp-client xmpp-local xmpp-server zabbix-agent zabbix-server zerotier
-drwxr-xr-x.   2 root root 0 Jul 12 08:15 block +
-drwxr-xr-x.  33 root root 0 Jul 12 08:15 bus +
-drwxr-xr-x.  57 root root 0 Jul 12 08:15 class +
-drwxr-xr-x.   root root 0 Jul 12 08:15 dev +
-drwxr-xr-x.  14 root root 0 Jul 12 08:15 devices +
-drwxr-xr-x.   6 root root 0 Jul 12 08:15 firmware +
-drwxr-xr-x.   9 root root 0 Jul 12 08:15 fs +
-drwxr-xr-x.   2 root root 0 Jul 12 08:15 hypervisor +
-drwxr-xr-x.  15 root root 0 Jul 12 08:15 kernel +
-drwxr-xr-x. 153 root root 0 Jul 12 08:15 module +
-drwxr-xr-x.   2 root root 0 Jul 12 08:15 power+
 </code> </code>
  
-Chaque répertoire contient des informations : +Pour obtenir la liste de toutes les types ICMP prédéfinisutilisez la commande suivante :
- +
-  * **block** +
-    * contient des informations sur les périphériques bloc +
-  * **bus** +
-    * contient des informations sur les bus de données +
-  * **class** +
-    * contient des informations sur des classes de matériel +
-  * **devices** +
-    * contient des informations sur la position des périphériques sur les bus +
-  * **firmware** +
-    * contient, entre autre, des informations sur l'ACPI +
-  * **module** +
-    * contient des informations sur les modules du noyau +
-  * **power** +
-    * contient des informations sur la gestion de l'énergie +
-  * **fs** +
-    * contient des informations sur les systèmes de fichiers +
- +
-Pour illustrer cecisaisissez la commande suivante :+
  
 <code> <code>
-[root@centos8 ~]# cat /sys/block/sda/sda1/size +[root@redhat9 ~]# firewall-cmd --get-icmptypes 
-2097152+address-unreachable bad-header beyond-scope communication-prohibited destination-unreachable echo-reply echo-request failed-policy fragmentation-needed host-precedence-violation host-prohibited host-redirect host-unknown host-unreachable ip-header-bad neighbour-advertisement neighbour-solicitation network-prohibited network-redirect network-unknown network-unreachable no-route packet-too-big parameter-problem port-unreachable precedence-cutoff protocol-unreachable redirect reject-route required-option-missing router-advertisement router-solicitation source-quench source-route-failed time-exceeded timestamp-reply timestamp-request tos-host-redirect tos-host-unreachable tos-network-redirect tos-network-unreachable ttl-zero-during-reassembly ttl-zero-during-transit unknown-header-type unknown-option
 </code> </code>
  
-Ce chiffre correspond aux nombre de secteurs. +Pour obtenir la liste des zones de la configuration couranteutilisez la commande suivante :
- +
-=====LAB #4 - Limitation des ressources===== +
- +
-====4.1 - ulimit==== +
- +
-Les ressources disponibles aux utilisateurs peuvent être limitées par l'utilisation de la commande **ulimit**.  +
- +
-La commande **ulimit** gère deux types de limitela limite //hard// en utilisant l'option **-H** et la limite //soft// en utilisant l'option **-S**. Seul root peut positionner une limite //hard// et ceci à condition que la limite ne dépasse pas les ressources réelles. +
- +
-La limite //soft// est la limite imposée à l'utilisateur par défaut tandis que la limite //hard// est la limite que l'utilisateur peut atteindre en utilisant la commande ulimit lui-même. +
- +
-L'utilisateur root peut paramétrer les limites accordées en éditant la fichier **/etc/security/limits.conf** :+
  
 <code> <code>
-[root@centos8 ~]# cat /etc/security/limits.conf +[root@redhat9 ~]# firewall-cmd --get-active-zones 
-# /etc/security/limits.conf +public 
-+  interfacesens18 
-#This file sets the resource limits for the users logged in via PAM. +</code>
-#It does not affect resource limits of the system services. +
-+
-#Also note that configuration files in /etc/security/limits.d directory, +
-#which are read in alphabetical order, override the settings in this +
-#file in case the domain is the same or more specific. +
-#That means for example that setting a limit for wildcard domain here +
-#can be overriden with a wildcard setting in a config file in the +
-#subdirectory, but a user specific setting here can be overriden only +
-#with a user specific setting in the subdirectory. +
-+
-#Each line describes a limit for a user in the form: +
-+
-#<domain>        <type>  <item>  <value> +
-+
-#Where: +
-#<domain> can be: +
-#        a user name +
-#        a group name, with @group syntax +
-#        the wildcard *, for default entry +
-#        the wildcard %, can be also used with %group syntax, +
-#                 for maxlogin limit +
-+
-#<type> can have the two values: +
-#        "soft" for enforcing the soft limits +
-#        - "hard" for enforcing hard limits +
-+
-#<item> can be one of the following+
-#        - core - limits the core file size (KB) +
-#        - data - max data size (KB) +
-#        - fsize - maximum filesize (KB) +
-#        - memlock - max locked-in-memory address space (KB) +
-#        - nofile - max number of open file descriptors +
-#        - rss - max resident set size (KB) +
-#        - stack - max stack size (KB) +
-#        - cpu - max CPU time (MIN) +
-#        - nproc - max number of processes +
-#        - as - address space limit (KB) +
-#        - maxlogins - max number of logins for this user +
-#        - maxsyslogins - max number of logins on the system +
-#        - priority - the priority to run user process with +
-#        - locks - max number of file locks the user can hold +
-#        - sigpending - max number of pending signals +
-#        - msgqueue - max memory used by POSIX message queues (bytes) +
-#        - nice - max nice priority allowed to raise to values: [-20, 19] +
-#        - rtprio - max realtime priority +
-+
-#<domain     <type>  <item>         <value> +
-#+
  
-#*               soft    core            0 +Pour obtenir la liste des zones de la configuration courante pour une interface spécifiqueutilisez la commande suivante :
-#*               hard    rss             10000 +
-#@student        hard    nproc           20 +
-#@faculty        soft    nproc           20 +
-#@faculty        hard    nproc           50 +
-#ftp             hard    nproc           0 +
-#@student        -       maxlogins       4 +
- +
-# End of file +
-</code>  +
- +
-<WRAP center round important 60%> +
-**Important** : La valeur de la limite peut être un **nombre** ou le mot **unlimited**. +
-</WRAP> +
- +
-Par exemplesi root inscrit les deux ligne suivantes dans le fichier /etc/security/limits.conf : +
- +
-<file> +
-... +
-trainee                soft        nofile          1024 +
-trainee                hard        nofile          4096 +
-... +
-</file> +
- +
-la limite du nombre de fichiers ouverts simultanément par trainee est de 1 024. Par contre, trainee a la possibilité d'augmenter cette limite jusqu'à 4 096 en utilisant la commande suivante :+
  
 <code> <code>
-$ ulimit -n 4096+[root@redhat9 ~]# firewall-cmd --get-zone-of-interface=ens18 
 +public
 </code> </code>
  
-Pour consulter la liste des limites actuellesil convient d'utiliser la commande ulimit avec l'option **-a** :+Pour obtenir la liste des services autorisés pour la zone publicutilisez la commande suivante :
  
 <code> <code>
-[root@centos8 ~]# ulimit -+[root@redhat9 ~]# firewall-cmd --zone=public --list-services 
-core file size          (blocks, -c) unlimited +cockpit dhcpv6-client ssh
-data seg size           (kbytes, -d) unlimited +
-scheduling priority             (-e) 0 +
-file size               (blocks, -f) unlimited +
-pending signals                 (-i) 14702 +
-max locked memory       (kbytes, -l) 64 +
-max memory size         (kbytes, -m) unlimited +
-open files                      (-n) 1024 +
-pipe size            (512 bytes, -p) 8 +
-POSIX message queues     (bytes, -q) 819200 +
-real-time priority              (-r) 0 +
-stack size              (kbytes, -s) 8192 +
-cpu time               (seconds, -t) unlimited +
-max user processes              (-u) 14702 +
-virtual memory          (kbytes, -v) unlimited +
-file locks                      (-x) unlimited+
 </code> </code>
  
-====Options de la commande==== +Pour obtenir toute la configuration pour la zone public, utilisez la commande suivante :
- +
-Les options de **ulimit** sont :+
  
 <code> <code>
-[root@centos8 ~]# help ulimit +[root@redhat9 ~]# firewall-cmd --zone=public --list-all 
-ulimit: ulimit [-SHabcdefiklmnpqrstuvxPT] [limit] +public (active
-    Modify shell resource limits. +  target: default 
-     +  icmp-block-inversion: no 
-    Provides control over the resources available to the shell and processes +  interfaces: ens18 
-    it creates, on systems that allow such control. +  sources:  
-     +  services: cockpit dhcpv6-client ssh 
-    Options: +  ports:  
-      -S        use the `soft' resource limit +  protocols:  
-      -H        use the `hard' resource limit +  forward: yes 
-      -a        all current limits are reported +  masquerade: no 
-      -b        the socket buffer size +  forward-ports:  
-      -c        the maximum size of core files created +  source-ports:  
-      -d        the maximum size of a process's data segment +  icmp-blocks:  
-      -e        the maximum scheduling priority (`nice'+  rich rules
-      -f        the maximum size of files written by the shell and its children +
-      -i        the maximum number of pending signals +
-      -k        the maximum number of kqueues allocated for this process +
-      -l        the maximum size a process may lock into memory +
-      -m        the maximum resident set size +
-      -n        the maximum number of open file descriptors +
-      -p        the pipe buffer size +
-      -q        the maximum number of bytes in POSIX message queues +
-      -r        the maximum real-time scheduling priority +
-      -s        the maximum stack size +
-      -t        the maximum amount of cpu time in seconds +
-      -u        the maximum number of user processes +
-      -v        the size of virtual memory +
-      -x        the maximum number of file locks +
-      -P        the maximum number of pseudoterminals +
-      -T        the maximum number of threads +
-     +
-    Not all options are available on all platforms. +
-     +
-    If LIMIT is given, it is the new value of the specified resource; the +
-    special LIMIT values `soft', `hard', and `unlimited' stand for the +
-    current soft limit, the current hard limit, and no limit, respectively. +
-    Otherwise, the current value of the specified resource is printed.  If +
-    no option is given, then -f is assumed. +
-     +
-    Values are in 1024-byte increments, except for -t, which is in seconds, +
-    -p, which is in increments of 512 bytes, and -u, which is an unscaled +
-    number of processes. +
-     +
-    Exit Status: +
-    Returns success unless an invalid option is supplied or an error occurs.+
 </code> </code>
  
-====4.2 - Groupes de Contrôle====+Pour obtenir la liste complète de toutes les zones et leurs configurations, utilisez la commande suivante :
  
-Les **Groupes de Contrôles** (//Control Groups//) aussi appelés **CGroups**, sont une façon de contrôler et de limiter des ressources. Les groupes de contrôle permettent l'allocation de ressources, même d'une manière dynamique pendant que le système fonctionne, telles le temps processeur, la mémoire système, la bande réseau, ou une combinaison de ces ressources parmi des groupes de tâches (processus) définis par l'utilisateur et exécutés sur un système.+<code> 
 +[root@redhat9 ~]# firewall-cmd --list-all-zones 
 +block 
 +  target: %%REJECT%% 
 +  icmp-block-inversion: no 
 +  interfaces:  
 +  sources:  
 +  services:  
 +  ports:  
 +  protocols:  
 +  forward: yes 
 +  masquerade: no 
 +  forward-ports:  
 +  source-ports:  
 +  icmp-blocks:  
 +  rich rules: 
  
-Les groupes de contrôle sont organisés de manière hiérarchique, comme des processus. Par contre, la comparaison entre les deux démontre que tandis que les processus se trouvent dans une arborescence unique descandant tous du processus init et héritant de l'environnement de leurs parents, les contrôles groupes peuvent être multiples donnant lieu à des arborescences ou **hiérarchies** multiples qui héritent de certains attributs de leurs groupes de contrôle parents.+dmz 
 +  target: default 
 +  icmp-block-inversion: no 
 +  interfaces:  
 +  sources:  
 +  services: ssh 
 +  ports:  
 +  protocols:  
 +  forward: yes 
 +  masquerade: no 
 +  forward-ports:  
 +  source-ports:  
 +  icmp-blocks:  
 +  rich rules: 
  
-Ces hiérarchies multiples et séparés sont necéssaires parce que chaque hiérarchie est attaché à un ou plusieurs **sous-système(s)** aussi appelés des **Contrôleurs de Ressources** ou simplement des **Contrôleurs**. Les contrôleurs disponibles sous RHEl/CentOS 7 sont :+drop 
 +  target: DROP 
 +  icmp-block-inversion: no 
 +  interfaces:  
 +  sources:  
 +  services:  
 +  ports:  
 +  protocols:  
 +  forward: yes 
 +  masquerade: no 
 +  forward-ports:  
 +  source-ports:  
 +  icmp-blocks:  
 +  rich rules
  
-  * **blkio** - utilisé pour établir des limites sur l'accès des entrées/sorties à partir et depuis des périphériques blocs, +external 
-  * **cpu** - utilisé pour fournir aux tâches des groupes de contrôle accès au CPU grâce au planificateur, +  target: default 
-  * **cpuacct** utilisé pour produire des rapports automatiques sur les ressources CPU utilisées par les tâches dans un groupe de contrôle, +  icmp-block-inversion: no 
-  * **cpuset** - utilisé pour assigner des CPU individuels sur un système multicoeur et des noeuds de mémoire à des tâches dans un groupe de contrôle, +  interfaces:  
-  * **devices** - utilisé pour autoriser ou pour refuser l'accès des tâches aux périphériques dans un groupe de contrôle, +  sources:  
-  * **freezer** - utilisé pour suspendre ou pour réactiver les tâches dans un groupe de contrôle, +  services: ssh 
-  * **memory** - utilisé pour établir les limites d'utilisation de la mémoire par les tâches d'un groupe de contrôle et pour génèrer des rapports automatiques sur les ressources rmémoire utilisées par ces tâches, +  ports:  
-  * **net_cls** - utilisé pour repèrer les paquets réseau avec un identifiant de classe (//classid//) afin de permettre au contrôleur de trafic Linux, **tc**,  d'identifier les paquets provenant d'une tâche particulière d'un groupe de contrôle. +  protocols:  
-  * **perf_event**  utilisé pour permettre le monitoring des CGroups avec l'outil perf, +  forward: yes 
-  * **hugetlb** utilisé pour limiter des ressources sur des pages de mémoire virtuelle de grande taille.+  masquerade: yes 
 +  forward-ports:  
 +  source-ports:  
 +  icmp-blocks:  
 +  rich rules: 
  
-Pour visualiser les hiérarchies, il convient d'utiliser la commande **lssubsys** :+home 
 +  target: default 
 +  icmp-block-inversion: no 
 +  interfaces:  
 +  sources:  
 +  services: cockpit dhcpv6-client mdns samba-client ssh 
 +  ports:  
 +  protocols:  
 +  forward: yes 
 +  masquerade: no 
 +  forward-ports:  
 +  source-ports:  
 +  icmp-blocks:  
 +  rich rules
  
-<code> +internal 
-[root@centos8 ~]# lssubsys -am +  target: default 
-bashlssubsyscommand not found... +  icmp-block-inversion: no 
-Install package 'libcgroup-tools' to provide command 'lssubsys'? [N/y] y+  interfaces 
 +  sources:  
 +  services: cockpit dhcpv6-client mdns samba-client ssh 
 +  ports:  
 +  protocols:  
 +  forward: yes 
 +  masquerade: no 
 +  forward-ports:  
 +  source-ports:  
 +  icmp-blocks:  
 +  rich rules: 
  
 +nm-shared
 +  target: ACCEPT
 +  icmp-block-inversion: no
 +  interfaces: 
 +  sources: 
 +  services: dhcp dns ssh
 +  ports: 
 +  protocols: icmp ipv6-icmp
 +  forward: no
 +  masquerade: no
 +  forward-ports: 
 +  source-ports: 
 +  icmp-blocks: 
 +  rich rules: 
 +        rule priority="32767" reject
  
- * Waiting in queue...  +public (active) 
-The following packages have to be installed+  targetdefault 
- libcgroup-0.41-19.el8.x86_64   Library to control and monitor control groups +  icmp-block-inversion: no 
- libcgroup-tools-0.41-19.el8.x86_64     Command-line utility programs, services and daemons for libcgroup +  interfaces: ens18 
-Proceed with changes? [N/y] y+  sources:  
 +  services: cockpit dhcpv6-client ssh 
 +  ports:  
 +  protocols:  
 +  forward: yes 
 +  masquerade: no 
 +  forward-ports:  
 +  source-ports:  
 +  icmp-blocks:  
 +  rich rules: 
  
 +trusted
 +  target: ACCEPT
 +  icmp-block-inversion: no
 +  interfaces: 
 +  sources: 
 +  services: 
 +  ports: 
 +  protocols: 
 +  forward: yes
 +  masquerade: no
 +  forward-ports: 
 +  source-ports: 
 +  icmp-blocks: 
 +  rich rules: 
  
- * Waiting in queue...  +work 
- * Waiting for authentication...  +  target: default 
- * Waiting in queue...  +  icmp-block-inversion: no 
- * Downloading packages...  +  interfaces:  
- * Requesting data...  +  sources:  
- * Testing changes...  +  services: cockpit dhcpv6-client ssh 
- * Installing packages...  +  ports:  
-cpuset /sys/fs/cgroup/cpuset +  protocols:  
-cpu,cpuacct /sys/fs/cgroup/cpu,cpuacct +  forward: yes 
-blkio /sys/fs/cgroup/blkio +  masquerade: no 
-memory /sys/fs/cgroup/memory +  forward-ports:  
-devices /sys/fs/cgroup/devices +  source-ports:  
-freezer /sys/fs/cgroup/freezer +  icmp-blocks:  
-net_cls,net_prio /sys/fs/cgroup/net_cls,net_prio +  rich rules:
-perf_event /sys/fs/cgroup/perf_event +
-hugetlb /sys/fs/cgroup/hugetlb +
-pids /sys/fs/cgroup/pids +
-rdma /sys/fs/cgroup/rdma+
 </code> </code>
 +
 +Pour changer la zone par défaut de public à work, utilisez la commande suivante :
  
 <code> <code>
-[root@centos8 ~]# lssubsys -am +[root@redhat9 ~]# firewall-cmd --set-default-zone=work 
-cpuset /sys/fs/cgroup/cpuset +success
-cpu,cpuacct /sys/fs/cgroup/cpu,cpuacct +
-blkio /sys/fs/cgroup/blkio +
-memory /sys/fs/cgroup/memory +
-devices /sys/fs/cgroup/devices +
-freezer /sys/fs/cgroup/freezer +
-net_cls,net_prio /sys/fs/cgroup/net_cls,net_prio +
-perf_event /sys/fs/cgroup/perf_event +
-hugetlb /sys/fs/cgroup/hugetlb +
-pids /sys/fs/cgroup/pids +
-rdma /sys/fs/cgroup/rdma +
-</code> +
  
-Sous RHEL/CentOS 8, **Systemd** organise les processus dans chaque CGroup. Par exemple tous les processus démarrés par le serveur Apache se trouveront dans le même CGroup, y compris les scripts CGI. Ceci implique que la gestion des ressources en utilisant des hiérarchies est couplé avec l'arborescence des unités de Systemd.+[root@redhat9 ~]# firewall-cmd --get-active-zones 
 +work 
 +  interfaces: ens18 
 +</code>
  
-En haut de l'arborescence des unités de Systemd se trouve la tranche root - **-.slice**dont dépend :+Pour ajouter l'interface ip_fixe à la zone workutilisez la commande suivante :
  
-  * le **system.slice** - l'emplacement des services système, +<code> 
-  * le **user.slice** l'emplacement des sessions des utilisateurs, +[root@redhat9 ~]# firewall-cmd --zone=work --add-interface=ip_fixe 
-  * le **machine.slice** l'emplacement des machines virtuelles et conteneurs.+success
  
-En dessous des tranches peuvent se trouver :+[root@redhat9 ~]# firewall-cmd --get-active-zones 
 +work 
 +  interfacesens18 ip_fixe 
 +</code>
  
-  * des **scopes** - des processus crées par **fork**, +Pour supprimer l'interface ip_fixe à la zone workutilisez la commande suivante :
-  * des **services** - des processus créés par une **Unité**. +
- +
-Les slices peuvent être visualisés avec la commande suivante :+
  
 <code> <code>
-[root@centos8 ~]# systemctl list-units --type=slice +[root@redhat9 ~]# firewall-cmd --zone=work --remove-interface=ip_fixe 
-UNIT                                        LOAD   ACTIVE SUB    DESCRIPTION                                 +success
--.slice                                     loaded active active Root Slice                                  +
-machine.slice                               loaded active active Virtual Machine and Container Slice         +
-system-getty.slice                          loaded active active system-getty.slice                          +
-system-lvm2\x2dpvscan.slice                 loaded active active system-lvm2\x2dpvscan.slice                 +
-system-sshd\x2dkeygen.slice                 loaded active active system-sshd\x2dkeygen.slice                 +
-system-systemd\x2dfsck.slice                loaded active active system-systemd\x2dfsck.slice                +
-system-systemd\x2dhibernate\x2dresume.slice loaded active active system-systemd\x2dhibernate\x2dresume.slice +
-system-user\x2druntime\x2ddir.slice         loaded active active system-user\x2druntime\x2ddir.slice         +
-system-vncserver.slice                      loaded active active system-vncserver.slice                      +
-system.slice                                loaded active active System Slice                                +
-user-1000.slice                             loaded active active User Slice of UID 1000                      +
-user-42.slice                               loaded active active User Slice of UID 42                        +
-user.slice                                  loaded active active User and Session Slice                     +
  
-LOAD   = Reflects whether the unit definition was properly loaded. +[root@redhat9 ~]# firewall-cmd --get-active-zones 
-ACTIVE = The high-level unit activation state, i.e. generalization of SUB. +work 
-SUB    = The low-level unit activation state, values depend on unit type. +  interfaces: ens18
- +
-13 loaded units listed. Pass --all to see loaded but inactive units, too. +
-To show all installed unit files use 'systemctl list-unit-files'.+
 </code> </code>
  
-L'arborescence des unités de Systemd est la suivante :+Pour ajouter le service **http** à la zone **work**, utilisez la commande suivante :
  
 <code> <code>
-[root@centos8 ~]# systemd-cgls +[root@redhat9 ~]# firewall-cmd --zone=work --add-service=http 
-Control group /: +success 
--.slice + 
-├─user.slice +[root@redhat9 ~]# firewall-cmd --zone=work --list-services 
-│ ├─user-42.slice +cockpit dhcpv6-client http ssh
-│ │ ├─session-c1.scope +
-│ │ │ ├─1317 gdm-session-worker [pam/gdm-launch-environment] +
-│ │ │ ├─1459 /usr/libexec/gdm-wayland-session --register-session gnome-session --autostart /usr/share/gdm/greeter/autostart +
-│ │ │ ├─1856 /usr/libexec/gnome-session-binary --autostart /usr/share/gdm/greeter/autostart +
-│ │ │ ├─1882 /usr/bin/gnome-shell +
-│ │ │ ├─2059 /usr/bin/Xwayland :1024 -rootless -terminate -accessx -core -listen 4 -listen 5 -displayfd 6 +
-│ │ │ ├─2132 ibus-daemon --xim --panel disable +
-│ │ │ ├─2135 /usr/libexec/ibus-dconf +
-│ │ │ ├─2138 /usr/libexec/ibus-x11 --kill-daemon +
-│ │ │ ├─2251 /usr/libexec/gsd-xsettings +
-│ │ │ ├─2261 /usr/libexec/gsd-a11y-settings +
-│ │ │ ├─2268 /usr/libexec/gsd-clipboard +
-│ │ │ ├─2271 /usr/libexec/gsd-color +
-│ │ │ ├─2272 /usr/libexec/gsd-datetime +
-│ │ │ ├─2273 /usr/libexec/gsd-housekeeping +
-│ │ │ ├─2274 /usr/libexec/gsd-keyboard +
-│ │ │ ├─2275 /usr/libexec/gsd-media-keys +
-│ │ │ ├─2280 /usr/libexec/gsd-mouse +
-│ │ │ ├─2281 /usr/libexec/gsd-power +
-│ │ │ ├─2283 /usr/libexec/gsd-print-notifications +
-│ │ │ ├─2284 /usr/libexec/gsd-rfkill +
-│ │ │ ├─2285 /usr/libexec/gsd-screensaver-proxy +
-│ │ │ ├─2290 /usr/libexec/gsd-sharing +
-│ │ │ ├─2321 /usr/libexec/gsd-smartcard +
-│ │ │ ├─2328 /usr/libexec/gsd-sound +
-│ │ │ ├─2333 /usr/libexec/gsd-wacom +
-│ │ │ └─2432 /usr/libexec/ibus-engine-simple +
-│ │ └─user@42.service +
-│ │   ├─xdg-permission-store.service +
-│ │   │ └─2170 /usr/libexec/xdg-permission-store +
-│ │   ├─pulseaudio.service +
-│ │   │ └─1455 /usr/bin/pulseaudio --daemonize=no --log-target=journal +
-│ │   ├─init.scope +
-│ │   │ ├─1357 /usr/lib/systemd/systemd --user +
-│ │   │ └─1377 (sd-pam) +
-│ │   ├─at-spi-dbus-bus.service +
-│ │   │ ├─2090 /usr/libexec/at-spi-bus-launcher +
-│ │   │ ├─2095 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 3 +
-│ │   │ └─2098 /usr/libexec/at-spi2-registryd --use-gnome-session +
-│ │   └─dbus.service +
-│ │     ├─1755 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only +
-│ │     └─2143 /usr/libexec/ibus-portal +
-│ └─user-1000.slice +
-│   ├─user@1000.service +
-│   │ ├─gvfs-goa-volume-monitor.service +
-│   │ │ └─2369 /usr/libexec/gvfs-goa-volume-monitor +
-│   │ ├─xdg-permission-store.service +
-│   │ │ └─2191 /usr/libexec/xdg-permission-store +
-│   │ ├─tracker-store.service +
-│   │ │ └─2653 /usr/libexec/tracker-store +
-│   │ ├─evolution-calendar-factory.service +
-│   │ │ ├─2605 /usr/libexec/evolution-calendar-factory +
-│   │ │ └─2706 /usr/libexec/evolution-calendar-factory-subprocess --factory all --bus-name org.gnome.evolution.dataserver.Subprocess.Backend.Calendarx2605x2 --own-path /org/gnome/evolution> +
-│   │ ├─pulseaudio.service +
-│   │ │ └─1456 /usr/bin/pulseaudio --daemonize=no --log-target=journal +
-│   │ ├─gvfs-daemon.service +
-│   │ │ ├─1896 /usr/libexec/gvfsd +
-│   │ │ └─1901 /usr/libexec/gvfsd-fuse /run/user/1000/gvfs -f -o big_writes +
-│   │ ├─evolution-source-registry.service +
-│   │ │ └─2206 /usr/libexec/evolution-source-registry +
-│   │ ├─gvfs-udisks2-volume-monitor.service +
-│   │ │ └─2243 /usr/libexec/gvfs-udisks2-volume-monitor +
-│   │ ├─init.scope +
-│   │ │ ├─1239 /usr/lib/systemd/systemd --user +
-│   │ │ └─1318 (sd-pam) +
-│   │ ├─gvfs-gphoto2-volume-monitor.service +
-│   │ │ └─2269 /usr/libexec/gvfs-gphoto2-volume-monitor +
-│   │ ├─at-spi-dbus-bus.service +
-│   │ │ ├─1964 /usr/libexec/at-spi-bus-launcher +
-│   │ │ ├─1969 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 3 +
-│   │ │ └─1972 /usr/libexec/at-spi2-registryd --use-gnome-session +
-│   │ ├─dbus.service +
-│   │ │ ├─1786 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only +
-│   │ │ ├─2183 /usr/libexec/ibus-portal +
-│   │ │ ├─2201 /usr/libexec/gnome-shell-calendar-server +
-│   │ │ ├─2225 /usr/libexec/goa-daemon +
-│   │ │ ├─2397 /usr/libexec/goa-identity-service +
-│   │ │ └─2721 /usr/libexec/dconf-service +
-│   │ ├─evolution-addressbook-factory.service +
-│   │ │ ├─2727 /usr/libexec/evolution-addressbook-factory +
-│   │ │ └─2771 /usr/libexec/evolution-addressbook-factory-subprocess --factory all --bus-name org.gnome.evolution.dataserver.Subprocess.Backend.AddressBookx2727x2 --own-path /org/gnome/evo> +
-│   │ ├─gvfs-mtp-volume-monitor.service +
-lines 44-86+
 </code> </code>
  
-En utilisant Systemdplusieurs ressources peuvent être limitées :+Pour supprimer le service **http** de la zone **work**utilisez la commande suivante :
  
-  * **CPUShares** - par défault 1024, +<code> 
-  * **MemoryLimit** limite exprimée en Mo ou en Go. Pas de valeur par défaut, +[root@redhat9 ~]# firewall-cmd --zone=work --remove-service=http 
-  * **BlockIOWeight** valeur entre 10 et 1000. Pas de valeur par défaut, +success
-  * **StartupCPUShares** comme CPUShares mais uniquement appliqué pendant le démarrage, +
-  * **StartupBlockIOWeight** comme BlockIOWeight mais uniquement appliqué pendant le démarrage, +
-  * **CPUQuota** - utilisé pour limiter le temps CPU, même quand le système ne fait rien.+
  
-<WRAP center round important 60%> +[root@redhat9 ~]# firewall-cmd --zone=work --list-services 
-**Important** : Consultez le manuel systemd.resource-control(5) pour voir les paramètres CGroup qui peuvent être passés à systemctl. +cockpit dhcpv6-client ssh 
-</WRAP>+</code>
  
-===Limitation de la Mémoire===+Pour ajouter un nouveau bloc ICMP, utilisez la commande suivante :
  
-Commencez par créer le script **hello-world.sh** qui servira à générer un processus pour travailler avec les CGroups :+<code> 
 +[root@redhat9 ~]# firewall-cmd --zone=work --add-icmp-block=echo-reply 
 +success
  
-<code> +[root@redhat9 ~]# firewall-cmd --zone=work --list-icmp-blocks 
-[root@centos8 ~]# vi hello-world.sh +echo-reply
-[root@centos8 ~]# cat hello-world.sh +
-#!/bin/bash +
-while [ 1 ]; do +
-        echo "hello world" +
-        sleep 360 +
-done+
 </code> </code>
  
-Rendez le script exécutable et testez-le :+Pour supprimer un bloc ICMP, utilisez la commande suivante :
  
 <code> <code>
-[root@centos8 ~]# chmod u+x hello-world.sh +[root@redhat9 ~]# firewall-cmd --zone=work --remove-icmp-block=echo-reply 
-[root@centos8 ~]# ./hello-world.sh +success
-hello world +
-^C +
-</code>+
  
-Créez maintenant un CGroup dans le sous-système **memory** appelé **helloworld** :+[root@redhat9 ~]# firewall-cmd --zone=work --list-icmp-blocks
  
-<code> +[root@redhat9 ~]#
-[root@centos8 ~]# mkdir /sys/fs/cgroup/memory/helloworld+
 </code> </code>
  
-Par défaut, ce CGroup héritera de l'ensemble de la mémoire disponible. Pour éviter celacréez maintenant une limite de **40000000** octets pour ce CGroup :+Pour ajouter le port 591/tcp à la zone workutilisez la commande suivante :
  
 <code> <code>
-[root@centos8 ~]# echo 40000000 > /sys/fs/cgroup/memory/helloworld/memory.limit_in_bytes +[root@redhat9 ~]# firewall-cmd --zone=work --add-port=591/tcp 
-[root@centos8 ~]# cat /sys/fs/cgroup/memory/helloworld/memory.limit_in_bytes +success 
-39997440+ 
 +[root@redhat9 ~]# firewall-cmd --zone=work --list-ports 
 +591/tcp
 </code> </code>
  
-<WRAP center round important 60%> +Pour supprimer le port 591/tcp à la zone work, utilisez la commande suivante :
-**Important** - Notez que les 40 000 000 demandés sont devenus 39 997 440 ce qui correspond à un nombre entier de pages mémoire du noyau de 4Ko. ( 39 997 440 / 4096 = 9 765 ). +
-</WRAP> +
- +
-Lancez maintenant le script **helloworld.sh** +
  
 <code> <code>
-[root@centos8 ~]# ./hello-world.sh & +[root@redhat9 ~]# firewall-cmd --zone=work --remove-port=591/tcp 
-[1] 35148+success
  
-[root@centos8 ~]# hello world +[root@redhat9 ~]# firewall-cmd --zone=work --list-ports
-[Entrée]+
  
-[root@centos8 ~]# ps aux | grep hello-world +[root@redhat9 ~]#
-root       35148  0.0  0.0  12724  2980 pts/1    S    08:48   0:00 /bin/bash ./hello-world.sh +
-root       35151  0.0  0.0  12136  1044 pts/1    S+   08:48   0:00 grep --color=auto hello-world+
 </code> </code>
  
-Notez qu'il n'y a pas de limite de la mémoire, ce qui implique l'héritage par défaut :+Pour créer un nouveau service, il convient de :
  
-<code> +  * copier un fichier existant se trouvant dans le répertoire **/usr/lib/firewalld/services** vers **/etc/firewalld/services**, 
-[root@centos8 ~]# ps -ww -o cgroup 35148 +  * modifier le fichier, 
-CGROUP +  * recharger la configuration de firewalld, 
-12:memory:/user.slice/user-1000.slice/session-7.scope,7:devices:/user.slice,4:pids:/user.slice/user-1000.slice/session-7.scope,2:blkio:/user.slice,1:name=systemd:/user.slice/user-1000.slice/session-7.scope +  * vérifier que firewalld voit le nouveau service.
-</code>+
  
-Insérer le PID de notre script dans le CGroup **helloworld** :+Par exemple :
  
 <code> <code>
-[root@centos8 ~]# echo 35148 > /sys/fs/cgroup/memory/helloworld/cgroup.procs +[root@redhat9 ~]# cp /usr/lib/firewalld/services/http.xml /etc/firewalld/services/filemaker.xml
-</code>+
  
-Notez maintenant l'héritage de la limitation de la mémoire - **12:memory:/helloworld** :+[root@redhat9 ~]# vi /etc/firewalld/services/filemaker.xml
  
-<code> +[root@redhat9 ~]# cat /etc/firewalld/services/filemaker.xml 
-[root@centos8 ~]# ps -ww -o cgroup 35148 +<?xml version="1.0" encoding="utf-8"?> 
-CGROUP +<service> 
-12:memory:/helloworld,7:devices:/user.slice,4:pids:/user.slice/user-1000.slice/session-7.scope,2:blkio:/user.slice,1:name=systemd:/user.slice/user-1000.slice/session-7.scope +  <short>FileMakerPro</short> 
-</code>+  <description>fichier de service firewalld pour FileMaker Pro</description> 
 +  <port protocol="tcp" port="591"/> 
 +</service>
  
-Constatez ensuite l'occupation mémoire réelle :+[root@redhat9 ~]# firewall-cmd --reload 
 +success
  
-<code> +[root@redhat9 ~]# firewall-cmd --get-services | grep filemaker 
-[root@centos8 ~]# cat /sys/fs/cgroup/memory/helloworld/memory.usage_in_bytes +RH-Satellite-6 RH-Satellite-6-capsule afp amanda-client amanda-k5-client amqp amqps apcupsd audit ausweisapp2 bacula bacula-client bareos-director bareos-filedaemon bareos-storage bb bgp bitcoin bitcoin-rpc bitcoin-testnet bitcoin-testnet-rpc bittorrent-lsd ceph ceph-exporter ceph-mon cfengine checkmk-agent cockpit collectd condor-collector cratedb ctdb dds dds-multicast dds-unicast dhcp dhcpv6 dhcpv6-client distcc dns dns-over-tls docker-registry docker-swarm dropbox-lansync elasticsearch etcd-client etcd-server filemaker finger foreman foreman-proxy freeipa-4 freeipa-ldap freeipa-ldaps freeipa-replication freeipa-trust ftp galera ganglia-client ganglia-master git gpsd grafana gre high-availability http http3 https ident imap imaps ipfs ipp ipp-client ipsec irc ircs iscsi-target isns jenkins kadmin kdeconnect kerberos kibana klogin kpasswd kprop kshell kube-api kube-apiserver kube-control-plane kube-control-plane-secure kube-controller-manager kube-controller-manager-secure kube-nodeport-services kube-scheduler kube-scheduler-secure kube-worker kubelet kubelet-readonly kubelet-worker ldap ldaps libvirt libvirt-tls lightning-network llmnr llmnr-client llmnr-tcp llmnr-udp managesieve matrix mdns memcache minidlna mongodb mosh mountd mqtt mqtt-tls ms-wbt mssql murmur mysql nbd nebula netbios-ns netdata-dashboard nfs nfs3 nmea-0183 nrpe ntp nut openvpn ovirt-imageio ovirt-storageconsole ovirt-vmconsole plex pmcd pmproxy pmwebapi pmwebapis pop3 pop3s postgresql privoxy prometheus prometheus-node-exporter proxy-dhcp ps2link ps3netsrv ptp pulseaudio puppetmaster quassel radius rdp redis redis-sentinel rpc-bind rquotad rsh rsyncd rtsp salt-master samba samba-client samba-dc sane sip sips slp smtp smtp-submission smtps snmp snmptls snmptls-trap snmptrap spideroak-lansync spotify-sync squid ssdp ssh steam-streaming svdrp svn syncthing syncthing-gui syncthing-relay synergy syslog syslog-tls telnet tentacle tftp tile38 tinc tor-socks transmission-client upnp-client vdsm vnc-server warpinator wbem-http wbem-https wireguard ws-discovery ws-discovery-client ws-discovery-tcp ws-discovery-udp wsman wsmans xdmcp xmpp-bosh xmpp-client xmpp-local xmpp-server zabbix-agent zabbix-server zerotier
-274432+
 </code> </code>
  
-Tuez le script **hello-world.sh** : +====4.4 - La Configuration Avancée de firewalld====
  
-<code> +La configuration de base de firewalld ne permet que la configuration des zones, services, blocs ICMP et les ports non-standardCependant firewalld peut également être configuré avec des **Rich Rules** ou **//Règles Riches//**. Rich Rules ou Règles Riches évaluent des **critères** pour ensuite entreprendre une **action**
-[root@centos8 ~]# kill 35148 +
-[root@centos8 ~]# ps aux | grep hello-world +
-root       35307  0.0  0.0  12136  1112 pts/1    S+   08:55   0:00 grep --color=auto hello-world +
-[1]+  Terminated              ./hello-world.sh +
-</code>+
  
-Créez un second CGroup beaucoup plus restrictif :+Les **Critères** sont :
  
-<code+  * **source address="<adresse_IP>"** 
-[root@centos8 ~]# mkdir /sys/fs/cgroup/memory/helloworld1 +  * **destination address="<adresse_IP>"**, 
-[root@centos8 ~]# echo 6000 /sys/fs/cgroup/memory/helloworld1/memory.limit_in_bytes +  * **rule port port="<numéro_du_port>"**, 
-[root@centos8 ~]# cat /sys/fs/cgroup/memory/helloworld1/memory.limit_in_bytes +  * **service name=<nom_d'un_sevice_prédéfini>**.
-4096 +
-</code>+
  
-Relancez le script **hello-world.sh** et insérez-le dans le nouveau CGroup :+Les **Actions** sont :
  
-<code+  * **accept**, 
-[root@centos8 ~]# ./hello-world.sh & +  * **reject**, 
-[1] 35389+    * une Action reject peut être associée avec un message d'erreur spécifique par la clause **type="<type_d'erreur>**, 
 +  * **drop**.
  
-[root@centos8 ~]# hello world +Saisissez la commande suivante pour ouvrir le port 80 :
-[Entrée]+
  
-[root@centos8 ~]# echo 35389 > /sys/fs/cgroup/memory/helloworld1/cgroup.procs+<code> 
 +[root@redhat9 ~]# firewall-cmd --add-rich-rule='rule port port="80" protocol="tcp" accept' 
 +success
 </code> </code>
  
-Attendez la prochaine sortie de **hello world** sur le canal standard puis constatez que le script s'arrête :+<WRAP center round important 50%> 
 +**Important** - Notez que la Rich Rule doit être entourée de caractères **'**.  
 +</WRAP> 
 + 
 +<WRAP center round important 50%> 
 +**Important** - Notez que la Rich Rule a créé deux règles, une pour IPv4 et une deuxième pour IPv6. Une règle peut être créée pour IPv4 seul en incluant le Critère **family=ipv4**. De la même façon, une règle peut être créée pour IPv6 seul en incluant le Critère **family=ipv6**. 
 +</WRAP> 
 + 
 +Cette nouvelle règle est écrite en mémoire mais non pas sur disque. Pour l'écrire sur disque dans le fichier zone se trouvant dans **/etc/firewalld**, il faut ajouter l'option **--permanent** :
  
 <code> <code>
-[root@centos8 ~]# hello world +[root@redhat9 ~]# firewall-cmd --add-rich-rule='rule port port="80" protocol="tcp" accept' --permanent 
-[Entrée+success 
-[1]+  Killed                  ./hello-world.sh+ 
 +[root@redhat9 ~]# cat /etc/firewalld/zones/work.xml 
 +<?xml version="1.0" encoding="utf-8"?> 
 +<zone> 
 +  <short>Work</short> 
 +  <description>For use in work areasYou mostly trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description> 
 +  <service name="ssh"/> 
 +  <service name="dhcpv6-client"/> 
 +  <service name="cockpit"/> 
 +  <rule> 
 +    <port port="80" protocol="tcp"/> 
 +    <accept/> 
 +  </rule> 
 +  <forward/> 
 +</zone>
 </code> </code>
  
-===La Commande cgcreate===+<WRAP center round important 50%> 
 +**Important** - Attention ! La règle ajoutée avec l'option --permanent n'est pas prise en compte imédiatement mais uniquement au prochain redémmarge. Pour qu'une règle soit appliquée immédiatement **et** être écrite sur disque, il faut saisir la commande deux fois dont une avec l'option --permanent et l'autre sans l'option --permanent. 
 +</WRAP>
  
-Cette commande permet la création d'un CGroup :+Redémarrez le service **firewalld** :
  
 <code> <code>
-[root@centos8 ~]# cgcreate -g memory:helloworld2 +[root@redhat9 ~]# systemctl restart firewalld.service
-[root@centos8 ~]# ls -l /sys/fs/cgroup/memory/helloworld2/ +
-total 0 +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 cgroup.clone_children +
---w--w----. 1 root root 0 Jul 13 10:39 cgroup.event_control +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 cgroup.procs +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.failcnt +
---w--w----. 1 root root 0 Jul 13 10:39 memory.force_empty +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.kmem.failcnt +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.kmem.limit_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.kmem.max_usage_in_bytes +
--r--r--r--. 1 root root 0 Jul 13 10:39 memory.kmem.slabinfo +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.kmem.tcp.failcnt +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.kmem.tcp.limit_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.kmem.tcp.max_usage_in_bytes +
--r--r--r--. 1 root root 0 Jul 13 10:39 memory.kmem.tcp.usage_in_bytes +
--r--r--r--. 1 root root 0 Jul 13 10:39 memory.kmem.usage_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.limit_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.max_usage_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.memsw.failcnt +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.memsw.limit_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.memsw.max_usage_in_bytes +
--r--r--r--. 1 root root 0 Jul 13 10:39 memory.memsw.usage_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.move_charge_at_immigrate +
--r--r--r--. 1 root root 0 Jul 13 10:39 memory.numa_stat +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.oom_control +
-----------. 1 root root 0 Jul 13 10:39 memory.pressure_level +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.soft_limit_in_bytes +
--r--r--r--. 1 root root 0 Jul 13 10:39 memory.stat +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.swappiness +
--r--r--r--. 1 root root 0 Jul 13 10:39 memory.usage_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.use_hierarchy +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 notify_on_release +
--rw-rw-r--1 root root 0 Jul 13 10:39 tasks+
 </code> </code>
  
-Il n'existe cependant pas de commande pour affecter une limitation de la mémoire :+Pour visualiser cette règle dans la configuration de firewalld, il convient de saisir la commande suivante :
  
 <code> <code>
-[root@centos8 ~]# echo 40000000 > /sys/fs/cgroup/memory/helloworld2/memory.limit_in_bytes+[root@redhat9 ~]# firewall-cmd --zone=work --list-all 
 +work (active) 
 +  target: default 
 +  icmp-block-inversion: no 
 +  interfaces: ens18 
 +  sources:  
 +  services: cockpit dhcpv6-client ssh 
 +  ports:  
 +  protocols:  
 +  forward: yes 
 +  masquerade: no 
 +  forward-ports:  
 +  source-ports:  
 +  icmp-blocks:  
 +  rich rules:  
 +        rule port port="80" protocol="tcp" accept
 </code> </code>
  
-==La Commande cgexec== +Notez que la Rich Rule est créée dans la Zone par Défaut. Il est possible de créer une Rich Rule dans une autre zone en utilisant l'option **--zone=<zone>** de la commande firewall-cmd :
- +
-Cette commande permet d'insérer la limitation dans le CGroup **et** de lancer le script en une seule ligne :+
  
 <code> <code>
-[root@centos8 ~]# cgexec -g memory:helloworld2 ./hello-world.sh & +[root@redhat9 ~]# firewall-cmd --zone=public --add-rich-rule='rule port port="80" protocol="tcp" accept' 
-[1] 37670 +success
- +
-[root@centos8 ~]# hello world +
-[Entrée]+
  
-[root@centos8 ~]# +[root@redhat9 ~]# firewall-cmd --zone=public --list-all 
 +public 
 +  target: default 
 +  icmp-block-inversion: no 
 +  interfaces:  
 +  sources:  
 +  services: cockpit dhcpv6-client ssh 
 +  ports:  
 +  protocols:  
 +  forward: yes 
 +  masquerade: no 
 +  forward-ports:  
 +  source-ports:  
 +  icmp-blocks:  
 +  rich rules:  
 +        rule port port="80" protocol="tcp" accept
 </code> </code>
  
-==La Commande cgdelete== 
  
-Une fois le script terminécette commande permet de supprimer le cgroup :+Pour supprimer une Rich Ruleil faut copier la ligne entière la concernant qui se trouve dans la sortie de la commande **firewall-cmd --list-all-zones** :
  
 <code> <code>
-[root@centos8 ~]# ps aux | grep *.sh +[root@redhat9 ~]# firewall-cmd --zone=public --remove-rich-rule='rule port port="80" protocol="tcp" accept' 
-root       37670  0.0  0.0  12724  3112 pts/1    S    10:41   0:00 /bin/bash ./hello-world.sh +success
-root       37685  0.0  0.0  12136  1148 pts/1    S+   10:42   0:00 grep --color=auto hello-world.sh+
  
-[root@centos8 ~]# kill 37670 +[root@redhat9 ~]# firewall-cmd --zone=public --list-all 
- +public 
-root@centos8 ~]# ps aux | grep *.sh +  target: default 
-root       37726  0.0  0.0  12136  1156 pts/1    R+   10:43   0:00 grep --color=auto hello-world.sh +  icmp-block-inversion: no 
-[1]+  Terminated              cgexec -g memory:helloworld2 ./hello-world.sh +  interfaces:  
- +  sources:  
-[root@centos8 ~]# cgdelete memory:helloworld2 +  servicescockpit dhcpv6-client ssh 
- +  ports:  
-[root@centos8 ~]# ls -l /sys/fs/cgroup/memory/helloworld2/ +  protocols:  
-lscannot access '/sys/fs/cgroup/memory/helloworld2/'No such file or directory+  forwardyes 
 +  masquerade: no 
 +  forward-ports:  
 +  source-ports 
 +  icmp-blocks:  
 +  rich rules
 </code> </code>
  
-==Le Fichier /etc/cgconfig.conf==+====4.5 - Le mode Panic de firewalld====
  
-Afin de les rendre persistants, il convient d'éditer le fichier **/etc/cgconfig.conf** :+Le mode Panic de firewalld permet de bloquer tout le trafic avec une seule commandePour connaître l'état du mode Panic, utilisez la commande suivante :
  
 <code> <code>
-[root@centos8 ~]# vi /etc/cgconfig.conf +[root@redhat9 ~]# firewall-cmd --query-panic 
-[root@centos8 ~]# cat /etc/cgconfig.conf +no
-+
-#  Copyright IBM Corporation. 2007 +
-+
-#  Authors:     Balbir Singh <balbir@linux.vnet.ibm.com> +
-#  This program is free software; you can redistribute it and/or modify it +
-#  under the terms of version 2.1 of the GNU Lesser General Public License +
-#  as published by the Free Software Foundation. +
-+
-#  This program is distributed in the hope that it would be useful, but +
-#  WITHOUT ANY WARRANTY; without even the implied warranty of +
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +
-+
-+
-# By default, we expect systemd mounts everything on boot, +
-# so there is not much to do. +
-# See man cgconfig.conf for further details, how to create groups +
-# on system boot using this file. +
-group helloworld2 { +
-        cpu { +
-                cpu.shares = 100; +
-        } +
-        memory { +
-                memory.limit_in_bytes = 40000; +
-        } +
-}+
 </code> </code>
  
-<WRAP center round important 60%> +Pour activer le mode Panicil convient de saisir la commande suivante :
-**Important** - Notez la création de **deux** limitationsune de 40 000 octets de mémoire et l'autre de **100** **cpu.shares**. Cette dernière est une valeur exprimée sur 1 024, où 1 024 représente 100% du temps CPU. La limite fixée est donc equivalente à 9,77% du temps CPU. +
-</WRAP> +
- +
-Créez donc les deux CGroups concernés :+
  
 <code> <code>
-[root@centos8 ~]cgcreate -g memory:helloworld2 +firewall-cmd --panic-on
-[root@centos8 ~]# ls -l /sys/fs/cgroup/memory/helloworld2/ +
-total 0 +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 cgroup.clone_children +
---w--w----. 1 root root 0 Jul 13 10:46 cgroup.event_control +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 cgroup.procs +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.failcnt +
---w--w----. 1 root root 0 Jul 13 10:46 memory.force_empty +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.kmem.failcnt +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.kmem.limit_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.kmem.max_usage_in_bytes +
--r--r--r--. 1 root root 0 Jul 13 10:46 memory.kmem.slabinfo +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.kmem.tcp.failcnt +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.kmem.tcp.limit_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.kmem.tcp.max_usage_in_bytes +
--r--r--r--. 1 root root 0 Jul 13 10:46 memory.kmem.tcp.usage_in_bytes +
--r--r--r--. 1 root root 0 Jul 13 10:46 memory.kmem.usage_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.limit_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.max_usage_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.memsw.failcnt +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.memsw.limit_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.memsw.max_usage_in_bytes +
--r--r--r--. 1 root root 0 Jul 13 10:46 memory.memsw.usage_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.move_charge_at_immigrate +
--r--r--r--. 1 root root 0 Jul 13 10:46 memory.numa_stat +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.oom_control +
-----------. 1 root root 0 Jul 13 10:46 memory.pressure_level +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.soft_limit_in_bytes +
--r--r--r--. 1 root root 0 Jul 13 10:46 memory.stat +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.swappiness +
--r--r--r--. 1 root root 0 Jul 13 10:46 memory.usage_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.use_hierarchy +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 notify_on_release +
--rw-rw-r--. 1 root root 0 Jul 13 10:46 tasks+
 </code> </code>
  
-<code> +Pour désactiver le mode Panic, il convient de saisir la commande suivante :
-[root@centos8 ~]# cgcreate -g cpu:helloworld2 +
-[root@centos8 ~]# ls -l /sys/fs/cgroup/cpu/helloworld2/ +
-total 0 +
--rw-rw-r--. 1 root root 0 Jul 13 10:47 cgroup.clone_children +
--rw-rw-r--. 1 root root 0 Jul 13 10:47 cgroup.procs +
--r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.stat +
--rw-rw-r--. 1 root root 0 Jul 13 10:47 cpuacct.usage +
--r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.usage_all +
--r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.usage_percpu +
--r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.usage_percpu_sys +
--r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.usage_percpu_user +
--r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.usage_sys +
--r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.usage_user +
--rw-rw-r--. 1 root root 0 Jul 13 10:47 cpu.cfs_period_us +
--rw-rw-r--. 1 root root 0 Jul 13 10:47 cpu.cfs_quota_us +
--rw-rw-r--. 1 root root 0 Jul 13 10:47 cpu.rt_period_us +
--rw-rw-r--. 1 root root 0 Jul 13 10:47 cpu.rt_runtime_us +
--rw-rw-r--. 1 root root 0 Jul 13 10:47 cpu.shares +
--r--r--r--. 1 root root 0 Jul 13 10:47 cpu.stat +
--rw-rw-r--. 1 root root 0 Jul 13 10:47 notify_on_release +
--rw-rw-r--. 1 root root 0 Jul 13 10:47 tasks +
-</code> +
- +
-==La Commande cgconfigparser== +
- +
-Appliquez le contenu du fichier **/etc/cgconfig.conf** grâce à l'utilisation de la commande **cgconfigparser** :+
  
 <code> <code>
-[root@centos8 ~]cgconfigparser -l /etc/cgconfig.conf +firewall-cmd --panic-off
-[root@centos8 ~]# cat /sys/fs/cgroup/memory/helloworld2/memory.limit_in_bytes +
-36864 +
-[root@centos8 ~]# cat /sys/fs/cgroup/cpu/helloworld2/cpu.shares +
-100+
 </code> </code>
  
 ----- -----
-Copyright © 2023 Hugh Norris.+Copyright © 2024 Hugh Norris.<br><br>
Menu