Différences

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

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
elearning:workbooks:centos:6:avance:l107 [2022/04/23 11:16] – created adminelearning:workbooks:centos:6:avance:l107 [2023/02/15 15:56] (Version actuelle) admin
Ligne 1: Ligne 1:
 ~~PDF:LANDSCAPE~~ ~~PDF:LANDSCAPE~~
  
-Version : **2022.01**+Version : **2021.01**
  
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
  
-======LCF307 - Gestion du Noyau et des Quotas======+======LCF306 - Gestion de l'Authentification======
  
 =====Contenu du Module===== =====Contenu du Module=====
  
-  * **LCF307 - Gestion du Noyau et des Quotas**+  * **LCF306 - Gestion de l'Authentification**
     * Contenu du Module     * Contenu du Module
-    * Rôle du noyau +    * Le Problématique 
-    * Compilation et installation du noyau et des modules +      * LAB #1 - John the Ripper 
-      * Déplacer /home +    * Surveillance Sécuritaire 
-      * Créer un Nouveau Noyau +      * La commande last 
-      * Préparer l'Arborescence Source du Noyau +      * La commande lastlog 
-      * Paramétrage du noyau +      * La Commande lastb 
-      Compiler le Noyau +      * /var/log/secure 
-      * Installer le Nouveau Noyau +    Les Contre-Mesures 
-    * Gestion des Quotas +      * LAB #2 - Renforcer la sécurité des comptes 
-      * La Commande quotacheck +    * LAB #3 - PAM sous RHEL/CentOS 7 
-      * La Commande edquota +      * Bloquer un Compte après N Echecs de Connexion 
-      * La Commande quotaon +      * Configuration 
-      * La Commande repquota +    * LAB #4 - Mise en place du Système de Prévention d'Intrusion Fail2Ban 
-      * La Commande quota +      * Installation 
-      * La Commande warnquota+      * Configuration 
 +      * Le répertoire /etc/fail2ban 
 +        * Le fichier fail2ban.conf 
 +        * Le répertoire /etc/fail2ban/filter.d/ 
 +        * Le répertoire /etc/fail2ban/action.d/ 
 +      * Commandes 
 +        * Activer et Démarrer le Serveur 
 +        * Utiliser la Commande Fail2Ban-server 
 +        * Ajouter un Prison
  
-=====Rôle du noyau=====+=====Le Problématique=====
  
-Le noyau ou //kernel// est la partie du système d'exploitation qui gère les entrées/sorties avec des périphériquesDans certains cas il est préférable de recompiler le noyau de LinuxLa motivation de cette recompilation peut être :+Un pirate peut utiliser un logiciel de **crackage** pour tenter de découvrir un mot de passe. Le plus connu est **[[http://www.dawal.org/article.php3?id_article=48|John The Ripper]]**.
  
-  * la diminution de la taille du noyau, +Le principe de ces logiciels est simples - le logiciel utilise des dictionnaires de mots de passe qui sont utilisés le uns après les autres à une vitesse qui peut atteindre des milliers par seconde.
-  * la prise en charge de nouveau matériel, +
-  * l'ajout de fonctionnalités, +
-  * l'optimisation du code, +
-  * la correction de bogues, +
-  * le besoin d'une fonctionnalité expérimentale.+
  
-Commencez par identifier le noyau utilisé par votre machine :+====LAB #1 - John the Ripper====
  
-<code> +===Installation===
-[root@centos7 ~]# uname -r +
-3.10.0-327.13.1.el7.x86_64 +
-</code>+
  
-Dans le cas d'une utilisation courante de Linux, il est cependant préférable de faire appel aux **modules**. Les modules se trouvent dans le répertoire **/lib/modules/<version-du-noyau>** :+Créez le script suivant dans un terminal de RHEL/CentOS 7 en tant que root :
  
 <code> <code>
-[root@centos7 ~]# ls /lib/modules/`uname -r`+[trainee@centos7 ~]$ su - 
-build   modules.alias      modules.builtin      modules.dep.bin  modules.modesetting  modules.softdep      source   weak-updates +Password: fenestros 
-extra   modules.alias.bin  modules.builtin.bin  modules.devname  modules.networking   modules.symbols      updates +Last login: Mon Apr 23 17:23:14 CEST 2018 on tty1 
-kernel  modules.block      modules.dep          modules.drm      modules.order        modules.symbols.bin  vdso+[root@centos7 ~]# vi john.sh 
 +[root@centos7 ~]# cat john.sh 
 +#!/bin/bash 
 +# Centos 7 John the Ripper Installation 
 +yum -y install wget gpgme 
 +yum -y group install "Development Tools" 
 +cd 
 +wget http://www.openwall.com/john/j/john-1.8.0.tar.xz 
 +wget http://www.openwall.com/john/j/john-1.8.0.tar.xz.sign 
 +wget http://www.openwall.com/signatures/openwall-signatures.asc 
 +gpg --import openwall-signatures.asc 
 +gpg --verify john-1.8.0.tar.xz.sign 
 +tar xvfJ john-1.8.0.tar.xz 
 +cd john-1.8.0/src 
 +make clean linux-x86-64 
 +cd ../run/ 
 +./john --test 
 +#password dictionnary download 
 +wget -O - http://mirrors.kernel.org/openwall/wordlists/all.gz | gunzip -c > openwall.dico
 </code> </code>
  
-Les commandes pour manipuler les modules sont : +Rendez-le exécutable :
- +
-  * insmod +
-  * rmmod +
-  * lsmod +
-  * modprobe +
- +
-Par exemple :+
  
 <code> <code>
-[root@centos7 ~]# lsmod +[root@centos7 ~]# chmod u+x john.sh 
-Module                  Size  Used by +
-ip6t_rpfilter          12546  1  +
-ip6t_REJECT            12939  2  +
-ipt_REJECT             12541  2  +
-xt_conntrack           12760  9  +
-ebtable_nat            12807  0  +
-ebtable_broute         12731  0  +
-bridge                119562  1 ebtable_broute +
-stp                    12976  1 bridge +
-llc                    14552  2 stp,bridge +
-ebtable_filter         12827  0  +
-ebtables               30913  3 ebtable_broute,ebtable_nat,ebtable_filter +
-ip6table_nat           12864  1  +
-nf_conntrack_ipv6      18738  6  +
-nf_defrag_ipv6         34768  1 nf_conntrack_ipv6 +
-nf_nat_ipv6            14131  1 ip6table_nat +
-ip6table_mangle        12700  1  +
-ip6table_security      12710  1  +
-ip6table_raw           12683  1  +
-ip6table_filter        12815  1  +
-ip6_tables             27025  5 ip6table_filter,ip6table_mangle,ip6table_security,ip6table_nat,ip6table_raw +
-iptable_nat            12875  1  +
-nf_conntrack_ipv4      14862  5  +
-nf_defrag_ipv4         12729  1 nf_conntrack_ipv4 +
-nf_nat_ipv4            14115  1 iptable_nat +
-nf_nat                 26146  2 nf_nat_ipv4,nf_nat_ipv6 +
-nf_conntrack          105745  6 nf_nat,nf_nat_ipv4,nf_nat_ipv6,xt_conntrack,nf_conntrack_ipv4,nf_conntrack_ipv6 +
-iptable_mangle         12695  1  +
-iptable_security       12705  1  +
-iptable_raw            12678  1  +
-iptable_filter         12810  1  +
-dm_mirror              22135  0  +
-dm_region_hash         20862  1 dm_mirror +
-dm_log                 18411  2 dm_region_hash,dm_mirror +
-dm_mod                113292  2 dm_log,dm_mirror +
-crc32_pclmul           13113  0  +
-ghash_clmulni_intel    13259  0  +
-aesni_intel            69884  0  +
-lrw                    13286  1 aesni_intel +
-gf128mul               14951  1 lrw +
-glue_helper            13990  1 aesni_intel +
-snd_intel8x0           38274  1  +
-ablk_helper            13597  1 aesni_intel +
-cryptd                 20359  3 ghash_clmulni_intel,aesni_intel,ablk_helper +
-snd_ac97_codec        130605  1 snd_intel8x0 +
-ac97_bus               12730  1 snd_ac97_codec +
-ppdev                  17671  0  +
-snd_seq                66691  0  +
-snd_seq_device         14356  1 snd_seq +
-snd_pcm               105835  2 snd_ac97_codec,snd_intel8x0 +
-pcspkr                 12718  0  +
-sg                     40721  0  +
-parport_pc             28165  0  +
-parport                42348  2 ppdev,parport_pc +
-snd_timer              29639  2 snd_pcm,snd_seq +
-snd                    83425  8 snd_ac97_codec,snd_intel8x0,snd_timer,snd_pcm,snd_seq,snd_seq_device +
-soundcore              15047  1 snd +
-i2c_piix4              22106  0  +
-video                  24400  0  +
-i2c_core               40582  1 i2c_piix4 +
-nfsd                  302418  1  +
-auth_rpcgss            59343  1 nfsd +
-nfs_acl                12837  1 nfsd +
-lockd                  93600  1 nfsd +
-grace                  13295  2 nfsd,lockd +
-sunrpc                300464  7 nfsd,auth_rpcgss,lockd,nfs_acl +
-ip_tables              27240  5 iptable_security,iptable_filter,iptable_mangle,iptable_nat,iptable_raw +
-xfs                   939662  2  +
-libcrc32c              12644  1 xfs +
-sd_mod                 45497  4  +
-crc_t10dif             12714  1 sd_mod +
-crct10dif_generic      12647  0  +
-sr_mod                 22416  0  +
-cdrom                  42556  1 sr_mod +
-ata_generic            12910  0  +
-pata_acpi              13038  0  +
-ahci                   29907  3  +
-libahci                32031  1 ahci +
-ata_piix               35038  0  +
-crct10dif_pclmul       14289  1  +
-crct10dif_common       12595  3 crct10dif_pclmul,crct10dif_generic,crc_t10dif +
-crc32c_intel           22079  1  +
-serio_raw              13462  0  +
-libata                218730  5 ahci,pata_acpi,libahci,ata_generic,ata_piix +
-e1000                 149323 +
 </code> </code>
  
-Pour ajouter un module, on peut utiliser la commande **insmod** ou **modprobe**. Cette dernière ajoute non seulement le module passé en argument mais également ses dépendances :+Exécutez le script :
  
 <code> <code>
-[root@centos7 ~]# modprobe bonding +[root@centos7 ~]# ./john.sh 
-[root@centos7 ~]# lsmod | more +
-Module                  Size  Used by +
-bonding               136705  0  +
-ip6t_rpfilter          12546  1  +
-ip6t_REJECT            12939  2  +
-ipt_REJECT             12541  2  +
-xt_conntrack           12760  9  +
-ebtable_nat            12807  0  +
-ebtable_broute         12731  0  +
-bridge                119562  1 ebtable_broute +
-stp                    12976  1 bridge +
-llc                    14552  2 stp,bridge +
-ebtable_filter         12827  0  +
-ebtables               30913  3 ebtable_broute,ebtable_nat,ebtable_filter +
-ip6table_nat           12864  1  +
-nf_conntrack_ipv6      18738  6  +
-nf_defrag_ipv6         34768  1 nf_conntrack_ipv6 +
-nf_nat_ipv6            14131  1 ip6table_nat +
-ip6table_mangle        12700  1  +
-ip6table_security      12710  1  +
-ip6table_raw           12683  1  +
-ip6table_filter        12815  1  +
-ip6_tables             27025  5 ip6table_filter,ip6table_mangle,ip6table_securit +
-y,ip6table_nat,ip6table_raw +
---More--+
 </code> </code>
  
-Pour supprimer un module, on peut utiliser la commande **rmmod** ou **modprobe -r**. Cette dernière essaie de supprimer les dépendances non-utilisées :+===Utilisation=== 
 + 
 +Placez-vous dans le répertoire **/root/john-1.8.0/run** :
  
 <code> <code>
-[root@centos7 ~]# modprobe -r bonding +[root@centos7 ~]# cd john-1.8.0/run/
-[root@centos7 ~]# lsmod | more +
-Module                  Size  Used by +
-ip6t_rpfilter          12546   +
-ip6t_REJECT            12939  2  +
-ipt_REJECT             12541  2  +
-xt_conntrack           12760  9  +
-ebtable_nat            12807   +
-ebtable_broute         12731  0  +
-bridge                119562  1 ebtable_broute +
-stp                    12976  1 bridge +
-llc                    14552  2 stp,bridge +
-ebtable_filter         12827  0  +
-ebtables               30913  3 ebtable_broute,ebtable_nat,ebtable_filter +
-ip6table_nat           12864  1  +
-nf_conntrack_ipv6      18738  6  +
-nf_defrag_ipv6         34768  1 nf_conntrack_ipv6 +
-nf_nat_ipv6            14131  1 ip6table_nat +
-ip6table_mangle        12700  1  +
-ip6table_security      12710  1  +
-ip6table_raw           12683  1  +
-ip6table_filter        12815  1  +
-ip6_tables             27025  5 ip6table_filter,ip6table_mangle,ip6table_securit +
-y,ip6table_nat,ip6table_raw +
-iptable_nat            12875  1  +
---More--+
 </code> </code>
  
-Les dépendances des modules sont résolues par la commande **modprobe** grâce aux fichier **/lib/modules/<version-du-noyau>/modules.dep**. Ce dernier peut être créé manuellement grâce à la commande **depmod** :+Utilisez l'utilitare **unshadow** pour créer le fichier des mots de passe :
  
 <code> <code>
-[root@centos7 ~]# more /lib/modules/`uname -r`/modules.dep +[root@centos7 run]# ./unshadow /etc/passwd /etc/shadow > mypasswd
-kernel/arch/x86/kernel/cpu/mcheck/mce-inject.ko: +
-kernel/arch/x86/kernel/test_nx.ko: +
-kernel/arch/x86/crypto/ablk_helper.ko: kernel/crypto/cryptd.ko +
-kernel/arch/x86/crypto/glue_helper.ko: +
-kernel/arch/x86/crypto/camellia-x86_64.ko: kernel/crypto/xts.ko kernel/crypto/lrw.ko kernel/crypto/gf128mul.ko kernel/arch/x86/crypto/glue_helper.ko +
-kernel/arch/x86/crypto/blowfish-x86_64.ko: kernel/crypto/blowfish_common.ko +
-kernel/arch/x86/crypto/twofish-x86_64.ko: kernel/crypto/twofish_common.ko +
-kernel/arch/x86/crypto/twofish-x86_64-3way.ko: kernel/arch/x86/crypto/twofish-x86_64.ko kernel/crypto/twofish_common.ko kernel/crypto/xts.ko kernel/cryp +
-to/lrw.ko kernel/crypto/gf128mul.ko kernel/arch/x86/crypto/glue_helper.ko +
-kernel/arch/x86/crypto/salsa20-x86_64.ko: +
-kernel/arch/x86/crypto/serpent-sse2-x86_64.ko: kernel/crypto/xts.ko kernel/crypto/serpent_generic.ko kernel/crypto/lrw.ko kernel/crypto/gf128mul.ko kern +
-el/arch/x86/crypto/glue_helper.ko kernel/arch/x86/crypto/ablk_helper.ko kernel/crypto/cryptd.ko +
-kernel/arch/x86/crypto/aesni-intel.ko: kernel/crypto/lrw.ko kernel/crypto/gf128mul.ko kernel/arch/x86/crypto/glue_helper.ko kernel/arch/x86/crypto/ablk_ +
-helper.ko kernel/crypto/cryptd.ko +
-kernel/arch/x86/crypto/ghash-clmulni-intel.ko: kernel/crypto/cryptd.ko +
-kernel/arch/x86/crypto/crc32c-intel.ko: +
-kernel/arch/x86/crypto/sha-mb/sha1-mb.ko: kernel/crypto/mcryptd.ko +
-kernel/arch/x86/crypto/crc32-pclmul.ko: +
-kernel/arch/x86/crypto/sha512-ssse3.ko: kernel/crypto/sha512_generic.ko +
-kernel/arch/x86/crypto/crct10dif-pclmul.ko: kernel/crypto/crct10dif_common.ko +
-kernel/arch/x86/crypto/camellia-aesni-avx-x86_64.ko: kernel/arch/x86/crypto/camellia-x86_64.ko kernel/crypto/xts.ko kernel/crypto/lrw.ko kernel/crypto/+
-f128mul.ko kernel/arch/x86/crypto/glue_helper.ko kernel/arch/x86/crypto/ablk_helper.ko kernel/crypto/cryptd.ko +
-kernel/arch/x86/crypto/cast5-avx-x86_64.ko: kernel/crypto/cast5_generic.ko kernel/crypto/cast_common.ko kernel/arch/x86/crypto/ablk_helper.ko kernel/cry +
---More--(0%)+
 </code> </code>
  
-Il est possible d'obtenir des informations sur un module grâce à la commande **modinfo** :+Consultez le fichier **mypasswd** :
  
 <code> <code>
-[root@centos7 ~]# modinfo bonding +[root@centos7 run]# cat mypasswd 
-filename      /lib/modules/3.10.0-327.13.1.el7.x86_64/kernel/drivers/net/bonding/bonding.ko +root:$6$TX12b5lW9UXD8Ld6$l/PjTA.XrBAbsayGCaSFaM5ibLo2xBBeYNCyEdVv9uMUctxq9Q0YBxLwCvS2bCdgr.BeSmXvi6BwD55KKscaJ.:0:0:root:/root:/bin/bash 
-author        Thomas Davis, tadavis@lbl.gov and many others +bin:*:1:1:bin:/bin:/sbin/nologin 
-description   Ethernet Channel Bonding Driver, v3.7.1 +daemon:*:2:2:daemon:/sbin:/sbin/nologin 
-version       3.7.1 +adm:*:3:4:adm:/var/adm:/sbin/nologin 
-license       GPL +lp:*:4:7:lp:/var/spool/lpd:/sbin/nologin 
-alias         rtnl-link-bond +sync:*:5:0:sync:/sbin:/bin/sync 
-rhelversion   7.2 +shutdown:*:6:0:shutdown:/sbin:/sbin/shutdown 
-srcversion    49765A3F5CDFF2C3DCFD8E6 +halt:*:7:0:halt:/sbin:/sbin/halt 
-depends        +mail:*:8:12:mail:/var/spool/mail:/sbin/nologin 
-intree        Y +operator:*:11:0:operator:/root:/sbin/nologin 
-vermagic      3.10.0-327.13.1.el7.x86_64 SMP mod_unload modversions  +games:*:12:100:games:/usr/games:/sbin/nologin 
-signer        CentOS Linux kernel signing key +ftp:*:14:50:FTP User:/var/ftp:/sbin/nologin 
-sig_key       6F:33:78:18:7D:83:CD:18:A4:3B:2E:0A:C4:9A:ED:8A:EF:FC:3A:C7 +nobody:*:99:99:Nobody:/:/sbin/nologin 
-sig_hashalgo  sha256 +avahi-autoipd:!!:170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin 
-parm          max_bonds:Max number of bonded devices (int) +systemd-bus-proxy:!!:999:997:systemd Bus Proxy:/:/sbin/nologin 
-parm          tx_queues:Max number of transmit queues (default = 16) (int) +systemd-network:!!:998:996:systemd Network Management:/:/sbin/nologin 
-parm          num_grat_arp:Number of peer notifications to send on failover event (alias of num_unsol_na) (int) +dbus:!!:81:81:System message bus:/:/sbin/nologin 
-parm          num_unsol_na:Number of peer notifications to send on failover event (alias of num_grat_arp) (int) +polkitd:!!:997:995:User for polkitd:/:/sbin/nologin 
-parm          miimon:Link check interval in milliseconds (int) +abrt:!!:173:173::/etc/abrt:/sbin/nologin 
-parm          updelay:Delay before considering link up, in milliseconds (int) +usbmuxd:!!:113:113:usbmuxd user:/:/sbin/nologin 
-parm          downdelay:Delay before considering link down, in milliseconds (int) +colord:!!:996:993:User for colord:/var/lib/colord:/sbin/nologin 
-parm          use_carrier:Use netif_carrier_ok (vs MII ioctls) in miimon; 0 for off, 1 for on (default) (int) +libstoragemgmt:!!:995:992:daemon account for libstoragemgmt:/var/run/lsm:/sbin/nologin 
-parm          mode:Mode of operation; 0 for balance-rr, 1 for active-backup, 2 for balance-xor, 3 for broadcast, 4 for 802.3ad, 5 for balance-tlb, 6 for balance-alb (charp) +setroubleshoot:!!:994:991::/var/lib/setroubleshoot:/sbin/nologin 
-parm          primary:Primary network device to use (charp) +rpc:!!:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin 
-parm          primary_reselect:Reselect primary slave once it comes up; 0 for always (default), 1 for only if speed of primary is better, 2 for only on active slave failure (charp) +rtkit:!!:172:172:RealtimeKit:/proc:/sbin/nologin 
-parm          lacp_rate:LACPDU tx rate to request from 802.3ad partner; 0 for slow, 1 for fast (charp) +chrony:!!:993:990::/var/lib/chrony:/sbin/nologin 
-parm          ad_select:803.ad aggregation selection logic; 0 for stable (default), 1 for bandwidth, 2 for count (charp) +unbound:!!:992:989:Unbound DNS resolver:/etc/unbound:/sbin/nologin 
-parm          min_links:Minimum number of available links before turning on carrier (int) +tss:!!:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin 
-parm          xmit_hash_policy:balance-xor and 802.3ad hashing method; 0 for layer 2 (default), 1 for layer 3+4, 2 for layer 2+3, 3 for encap layer 2+3, 4 for encap layer 3+4 (charp) +geoclue:!!:991:988:User for geoclue:/var/lib/geoclue:/sbin/nologin 
-parm          arp_interval:arp interval in milliseconds (int) +ntp:!!:38:38::/etc/ntp:/sbin/nologin 
-parm          arp_ip_target:arp targets in n.n.n.n form (array of charp) +sssd:!!:990:987:User for sssd:/:/sbin/nologin 
-parm          arp_validate:validate src/dst of ARP probes; 0 for none (default), 1 for active, 2 for backup, 3 for all (charp) +rpcuser:!!:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin 
-parm          arp_all_targets:fail on any/all arp targets timeout; 0 for any (default), 1 for all (charp) +nfsnobody:!!:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin 
-parm          fail_over_mac:For active-backup, do not set all slaves to the same MAC; 0 for none (default), 1 for active, 2 for follow (charp) +pulse:!!:171:171:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin 
-parm          all_slaves_active:Keep all frames received on an interface by setting active flag for all slaves; 0 for never (default), 1 for always. (int) +gdm:!!:42:42::/var/lib/gdm:/sbin/nologin 
-parm          resend_igmp:Number of IGMP membership reports to send on link failure (int) +gnome-initial-setup:!!:989:984::/run/gnome-initial-setup/:/sbin/nologin 
-parm          packets_per_slave:Packets to send per slave in balance-rr mode; 0 for a random slave, 1 packet per slave (default), >1 packets per slave. (int) +avahi:!!:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin 
-parm          lp_interval:The number of seconds between instances where the bonding driver sends learning packets to each slaves peer switchThe default is 1. (uint)+postfix:!!:89:89::/var/spool/postfix:/sbin/nologin 
 +sshd:!!:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin 
 +tcpdump:!!:72:72::/:/sbin/nologin 
 +trainee:$6$4PW9kfdOIOmWmSSO$8vikc1pyXgVc.C8xKP5EvIbBwe1fWd3DSvgWGQ5FAr7jwyMCbLQOOWbvomS9z1Q6V8IqZjBSREWafNzOYjKqC0:1000:1000:trainee:/home/trainee:/bin/bash 
 +vboxadd:!!:988:1::/var/run/vboxadd:/bin/false
 </code> </code>
  
-Dernièrement, les fichiers dans le repertoire **/etc/modprobe.d** sont utilisés pour spécifier les options éventuelles à passer aux modules lors de leur chargement ainsi que les alias utilisés pour leur faire référence :+Lancez **john** pour craquer le fichier **mypasswd** :
  
 <code> <code>
-[root@centos7 ~]# ls /etc/modprobe.d +[root@centos7 run]# ./john mypasswd 
-mlx4.conf +Loaded 2 password hashes with 2 different salts (crypt, generic crypt(3) [?/64]) 
- +Press 'q' or Ctrl-C to abort, almost any other key for status 
-[root@centos7 ~]# cat /etc/modprobe.d/mlx4.conf +trainee          (trainee) 
-# This file is intended for users to select the various module options +1g 0:00:00:26 4% 2/3 0.03831g/s 230.1p/s 230.2c/s 230.2C/s Hanson..Kristine 
-# they need for the mlx4 driver On upgrade of the rdma package, +1g 0:00:00:27 4% 2/3 0.03658g/s 230.3p/s 230.4c/s 230.4C/s Ruthless..Tanner 
-# any user made changes to this file are preserved Any changes made +1g 0:00:00:28 4% 2/3 0.03549g/s 230.3p/s 230.3c/s 230.3C/s Bonjour..Blessing 
-# to the libmlx4.conf file in this directory are overwritten on +1g 0:00:00:36 5% 2/3 0.02775g/s 230.6p/s 230.7c/s 230.7C/s dances..olivias 
-# pacakge upgrade+1g 0:00:01:14 10% 2/3 0.01348g/s 231.2p/s 231.2c/s 231.2C/s rabbitrabbit..dennisdennis 
-# +1g 0:00:01:16 11% 2/3 0.01311g/s 231.1p/s 231.2c/s 231.2C/s grahamgraham..sharkshark 
-# Some sample options and what they would do +1g 0:00:01:18 11% 2/3 0.01277g/s 231.2p/s 231.2c/s 231.2C/s reggiereggie..vickivicki 
-# Enable debugging output, device managed flow control, and disable SRIOV +1g 0:00:01:19 11% 2/3 0.01263g/s 231.1p/s 231.1c/s 231.1C/s javierjavier..melvinmelvin 
-#options mlx4_core debug_level=1 log_num_mgm_entry_size=-1 probe_vf=num_vfs=+1g 0:00:01:20 12% 2/3 0.01244g/s 231.2p/s 231.2c/s 231.2C/s goldengolden..dixondixon 
-# +1g 0:00:01:21 12% 2/3 0.01231g/s 231.2p/s 231.2c/s 231.2C/s obiwanobiwan..bytemebyteme 
-# Enable debugging output and create SRIOV devices, but don't attach any of +1g 0:00:01:22 12% 2/3 0.01218g/s 231.1p/s 231.1c/s 231.1C/s suzysuzy..raeb 
-# the child devices to the host, only the parent device +1g 0:00:01:23 12% 2/3 0.01200g/s 231.1p/s 231.2c/s 231.2C/s xilef..ognimalf 
-#options mlx4_core debug_level=1 probe_vf=num_vfs=7 +1g 0:00:01:24 12% 2/3 0.01188g/s 231.1p/s 231.2c/s 231.2C/s auhsoj..trebreh 
-# +1g 0:00:01:25 12% 2/3 0.01171g/s 231.2p/s 231.2c/s 231.2C/s namgib..lareneg 
-# Enable debugging output, SRIOV, and attach one of the SRIOV child devices +1g 0:00:02:34 21% 2/3 0.006482g/s 231.2p/s 231.2c/s 231.2C/s tinker3..ashraf3 
-# in addition to the parent device to the host +[q] <--------------------------------------------------------------------------------------appuyez sur la touche q 
-#options mlx4_core debug_level=1 probe_vf=1 num_vfs=7 +Use the "--show" option to display all of the cracked passwords reliably 
-+Session aborted
-# Enable per priority flow control for send and receive, setting both priority +
-# 1 and 2 as no drop priorities +
-#options mlx4_en pfctx=3 pfcrx=3+
 </code> </code>
  
-=====Compilation et installation du noyau et des modules===== +Consultez la liste des mots de passe craqués :
- +
-Commencez par installer les paquets necessaires :+
  
 <code> <code>
-[root@centos7 ~]# yum install qt3-devel libXi-devel gcc-c++ rpmdevtools ncurses-devel +[root@centos7 run]# ./john --show mypasswd 
-Loaded plugins: fastestmirror, langpacks +trainee:trainee:1000:1000:trainee:/home/trainee:/bin/bash
-Loading mirror speeds from cached hostfile +
- * base: centos.mirrors.ovh.net +
- * extras: centos.mirror.fr.planethoster.net +
- * updates: mirror1.evolution-host.com +
-Resolving Dependencies +
---> Running transaction check +
----> Package gcc-c++.x86_64 0:4.8.5-4.el7 will be installed +
---> Processing Dependencylibstdc++-devel = 4.8.5-4.el7 for packagegcc-c++-4.8.5-4.el7.x86_64 +
----> Package libXi-devel.x86_64 0:1.7.4-2.el7 will be installed +
---> Processing Dependencyxorg-x11-proto-devel for packagelibXi-devel-1.7.4-2.el7.x86_64 +
---> Processing Dependency: pkgconfig(xfixes) for package: libXi-devel-1.7.4-2.el7.x86_64 +
---> Processing Dependency: pkgconfig(xext) for package: libXi-devel-1.7.4-2.el7.x86_64 +
---> Processing Dependency: pkgconfig(x11) for package: libXi-devel-1.7.4-2.el7.x86_64 +
---> Processing Dependency: pkgconfig(inputproto) for package: libXi-devel-1.7.4-2.el7.x86_64 +
----> Package ncurses-devel.x86_64 0:5.9-13.20130511.el7 will be installed +
----> Package qt3-devel.x86_64 0:3.3.8b-51.el7 will be installed +
---> Processing Dependency: qt3 = 3.3.8b-51.el7 for package: qt3-devel-3.3.8b-51.el7.x86_64 +
---> Processing Dependency: mesa-libGLU-devel for package: qt3-devel-3.3.8b-51.el7.x86_64 +
---> Processing Dependency: mesa-libGL-devel for package: qt3-devel-3.3.8b-51.el7.x86_64 +
---> Processing Dependency: libpng-devel for package: qt3-devel-3.3.8b-51.el7.x86_64 +
---> Processing Dependency: libmng-devel for package: qt3-devel-3.3.8b-51.el7.x86_64 +
---> Processing Dependency: libjpeg-devel for package: qt3-devel-3.3.8b-51.el7.x86_64 +
---> Processing Dependency: libXt-devel for package: qt3-devel-3.3.8b-51.el7.x86_64 +
---> Processing Dependency: libXrender-devel for package: qt3-devel-3.3.8b-51.el7.x86_64 +
---> Processing Dependency: libXrandr-devel for package: qt3-devel-3.3.8b-51.el7.x86_64 +
---> Processing Dependency: libXinerama-devel for package: qt3-devel-3.3.8b-51.el7.x86_64 +
---> Processing Dependency: libXft-devel for package: qt3-devel-3.3.8b-51.el7.x86_64 +
---> Processing Dependency: libXcursor-devel for package: qt3-devel-3.3.8b-51.el7.x86_64 +
---> Processing Dependency: libSM-devel for package: qt3-devel-3.3.8b-51.el7.x86_64 +
---> Processing Dependency: libICE-devel for package: qt3-devel-3.3.8b-51.el7.x86_64 +
---> Processing Dependency: freetype-devel for package: qt3-devel-3.3.8b-51.el7.x86_64 +
---> Processing Dependency: fontconfig-devel for package: qt3-devel-3.3.8b-51.el7.x86_64 +
---> Processing Dependency: libqui.so.1()(64bit) for package: qt3-devel-3.3.8b-51.el7.x86_64 +
---> Processing Dependency: libqt-mt.so.3()(64bit) for package: qt3-devel-3.3.8b-51.el7.x86_64 +
---> Processing Dependency: libmng.so.1()(64bit) for package: qt3-devel-3.3.8b-51.el7.x86_64 +
----> Package rpmdevtools.noarch 0:8.3-5.el7 will be installed +
---> Processing Dependency: rpm-build >= 4.4.2.3 for package: rpmdevtools-8.3-5.el7.noarch +
---> Running transaction check +
----> Package fontconfig-devel.x86_64 0:2.10.95-7.el7 will be installed +
---> Processing Dependency: pkgconfig(expat) for package: fontconfig-devel-2.10.95-7.el7.x86_64 +
----> Package freetype-devel.x86_64 0:2.4.11-11.el7 will be installed +
---> Processing Dependency: zlib-devel for package: freetype-devel-2.4.11-11.el7.x86_64 +
----> Package libICE-devel.x86_64 0:1.0.9-2.el7 will be installed +
----> Package libSM-devel.x86_64 0:1.2.2-2.el7 will be installed +
----> Package libX11-devel.x86_64 0:1.6.3-2.el7 will be installed +
---> Processing Dependency: pkgconfig(xcb) >= 1.1.92 for package: libX11-devel-1.6.3-2.el7.x86_64 +
---> Processing Dependency: pkgconfig(xcb) for package: libX11-devel-1.6.3-2.el7.x86_64 +
----> Package libXcursor-devel.x86_64 0:1.1.14-2.1.el7 will be installed +
----> Package libXext-devel.x86_64 0:1.3.3-3.el7 will be installed +
----> Package libXfixes-devel.x86_64 0:5.0.1-2.1.el7 will be installed +
----> Package libXft-devel.x86_64 0:2.3.2-2.el7 will be installed +
----> Package libXinerama-devel.x86_64 0:1.1.3-2.1.el7 will be installed +
----> Package libXrandr-devel.x86_64 0:1.4.2-2.el7 will be installed +
----> Package libXrender-devel.x86_64 0:0.9.8-2.1.el7 will be installed +
----> Package libXt-devel.x86_64 0:1.1.4-6.1.el7 will be installed +
----> Package libjpeg-turbo-devel.x86_64 0:1.2.90-5.el7 will be installed +
----> Package libmng.x86_64 0:1.0.10-14.el7 will be installed +
----> Package libmng-devel.x86_64 0:1.0.10-14.el7 will be installed +
----> Package libpng-devel.x86_64 2:1.5.13-7.el7_2 will be installed +
----> Package libstdc++-devel.x86_64 0:4.8.5-4.el7 will be installed +
----> Package mesa-libGL-devel.x86_64 0:10.6.5-3.20150824.el7 will be installed +
---> Processing Dependency: pkgconfig(xshmfence) >= 1.1 for package: mesa-libGL-devel-10.6.5-3.20150824.el7.x86_64 +
---> Processing Dependency: pkgconfig(libdrm) >= 2.4.38 for package: mesa-libGL-devel-10.6.5-3.20150824.el7.x86_64 +
---> Processing Dependency: pkgconfig(xxf86vm) for package: mesa-libGL-devel-10.6.5-3.20150824.el7.x86_64 +
---> Processing Dependency: pkgconfig(xdamage) for package: mesa-libGL-devel-10.6.5-3.20150824.el7.x86_64 +
---> Processing Dependency: gl-manpages for package: mesa-libGL-devel-10.6.5-3.20150824.el7.x86_64 +
----> Package mesa-libGLU-devel.x86_64 0:9.0.0-4.el7 will be installed +
----> Package qt3.x86_64 0:3.3.8b-51.el7 will be installed +
----> Package rpm-build.x86_64 0:4.11.3-17.el7 will be installed +
---> Processing Dependency: system-rpm-config for package: rpm-build-4.11.3-17.el7.x86_64 +
---> Processing Dependency: perl(Thread::Queue) for package: rpm-build-4.11.3-17.el7.x86_64 +
----> Package xorg-x11-proto-devel.noarch 0:7.7-12.el7 will be installed +
---> Running transaction check +
----> Package expat-devel.x86_64 0:2.1.0-8.el7 will be installed +
----> Package gl-manpages.noarch 0:1.1-7.20130122.el7 will be installed +
----> Package libXdamage-devel.x86_64 0:1.1.4-4.1.el7 will be installed +
----> Package libXxf86vm-devel.x86_64 0:1.1.3-2.1.el7 will be installed +
----> Package libdrm-devel.x86_64 0:2.4.60-3.el7 will be installed +
----> Package libxcb-devel.x86_64 0:1.11-4.el7 will be installed +
---> Processing Dependency: pkgconfig(xau) >= 0.99.2 for package: libxcb-devel-1.11-4.el7.x86_64 +
----> Package libxshmfence-devel.x86_64 0:1.2-1.el7 will be installed +
----> Package perl-Thread-Queue.noarch 0:3.02-2.el7 will be installed +
----> Package redhat-rpm-config.noarch 0:9.1.0-68.el7.centos will be installed +
---> Processing Dependency: dwz >= 0.4 for package: redhat-rpm-config-9.1.0-68.el7.centos.noarch +
---> Processing Dependency: perl-srpm-macros for package: redhat-rpm-config-9.1.0-68.el7.centos.noarch +
----> Package zlib-devel.x86_64 0:1.2.7-15.el7 will be installed +
---> Running transaction check +
----> Package dwz.x86_64 0:0.11-3.el7 will be installed +
----> Package libXau-devel.x86_64 0:1.0.8-2.1.el7 will be installed +
----> Package perl-srpm-macros.noarch 0:1-8.el7 will be installed +
---> Finished Dependency Resolution+
  
-Dependencies Resolved +password hash cracked, left
- +
-======================================================================================================================================================================== +
- Package                                       Arch                            Version                                           Repository                        Size +
-======================================================================================================================================================================== +
-Installing: +
- gcc-c++                                       x86_64                          4.8.5-4.el7                                       base                             7.2 M +
- libXi-devel                                   x86_64                          1.7.4-2.el7                                       base                             105 k +
- ncurses-devel                                 x86_64                          5.9-13.20130511.el7                               base                             713 k +
- qt3-devel                                     x86_64                          3.3.8b-51.el7                                     base                             8.8 M +
- rpmdevtools                                   noarch                          8.3-5.el7                                         base                              97 k +
-Installing for dependencies: +
- dwz                                           x86_64                          0.11-3.el7                                        base                              99 k +
- expat-devel                                   x86_64                          2.1.0-8.el7                                       base                              56 k +
- fontconfig-devel                              x86_64                          2.10.95-7.el7                                     base                             128 k +
- freetype-devel                                x86_64                          2.4.11-11.el7                                     base                             356 k +
- gl-manpages                                   noarch                          1.1-7.20130122.el7                                base                             994 k +
- libICE-devel                                  x86_64                          1.0.9-2.el7                                       base                              49 k +
- libSM-devel                                   x86_64                          1.2.2-2.el7                                       base                              13 k +
- libX11-devel                                  x86_64                          1.6.3-2.el7                                       base                             980 k +
- libXau-devel                                  x86_64                          1.0.8-2.1.el7                                     base                              14 k +
- libXcursor-devel                              x86_64                          1.1.14-2.1.el7                                    base                              23 k +
- libXdamage-devel                              x86_64                          1.1.4-4.1.el7                                     base                             9.7 k +
- libXext-devel                                 x86_64                          1.3.3-3.el7                                       base                              75 k +
- libXfixes-devel                               x86_64                          5.0.1-2.1.el7                                     base                              13 k +
- libXft-devel                                  x86_64                          2.3.2-2.el7                                       base                              19 k +
- libXinerama-devel                             x86_64                          1.1.3-2.1.el7                                     base                              13 k +
- libXrandr-devel                               x86_64                          1.4.2-2.el7                                       base                              21 k +
- libXrender-devel                              x86_64                          0.9.8-2.1.el7                                     base                              16 k +
- libXt-devel                                   x86_64                          1.1.4-6.1.el7                                     base                             445 k +
- libXxf86vm-devel                              x86_64                          1.1.3-2.1.el7                                     base                              18 k +
- libdrm-devel                                  x86_64                          2.4.60-3.el7                                      base                              92 k +
- libjpeg-turbo-devel                           x86_64                          1.2.90-5.el7                                      base                              98 k +
- libmng                                        x86_64                          1.0.10-14.el7                                     base                             171 k +
- libmng-devel                                  x86_64                          1.0.10-14.el7                                     base                              85 k +
- libpng-devel                                  x86_64                          2:1.5.13-7.el7_2                                  updates                          122 k +
- libstdc++-devel                               x86_64                          4.8.5-4.el7                                       base                             1.5 M +
- libxcb-devel                                  x86_64                          1.11-4.el7                                        base                             1.1 M +
- libxshmfence-devel                            x86_64                          1.2-1.el7                                         base                             5.4 k +
- mesa-libGL-devel                              x86_64                          10.6.5-3.20150824.el7                             base                             147 k +
- mesa-libGLU-devel                             x86_64                          9.0.0-4.el7                                       base                             9.0 k +
- perl-Thread-Queue                             noarch                          3.02-2.el7                                        base                              17 k +
- perl-srpm-macros                              noarch                          1-8.el7                                           base                             4.6 k +
- qt3                                           x86_64                          3.3.8b-51.el7                                     base                             3.5 M +
- redhat-rpm-config                             noarch                          9.1.0-68.el7.centos                               base                              77 k +
- rpm-build                                     x86_64                          4.11.3-17.el7                                     base                             143 k +
- xorg-x11-proto-devel                          noarch                          7.7-12.el7                                        base                             281 k +
- zlib-devel                                    x86_64                          1.2.7-15.el7                                      base                              50 k +
- +
-Transaction Summary +
-======================================================================================================================================================================== +
-Install  5 Packages (+36 Dependent packages) +
- +
-Total download size: 27 M +
-Installed size: 90 M +
-Is this ok [y/d/N]: y+
 </code> </code>
  
-<WRAP center round alert> +=====Surveillance Sécuritaire=====
-Il n'est pas conseillé de compiler en tant que root pour des raisons de sécurité. Pour pouvoir utiliser le compte d'un utilisateur pour créer un nouveau noyau, celui-ci doit disposer de plusieurs Go d'espace libre. +
-</WRAP>+
  
-====Déplacer /home====+====La commande last====
  
-<WRAP center round todo> +Cette commande indique les dates et heures des connexions des utilisateurs à partir du contenu du fichier **/var/log/wtmp** :
-Arrêtez votre machine virtuelle. Ajoutez un deuxième disque de 20 Go au contrôleur SATA en utilisant la section **Stockage** des paramètres de la machine virtuelle. Le format du disque doit être **vmdk**. Nommez ce disque **RedHatHome** et re-démarrez la machine virtuelle en vous connectant directement en tant que **root**. +
-</WRAP> +
- +
-Créez une seule partition sur **/dev/sdb** :+
  
 <code> <code>
-[root@centos7 ~]# fdisk /dev/sdb +[root@centos7 ~]# last 
-Welcome to fdisk (util-linux 2.23.2).+trainee  pts/2        10.0.2.2         Tue Jun 19 18:47   still logged in    
 +trainee  pts/0        10.0.2.2         Tue Jun 19 17:29 - 19:49  (02:20)     
 +trainee  pts/0        2.2.0.10.rev.sfr Tue Jun 19 16:37 - 17:28  (00:51)     
 +trainee  pts/1        2.2.0.10.rev.sfr Tue Jun 19 12:24 17:28  (05:04)     
 +trainee  pts/0        10.0.2.2         Tue Jun 19 11:26 - 16:36  (05:10)     
 +reboot   system boot  3.10.0-693.21.1. Tue Jun 19 11:25 - 01:03  (13:37)     
 +trainee  tty1                          Mon Apr 23 17:23 - 17:25  (00:02)     
 +reboot   system boot  3.10.0-693.21.1. Mon Apr 23 17:21 - 01:03 (57+07:41)   
 +trainee  pts/0        10.0.2.2         Mon Apr 23 12:04 - 17:21  (05:16    
 +reboot   system boot  3.10.0-327.13.1. Mon Apr 23 12:03 - 17:21  (05:17)     
 +reboot   system boot  3.10.0-327.13.1. Sat Apr 30 16:22 - 17:21 (723+00:59)  
 +trainee  pts/0        2.2.0.10.rev.sfr Sat Apr 30 16:20 - 16:21  (00:00)     
 +trainee  tty1                          Sat Apr 30 16:17 - 16:21  (00:03)     
 +reboot   system boot  3.10.0-327.13.1. Sat Apr 30 16:17 - 16:21  (00:04)     
 +trainee  pts/0        2.2.0.10.rev.sfr Sat Apr 30 16:11 - 16:17  (00:05)     
 +trainee  tty1                          Sat Apr 30 16:08 - 16:17  (00:08)     
 +reboot   system boot  3.10.0-327.13.1. Sat Apr 30 16:04 - 16:17  (00:13)     
 +trainee  tty1                          Sat Apr 30 15:46 - 16:03  (00:16)     
 +reboot   system boot  3.10.0-327.13.1. Sat Apr 30 15:32 - 16:03  (00:31)     
 +trainee  pts/1        gateway          Sat Apr 30 15:35 - 15:40  (00:05)     
 +trainee  pts/0        :0               Sat Apr 30 15:29 - 15:40  (00:10)     
 +trainee  :0           :              Sat Apr 30 15:29 - 15:40  (00:11)     
 +(unknown :0           :              Sat Apr 30 15:22 - 15:29  (00:06)     
 +reboot   system boot  3.10.0-327.13.1. Sat Apr 30 15:21 - 15:40  (00:19)     
 +trainee  pts/0        gateway          Sat Apr 30 15:12 - 15:27  (00:14)     
 +trainee  tty1                          Sat Apr 30 14:19 - 15:27  (01:07)     
 +reboot   system boot  3.10.0-327.el7.x Sat Apr 30 14:19 - 15:27  (01:07)     
 +trainee  tty1                          Sat Apr 30 14:18 - 14:19  (00:00)     
 +reboot   system boot  3.10.0-327.el7.x Sat Apr 30 14:18 - 14:19  (00:01)     
 +trainee  pts/0        10.0.2.2         Sat Apr 30 14:16 - 14:17  (00:01)     
 +trainee  tty1                          Sat Apr 30 14:15 - 14:17  (00:02)     
 +reboot   system boot  3.10.0-327.el7.x Sat Apr 30 14:13 - 14:19  (00:06)     
 +trainee  pts/0        :0               Sat Apr 30 14:11 - 14:11  (00:00)     
 +trainee  :0           :              Sat Apr 30 14:10 - 14:11  (00:01)     
 +(unknown :0           :              Sat Apr 30 14:10 - 14:10  (00:00)     
 +reboot   system boot  3.10.0-327.el7.x Sat Apr 30 14:09 - 14:11  (00:02)     
 +trainee  pts/0        :0               Sat Apr 30 12:38 - crash  (01:31)     
 +trainee  :0           :              Sat Apr 30 12:36 - crash  (01:33)     
 +(unknown :0           :              Sat Apr 30 12:34 - 12:36  (00:01)     
 +reboot   system boot  3.10.0-327.el7.x Sat Apr 30 12:34 - 14:11  (01:37)     
 +trainee  tty1                          Sat Apr 30 12:19 - 12:28  (00:09)     
 +reboot   system boot  3.10.0-327.el7.x Sat Apr 30 12:18 - 12:28  (00:10)     
 +trainee  pts/0        :0               Sat Apr 30 12:15 - 12:18  (00:03)     
 +trainee  :0           :              Sat Apr 30 12:14 - 12:18  (00:03)     
 +(unknown :0           :              Sat Apr 30 12:11 - 12:14  (00:02)     
 +reboot   system boot  3.10.0-327.el7.x Sat Apr 30 12:10 - 12:28  (00:18)     
 +trainee  pts/1        :0               Sat Apr 30 12:06 - 12:09  (00:03)     
 +trainee  pts/1        :0               Sat Apr 30 12:01 - 12:02  (00:01)     
 +trainee  pts/0        :0               Sat Apr 30 11:57 - 12:09  (00:12)     
 +trainee  pts/0        :0               Sat Apr 30 11:55 - 11:56  (00:01)     
 +trainee  :0           :              Sat Apr 30 11:54 - 12:09  (00:15)     
 +(unknown :0           :              Sat Apr 30 11:53 - 11:54  (00:00)     
 +reboot   system boot  3.10.0-327.el7.x Sat Apr 30 11:43 - 12:28  (00:45)    
  
-Changes will remain in memory only, until you decide to write them. +wtmp begins Sat Apr 30 11:43:38 2016     
-Be careful before using the write command.+</code>
  
-Device does not contain a recognized partition table +====La commande lastlog====
-Building a new DOS disklabel with disk identifier 0x88708329.+
  
-Command (m for help)+Cette commande indique les dates et heures de la connexion au système la plus récente des utilisateurs :
-Partition type: +
-     primary (0 primary, 0 extended, 4 free) +
-     extended +
-Select (default p): p +
-Partition number (1-4, default 1):  +
-First sector (2048-41943039, default 2048):  +
-Using default value 2048 +
-Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):  +
-Using default value 41943039 +
-Partition 1 of type Linux and of size 20 GiB is set+
  
-Command (m for help)w +<code> 
-The partition table has been altered! +[root@centos7 ~]# lastlog 
- +Username         Port     From             Latest 
-Calling ioctl() to re-read partition table. +root             pts/                    Tue Jun 19 18:47:20 +0200 2018 
-Syncing disks.+bin                                        **Never logged in** 
 +daemon                                     **Never logged in** 
 +adm                                        **Never logged in** 
 +lp                                         **Never logged in** 
 +sync                                       **Never logged in** 
 +shutdown                                   **Never logged in** 
 +halt                                       **Never logged in** 
 +mail                                       **Never logged in** 
 +operator                                   **Never logged in** 
 +games                                      **Never logged in** 
 +ftp                                        **Never logged in** 
 +nobody                                     **Never logged in** 
 +avahi-autoipd                              **Never logged in** 
 +systemd-bus-proxy                           **Never logged in** 
 +systemd-network                            **Never logged in** 
 +dbus                                       **Never logged in** 
 +polkitd                                    **Never logged in** 
 +abrt                                       **Never logged in** 
 +usbmuxd                                    **Never logged in** 
 +colord                                     **Never logged in** 
 +libstoragemgmt                             **Never logged in** 
 +setroubleshoot                             **Never logged in** 
 +rpc                                        **Never logged in** 
 +rtkit                                      **Never logged in** 
 +chrony                                     **Never logged in** 
 +unbound                                    **Never logged in** 
 +tss                                        **Never logged in** 
 +geoclue                                    **Never logged in** 
 +ntp                                        **Never logged in** 
 +sssd                                       **Never logged in** 
 +rpcuser                                    **Never logged in** 
 +nfsnobody                                  **Never logged in** 
 +pulse                                      **Never logged in** 
 +gdm              :0                        Sat Apr 30 15:22:30 +0200 2016 
 +gnome-initial-setup                           **Never logged in** 
 +avahi                                      **Never logged in** 
 +postfix                                    **Never logged in** 
 +sshd                                       **Never logged in** 
 +tcpdump                                    **Never logged in** 
 +trainee          pts/2    10.0.2.2         Tue Jun 19 18:47:12 +0200 2018 
 +vboxadd                                    **Never logged in** 
 +snort                                      **Never logged in** 
 +apache                                     **Never logged in**
 </code> </code>
  
-Créez maintenant un système de fichiers ext4 sur **/dev/sdb1** :+====La Commande lastb==== 
 + 
 +Cette commande indique les dates et heures des connexions infructueueses des utilisateurs à partir du contenu du fichier **/var/log/btmp** :
  
 <code> <code>
-[root@centos7 ~]# mkfs.ext4 /dev/sdb1 +[root@centos7 ~]# lastb 
-mke2fs 1.42.9 (28-Dec-2013) +root     pts/0                         Tue Jun 19 16:37 16:37  (00:00   
-Filesystem label= +
-OS typeLinux +
-Block size=4096 (log=2) +
-Fragment size=4096 (log=2) +
-Stride=0 blocks, Stripe width=0 blocks +
-1310720 inodes, 5242624 blocks +
-262131 blocks (5.00%reserved for the super user +
-First data block=0 +
-Maximum filesystem blocks=2153775104 +
-160 block groups +
-32768 blocks per group, 32768 fragments per group +
-8192 inodes per group +
-Superblock backups stored on blocks:  +
- 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,  +
- 4096000+
  
-Allocating group tablesdone                             +btmp begins Tue Jun 19 16:37:18 2018
-Writing inode tablesdone                             +
-Creating journal (32768 blocks): done +
-Writing superblocks and filesystem accounting information: done +
 </code> </code>
  
-Montez **/dev/sdb1** sur /mnt :+====/var/log/secure====
  
-<code> +Sous RHEL/CentOS ce fichier contient la journalisation des opérations de gestion des authentifications :
-[root@centos7 ~]# mount /dev/sdb1 /mnt +
-</code> +
- +
-Copiez le contenu de /home vers /mnt :+
  
 <code> <code>
-[root@centos7 ~]# cp -/home//mnt+[root@centos7 ~]# tail -n 15 /var/log/secure 
 +Jun 19 22:03:57 centos7 polkitd[532]: Unregistered Authentication Agent for unix-process:21784:3831602 (system bus name :1.320, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_GB.UTF-8) (disconnected from bus) 
 +Jun 19 22:04:06 centos7 polkitd[532]: Registered Authentication Agent for unix-process:21883:3832537 (system bus name :1.321 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_GB.UTF-8) 
 +Jun 19 22:04:07 centos7 polkitd[532]: Unregistered Authentication Agent for unix-process:21883:3832537 (system bus name :1.321, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_GB.UTF-8) (disconnected from bus) 
 +Jun 19 23:45:43 centos7 su: pam_unix(su-l:session): session opened for user prison by trainee(uid=0) 
 +Jun 19 23:46:13 centos7 su: pam_unix(su-l:session): session closed for user prison 
 +Jun 19 23:48:25 centos7 su: pam_unix(su-l:session): session opened for user prison by trainee(uid=0) 
 +Jun 19 23:48:25 centos7 su: pam_unix(su-l:session): session closed for user prison 
 +Jun 19 23:52:22 centos7 su: pam_unix(su-l:session): session opened for user prison by trainee(uid=0) 
 +Jun 19 23:52:27 centos7 su: pam_unix(su-l:session): session closed for user prison 
 +Jun 19 23:54:35 centos7 su: pam_unix(su-l:session): session opened for user prison by trainee(uid=0) 
 +Jun 19 23:55:33 centos7 su: pam_unix(su-l:session): session closed for user prison 
 +Jun 20 00:01:21 centos7 su: pam_unix(su-l:session): session opened for user prison by trainee(uid=0) 
 +Jun 20 00:01:50 centos7 su: pam_unix(su-l:session): session closed for user prison 
 +Jun 20 00:01:53 centos7 su: pam_unix(su-l:session): session opened for user prison by trainee(uid=0) 
 +Jun 20 00:02:19 centos7 su: pam_unix(su-l:session): session closed for user prison
 </code> </code>
  
-Démontez /dev/sdb1 et déplacez /home vers /root :+=====Les Contre-Mesures=====
  
-<code> +Les contre-mesures incluent le renforcement de la sécurité des comptes et l'utilisation des mots de passe complexes.
-[root@centos7 ~]# umount /mnt +
-[root@centos7 ~]# mv /home /root +
-</code>+
  
-Identifiez l'UUID de /dev/sdb1 :+====LAB #2 - Renforcer la sécurité des comptes====
  
-<code> +Passez en revue le fichier **/etc/passwd** :
-[root@centos7 ~]# ls -l /dev/disk/by-uuid/ | grep sdb1 +
-lrwxrwxrwx. 1 root root 10  9 août  06:47 a5e2457f-7337-41f4-b958-e403eb419f94 -> ../../sdb1 +
-</code> +
- +
-Editez le fichier **/etc/fstab** : +
- +
-<file txt /etc/fstab> +
-+
-# /etc/fstab +
-# Created by anaconda on Sat Apr 30 11:27:02 2016 +
-+
-# Accessible filesystems, by reference, are maintained under '/dev/disk' +
-# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info +
-+
-UUID=e65fe7da-cda8-4f5a-a827-1b5cabe94bed /                       xfs     defaults        0 0 +
-UUID=2d947276-66e8-41f4-8475-b64b67d7a249 /boot                   xfs     defaults        0 0 +
-UUID=3181601a-7295-4ef0-a92c-f21f76b18e64 swap                    swap    defaults        0 0 +
-UUID=a5e2457f-7337-41f4-b958-e403eb419f94 /home           ext4   defaults       1 2+
  
 +<file>
 +root:x:0:0:root:/root:/bin/bash
 +bin:x:1:1:bin:/bin:/sbin/nologin
 +daemon:x:2:2:daemon:/sbin:/sbin/nologin
 +adm:x:3:4:adm:/var/adm:/sbin/nologin
 +lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
 +sync:x:5:0:sync:/sbin:/bin/sync
 +shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
 +halt:x:7:0:halt:/sbin:/sbin/halt
 +mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
 +uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
 +operator:x:11:0:operator:/root:/sbin/nologin
 +games:x:12:100:games:/usr/games:/sbin/nologin
 +gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
 +ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
 +nobody:x:99:99:Nobody:/:/sbin/nologin
 +dbus:x:81:81:System message bus:/:/sbin/nologin
 +usbmuxd:x:113:113:usbmuxd user:/:/sbin/nologin
 +avahi-autoipd:x:170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin
 +vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
 +rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin
 +rtkit:x:499:499:RealtimeKit:/proc:/sbin/nologin
 +abrt:x:498:498::/etc/abrt:/sbin/nologin
 +nscd:x:28:28:NSCD Daemon:/:/sbin/nologin
 +tcpdump:x:72:72::/:/sbin/nologin
 +haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
 +apache:x:48:48:Apache:/var/www:/sbin/nologin
 +nslcd:x:65:55:LDAP Client User:/:/sbin/nologin
 +saslauth:x:497:495:"Saslauthd user":/var/empty/saslauth:/sbin/nologin
 +postfix:x:89:89::/var/spool/postfix:/sbin/nologin
 +avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin
 +ntp:x:38:38::/etc/ntp:/sbin/nologin
 +rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
 +nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
 +sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
 +pulse:x:496:494:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin
 +gdm:x:42:42::/var/lib/gdm:/sbin/nologin
 +trainee:x:500:500:trainee:/home/trainee:/bin/bash
 +vboxadd:x:495:1::/var/run/vboxadd:/bin/false
 +prison:x:501:502:chroot_user:/home/prison:/bin/chroot
 </file> </file>
  
-Créez le point de montage /home :+<WRAP center round important 50%> 
 +**Important** : Notez que la valeur de l'UID de root est toujours de 0. Notez cependant que sous RHEL 5 et 6 les UID des utilisateurs normaux commencent à **500** et les UID des comptes système sont inclus entre 1 et 99 par convention. Sous RHEL 7, les UID des utilisateurs normaux commencent à **1000** et les UID des comptes système sont inclus entre 201 et 999. Sous Debian 6, 7 et 8 les UID des utilisateurs normaux commencent à **1000** et les UID des comptes système sont inclus entre 100 et 999 par convention. Sous openSUSE, les UID des utilisateurs normaux commencent à **1000** et les UID des comptes système sont inclus entre 100 et 499. Sous Ubuntu 14.04 les UID des utilisateurs normaux commencent à **1000** et les UID des comptes système sont inclus entre 100 et 999. 
 +</WRAP>
  
-<code> +Chaque ligne est constituée de 7 champs :
-[root@centos7 ~]# mkdir /home +
-</code>+
  
-Montez /dev/sdb1 :+  * Le nom d'utilisateur 
 +  * Le mot de passe. Une valeur de **x** dans ce champs indique que le système utilise le fichier **/etc/shadow** pour stocker les mots de passe. 
 +  * L'UID. Une valeur unique qui est utilisée pour déterminée les droits aux fichiers et aux répertoires. 
 +  * Le GID. Une valeur indiquant le groupe **principal** de l'utilisateur 
 +  * Le nom complet. Ce champs optionnel est aussi appelé **GECOS** 
 +  * Le répertoire personnel de l'utilisateur 
 +  * Le shell de l'utilisateur.
  
-<code> +Notez d'abord les utilisateurs inutiles. Par exempledans le cas ci-dessusl'utilisateur suivant est inutile si vous ne souhaitez par imprimer a partir du serveur:
-[root@centos7 ~]# mount -a +
-[root@centos7 ~]# mount +
-sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel) +
-proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) +
-devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=236036k,nr_inodes=59009,mode=755) +
-securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime) +
-tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel) +
-devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000) +
-tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755) +
-tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,mode=755) +
-cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd) +
-pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime) +
-cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu) +
-cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb) +
-cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls) +
-cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset) +
-cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer) +
-cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory) +
-cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio) +
-cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices) +
-cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event) +
-configfs on /sys/kernel/config type configfs (rw,relatime) +
-/dev/sda2 on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota) +
-selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime) +
-systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=30,pgrp=1,timeout=300,minproto=5,maxproto=5,direct) +
-debugfs on /sys/kernel/debug type debugfs (rw,relatime) +
-hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel) +
-mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel) +
-tmpfs on /tmp type tmpfs (rw,seclabel) +
-sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime) +
-nfsd on /proc/fs/nfsd type nfsd (rw,relatime) +
-/dev/sda1 on /boot type xfs (rw,relatime,seclabel,attr2,inode64,noquota) +
-/dev/sdb1 on /home type ext4 (rw,relatime,seclabel,data=ordered) +
-tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=50080k,mode=700,uid=1000,gid=1000) +
-</code>+
  
-Notez la taille de /home :+<file> 
 +lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin 
 +</file>
  
-<code> +Supprimez donc les utilisateurs et groupes inutiles en utilisant des commandes telles:
-[trainee@centos7 ~]$ df -h +
-Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur +
-/dev/sda2          9,8G    4,4G  5,5G  45% / +
-devtmpfs           231M        231M   0% /dev +
-tmpfs              245M        245M   0% /dev/shm +
-tmpfs              245M    4,7M  240M   2% /run +
-tmpfs              245M        245M   0% /sys/fs/cgroup +
-tmpfs              245M     72K  245M   1% /tmp +
-/dev/sda1          197M    197M   20K 100% /boot +
-/dev/sdb1           20G     65M   19G   1% /home +
-tmpfs               49M         49M   0% /run/user/1000 +
-</code>+
  
-<WRAP center round todo> +  # userdel -r lp [Entree]
-Fermez la session de root et connectez-vous en tant que trainee. +
-</WRAP>+
  
-====Créer un Nouveau Noyau====+  # groupdel lp [Entree]
  
-Pour créer l'arborescence de l'environnement de création de paquets dans /home/trainee, utilisez la commande **rpmdev-setuptree** :+Pour les utilisateurs restants, utilisez le système de shadowing :
  
 <code> <code>
-[trainee@centos7 ~]$ rpmdev-setuptree +[root@centos7 ~]# cat /etc/shadow 
-[trainee@centos7 ~]ls -laR rpmbuild+root:$6$TX12b5lW9UXD8Ld6$l/PjTA.XrBAbsayGCaSFaM5ibLo2xBBeYNCyEdVv9uMUctxq9Q0YBxLwCvS2bCdgr.BeSmXvi6BwD55KKscaJ.::0:99999:7::: 
-rpmbuild/+bin:*:16659:0:99999:7::
-total 28 +daemon:*:16659:0:99999:7::: 
-drwxrwxr-x.  trainee trainee 4096  9 août  06:56 . +adm:*:16659:0:99999:7::: 
-drwx------. 15 trainee trainee 4096  9 août  06:56 .. +lp:*:16659:0:99999:7::: 
-drwxrwxr-x.  2 trainee trainee 4096  9 août  06:56 BUILD +sync:*:16659:0:99999:7::: 
-drwxrwxr-x.  2 trainee trainee 4096  9 août  06:56 RPMS +shutdown:*:16659:0:99999:7::: 
-drwxrwxr-x.  2 trainee trainee 4096  9 août  06:56 SOURCES +halt:*:16659:0:99999:7::: 
-drwxrwxr-x.  2 trainee trainee 4096  9 août  06:56 SPECS +mail:*:16659:0:99999:7::: 
-drwxrwxr-x. trainee trainee 4096  9 août  06:56 SRPMS+operator:*:16659:0:99999:7::: 
 +games:*:16659:0:99999:7::: 
 +ftp:*:16659:0:99999:7::: 
 +nobody:*:16659:0:99999:7::: 
 +avahi-autoipd:!!:16779:::::: 
 +systemd-bus-proxy:!!:16779:::::: 
 +systemd-network:!!:16779:::::: 
 +dbus:!!:16779:::::: 
 +polkitd:!!:16779:::::: 
 +abrt:!!:16779:::::: 
 +usbmuxd:!!:16779:::::: 
 +colord:!!:16779:::::: 
 +libstoragemgmt:!!:16779:::::: 
 +setroubleshoot:!!:16779:::::: 
 +rpc:!!:16779:0:99999:7::: 
 +rtkit:!!:16779:::::: 
 +chrony:!!:16779:::::: 
 +unbound:!!:16779:::::: 
 +tss:!!:16779:::::: 
 +geoclue:!!:16779:::::: 
 +ntp:!!:16779:::::: 
 +sssd:!!:16779:::::: 
 +rpcuser:!!:16779:::::: 
 +nfsnobody:!!:16779:::::: 
 +pulse:!!:16779:::::: 
 +gdm:!!:16779:::::: 
 +gnome-initial-setup:!!:16779:::::
 +avahi:!!:16779:::::
 +postfix:!!:16779:::::
 +sshd:!!:16779:::::
 +tcpdump:!!:16779:::::
 +trainee:$6$4PW9kfdOIOmWmSSO$8vikc1pyXgVc.C8xKP5EvIbBwe1fWd3DSvgWGQ5FAr7jwyMCbLQOOWbvomS9z1Q6V8IqZjBSREWafNzOYjKqC0::0:99999:7::: 
 +vboxadd:!!:16921:::::: 
 +</code>
  
-rpmbuild/BUILD: +Chaque ligne est constituée de champs :
-total 8 +
-drwxrwxr-x. 2 trainee trainee 4096  9 août  06:56 . +
-drwxrwxr-x. 7 trainee trainee 4096  9 août  06:56 ..+
  
-rpmbuild/RPMS+  * Le nom de l'utilisateur. Ce champs est utilisé pour faire le lien avec le fichier **/etc/passwd**, 
-total 8 +  * Le mot de passe **crypté** de l'utilisateur. Le cryptage est à sens **unique**. Ce champ peut aussi contenir une des trois valeurs suivantes 
-drwxrwxr-x. 2 trainee trainee 4096  9 août  06:56 +    * **!!** - Le mot de passe n'a pas encore été défini et l'utilisateur ne peut pas se connecter, 
-drwxrwxr-x. 7 trainee trainee 4096  9 août  06:56 ..+    * ***** L'utilisateur ne peut pas se connecter, 
 +    * **vide** - aucun mot de passe sera demandé pour l'utilisateur concerné, 
 +  * Le nombre de jours entre le **01/01/1970** et le dernier changement du mot de passe, 
 +  * Le nombre de jours que le mot de passe est encore valideUne valeur de **0** dans ce champs indique sue le mot de passe n'expire jamais, 
 +  * Le nombre de jours après lequel le mot de passe doit être changé, 
 +  * Le nombre de jours avant la date de modification forcée que l'utilisateur recevra un avertissement, 
 +  * Le nombre de jours après l'expiration du mot de passe que le compte sera désactivé, 
 +  * Le **numéro** du jour après le **01/01/1970** que le compte a été désactivé.
  
-rpmbuild/SOURCES: +=====LAB #3 - PAM sous RHEL/CentOS 7=====
-total 8 +
-drwxrwxr-x. 2 trainee trainee 4096  9 août  06:56 . +
-drwxrwxr-x. trainee trainee 4096  9 août  06:56 ..+
  
-rpmbuild/SPECS: +**PAM** ( //Pluggable Authentification Modules// ou Modules d'Authentification Enfichables ) est une architecture modulaire permettant à l'administrateur système de définir une politique d'authentification pour les logiciels prenant en charge PAM.
-total 8 +
-drwxrwxr-x. 2 trainee trainee 4096  9 août  06:56 . +
-drwxrwxr-x. 7 trainee trainee 4096  9 août  06:56 ..+
  
-rpmbuild/SRPMS: +Les fichiers de configuration se trouvent dans le répertoire **/etc/pam.d** :
-total 8 +
-drwxrwxr-x2 trainee trainee 4096  9 août  06:56 . +
-drwxrwxr-x. 7 trainee trainee 4096  9 août  06:56 .. +
-</code> +
- +
-Téléchargez le rpm source du noyau :+
  
 <code> <code>
-[trainee@centos7 ~]$ uname -a +[root@centos7 ~]# ls /etc/pam.d 
-Linux centos7.fenestros.loc 3.10.0-327.13.1.el7.x86_64 #1 SMP Thu Mar 31 16:04:38 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux +atd                     login              smtp 
- +chfn                    other              smtp.postfix 
-[trainee@centos7 ~]$ wget http://vault.centos.org/7.2.1511/updates/Source/SPackages/kernel-3.10.0-327.13.1.el7.src.rpm +chsh                    passwd             sshd 
---2016-08-09 06:57:08--  http://vault.centos.org/7.2.1511/updates/Source/SPackages/kernel-3.10.0-327.13.1.el7.src.rpm +config-util             password-auth      su 
-Résolution de vault.centos.org (vault.centos.org)... 88.208.217.170, 2a00:f10:10b:13::10 +crond                   password-auth-ac   sudo 
-Connexion vers vault.centos.org (vault.centos.org)|88.208.217.170|:80...connecté. +cups                    pluto              sudo-
-requête HTTP transmise, en attente de la réponse...200 OK +fingerprint-auth        polkit-1           su-
-Longueur: 83047820 (79M) [application/x-rpm] +fingerprint-auth-ac     postlogin          system-auth 
-Sauvegarde en : «kernel-3.10.0-327.13.1.el7.src.rpm» +gdm-autologin           postlogin-ac       system-auth-ac 
- +gdm-fingerprint         ppp                system-config-language 
-100%[==============================================================================================================================>] 83 047 820   496KB/  ds 2m 52s  +gdm-launch-environment  remote             systemd-user 
- +gdm-password            runuser            vlock 
-2016-08-09 07:00:00 (471 KB/s) - «kernel-3.10.0-327.13.1.el7.src.rpm» sauvegardé [83047820/83047820] +gdm-pin                 runuser-l          vmtoolsd 
 +gdm-smartcard           setup              xserver 
 +ksu                     smartcard-auth 
 +liveinst                smartcard-auth-ac
 </code> </code>
  
-Installez maintenant les dépendances pour le rpm source en tant que root :+Ces fichiers ont une structure spécifique et sont nommés d'après le service ou l'application qu'ils contrôlent. Leur contenu fait appel à des modules qui se trouvent dans le répertoire **/lib64/security** :
  
 <code> <code>
-[trainee@centos7 ~]$ su - +[root@centos7 ~]# ls /lib64/security 
-Mot de passe : fenestros +pam_access.so         pam_krb5afs.so           pam_selinux.so 
-[root@centos7 ~]# yum-builddep /home/trainee/kernel-3.10.0-327.13.1.el7.src.rpm  +pam_cap.so            pam_krb5.so              pam_sepermit.so 
-Loaded plugins: fastestmirror, langpacks +pam_chroot.so         pam_lastlog.so           pam_shells.so 
-Enabling base-source repository +pam_console.so        pam_limits.so            pam_sss.so 
-Enabling extras-source repository +pam_cracklib.so       pam_listfile.so          pam_stress.so 
-Enabling updates-source repository +pam_debug.so          pam_localuser.so         pam_succeed_if.so 
-base-source                                                                                                                                      | 2.9 kB  00:00:00      +pam_deny.so           pam_loginuid.so          pam_systemd.so 
-extras-source                                                                                                                                    | 2.9 kB  00:00:00      +pam_echo.so           pam_mail.so              pam_tally2.so 
-updates-source                                                                                                                                   | 2.9 kB  00:00:00      +pam_env.so            pam_mkhomedir.so         pam_time.so 
-(1/3): extras-source/7/primary_db                                                                                                                |  43 kB  00:00:00      +pam_exec.so           pam_motd.so              pam_timestamp.so 
-(2/3): base-source/7/primary_db                                                                                                                  | 949 kB  00:00:00      +pam_faildelay.so      pam_namespace.so         pam_tty_audit.so 
-(3/3): updates-source/7/primary_db                                                                                                               | 140 kB  00:00:00      +pam_faillock.so       pam_nologin.so           pam_umask.so 
-Loading mirror speeds from cached hostfile +pam_filter            pam_oddjob_mkhomedir.so  pam_unix_acct.so 
- * base: centos.mirrors.ovh.net +pam_filter.so         pam_permit.so            pam_unix_auth.so 
- * extras: centos.mirror.fr.planethoster.net +pam_fprintd.so        pam_postgresok.so        pam_unix_passwd.so 
- * updates: mirror1.evolution-host.com +pam_ftp.so            pam_pwhistory.so         pam_unix_session.so 
-Checking for new repos for mirrors +pam_gnome_keyring.so  pam_pwquality.so         pam_unix.so 
-Getting requirements for kernel-3.10.0-327.13.1.el7.src +pam_group.so          pam_rhosts.so            pam_userdb.so 
- --> Already installed : kmod-20-5.el7.x86_64 +pam_issue.so          pam_rootok.so            pam_warn.so 
- --> Already installed : patch-2.7.1-8.el7.x86_64 +pam_keyinit.so        pam_securetty.so         pam_wheel.so 
- --> Already installed : bash-4.2.46-19.el7.x86_64 +pam_krb5              pam_selinux_permit.so    pam_xauth.so 
- --> Already installed : coreutils-8.22-15.el7_2.1.x86_64 +</code>
- --> Already installed : 2:tar-1.26-29.el7.x86_64 +
- --> Already installed : xz-5.1.2-12alpha.el7.x86_64 +
- --> Already installed : 1:findutils-4.5.11-5.el7.x86_64 +
- --> Already installed : gzip-1.5-8.el7.x86_64 +
- --> m4-1.4.16-10.el7.x86_64 +
- --> Already installed : 4:perl-5.16.3-286.el7.x86_64 +
- --> Already installed : 1:make-3.82-21.el7.x86_64 +
- --> Already installed : diffutils-3.3-4.el7.x86_64 +
- --> Already installed : gawk-4.0.2-4.el7.x86_64 +
- --> Already installed : gcc-4.8.5-4.el7.x86_64 +
- --> Already installed : binutils-2.23.52.0.1-55.el7.x86_64 +
- --> Already installed : redhat-rpm-config-9.1.0-68.el7.centos.noarch +
- --> Already installed : hostname-3.13-3.el7.x86_64 +
- --> Already installed : net-tools-2.0-0.17.20131004git.el7.x86_64 +
- --> Already installed : bc-1.06.95-13.el7.x86_64 +
- --> xmlto-0.0.25-7.el7.x86_64 +
- --> asciidoc-8.6.8-5.el7.noarch +
- --> Already installed : 1:openssl-1.0.1e-51.el7_2.4.x86_64 +
- --> hmaccalc-0.9.13-4.el7.x86_64 +
- --> python-devel-2.7.5-34.el7.x86_64 +
- --> newt-devel-0.52.15-4.el7.x86_64 +
- --> perl-ExtUtils-Embed-1.30-286.el7.noarch +
- --> Already installed : rpm-build-4.11.3-17.el7.x86_64 +
- --> Already installed : elfutils-0.163-3.el7.x86_64 +
---> Running transaction check +
----> Package asciidoc.noarch 0:8.6.8-5.el7 will be installed +
---> Processing Dependency: source-highlight for package: asciidoc-8.6.8-5.el7.noarch +
---> Processing Dependency: graphviz for package: asciidoc-8.6.8-5.el7.noarch +
---> Processing Dependency: docbook-style-xsl for package: asciidoc-8.6.8-5.el7.noarch +
----> Package hmaccalc.x86_64 0:0.9.13-4.el7 will be installed +
----> Package m4.x86_64 0:1.4.16-10.el7 will be installed +
----> Package newt-devel.x86_64 0:0.52.15-4.el7 will be installed +
---> Processing Dependency: slang-devel for package: newt-devel-0.52.15-4.el7.x86_64 +
----> Package perl-ExtUtils-Embed.noarch 0:1.30-286.el7 will be installed +
---> Processing Dependency: perl-devel for package: perl-ExtUtils-Embed-1.30-286.el7.noarch +
----> Package python-devel.x86_64 0:2.7.5-34.el7 will be installed +
----> Package xmlto.x86_64 0:0.0.25-7.el7 will be installed +
---> Processing Dependency: text-www-browser for package: xmlto-0.0.25-7.el7.x86_64 +
---> Processing Dependency: flex for package: xmlto-0.0.25-7.el7.x86_64 +
---> Processing Dependency: docbook-dtds for package: xmlto-0.0.25-7.el7.x86_64 +
---> Running transaction check +
----> Package docbook-dtds.noarch 0:1.0-60.el7 will be installed +
---> Processing Dependency: sgml-common for package: docbook-dtds-1.0-60.el7.noarch +
----> Package docbook-style-xsl.noarch 0:1.78.1-3.el7 will be installed +
----> Package flex.x86_64 0:2.5.37-3.el7 will be installed +
----> Package graphviz.x86_64 0:2.30.1-19.el7 will be installed +
---> Processing Dependency: libXaw.so.7()(64bit) for package: graphviz-2.30.1-19.el7.x86_64 +
----> Package lynx.x86_64 0:2.8.8-0.3.dev15.el7 will be installed +
----> Package perl-devel.x86_64 4:5.16.3-286.el7 will be installed +
---> Processing Dependency: systemtap-sdt-devel for package: 4:perl-devel-5.16.3-286.el7.x86_64 +
---> Processing Dependency: perl(ExtUtils::ParseXS) for package: 4:perl-devel-5.16.3-286.el7.x86_64 +
---> Processing Dependency: perl(ExtUtils::MakeMaker) for package: 4:perl-devel-5.16.3-286.el7.x86_64 +
---> Processing Dependency: perl(ExtUtils::Installed) for package: 4:perl-devel-5.16.3-286.el7.x86_64 +
---> Processing Dependency: libdb-devel for package: 4:perl-devel-5.16.3-286.el7.x86_64 +
---> Processing Dependency: gdbm-devel for package: 4:perl-devel-5.16.3-286.el7.x86_64 +
----> Package slang-devel.x86_64 0:2.2.4-11.el7 will be installed +
----> Package source-highlight.x86_64 0:3.1.6-6.el7 will be installed +
---> Processing Dependency: ctags for package: source-highlight-3.1.6-6.el7.x86_64 +
---> Processing Dependency: libboost_regex.so.1.53.0()(64bit) for package: source-highlight-3.1.6-6.el7.x86_64 +
---> Running transaction check +
----> Package boost-regex.x86_64 0:1.53.0-25.el7 will be installed +
----> Package ctags.x86_64 0:5.8-13.el7 will be installed +
----> Package gdbm-devel.x86_64 0:1.10-8.el7 will be installed +
----> Package libXaw.x86_64 0:1.0.12-5.el7 will be installed +
----> Package libdb-devel.x86_64 0:5.3.21-19.el7 will be installed +
----> Package perl-ExtUtils-Install.noarch 0:1.58-286.el7 will be installed +
----> Package perl-ExtUtils-MakeMaker.noarch 0:6.68-3.el7 will be installed +
---> Processing Dependency: perl(Test::Harness) for package: perl-ExtUtils-MakeMaker-6.68-3.el7.noarch +
---> Processing Dependency: perl(ExtUtils::Manifest) for package: perl-ExtUtils-MakeMaker-6.68-3.el7.noarch +
----> Package perl-ExtUtils-ParseXS.noarch 1:3.18-2.el7 will be installed +
----> Package sgml-common.noarch 0:0.6.3-39.el7 will be installed +
----> Package systemtap-sdt-devel.x86_64 0:2.8-10.el7 will be installed +
---> Running transaction check +
----> Package perl-ExtUtils-Manifest.noarch 0:1.61-244.el7 will be installed +
----> Package perl-Test-Harness.noarch 0:3.28-3.el7 will be installed +
---Finished Dependency Resolution+
  
-Dependencies Resolved+Les modules les plus importants sont :
  
-======================================================================================================================================================================== +^ Module ^ Description ^ 
- Package                                           Arch                             Version                                        Repository                      Size +| pam_access.so | Ce module est utilisé pour interdire l'accès aux services sécurisés par des hôtes non-autorisés| 
-======================================================================================================================================================================== +| pam_echo.so | Ce module présente le contenu du fichier passé en argument à tout utilisateur lors de sa connexion| 
-Installing: +| pam_limits.so | Ce module implémente les limites des ressources détaillées dans le fichier **/etc/security/limits.conf** et dans les fichiers ***.conf** trouvés dans le répertoire **/etc/security/limits.d/**| 
- asciidoc                                          noarch                           8.6.8-5.el7                                    base                           251 k +| pam_listfile.so | Ce module est utilisé pour consulter un fichier spécifique pour vérifier les authiorisationsPar exemple, le service ftp utilise ce module pour consulter le fichier **/etc/ftpusers** qui contient une liste d'utilisateurs qui ne sont **pas** autorisés à se connecter au serveur ftp| 
- hmaccalc                                          x86_64                           0.9.13-4.el7                                   base                            26 k +| pam_nologin.so | Ce module interdit les connexions d'utilisteurs, autre que root, dans le cas où le fichier **/etc/nologin** est présent| 
- m4                                                x86_64                           1.4.16-10.el7                                  base                           256 k +| pam_pwquality.so | Ce module est utilisé pour vérifier la qualité du mot de passe d'un utilisateur | 
- newt-devel                                        x86_64                           0.52.15-4.el7                                  base                            51 k +| pam_securetty.so | Ce module interdit des connexions de root à partir des périphériques tty qui ne sont pas listés dans le fichier **/etc/securetty**| 
- perl-ExtUtils-Embed                               noarch                           1.30-286.el7                                   base                            49 k +| pam_unix.so | Ce module est utilisé pour vérifier les informations suivantes ; expire, last_change, max_change, min_change, warn_change|
- python-devel                                      x86_64                           2.7.5-34.el7                                   base                           391 k +
- xmlto                                             x86_64                           0.0.25-7.el7                                   base                            50 k +
-Installing for dependencies: +
- boost-regex                                       x86_64                           1.53.0-25.el7                                  base                           294 k +
- ctags                                             x86_64                           5.8-13.el7                                     base                           155 k +
- docbook-dtds                                      noarch                           1.0-60.el7                                     base                           226 k +
- docbook-style-xsl                                 noarch                           1.78.1-3.el7                                   base                           2.0 M +
- flex                                              x86_64                           2.5.37-3.el7                                   base                           292 k +
- gdbm-devel                                        x86_64                           1.10-8.el7                                     base                            47 k +
- graphviz                                          x86_64                           2.30.1-19.el7                                  base                           1.3 M +
- libXaw                                            x86_64                           1.0.12-5.el7                                   base                           190 k +
- libdb-devel                                       x86_64                           5.3.21-19.el7                                  base                            38 k +
- lynx                                              x86_64                           2.8.8-0.3.dev15.el7                            base                           1.4 M +
- perl-ExtUtils-Install                             noarch                           1.58-286.el7                                   base                            73 k +
- perl-ExtUtils-MakeMaker                           noarch                           6.68-3.el7                                     base                           275 k +
- perl-ExtUtils-Manifest                            noarch                           1.61-244.el7                                   base                            31 k +
- perl-ExtUtils-ParseXS                             noarch                           1:3.18-2.el7                                   base                            77 k +
- perl-Test-Harness                                 noarch                           3.28-3.el7                                     base                           302 k +
- perl-devel                                        x86_64                           4:5.16.3-286.el7                               base                           452 k +
- sgml-common                                       noarch                           0.6.3-39.el7                                   base                            55 k +
- slang-devel                                       x86_64                           2.2.4-11.el7                                   base                            91 k +
- source-highlight                                  x86_64                           3.1.6-6.el7                                    base                           611 k +
- systemtap-sdt-devel                               x86_64                           2.8-10.el7                                     base                            65 k+
  
-Transaction Summary +Chaque fichier dans /etc/pam.d contient les règles PAM utilisées pendant l'authentification. Ouvrez le fichier **login** :
-======================================================================================================================================================================== +
-Install  7 Packages (+20 Dependent packages) +
- +
-Total download size: 9.0 M +
-Installed size: 43 M +
-Is this ok [y/d/N]: y +
-</code> +
- +
-Installez maintenant le paquet **kernel-3.10.0-327.13.1.el7.src.rpm** :+
  
 <code> <code>
-[root@centos7 ~]# exit +[root@centos7 ~]# cat /etc/pam.d/login 
-logout +#%PAM-1.0 
-[trainee@centos7 ~]$ rpm -Uvh kernel-3.10.0-327.13.1.el7.src.rpm  +auth [user_unknown=ignore success=ok ignore=ignore default=badpam_securetty.so 
-Mise à jour installation... +auth       substack     system-auth 
-   1:kernel-3.10.0-327.13.1.el7       ################################# [100%+auth       include      postlogin 
-attention : utilisateur builder inexistant utilisation de root +account    required     pam_nologin.so 
-attention : groupe builder inexistant - utilisation de root +account    include      system-auth 
-attention : utilisateur builder inexistant - utilisation de root +password   include      system-auth 
-attention : groupe builder inexistant utilisation de root +# pam_selinux.so close should be the first session rule 
-attention : utilisateur builder inexistant utilisation de root +session    required     pam_selinux.so close 
-attention : groupe builder inexistant - utilisation de root +session    required     pam_loginuid.so 
-attention : utilisateur builder inexistant - utilisation de root +session    optional     pam_console.so 
-attention : groupe builder inexistant - utilisation de root +# pam_selinux.so open should only be followed by sessions to be executed in the user context 
-attention : utilisateur builder inexistant - utilisation de root +session    required     pam_selinux.so open 
-attention : groupe builder inexistant - utilisation de root +session    required     pam_namespace.so 
-attention : utilisateur builder inexistant - utilisation de root +session    optional     pam_keyinit.so force revoke 
-attention : groupe builder inexistant - utilisation de root +session    include      system-auth 
-attention : utilisateur builder inexistant - utilisation de root +session    include      postlogin 
-attention : groupe builder inexistant utilisation de root +-session   optional     pam_ck_connector.so
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root +
-attention : utilisateur builder inexistant - utilisation de root +
-attention : groupe builder inexistant - utilisation de root+
 </code> </code>
  
-<WRAP center round important> +La première ligne de ce fichier est un commentaire qui spécifie que le fichier est conforme à la spécification PAM 1.0.
-Les erreurs sont sans importance. +
-</WRAP>+
  
-====Préparer l'Arborescence Source du Noyau====+Ce fichier, tout comme les autres, est ensuite structuré de la façon suivante :
  
-Naviguez vers le repertoire **~/rpmbuild/SPECS** et utilisez la commande **rpmbuild** pour préparer l'arborescence source du noyau :+  Une module par ligne, 
 +  Quatre champs séparés par un espace dans chaque règle dont les trois premières sont obligatoires.
  
-<code> +Le **premier champs** est le //**type de module**//. Il en existe quatre :
-[trainee@centos7 ~]$ cd ~/rpmbuild/SPECS +
-[trainee@centos7 SPECS]$ rpmbuild -bp --target=$(uname -m) kernel.spec +
-Construction pour plate-formes ciblesx86_64 +
-Construction pour cible x86_64 +
-erreur : Dépendances de construction manquantes: +
- pesign >= 0.109-4 est nécessaire pour kernel-3.10.0-327.13.1.el7.x86_64 +
- elfutils-devel est nécessaire pour kernel-3.10.0-327.13.1.el7.x86_64 +
- binutils-devel est nécessaire pour kernel-3.10.0-327.13.1.el7.x86_64 +
- bison est nécessaire pour kernel-3.10.0-327.13.1.el7.x86_64 +
- audit-libs-devel est nécessaire pour kernel-3.10.0-327.13.1.el7.x86_64 +
- numactl-devel est nécessaire pour kernel-3.10.0-327.13.1.el7.x86_64 +
- pciutils-devel est nécessaire pour kernel-3.10.0-327.13.1.el7.x86_64 +
-</code>+
  
-<WRAP center round important> +^ Type ^ Description ^ 
-Notez qu'il existe toujours des dépendances manquantes ! +| **auth** | Utilisé pour authentifier un utilisateur ou les pré-requis système ( par exemple /etc/nologin ) | 
-</WRAP>+| **account** | Utilisé pour vérifier si l'utilisateur peut s'authentifier ( par exemple la validité du compte ) | 
 +| **password** | Utilisé pour vérifier si l'utilisateur dispose des droits pour mettre le mécanisme d'authentification à jour | 
 +| **session** | Utilisé pour gérer la session après l'authentification ( par exemple monter un répertoire ) |
  
-Redevenez root et installez les dépendances :+Le **deuxième champs** est le //**Control-flag**//. Il en existe quatre :
  
-<code> +^ Control-flag ^ Description ^ 
-[trainee@centos7 SPECS]$ cd +| **required** | La réussite de ce module est indispensable. L'échec d'un module //required// n'est communiqué à l'application qu'après la vérification de tous les modules ayant un //control-flag// de **required**| 
-/home/trainee +| **requisite** | La réussite de ce module est indispensable. L'échec d'un module //requisite// est immédiatement communiqué à l'application | 
-[trainee@centos7 ~]$ su - +| **sufficient** | La réussite de ce module est suffisant pour authoriser l'authentificationSi aucun test //required// précédent est en échec, la vérification s'arrêteSi un test //required// précédent était en échec, le test //sufficient// est ignoréL'échec d'un test //sufficient// n'a pas de conséquence si tous les tests //required// réussissent.  | 
-Mot de passe :  +| **optional** | La réussite ou l'échec de ce module est sans importance, **sauf** s'il s'agit du seul module à exécuter | 
-Dernière connexion : lundi  8 août 2016 à 16:39:54 CEST sur pts/+| **include** | Ce control-flag permet d'inclure toutes les lignes du même //type de module/se trouvant dans le fichier spécifié en argument |
-[root@centos7 ~]# yum install elfutils-devel binutils-devel bison audit-libs-devel numactl-devel pciutils-devel pesign +
-... +
-</code>+
  
-Vous pouvez maintenant utilisez la commande rpmbuild pour préparer l'arborescence source du noyau :+Le **troisième champs** stipule le //**module**// associé à la règle. Sans chemin absolu, le fichier est supposé être dans le répertoire **/lib/security**. Pour inclure un module en dehors de ce répertoire il convient donc de stipuler son chemin absolu.
  
-<code> +Le **quatrième champs** contient éventuellement les **arguments**.
-[root@centos7 ~]# exit +
-logout +
-[trainee@centos7 ~]$ cd ~/rpmbuild/SPECS +
-[trainee@centos7 SPECS]$ rpmbuild -bp --target=$(uname -m) kernel.spec +
-Construction pour plate-formes cibles: x86_64 +
-Construction pour cible x86_64 +
-Exécution_de(%prep) : /bin/sh -e /var/tmp/rpm-tmp.xP6OkC +
-+ umask 022 +
-+ cd /home/trainee/rpmbuild/BUILD +
-+ patch_command='patch -p1 -F1 -s' +
-+ cd /home/trainee/rpmbuild/BUILD +
-+ rm -rf kernel-3.10.0-327.13.1.el7 +
-+ /usr/bin/mkdir -p kernel-3.10.0-327.13.1.el7 +
-+ cd kernel-3.10.0-327.13.1.el7 +
-+ /usr/bin/xz -dc /home/trainee/rpmbuild/SOURCES/linux-3.10.0-327.13.1.el7.tar.xz +
-+ /usr/bin/tar -xf - +
-... +
-</code>+
  
-A l'issu du processus, examinez l'arborescence :+Ouvrez maintenant le fichier **password-auth-ac** :
  
 <code> <code>
-[trainee@centos7 SPECS]$ ls -la ~/rpmbuild/BUILD/kernel-3.10.0-327.13.1.el7/linux-3.10.0-327.13.1.el7.x86_64/ +[root@centos7 ~]# cat /etc/pam.d/password-auth-ac 
-total 824 +#%PAM-1.0 
-drwxr-xr-x.  24 trainee trainee   4096  8 août  16:52 . +# This file is auto-generated
-drwxr-xr-x.   3 trainee trainee   4096  8 août  16:52 .. +# User changes will be destroyed the next time authconfig is run
-drwxr-xr-x.  32 trainee trainee   4096  8 août  16:52 arch +auth        required      pam_env.so 
-drwxr-xr-x.   3 trainee trainee   4096 29 févr. 18:35 block +auth        sufficient    pam_unix.so nullok try_first_pass 
--rw-r--r--.   trainee trainee 126411  8 août  16:52 .config +auth        requisite     pam_succeed_if.so uid >= 1000 quiet_success 
--rw-r--r--  1 trainee trainee 126420  8 août  16:52 .config.old +auth        required      pam_deny.so
-drwxr-xr-x  2 trainee trainee   4096  8 août  16:52 configs +
--rw-r--r--  1 trainee trainee  18693 29 févr. 18:35 COPYING +
--rw-r--r--  1 trainee trainee  95317 29 févr. 18:35 CREDITS +
-drwxr-xr-x.   4 trainee trainee   4096 29 févr. 18:35 crypto +
-drwxr-xr-x. 101 trainee trainee  12288  8 août  16:52 Documentation +
-drwxr-xr-x. 114 trainee trainee   4096 29 févr. 18:35 drivers +
-drwxr-xr-x.  36 trainee trainee   4096  8 août  16:52 firmware +
-drwxr-xr-x.  74 trainee trainee   4096 29 févr. 18:35 fs +
--rw-r--r--.   1 trainee trainee     46 29 févr18:35 .gitattributes +
-drwxr-xr-x.  27 trainee trainee   4096  8 août  16:52 include +
-drwxr-xr-x.   2 trainee trainee   4096 29 févr. 18:35 init +
-drwxr-xr-x.   2 trainee trainee   4096 29 févr. 18:35 ipc +
--rw-r--r--.   1 trainee trainee   2536 29 févr. 18:35 Kbuild +
--rw-r--r--.   1 trainee trainee    505 29 févr. 18:35 Kconfig +
-drwxr-xr-x.  11 trainee trainee   4096  8 août  16:52 kernel +
-drwxr-xr-x.  10 trainee trainee   4096  8 août  16:52 lib +
--rw-r--r--.   1 trainee trainee   4465 29 févr. 18:35 .mailmap +
--rw-r--r--.   1 trainee trainee 260223 29 févr. 18:35 MAINTAINERS +
--rw-r--r--.   1 trainee trainee  49887 29 févr. 18:35 Makefile +
-drwxr-xr-x.   2 trainee trainee   4096 29 févr. 18:35 mm +
-drwxr-xr-x.  56 trainee trainee   4096 29 févr. 18:35 net +
--rw-r--r--.   1 trainee trainee  18736 29 févr. 18:35 README +
--rw-r--r--.   1 trainee trainee   7485 29 févr. 18:35 REPORTING-BUGS +
-drwxr-xr-x.  12 trainee trainee   4096 29 févr. 18:35 samples +
--rw-r--r--.   1 trainee trainee      0  8 août  16:52 .scmversion +
-drwxr-xr-x.  13 trainee trainee   4096  8 août  16:52 scripts +
-drwxr-xr-x.   9 trainee trainee   4096 29 févr. 18:35 security +
-drwxr-xr-x.  23 trainee trainee   4096 29 févr. 18:35 sound +
-drwxr-xr-x.  19 trainee trainee   4096 29 févr. 18:35 tools +
-drwxr-xr-x.   2 trainee trainee   4096  8 août  16:52 usr +
-drwxr-xr-x.   3 trainee trainee   4096 29 févr. 18:35 virt +
-</code>+
  
-A l'intérieur de ce répertoire se trouve le fichier .config utilisé pour compiler le noyau :+account     required      pam_unix.so 
 +account     sufficient    pam_localuser.so 
 +account     sufficient    pam_succeed_if.so uid < 1000 quiet 
 +account     required      pam_permit.so
  
-<code> +password    requisite     pam_pwquality.so try_first_pass local_users_only retry=authtok_type= 
-[trainee@centos7 SPECS]$ more ~/rpmbuild/BUILD/kernel-3.10.0-327.13.1.el7/linux-3.10.0-327.13.1.el7.x86_64/.config +password    sufficient    pam_unix.so sha512 shadow nullok try_first_pass use_authtok 
-+password    required      pam_deny.so
-# Automatically generated file; DO NOT EDIT+
-# Linux/x86_64 3.10.0 Kernel Configuration +
-+
-CONFIG_64BIT=y +
-CONFIG_X86_64=y +
-CONFIG_X86=y +
-CONFIG_INSTRUCTION_DECODER=y +
-CONFIG_OUTPUT_FORMAT="elf64-x86-64" +
-CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig" +
-CONFIG_LOCKDEP_SUPPORT=y +
-CONFIG_STACKTRACE_SUPPORT=y +
-CONFIG_HAVE_LATENCYTOP_SUPPORT=y +
-CONFIG_MMU=y +
-CONFIG_NEED_DMA_MAP_STATE=y +
-CONFIG_NEED_SG_DMA_LENGTH=y +
-CONFIG_GENERIC_ISA_DMA=y +
-CONFIG_GENERIC_BUG=y +
-CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y +
-CONFIG_GENERIC_HWEIGHT=y +
-CONFIG_ARCH_MAY_HAVE_PC_FDC=y +
-CONFIG_RWSEM_XCHGADD_ALGORITHM=y +
-CONFIG_GENERIC_CALIBRATE_DELAY=y +
-CONFIG_ARCH_HAS_CPU_RELAX=y +
-CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y +
-CONFIG_ARCH_HAS_CPU_AUTOPROBE=y +
-CONFIG_HAVE_SETUP_PER_CPU_AREA=y +
-CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y +
-CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y +
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y +
-CONFIG_ARCH_SUSPEND_POSSIBLE=y +
-CONFIG_ZONE_DMA32=y +
-CONFIG_AUDIT_ARCH=y +
-CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y +
-CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +
-CONFIG_HAVE_INTEL_TXT=y +
-CONFIG_X86_64_SMP=y +
-CONFIG_X86_HT=y +
-CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" +
-CONFIG_ARCH_SUPPORTS_UPROBES=y +
-CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" +
-CONFIG_IRQ_WORK=y +
-CONFIG_BUILDTIME_EXTABLE_SORT=y+
  
-# +session     optional      pam_keyinit.so revoke 
---Plus--(1%)+session     required      pam_limits.so 
 +-session     optional      pam_systemd.so 
 +session     [success=default=ignore] pam_succeed_if.so service in crond quiet use_uid 
 +session     required      pam_unix.so
 </code> </code>
  
-Ce fichier est généré par une des trois commandes suivantes et ne doit **pas** être édité manuellement :+Dans ce fichier, si la règle **sufficient** réussit, les modules suivants ne sont pas invoqués.
  
-  * make config +===Bloquer un Compte après N Echecs de Connexion===
-  * make menuconfig +
-  * make xconfig+
  
-Dans ce fichier, vous pouvez constater la présence de lignes correspondantes à des fonctionalités suivies par une lettre ou une valeurDans le cas d'une lettre, la signification est la suivante :+Le module PAM **pam_tally.so** permet de bloquer un compte après N échecs de connexionAfin d'activer ce comportementil convient d'ajouter dans le fichier **/etc/pam.d/system-auth** la ligne suivante :
  
-  * **y** +<file> 
-    * la fonctionalité est incluse dans le noyau monolithique ou dans le cas d'une dépendance d'un module, dans le module concerné, +auth required pam_tally.so onerr=fail deny=3 unlock_time=300 
-  * **m** +</file>
-    * la fonctionalité est incluse en tant que module, +
-  * **n** +
-    * la fonctionalité n'est pas incluse. Cette option est rarement visible car dans bien les cas, la fonctionalité est simplement commentée dans le fichier lui-même.+
  
-Le fichier **Makefile** contient le nom du noyau et spécifie les informations suivantes :+Dans ce cas, après trois tentatives infructueuses de connexion, le compte sera bloquer pendant 5 minutes. 
  
-  * VERSION, +===Configuration===
-  * PATCHLEVEL, +
-  * SUBLEVEL, +
-  * EXTRAVERSION.+
  
-Les trois premières informations sont gérées par **kernel.org** et Linus Torvalds en personne tandis que l'EXTRAVERSION est gérée par Red Hat :+Certains modules de PAM peuvent être configurés grâce aux fichiers présents dans le répertoire **/etc/security** :
  
 <code> <code>
-[trainee@centos7 SPECS]$ more ~/rpmbuild/BUILD/kernel-3.10.0-327.13.1.el7/linux-3.10.0-327.13.1.el7.x86_64/Makefile  +[root@centos7 ~]# ls /etc/security 
-VERSION = 3 +access.conf       console.perms    limits.d        opasswd         time.conf 
-PATCHLEVEL = 10 +chroot.conf       console.perms.d  namespace.conf  pam_env.conf 
-SUBLEVEL = 0 +console.apps      group.conf       namespace.d     pwquality.conf 
-EXTRAVERSION = +console.handlers  limits.conf      namespace.init  sepermit.conf 
-NAME = Unicycling Gorilla +</code>
-RHEL_MAJOR = 7 +
-RHEL_MINOR = 2 +
-RHEL_RELEASE = 327.13.1 +
-RHEL_DRM_VERSION = 4 +
-RHEL_DRM_PATCHLEVEL = 1 +
-RHEL_DRM_SUBLEVEL = 0+
  
-# *DOCUMENTATION* +Parmi les fichiers cités on note ceux qui peuvent être utilisés pour configurer les modules suivants :
-# To see a list of typical targets execute "make help" +
-# More info can be located in ./README +
-# Comments in this file are targeted only to the developer, do not +
-# expect to learn how to build the kernel reading this file.+
  
-# Do not: +^ Fichier///Répertoire// ^ Description ^ 
-# o  use make's built-in rules and variables +| **access.conf** | Utilisé par le module pam_access.so | 
-#    (this increases performance and avoids hard-to-debug behaviour); +| **//console.apps//** | Utilisés par le module pam_console.so | 
-# o  print "Entering directory ..."; +| **console.perms** | Utilisé par le module pam_console.so | 
-MAKEFLAGS += -rR --no-print-directory+| **//console.perms.d//** | Utilisé par le module pam_console.so | 
 +| **group.conf** | Utilisés par le module pam_group.so | 
 +| **limits.conf** | Utilisé par le module pam_limits.so | 
 +| **pam_env.conf** | Utilisé par le module pam_env.so | 
 +| **time.conf** | Utilisé par le module pam_time.so |
  
-# Avoid funny character set dependencies +<WRAP center round todo 50%
-unexport LC_ALL +**A faire** : Passez en revue chacun de ces fichiers.
-LC_COLLATE=C +
-LC_NUMERIC=C +
-export LC_COLLATE LC_NUMERIC +
- +
-# We are using a recursive build, so we need to do a little thinking +
-# to get the ordering right. +
-+
-# Most importantly: sub-Makefiles should only ever modify files in +
-# their own directory. If in some directory we have a dependency on +
-# a file in another dir (which doesn't happen often, but it's often +
-# unavoidable when linking the built-in.o targets which finally +
-# turn into vmlinux), we will call a sub make in that other dir, and +
-# after that we are sure that everything which is in that other dir +
-# is now up to date. +
-+
-# The only cases where we need to modify files which have global +
-# effects are thus separated out and done before the recursive +
-# descending is started. They are now explicitly listed as the +
-# prepare rule. +
---Plus--(2%) +
-</code> +
- +
-<WRAP center round important+
-La version 2.6 du noyau a vu le jour en **2003**. Les **SUBLEVEL** se suivaient régulièrement. Avec la version 2.6 du noyau, la valeur paire du **PATCHLEVEL** indiquait que le noyau était stable. Quand vous recompilez le noyau à partir des sources, vous devez modifier la valeur de l'EXTRAVERSION.  Le passage à la version 3.0 fut décidé par Linus Torvalds à l'occasion des 20 ans du noyau Linux.+
 </WRAP> </WRAP>
  
-Utilisez maintenant la commande **make oldconfig** :+Dernièrement, PAM propose une solution pour toutes les applications ne disposant pas de leurs propres fichiers de configuration PAM. Cette solution prend la forme du fichier **/etc/pam.d/other** :
  
 <code> <code>
-[trainee@centos7 SPECS]$ cd ~/rpmbuild/BUILD/kernel-3.10.0-327.13.1.el7/linux-3.10.0-327.13.1.el7.x86_64 +[root@centos7 ~]# cat /etc/pam.d/other 
-[trainee@centos7 linux-3.10.0-327.13.1.el7.x86_64]$ make oldconfig +#%PAM-1.0 
-scripts/kconfig/conf --oldconfig Kconfig +auth     required       pam_deny.so 
-+account  required       pam_deny.so 
-# configuration written to .config +password required       pam_deny.so 
-#+session  required       pam_deny.so
 </code> </code>
  
-<WRAP center round important> +=====LAB #4 - Mise en place du Système de Prévention d'Intrusion Fail2Ban=====
-Cette commande lit le fichier .config du noyau actuel et le compare avec celui des sources du noyau. S'il existent des nouvelles configurations à effectuer dans les sources du noyau, la commande vous pose des questions. +
-</WRAP>+
  
-====Paramétrage du noyau====+Fail2Ban est un **S**ystème de **P**révention d'**I**ntrusion. Fail2Ban lit les logs de divers services (SSH, Apache, FTP…) à la recherche d’erreurs d'authentification répétées et ajoute une règle à iptables pour bannir l'adresse IP de la source.
  
-Après avoir modifié la configuration du noyau selon vos besoins en utilisant soit la commande **menuconfig** soit la commande **xconfig** (pas necéssaire pour cet exemple)insérez la sortie de la commande **uname -i** sur la première ligne du fichier .config :+====Installation==== 
 + 
 +Sous  RHEL/CentOS 7beaucoup d'outils de sécurité ne se trouvent pas dans leurs versions les plus récentes dans les dépôts de base. Installez donc le dépôt Fedora **epel** :
  
 <code> <code>
-[trainee@centos7 linux-3.10.0-327.13.1.el7.x86_64]$ uname -+[root@centos7 ~]# yum -y install epel-release
-x86_64 +
-[trainee@centos7 linux-3.10.0-327.13.1.el7.x86_64]$ vi .config +
-[trainee@centos7 linux-3.10.0-327.13.1.el7.x86_64]$ head .config +
-# x86_64 +
-+
-# Automatically generated file; DO NOT EDIT. +
-# Linux/x86 3.10.0 Kernel Configuration +
-+
-CONFIG_64BIT=y +
-CONFIG_X86_64=y +
-CONFIG_X86=y +
-CONFIG_INSTRUCTION_DECODER=y +
-CONFIG_OUTPUT_FORMAT="elf64-x86-64"+
 </code> </code>
  
-Renommez le fichier .config en le plaçant dans le répertoire **~/rpmbuild/SOURCES/** :+Ensuite installez Fail2Ban :
  
 <code> <code>
-[trainee@centos7 linux-3.10.0-327.13.1.el7.x86_64]$ cp .config ~/rpmbuild/SOURCES/config-`uname -m`-generic +[root@centos6 ~]# yum install fail2ban
-[trainee@centos7 linux-3.10.0-327.13.1.el7.x86_64]$ ls ~/rpmbuild/SOURCES +
-centos.cer             cpupower.service            kernel-3.10.0-ppc64-debug.config    kernel-3.10.0-x86_64.config        Module.kabi_ppc64    x509.genkey +
-centos-kpatch.x509     debrand-rh-i686-cpu.patch   kernel-3.10.0-ppc64le.config        kernel-3.10.0-x86_64-debug.config  Module.kabi_ppc64le +
-centos-ldup.x509       debrand-rh_taint.patch      kernel-3.10.0-ppc64le-debug.config  kernel-abi-whitelists-327.tar.bz2  Module.kabi_s390x +
-check-kabi             debrand-single-cpu.patch    kernel-3.10.0-s390x.config          linux-3.10.0-327.13.1.el7.tar.xz   Module.kabi_x86_64 +
-config-x86_64-generic  extra_certificates          kernel-3.10.0-s390x-debug.config    linux-kernel-test.patch            secureboot.cer +
-cpupower.config        kernel-3.10.0-ppc64.config  kernel-3.10.0-s390x-kdump.config    Makefile.common                    sign-modules+
 </code> </code>
  
-<WRAP center round important> +====Configuration====
-Pour un noyau 32 bits, remplacez **x86_64** par **i386** et **config-`uname -m`-generic** par **config-x86-32-generic**. +
-</WRAP>+
  
-Editez la directive **buildid** dans le fichier **~/rpmbuild/SPECS/kernel.spec** :+La configuration de Fail2Ban se trouve dans le fichier **/etc/fail2ban/jail.conf** :
  
 <code> <code>
-[trainee@centos7 linux-3.10.0-327.13.1.el7.x86_64]$ cd ~/rpmbuild/SPECS +[root@centos7 ~]# more /etc/fail2ban/jail.conf 
-[trainee@centos7 SPECS]$ vi kernel.spec +
-[trainee@centos7 SPECS]$ head kernel.spec  +# WARNING: heavily refactored in 0.9.0 release Please review and 
-We have to override the new %%install behavior because, well... the kernel is special+#          customize settings for your setup. 
-%global __spec_install_pre %{___build_pre}+
 +# Changes:  in most of the cases you should not modify this 
 +#           file, but provide customizations in jail.local file, 
 +#           or separate .conf files under jail.ddirectory, e.g.: 
 +
 +# HOW TO ACTIVATE JAILS: 
 +
 +# YOU SHOULD NOT MODIFY THIS FILE
 +
 +# It will probably be overwritten or improved in a distribution update
 +# 
 +# Provide customizations in a jail.local file or a jail.d/customisation.local. 
 +# For example to change the default bantime for all jails and to enable the 
 +# ssh-iptables jail the following (uncommented) would appear in the .local file. 
 +# See man 5 jail.conf for details
 +
 +# [DEFAULT] 
 +# bantime = 3600 
 +
 +# [sshd] 
 +# enabled = true 
 +
 +# See jail.conf(5) man page for more information
  
-Summary: The Linux kernel 
  
-%define buildid .i2tch 
  
-For kernel released for public testing, released_kernel should be 1. +Comments: use '#' for comment lines and ';' (following space) for inline comments
-# For internal testing builds during development, it should be 0. +
-%global released_kernel 1 +
-</code>+
  
-====Compiler le Noyau==== 
  
-La compilation du noyau peut prendre beaucoup de temps. La commande utilisée est la suivante :+[INCLUDES]
  
-<code> +#before = paths-distro.conf 
-[trainee@centos7 SPECS]$ rpmbuild -bb --target=`uname -m` kernel.spec+--More--(4%)
 </code> </code>
  
-A l'issu du processus, les rpm se trouvent dans le répertoire **/home/trainee/rpmbuild/RPMS/x86_64/** :+Dans ce fichier se trouvent des sections pour configurer l'action de Fail2Ban pour chaque service :
  
 <code> <code>
 ... ...
-Vérification des fichiers non empaquetés : /usr/lib/rpm/check-files /home/trainee/rpmbuild/BUILDROOT/kernel-3.10.0-327.13.1.el7.i2tch.x86_64 +[sshd]
-Écrit : /home/trainee/rpmbuild/RPMS/x86_64/kernel-3.10.0-327.13.1.el7.i2tch.x86_64.rpm +
-Écrit : /home/trainee/rpmbuild/RPMS/x86_64/kernel-headers-3.10.0-327.13.1.el7.i2tch.x86_64.rpm +
-Écrit : /home/trainee/rpmbuild/RPMS/x86_64/kernel-debuginfo-common-x86_64-3.10.0-327.13.1.el7.i2tch.x86_64.rpm +
-Écrit : /home/trainee/rpmbuild/RPMS/x86_64/perf-3.10.0-327.13.1.el7.i2tch.x86_64.rpm +
-Écrit : /home/trainee/rpmbuild/RPMS/x86_64/perf-debuginfo-3.10.0-327.13.1.el7.i2tch.x86_64.rpm +
-Écrit : /home/trainee/rpmbuild/RPMS/x86_64/python-perf-3.10.0-327.13.1.el7.i2tch.x86_64.rpm +
-Écrit : /home/trainee/rpmbuild/RPMS/x86_64/python-perf-debuginfo-3.10.0-327.13.1.el7.i2tch.x86_64.rpm +
-Écrit : /home/trainee/rpmbuild/RPMS/x86_64/kernel-tools-3.10.0-327.13.1.el7.i2tch.x86_64.rpm +
-Écrit : /home/trainee/rpmbuild/RPMS/x86_64/kernel-tools-libs-3.10.0-327.13.1.el7.i2tch.x86_64.rpm +
-Écrit : /home/trainee/rpmbuild/RPMS/x86_64/kernel-tools-libs-devel-3.10.0-327.13.1.el7.i2tch.x86_64.rpm +
-Écrit : /home/trainee/rpmbuild/RPMS/x86_64/kernel-tools-debuginfo-3.10.0-327.13.1.el7.i2tch.x86_64.rpm +
-Écrit : /home/trainee/rpmbuild/RPMS/x86_64/kernel-devel-3.10.0-327.13.1.el7.i2tch.x86_64.rpm +
-Écrit : /home/trainee/rpmbuild/RPMS/x86_64/kernel-debuginfo-3.10.0-327.13.1.el7.i2tch.x86_64.rpm +
-Écrit : /home/trainee/rpmbuild/RPMS/x86_64/kernel-debug-3.10.0-327.13.1.el7.i2tch.x86_64.rpm +
-Écrit : /home/trainee/rpmbuild/RPMS/x86_64/kernel-debug-devel-3.10.0-327.13.1.el7.i2tch.x86_64.rpm +
-Écrit : /home/trainee/rpmbuild/RPMS/x86_64/kernel-debug-debuginfo-3.10.0-327.13.1.el7.i2tch.x86_64.rpm +
-Exécution_de(%clean) : /bin/sh -e /var/tmp/rpm-tmp.HNhcuC +
-+ umask 022 +
-+ cd /home/trainee/rpmbuild/BUILD +
-+ cd kernel-3.10.0-327.13.1.el7 +
-+ rm -rf /home/trainee/rpmbuild/BUILDROOT/kernel-3.10.0-327.13.1.el7.i2tch.x86_64 +
-+ exit 0 +
-</code>+
  
-Notez que la génération du nouveau noyau a consommé plus de 9 Go d'espace disque :+port    = ssh 
 +logpath = %(sshd_log)s 
 +... 
 +</code> 
  
-<code> +Ces sectionsappelées des Prisons (//Jails// en anglais)peuvent contenir des directives telles que :
-[trainee@centos7 SPECS]$ df -h +
-Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur +
-/dev/sda2          9,8G    4,3G  5,5G  44% / +
-devtmpfs           231M        231M   0% /dev +
-tmpfs              245M        245M   0% /dev/shm +
-tmpfs              245M    4,7M  240M   2% /run +
-tmpfs              245M        245M   0% /sys/fs/cgroup +
-tmpfs              245M     40K  245M   1% /tmp +
-/dev/sdb1           20G    9,5G  9,2G  51% /home +
-/dev/sda1          197M    197M   20K 100% /boot +
-tmpfs               49M         49M   0% /run/user/1000 +
-</code>+
  
-====Installer le Nouveau Noyau====+^ Directive ^ Description ^ 
 +| enabled | Indique si oui (true) ou non (false) le prison est activé. | 
 +| port | Le port à bloquer dans iptables. | 
 +| filter | Le nom du filtre, une expression régulière, associé au prison et utilisé pour trouver une activité suspect. Le nom dans ce champs, sans l'extention .conf, fait référence à un fichier dans le répertoire **/etc/fail2ban/filter.d/**. Par exemple la valeur **sshd** fait reférence au fichier **/etc/fail2ban/filter.d/sshd.conf**. | 
 +| logpath | Le nom et le chemin du journal à examiner. | 
 +| maxretry | Le nombre maximal de tentatives. | 
 +| action | Spécifie l'action à entreprendre lors d'une corréspondance du **filter**. Le nom dans ce champs, sans l'extention .conf, fait référence à un fichier dans le répertoire **/etc/fail2ban/action.d/**. Par exemple la valeur **iptables** fait reférence au fichier **/etc/fail2ban/action.d/iptables.conf**. |
  
-Installez maintenant les deux paquets **kernel-devel** et **kernel-headers** :+Il n'est pas recommendé de modifier ce fichier afin de ne pas voir ses modifications ecrasées lors de la prochaine mise-à-jour de Fail2Ban. Fail2Ban nous donne la possibilité de créer le fichier **/etc/fail2ban/jail.local** pour contenir nos modifications. Créez donc ce fichier avec le contenu ci-dessous :
  
 <code> <code>
-[root@centos7 ~]# rpm -ivh /home/trainee/rpmbuild/RPMS/x86_64/kernel-devel-3.10.0-327.13.1.el7.i2tch.x86_64.rpm  +[root@centos7 ~]# vi /etc/fail2ban/jail.local 
-Preparing...                          ################################# [100%] +[root@centos7 ~]# cat /etc/fail2ban/jail.local 
-Updating / installing... +[DEFAULT
-   1:kernel-devel-3.10.0-327.13.1.el7.################################# [100%] +ignoreip = 127.0.0.1 172.YY+20.0.3  
-[root@centos7 ~]# rpm -ivh /home/trainee/rpmbuild/RPMS/x86_64/kernel-headers-3.10.0-327.13.1.el7.i2tch.x86_64.rpm +findtime = 3600 
-Preparing...                          ################################# [100%+bantime = 86400 
-Updating / installing... +maxretry = 5 
-   1:kernel-headers-3.10.0-327.13.1.el################################# [100%]+ 
 +[sshd] 
 +enabled = true
 </code> </code>
  
-Installez en dernier le nouveau noyau avec la commande **rpm** :+Il est à noter que les directives dans le fichier **jail.conf** sont surchargées par celles dans les fichiers suivantes et dans l'ordre suivant :
  
-<code> +  * **/etc/fail2ban/jail.d/*.conf** dans l'ordre alphabétique, 
-[root@centos7 ~]# rpm -ivh --force --nodeps /home/trainee/rpmbuild/RPMS/x86_64/kernel-3.10.0-327.13.1.el7.i2tch.x86_64.rpm +  * **/etc/fail2ban/jail.local**, 
-Preparing...                          ################################# [100%] +  * **/etc/fail2ban/jail.d/*.local** dans l'ordre alphabétique.
- installing package kernel-3.10.0-327.13.1.el7.i2tch.x86_64 needs 30MB on the /boot filesystem +
-</code>+
  
-<WRAP center round important> +<WRAP center round important 50%
-**Important** Notez le message d'erreur concernant le manque d'espace disponible sur /boot.+**Important** Notez que la définition des variables dans la section **[DEFAULT]** du fichier **/etc/fail2ban/jail.local** s'appliquent à toutes les sections de prisons actives dans les fichiers **/etc/fail2ban/jail.local** et **/etc/fail2ban/jail.conf** sauf si dans la section du prison elle-même, la variable est redéfinie.
 </WRAP> </WRAP>
  
-Lister maintenant les noyaux installés :+Dans ce fichier, les directives sont donc :
  
-<code> +^ Directive ^ Description ^ 
-[root@centos7 ~]# rpm -qa grep kernel-3 +ignoreip | Liste des adresses IP, séparées par un **espace**, qui ne sont pas concernées par l'action de Fail2Ban ou une liste d'adresses de réseaux, exprimées au format CIDR. | 
-kernel-3.10.0-327.el7.x86_64 +| findtime | L'intervale de temps en secondes, avant l'heure actuelle, pendant laquelle des authentifications infructueueses sont prises en compte pour le calcul de banir l'adresse IP ou non
-kernel-3.10.0-327.13.1.el7.x86_64 +| bantime | La durée de vie des règles, en secondes, inscrites dans le pare-feu iptables| 
-</code>+| maxretry | Le nombre maximal de tentativesLa règle sera donc inscrite dans le pare-feu lors de la sixième tentative|
  
-Un noyau se désinstalle comme tout autre paquet : +===Le répertoire /etc/fail2ban===
- +
-<code> +
-[root@centos7 ~]# yum remove kernel-3.10.0-327.el7.x86_64 +
-Loaded plugins: fastestmirror, langpacks +
-Resolving Dependencies +
---> Running transaction check +
----> Package kernel.x86_64 0:3.10.0-327.el7 will be erased +
---> Finished Dependency Resolution +
- +
-Dependencies Resolved +
- +
-======================================================================================================================================================================== +
- Package                            Arch                               Version                                      Repository                                     Size +
-======================================================================================================================================================================== +
-Removing: +
- kernel                             x86_64                             3.10.0-327.el7                               @base/$releasever                             136 M +
- +
-Transaction Summary +
-======================================================================================================================================================================== +
-Remove  1 Package +
- +
-Installed size: 136 M +
-Is this ok [y/N]: y +
-</code>+
  
-Installez le nouveau noyau avec la commande **rpm** :+Le répertoire **/etc/fail2ban/** contient des fichiers et répertoires importants pour le fonctionnement de Fail2Ban :
  
 <code> <code>
-[root@centos7 ~]# rpm -ivh --force --nodeps /home/trainee/rpmbuild/RPMS/x86_64/kernel-3.10.0-327.13.1.el7.i2tch.x86_64.rpm +[root@centos7 ~]# ls -l /etc/fail2ban/ 
-Preparing...                          ################################# [100%] +total 68 
-Updating / installing... +drwxr-xr-x. 2 root root  4096 Jun  8 22:51 action.d 
-   1:kernel-3.10.0-327.13.1.el7.i2tch ################################# [100%]+-rw-r--r--. 1 root root  2328 May 11  2017 fail2ban.conf 
 +drwxr-xr-x2 root root     6 Jul 13  2017 fail2ban.
 +drwxr-xr-x3 root root  4096 Jun  8 22:51 filter.
 +-rw-r--r--1 root root 21502 Jul 13  2017 jail.conf 
 +drwxr-xr-x2 root root    30 Jun  8 22:51 jail.d 
 +-rw-r--r--1 root root   110 Jun  8 22:54 jail.local 
 +-rw-r--r--1 root root  2375 May 11  2017 paths-common.conf 
 +-rw-r--r--. 1 root root   642 May 11  2017 paths-debian.conf 
 +-rw-r--r--. root root  1070 May 11  2017 paths-fedora.conf 
 +-rw-r--r--1 root root  1156 May 11  2017 paths-freebsd.conf 
 +-rw-r--r--. 1 root root   975 May 11  2017 paths-opensuse.conf 
 +-rw-r--r--. 1 root root   290 May 11  2017 paths-osx.conf
 </code> </code>
  
-Lister maintenant les noyaux installés :+==Le fichier fail2ban.conf==
  
-<code> +Ce fichier définit les configurations globales de Fail2Ban, telles le **pidfile**, le **socket** et le niveau syslog de journalisation :
-[root@centos7 ~]# rpm -qa | grep kernel-3 +
-kernel-3.10.0-327.13.1.el7.i2tch.x86_64 +
-kernel-3.10.0-327.13.1.el7.x86_64 +
-</code> +
- +
-Constatez la création d'un nouveau grub.cfg :+
  
 <code> <code>
-[root@centos7 ~]# grep i2tch /boot/grub2/grub.cfg +[root@centos7 ~]# cat /etc/fail2ban/fail2ban.conf  
-menuentry 'CentOS Linux (3.10.0-327.13.1.el7.i2tch.x86_64) 7 (Core)--class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.el7.x86_64-advanced-e65fe7da-cda8-4f5a-a827-1b5cabe94bed{ +# Fail2Ban main configuration file 
- linux16 /vmlinuz-3.10.0-327.13.1.el7.i2tch.x86_64 root=UUID=e65fe7da-cda8-4f5a-a827-1b5cabe94bed ro rhgb quiet LANG=en_GB.UTF-8 +
- initrd16 /initramfs-3.10.0-327.13.1.el7.i2tch.x86_64.img +# Comments: use '#for comment lines and ';(following a space) for inline comments 
-</code>+
 +# Changes:  in most of the cases you should not modify this 
 +#           file, but provide customizations in fail2ban.local file, e.g.
 +
 +# [Definition] 
 +# loglevel DEBUG 
 +#
  
-<WRAP center round important> +[Definition]
-**Important** : Re-démarrez votre VM en utilisant le nouveau noyau. +
-</WRAP>+
  
-Vérifiez ensuite l'utilisation du nouveau noyau :+# Optionloglevel 
 +# Notes.: Set the log level output. 
 +#         CRITICAL 
 +#         ERROR 
 +#         WARNING 
 +#         NOTICE 
 +#         INFO 
 +#         DEBUG 
 +# Values: [ LEVEL ]  Default: ERROR 
 +
 +loglevel = INFO
  
-<code> +Option: logtarget 
-[root@centos7 ~]uname -r +# Notes.: Set the log targetThis could be a file, SYSLOG, STDERR or STDOUT. 
-3.10.0-327.13.1.el7.i2tch.x86_64 +#         Only one log target can be specified. 
-</code>+#         If you change logtarget from the default value and you are 
 +#         using logrotate -- also adjust or disable rotation in the 
 +#         corresponding configuration file 
 +#         (e.g/etc/logrotate.d/fail2ban on Debian systems) 
 +# Values: [ STDOUT | STDERR | SYSLOG | FILE ]  Default: STDERR 
 +
 +logtarget = /var/log/fail2ban.log
  
-=====Gestion des Quotas=====+# Option: syslogsocket 
 +# Notes: Set the syslog socket file. Only used when logtarget is SYSLOG 
 +#        auto uses platform.system() to determine predefined paths 
 +# Values: [ auto | FILE ]  Default: auto 
 +syslogsocket auto
  
-Sous Linux il est possible de mettre en place des quotas par utilisateur et par groupeCeci étant, Linux ne sait  pas gérer des quotas par répertoire, uniquement des  +# Option: socket 
-quotas par partitionL'administrateur met souvent des quotas en place sur l'arborescence de /home pour limiter l'espace de stockage occupé par les utilisateurs.+# Notes.: Set the socket file. This is used to communicate with the daemon. Do 
 +#         not remove this file when Fail2ban runs. It will not be possible to 
 +#         communicate with the server afterwards
 +# Values: [ FILE ]  Default: /var/run/fail2ban/fail2ban.sock 
 +
 +socket = /var/run/fail2ban/fail2ban.sock
  
-Déconnectez-vous et reconnectez-vous en tant que root.+# Option: pidfile 
 +# Notes.: Set the PID file. This is used to store the process ID of the 
 +#         fail2ban server. 
 +# Values: [ FILE ]  Default: /var/run/fail2ban/fail2ban.pid 
 +
 +pidfile = /var/run/fail2ban/fail2ban.pid
  
-Avant de mettre en place des quotas, configurer SELINUX en mode **permissive** afin de ne pas avoir d'erreurs de ce dernier :+# Optionsdbfile 
 +# Notes.: Set the file for the fail2ban persistent data to be stored. 
 +#         A value of ":memory:" means database is only stored in memory  
 +#         and data is lost when fail2ban is stopped. 
 +#         A value of "None" disables the database. 
 +# Values: [ None :memory: FILE ] Default: /var/lib/fail2ban/fail2ban.sqlite3 
 +dbfile = /var/lib/fail2ban/fail2ban.sqlite3
  
-<code> +# Options: dbpurgeage 
-[root@centos7 ~]getenforce +Notes.: Sets age at which bans should be purged from the database 
-Enforcing +Values: SECONDS Default: 86400 (24hours) 
-[root@centos7 ~]setenforce permissive +dbpurgeage = 86400
-[root@centos7 ~]# getenforce +
-Permissive+
 </code> </code>
  
-Editez ensuite le fichier /etc/sysconfig/selinux ainsi :+==Le répertoire /etc/fail2ban/filter.d/== 
 + 
 +Ce répertoire contient les fichiers appelés par les directives **filter** dans les sections des prisons :
  
 <code> <code>
-[root@centos7 ~]# vi /etc/sysconfig/selinux +[root@centos7 ~]# ls -l /etc/fail2ban/filter.d/ 
-[root@centos7 ~]# cat /etc/sysconfig/selinux +total 344 
- +-rw-r--r--. 1 root root  442 May 11  2017 3proxy.conf 
-# This file controls the state of SELinux on the system+-rw-r--r--. 1 root root 3241 May 11  2017 apache-auth.conf 
-# SELINUX= can take one of these three values: +-rw-r--r--. 1 root root 2745 May 11  2017 apache-badbots.conf 
-#     enforcing SELinux security policy is enforced+-rw-r--r--. 1 root root 1273 May 11  2017 apache-botsearch.conf 
-#     permissive SELinux prints warnings instead of enforcing+-rw-r--r--. 1 root root  813 May 11  2017 apache-common.conf 
-#     disabled No SELinux policy is loaded+-rw-r--r--. 1 root root  268 May 11  2017 apache-fakegooglebot.conf 
-SELINUX=permissive +-rw-r--r--. 1 root root  487 May 11  2017 apache-modsecurity.conf 
-# SELINUXTYPE= can take one of three two values: +-rw-r--r--. 1 root root  596 May 11  2017 apache-nohome.conf 
-#     targeted Targeted processes are protected, +-rw-r--r--. 1 root root 1187 May 11  2017 apache-noscript.conf 
-#     minimum Modification of targeted policyOnly selected processes are protected.  +-rw-r--r--. 1 root root 2000 May 11  2017 apache-overflows.conf 
-#     mls Multi Level Security protection+-rw-r--r--. 1 root root  346 May 11  2017 apache-pass.conf 
-SELINUXTYPE=targeted +-rw-r--r--. 1 root root 1014 May 11  2017 apache-shellshock.conf 
 +-rw-r--r--. 1 root root 3418 May 11  2017 assp.conf 
 +-rw-r--r--. 1 root root 2443 May 11  2017 asterisk.conf 
 +-rw-r--r--. 1 root root  520 May 11  2017 botsearch-common.conf 
 +-rw-r--r--. 1 root root 1863 May 11  2017 common.conf 
 +-rw-r--r--. 1 root root  252 May 11  2017 counter-strike.conf 
 +-rw-r--r--. 1 root root  393 May 11  2017 courier-auth.conf 
 +-rw-r--r--. 1 root root  490 May 11  2017 courier-smtp.conf 
 +-rw-r--r--. 1 root root  444 May 11  2017 cyrus-imap.conf 
 +-rw-r--r--. 1 root root  345 May 11  2017 directadmin.conf 
 +-rw-r--r--. 1 root root 1942 May 11  2017 domino-smtp.conf 
 +-rw-r--r--. 1 root root 1875 May 11  2017 dovecot.conf 
 +-rw-r--r--. 1 root root 1696 May 11  2017 dropbear.conf 
 +-rw-r--r--. 1 root root  557 May 11  2017 drupal-auth.conf 
 +-rw-r--r--. 1 root root 1282 May 11  2017 ejabberd-auth.conf 
 +-rw-r--r--. 1 root root  516 May 11  2017 exim-common.conf 
 +-rw-r--r--. 1 root root 1847 May 11  2017 exim.conf 
 +-rw-r--r--. 1 root root 2158 May 11  2017 exim-spam.conf 
 +-rw-r--r--. 1 root root  963 May 11  2017 freeswitch.conf 
 +-rw-r--r--. 1 root root 1209 May 11  2017 froxlor-auth.conf 
 +-rw-r--r--. 1 root root  236 May 11  2017 groupoffice.conf 
 +-rw-r--r--. 1 root root  322 May 11  2017 gssftpd.conf 
 +-rw-r--r--. 1 root root  512 May 11  2017 guacamole.conf 
 +-rw-r--r--. 1 root root 1158 May 11  2017 haproxy-http-auth.conf 
 +-rw-r--r--. 1 root root  404 May 11  2017 horde.conf 
 +drwxr-xr-x. 2 root root   33 Jun  8 22:51 ignorecommands 
 +-rw-r--r--. 1 root root  482 May 11  2017 kerio.conf 
 +-rw-r--r--. 1 root root  323 May 11  2017 lighttpd-auth.conf 
 +-rw-r--r--. 1 root root 2279 May 11  2017 mongodb-auth.conf 
 +-rw-r--r--. 1 root root  773 May 11  2017 monit.conf 
 +-rw-r--r--. 1 root root  652 May 11  2017 murmur.conf 
 +-rw-r--r--. 1 root root  890 May 11  2017 mysqld-auth.conf 
 +-rw-r--r--. 1 root root  400 May 11  2017 nagios.conf 
 +-rw-r--r--. 1 root root 1594 May 11  2017 named-refused.conf 
 +-rw-r--r--. 1 root root  528 May 11  2017 nginx-botsearch.conf 
 +-rw-r--r--. 1 root root  442 May 11  2017 nginx-http-auth.conf 
 +-rw-r--r--. 1 root root 1427 May 11  2017 nginx-limit-req.conf 
 +-rw-r--r--. 1 root root  707 May 11  2017 nsd.conf 
 +-rw-r--r--. 1 root root  459 May 11  2017 openhab.conf 
 +-rw-r--r--. 1 root root  495 May 11  2017 openwebmail.conf 
 +-rw-r--r--. 1 root root 1905 May 11  2017 oracleims.conf 
 +-rw-r--r--. 1 root root  814 May 11  2017 pam-generic.conf 
 +-rw-r--r--. 1 root root  568 May 11  2017 perdition.conf 
 +-rw-r--r--. 1 root root  834 May 11  2017 php-url-fopen.conf 
 +-rw-r--r--. 1 root root  188 May 11  2017 portsentry.conf 
 +-rw-r--r--. 1 root root 1289 May 11  2017 postfix.conf 
 +-rw-r--r--. 1 root root  454 May 11  2017 postfix-rbl.conf 
 +-rw-r--r--. 1 root root  482 May 11  2017 postfix-sasl.conf 
 +-rw-r--r--. 1 root root 1216 May 11  2017 proftpd.conf 
 +-rw-r--r--. 1 root root 2409 May 11  2017 pure-ftpd.conf 
 +-rw-r--r--. 1 root root  795 May 11  2017 qmail.conf 
 +-rw-r--r--. 1 root root 1286 May 11  2017 recidive.conf 
 +-rw-r--r--. 1 root root 1367 May 11  2017 roundcube-auth.conf 
 +-rw-r--r--. 1 root root  821 May 11  2017 screensharingd.conf 
 +-rw-r--r--. 1 root root  517 May 11  2017 selinux-common.conf 
 +-rw-r--r--. 1 root root  570 May 11  2017 selinux-ssh.conf 
 +-rw-r--r--. 1 root root  396 Jul 13  2017 sendmail-auth.conf 
 +-rw-r--r--1 root root 2472 Jul 13  2017 sendmail-reject.conf 
 +-rw-r--r--. 1 root root  371 May 11  2017 sieve.conf 
 +-rw-r--r--1 root root  706 May 11  2017 slapd.conf 
 +-rw-r--r--. 1 root root  472 May 11  2017 sogo-auth.conf 
 +-rw-r--r--1 root root 1094 May 11  2017 solid-pop3d.conf 
 +-rw-r--r--. 1 root root  206 May 11  2017 squid.conf 
 +-rw-r--r--. 1 root root  199 May 11  2017 squirrelmail.conf 
 +-rw-r--r--. 1 root root  186 May 11  2017 sshd-aggressive.conf 
 +-rw-r--r--1 root root 4487 May 11  2017 sshd.conf 
 +-rw-r--r--1 root root  476 May 11  2017 sshd-ddos.conf 
 +-rw-r--r--. 1 root root  363 May 11  2017 stunnel.conf 
 +-rw-r--r--. 1 root root  649 May 11  2017 suhosin.conf 
 +-rw-r--r--. 1 root root  821 May 11  2017 tine20.conf 
 +-rw-r--r--. 1 root root  374 May 11  2017 uwimap-auth.conf 
 +-rw-r--r--. 1 root root  637 May 11  2017 vsftpd.conf 
 +-rw-r--r--. 1 root root  444 May 11  2017 webmin-auth.conf 
 +-rw-r--r--. 1 root root  520 May 11  2017 wuftpd.conf 
 +-rw-r--r--. 1 root root  503 May 11  2017 xinetd-fail.conf
 </code> </code>
  
-Commencez par vérifiez que le paquet **quota** est bien installé :+==Le répertoire /etc/fail2ban/action.d/==
  
-<code> +Ce répertoire contient les fichiers appelés par les directives **action** dans les sections des prisons :
-[root@centos7 ~]# rpm -qa | grep quota +
-quota-4.01-11.el7_2.1.x86_64 +
-quota-nls-4.01-11.el7_2.1.noarch +
-</code> +
- +
-Editez le fichier **/etc/fstab** en ajoutant les options **usrquota** et **grpquota** à la ligne **/home** :+
  
 <code> <code>
-[root@centos7 ~]# vi /etc/fstab +[root@centos7 ~]# ls -l /etc/fail2ban/action.d
-[root@centos7 ~]# cat /etc/fstab +total 244 
- +-rw-r--r--. 1 root root   587 May 11  2017 apf.conf 
-# +-rw-r--r--. 1 root root   629 May 11  2017 badips.conf 
-# /etc/fstab +-rw-r--r--. 1 root root 10620 May 11  2017 badips.py 
-# Created by anaconda on Sat Apr 30 11:27:02 2016 +-rw-r--r--. 2 root root 11791 Jul 13  2017 badips.pyc 
-# +-rw-r--r--. 2 root root 11791 Jul 13  2017 badips.pyo 
-# Accessible filesystems, by reference, are maintained under '/dev/disk' +-rw-r--r--. 1 root root  2631 May 11  2017 blocklist_de.conf 
-# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info +-rw-r--r--. 1 root root  1931 May 11  2017 cloudflare.conf 
-# +-rw-r--r--. 1 root root  7524 May 11  2017 dshield.conf 
-UUID=e65fe7da-cda8-4f5a-a827-1b5cabe94bed /                       xfs     defaults        0 0 +-rw-r--r--. 1 root root  1133 May 11  2017 dummy.conf 
-UUID=2d947276-66e8-41f4-8475-b64b67d7a249 /boot                   xfs     defaults        0 0 +-rw-r--r--. 1 root root  1538 May 11  2017 firewallcmd-allports.conf 
-UUID=3181601a-7295-4ef0-a92c-f21f76b18e64 swap                    swap    defaults        0 0 +-rw-r--r--. root root  1530 May 11  2017 firewallcmd-ipset.conf 
-UUID=a080ac6a-d15c-48e2-8461-a7b1aa3ebf1a /home   ext4    defaults,usrquota,grpquota        1 2+-rw-r--r--. 1 root root  2088 May 11  2017 firewallcmd-multiport.conf 
 +-rw-r--r--. 1 root root  2005 May 11  2017 firewallcmd-new.conf 
 +-rw-r--r--. 1 root root  3223 May 11  2017 firewallcmd-rich-logging.conf 
 +-rw-r--r--. 1 root root  2689 May 11  2017 firewallcmd-rich-rules.conf 
 +-rw-r--r--. 1 root root  1437 May 11  2017 iptables-allports.conf 
 +-rw-r--r--. 1 root root  1868 May 11  2017 iptables-common.conf 
 +-rw-r--r--. 1 root root  1350 May 11  2017 iptables.conf 
 +-rw-r--r--. 1 root root  1828 May 11  2017 iptables-ipset-proto4.conf 
 +-rw-r--r--. 1 root root  1755 May 11  2017 iptables-ipset-proto6-allports.conf 
 +-rw-r--r--. 1 root root  1798 May 11  2017 iptables-ipset-proto6.conf 
 +-rw-r--r--. 1 root root  1431 May 11  2017 iptables-multiport.conf 
 +-rw-r--r--. 1 root root  1910 May 11  2017 iptables-multiport-log.conf 
 +-rw-r--r--. 1 root root  1508 May 11  2017 iptables-new.conf 
 +-rw-r--r--. 1 root root  2282 May 11  2017 iptables-xt_recent-echo.conf 
 +-rw-r--r--. 1 root root  1556 May 11  2017 mail.conf 
 +-rw-r--r--. 1 root root  5233 May 11  2017 mynetwatchman.conf 
 +-rw-r--r--. 1 root root  1493 May 11  2017 netscaler.conf 
 +-rw-r--r--. 1 root root   489 May 11  2017 nftables-allports.conf 
 +-rw-r--r--. 1 root root  3680 May 11  2017 nftables-common.conf 
 +-rw-r--r--. 1 root root   496 May 11  2017 nftables-multiport.conf 
 +-rw-r--r--. 1 root root  1436 May 11  2017 npf.conf 
 +-rw-r--r--. 1 root root  3146 May 11  2017 nsupdate.conf 
 +-rw-r--r--. 1 root root  1023 May 11  2017 route.conf 
 +-rw-r--r--. 1 root root  2762 May 11  2017 sendmail-buffered.conf 
 +-rw-r--r--. 1 root root  1818 May 11  2017 sendmail-common.conf 
 +-rw-r--r--. 1 root root   798 May 11  2017 sendmail.conf 
 +-rw-r--r--. 1 root root  1692 May 11  2017 sendmail-geoip-lines.conf 
 +-rw-r--r--. 1 root root   918 May 11  2017 sendmail-whois.conf 
 +-rw-r--r--. 1 root root   993 May 11  2017 sendmail-whois-ipjailmatches.conf 
 +-rw-r--r--. 1 root root   974 May 11  2017 sendmail-whois-ipmatches.conf 
 +-rw-r--r--. 1 root root  1207 May 11  2017 sendmail-whois-lines.conf 
 +-rw-r--r--. 1 root root   938 May 11  2017 sendmail-whois-matches.conf 
 +-rw-r--r--. 1 root root  2981 May 11  2017 shorewall-ipset-proto6.conf 
 +-rw-r--r--. 1 root root  6021 May 11  2017 smtp.py 
 +-rw-r--r--. root root  5921 Jul 13  2017 smtp.pyc 
 +-rw-r--r--. 2 root root  5921 Jul 13  2017 smtp.pyo 
 +-rw-r--r--. 1 root root  1330 May 11  2017 symbiosis-blacklist-allports.conf 
 +-rw-r--r--. 1 root root  6018 May 11  2017 xarf-login-attack.conf
 </code> </code>
  
-Démontez puis remontez /home : +====Commandes====
- +
-<code> +
-[root@centos7 ~]# umount /home +
-[root@centos7 ~]# mount -a +
-</code>+
  
-Déconnectez-vous et reconnectez-vous en tant que trainee. Vérifiez ensuite que les options soient prises en compte :+Fail2Ban est constitué de deux commandes :
  
 <code> <code>
-[root@centos7 ~]# cat /etc/mtab +[root@centos7 ~]# which fail2ban-client 
-rootfs rootfs rw 0 0 +/bin/fail2ban-client 
-sysfs /sys sysfs rw,seclabel,nosuid,nodev,noexec,relatime 0 0 +[root@centos7 ~]# which fail2ban-server 
-proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0 +/bin/fail2ban-server
-devtmpfs /dev devtmpfs rw,seclabel,nosuid,size=236036k,nr_inodes=59009,mode=755 0 0 +
-securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0 +
-tmpfs /dev/shm tmpfs rw,seclabel,nosuid,nodev 0 0 +
-devpts /dev/pts devpts rw,seclabel,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0 +
-tmpfs /run tmpfs rw,seclabel,nosuid,nodev,mode=755 0 0 +
-tmpfs /sys/fs/cgroup tmpfs ro,seclabel,nosuid,nodev,noexec,mode=755 0 0 +
-cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd 0 0 +
-pstore /sys/fs/pstore pstore rw,nosuid,nodev,noexec,relatime 0 0 +
-cgroup /sys/fs/cgroup/net_cls cgroup rw,nosuid,nodev,noexec,relatime,net_cls 0 0 +
-cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0 +
-cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0 +
-cgroup /sys/fs/cgroup/hugetlb cgroup rw,nosuid,nodev,noexec,relatime,hugetlb 0 0 +
-cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0 +
-cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0 +
-cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpuacct,cpu 0 0 +
-cgroup /sys/fs/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0 +
-cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0 +
-configfs /sys/kernel/config configfs rw,relatime 0 0 +
-/dev/sda2 / xfs rw,seclabel,relatime,attr2,inode64,noquota 0 0 +
-selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0 +
-systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=23,pgrp=1,timeout=300,minproto=5,maxproto=5,direct 0 0 +
-debugfs /sys/kernel/debug debugfs rw,relatime 0 0 +
-hugetlbfs /dev/hugepages hugetlbfs rw,seclabel,relatime 0 0 +
-tmpfs /tmp tmpfs rw,seclabel 0 0 +
-mqueue /dev/mqueue mqueue rw,seclabel,relatime 0 0 +
-sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw,relatime 0 0 +
-nfsd /proc/fs/nfsd nfsd rw,relatime 0 0 +
-/dev/sda1 /boot xfs rw,seclabel,relatime,attr2,inode64,noquota 0 0 +
-tmpfs /run/user/0 tmpfs rw,seclabel,nosuid,nodev,relatime,size=50080k,mode=700 0 0 +
-/dev/sdb1 /home ext4 rw,seclabel,relatime,quota,usrquota,grpquota,data=ordered 0 0+
 </code> </code>
  
-====La Commande quotacheck====+L'exécutable **fail2ban-server** est responsable de l'examen des fichiers de journalisation ainsi que les commandes de blocage/déblocage. La commande fail2ban-client est utilisée pour configurer le **fail2ban-server**.
  
-Pour activer les quotas sur /home, il convient d'utiliser la commande **quotacheck** :+Les options de la commande **fail2ban-server** sont :
  
 <code> <code>
-[root@centos7 ~]# quotacheck -cugvm -f /dev/sdb1 +[root@centos7 ~]# fail2ban-server --help 
-quotacheckYour kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown. +Usage: /bin/fail2ban-server [OPTIONS]
-quotacheck: Parcours de /dev/sdb1 [/hometerminé +
-quotacheck: Cannot stat old user quota file /home/aquota.user: Aucun fichier ou dossier de ce type. Usage will not be subtracted. +
-quotacheck: Cannot stat old group quota file /home/aquota.group: Aucun fichier ou dossier de ce type. Usage will not be subtracted. +
-quotacheck: Cannot stat old user quota file /home/aquota.user: Aucun fichier ou dossier de ce type. Usage will not be subtracted. +
-quotacheck: Cannot stat old group quota file /home/aquota.group: Aucun fichier ou dossier de ce type. Usage will not be subtracted. +
-quotacheck: Vérifié 100 répertoires et 230 fichiers +
-quotacheck: Ancien fichier non trouvé. +
-quotacheck: Ancien fichier non trouvé. +
-</code>+
  
-Les options de la commande quotacheck sont :+Fail2Ban v0.9.7 reads log file that contains password failure report 
 +and bans the corresponding IP addresses using firewall rules.
  
-<code> +Only use this command for debugging purpose. Start the server with 
-[root@centos7 ~]# quotacheck --help +fail2ban-client instead. The default behaviour is to start the server 
-Utility for checking and repairing quota files. +in background.
-quotacheck [-gucbfinvdmMR] [-F <quota-format>] filesystem|-a+
  
--u, --user                check user files +Options: 
--g, --group               check group files +    -b                   start in background 
--c, --create-files        create new quota files +    -f                   start in foreground 
--b, --backup              create backups of old quota files +    -s <FILE>            socket path 
--f, --force               force check even if quotas are enabled +    -p <FILE>            pidfile path 
--i, --interactive         interactive mode +    -x                   force execution of the server (remove socket file) 
--n, --use-first-dquot     use the first copy of duplicated structure +    -h, --help           display this help message 
--v, --verbose             print more information +    -V, --version        print the version
--d, --debug               print even more messages +
--m, --no-remount          do not remount filesystem read-only +
--M, --try-remount         try remounting filesystem read-only, +
-                          continue even if it fails +
--R, --exclude-root        exclude root when checking all filesystems +
--F, --format=formatname   check quota files of specific format +
--a, --all                 check all filesystems +
--h, --help                display this message and exit +
--V, --version             display version information and exit+
  
-Rapports de bugs à jack@suse.cz+Report bugs to https://github.com/fail2ban/fail2ban/issues
 </code> </code>
  
-Les quotas ont été activés et les fichier **aquota.user** et **aquota.group** ont été créés dans le répertoire /home :+Les options de la commande **fail2ban-client** sont :
  
 <code> <code>
-[root@centos7 ~]# ls -la /home +[root@centos7 ~]# fail2ban-client --help 
-total 44 +Usage/bin/fail2ban-client [OPTIONS] <COMMAND>
-drwxr-xr-x.  4 root    root     4096 11 août  13:39 . +
-dr-xr-xr-x. 18 root    root     4096 11 août  13:27 .. +
--rw-------.  1 root    root     7168 11 août  13:39 aquota.group +
--rw-------.  1 root    root     7168 11 août  13:39 aquota.user +
-drwx------.  2 root    root    16384 11 août  13:26 lost+found +
-drwx------. 14 trainee trainee  4096 30 avril 15:29 trainee +
-</code>+
  
-Créez maintenant un utilisateur **fenestros** avec le mot de passe **fenestros** :+Fail2Ban v0.9.7 reads log file that contains password failure report 
 +and bans the corresponding IP addresses using firewall rules.
  
-<code+Options: 
-[root@centos7 ~]# groupadd fenestros && useradd fenestros -c FenestrOs -d /home/fenestros -g fenestros -s /bin/bash +    -c <DIR               configuration directory 
-[root@centos7 ~]# passwd fenestros +    -s <FILE>               socket path 
-Changement de mot de passe pour l'utilisateur fenestros+    -p <FILE>               pidfile path 
-Nouveau mot de passe : fenestros +    -d                      dump configurationFor debugging 
-MOT DE PASSE INCORRECT : Le mot de passe contient le nom d'utilisateur sous une forme +    -i                      interactive mode 
-Retapez le nouveau mot de passe : fenestros +    -v                      increase verbosity 
-passwd : mise à jour réussie de tous les jetons d'authentification. +    -q                      decrease verbosity 
-[root@centos7 ~]#  +    -x                      force execution of the server (remove socket file) 
-</code>+    -b                      start server in background (default) 
 +    -f                      start server in foreground (note that the client forks once itself) 
 +    -h, --help              display this help message 
 +    -V, --version           print the version
  
-====La Commande edquota====+Command: 
 +                                             BASIC 
 +    start                                    starts the server and the jails 
 +    reload                                   reloads the configuration 
 +    reload <JAIL>                            reloads the jail <JAIL> 
 +    stop                                     stops all jails and terminate the 
 +                                             server 
 +    status                                   gets the current status of the 
 +                                             server 
 +    ping                                     tests if the server is alive 
 +    help                                     return this output 
 +    version                                  return the server version
  
-Mettez en place maintenant un quota de 10Mo pour l'utilisateur **fenestros** :+                                             LOGGING 
 +    set loglevel <LEVEL>                     sets logging level to <LEVEL>
 +                                             LevelsCRITICAL, ERROR, WARNING, 
 +                                             NOTICE, INFO, DEBUG 
 +    get loglevel                             gets the logging level 
 +    set logtarget <TARGET>                   sets logging target to <TARGET>
 +                                             Can be STDOUT, STDERR, SYSLOG or a 
 +                                             file 
 +    get logtarget                            gets logging target 
 +    set syslogsocket auto|<SOCKET>           sets the syslog socket path to 
 +                                             auto or <SOCKET>. Only used if 
 +                                             logtarget is SYSLOG 
 +    get syslogsocket                         gets syslog socket path 
 +    flushlogs                                flushes the logtarget if a file 
 +                                             and reopens it. For log rotation.
  
-<code+                                             DATABASE 
-[root@centos ~]# edquota -u fenestros -f /home +    set dbfile <FILE                       set the location of fail2ban 
-</code>+                                             persistent datastore. Set to 
 +                                             "None" to disable 
 +    get dbfile                               get the location of fail2ban 
 +                                             persistent datastore 
 +    set dbpurgeage <SECONDS                sets the max age in <SECONDS> that 
 +                                             history of bans will be kept 
 +    get dbpurgeage                           gets the max age in seconds that 
 +                                             history of bans will be kept
  
-L'éditeur **vi** se lance et vous obtiendrez un résultat similaire à celui-ci :+                                             JAIL CONTROL 
 +    add <JAIL> <BACKEND>                     creates <JAIL> using <BACKEND> 
 +    start <JAIL>                             starts the jail <JAIL> 
 +    stop <JAIL>                              stops the jail <JAIL>. The jail is 
 +                                             removed 
 +    status <JAIL> [FLAVOR]                   gets the current status of <JAIL>, 
 +                                             with optional flavor or extended 
 +                                             info
  
-<file+                                             JAIL CONFIGURATION 
-Quotas disque pour user fenestros (uid 1001: +    set <JAIL> idle on|off                   sets the idle state of <JAIL
- Système de fichiers           blocs       souple     stricte   inodes    souple   stricte +    set <JAIL> addignoreip <IP>              adds <IP> to the ignore list of 
-  /dev/sdb1                                           0          0               0 +                                             <JAIL> 
-</file>+    set <JAIL> delignoreip <IP>              removes <IP> from the ignore list 
 +                                             of <JAIL> 
 +    set <JAIL> addlogpath <FILE> ['tail'   adds <FILE> to the monitoring list 
 +                                             of <JAIL>, optionally starting at 
 +                                             the 'tail' of the file (default 
 +                                             'head'). 
 +    set <JAIL> dellogpath <FILE>             removes <FILE> from the monitoring 
 +                                             list of <JAIL> 
 +    set <JAIL> logencoding <ENCODING>        sets the <ENCODING> of the log 
 +                                             files for <JAIL> 
 +    set <JAIL> addjournalmatch <MATCH>       adds <MATCH> to the journal filter 
 +                                             of <JAIL> 
 +    set <JAIL> deljournalmatch <MATCH>       removes <MATCH> from the journal 
 +                                             filter of <JAIL> 
 +    set <JAIL> addfailregex <REGEX>          adds the regular expression 
 +                                             <REGEX> which must match failures 
 +                                             for <JAIL> 
 +    set <JAIL> delfailregex <INDEX>          removes the regular expression at 
 +                                             <INDEX> for failregex 
 +    set <JAIL> ignorecommand <VALUE>         sets ignorecommand of <JAIL> 
 +    set <JAIL> addignoreregex <REGEX>        adds the regular expression 
 +                                             <REGEX> which should match pattern 
 +                                             to exclude for <JAIL> 
 +    set <JAIL> delignoreregex <INDEX>        removes the regular expression at 
 +                                             <INDEX> for ignoreregex 
 +    set <JAIL> findtime <TIME>               sets the number of seconds <TIME> 
 +                                             for which the filter will look 
 +                                             back for <JAIL> 
 +    set <JAIL> bantime <TIME>                sets the number of seconds <TIME> 
 +                                             a host will be banned for <JAIL> 
 +    set <JAIL> datepattern <PATTERN>         sets the <PATTERN> used to match 
 +                                             date/times for <JAIL> 
 +    set <JAIL> usedns <VALUE>                sets the usedns mode for <JAIL> 
 +    set <JAIL> banip <IP>                    manually Ban <IP> for <JAIL> 
 +    set <JAIL> unbanip <IP>                  manually Unban <IP> in <JAIL> 
 +    set <JAIL> maxretry <RETRY>              sets the number of failures 
 +                                             <RETRY> before banning the host 
 +                                             for <JAIL> 
 +    set <JAIL> maxlines <LINES>              sets the number of <LINES> to 
 +                                             buffer for regex search for <JAIL> 
 +    set <JAIL> addaction <ACT>[ <PYTHONFILE> <JSONKWARGS>
 +                                             adds a new action named <ACT> for 
 +                                             <JAIL>. Optionally for a Python 
 +                                             based action, a <PYTHONFILE> and 
 +                                             <JSONKWARGS> can be specified, 
 +                                             else will be a Command Action 
 +    set <JAIL> delaction <ACT>               removes the action <ACT> from 
 +                                             <JAIL>
  
-Modifiez ce fichier ainsi :+                                             COMMAND ACTION CONFIGURATION 
 +    set <JAIL> action <ACT> actionstart <CMD> 
 +                                             sets the start command <CMD> of 
 +                                             the action <ACT> for <JAIL> 
 +    set <JAIL> action <ACT> actionstop <CMD> sets the stop command <CMD> of the 
 +                                             action <ACT> for <JAIL> 
 +    set <JAIL> action <ACT> actioncheck <CMD> 
 +                                             sets the check command <CMD> of 
 +                                             the action <ACT> for <JAIL> 
 +    set <JAIL> action <ACT> actionban <CMD>  sets the ban command <CMD> of the 
 +                                             action <ACT> for <JAIL> 
 +    set <JAIL> action <ACT> actionunban <CMD> 
 +                                             sets the unban command <CMD> of 
 +                                             the action <ACT> for <JAIL> 
 +    set <JAIL> action <ACT> timeout <TIMEOUT> 
 +                                             sets <TIMEOUT> as the command 
 +                                             timeout in seconds for the action 
 +                                             <ACT> for <JAIL>
  
-<file+                                             GENERAL ACTION CONFIGURATION 
-Quotas disque pour user fenestros (uid 1001) : +    set <JAIL> action <ACT> <PROPERTY> <VALUE
- Système de fichiers           blocs       souple     stricte   inodes    souple   stricte +                                             sets the <VALUE> of <PROPERTY> for 
-  /dev/sdb1                                8000       10000        0        0        0 +                                             the action <ACT> for <JAIL> 
-</file>+    set <JAIL> action <ACT> <METHOD>[ <JSONKWARGS>] 
 +                                             calls the <METHOD> with 
 +                                             <JSONKWARGS> for the action <ACT> 
 +                                             for <JAIL>
  
-Les options de la commande **edquota** sont :+                                             JAIL INFORMATION 
 +    get <JAIL> logpath                       gets the list of the monitored 
 +                                             files for <JAIL> 
 +    get <JAIL> logencoding                   gets the encoding of the log files 
 +                                             for <JAIL> 
 +    get <JAIL> journalmatch                  gets the journal filter match for 
 +                                             <JAIL> 
 +    get <JAIL> ignoreip                      gets the list of ignored IP 
 +                                             addresses for <JAIL> 
 +    get <JAIL> ignorecommand                 gets ignorecommand of <JAIL> 
 +    get <JAIL> failregex                     gets the list of regular 
 +                                             expressions which matches the 
 +                                             failures for <JAIL> 
 +    get <JAIL> ignoreregex                   gets the list of regular 
 +                                             expressions which matches patterns 
 +                                             to ignore for <JAIL> 
 +    get <JAIL> findtime                      gets the time for which the filter 
 +                                             will look back for failures for 
 +                                             <JAIL> 
 +    get <JAIL> bantime                       gets the time a host is banned for 
 +                                             <JAIL> 
 +    get <JAIL> datepattern                   gets the patern used to match 
 +                                             date/times for <JAIL> 
 +    get <JAIL> usedns                        gets the usedns setting for <JAIL> 
 +    get <JAIL> maxretry                      gets the number of failures 
 +                                             allowed for <JAIL> 
 +    get <JAIL> maxlines                      gets the number of lines to buffer 
 +                                             for <JAIL> 
 +    get <JAIL> actions                       gets a list of actions for <JAIL>
  
-<code+                                             COMMAND ACTION INFORMATION 
-[root@centos7 ~]# edquota --help +    get <JAILaction <ACT> actionstart      gets the start command for the 
-edquota: Usage: +                                             action <ACT> for <JAIL> 
- edquota [-rm] [-u] [-F formatname] [-p username] [-f filesystem] username ... +    get <JAIL> action <ACT> actionstop       gets the stop command for the 
- edquota [-rm] -g [-F formatname] [-p groupname] [-f filesystem] groupname ... +                                             action <ACT> for <JAIL> 
- edquota [-u|g] [-F formatname] [-f filesystem] -t +    get <JAIL> action <ACT> actioncheck      gets the check command for the 
- edquota [-u|g] [-F formatname] [-f filesystem] -T username|groupname ...+                                             action <ACT> for <JAIL> 
 +    get <JAIL> action <ACT> actionban        gets the ban command for the 
 +                                             action <ACT> for <JAIL> 
 +    get <JAIL> action <ACT> actionunban      gets the unban command for the 
 +                                             action <ACT> for <JAIL> 
 +    get <JAIL> action <ACT> timeout          gets the command timeout in 
 +                                             seconds for the action <ACT> for 
 +                                             <JAIL>
  
--u, --user                    edit user data +                                             GENERAL ACTION INFORMATION 
--g, --group                   edit group data +    get <JAIL> actionproperties <ACT>        gets a list of properties for the 
--r, --remote                  edit remote quota (via RPC) +                                             action <ACT> for <JAIL> 
--m, --no-mixed-pathnames      trim leading slashes from NFSv4 mountpoints +    get <JAIL> actionmethods <ACT>           gets a list of methods for the 
--F, --format=formatname       edit quotas of a specific format +                                             action <ACT> for <JAIL> 
--p, --prototype=name          copy data from a prototype user/group +    get <JAIL> action <ACT> <PROPERTY>       gets the value of <PROPERTY> for 
-    --always-resolve          always try to resolve name, even if it is +                                             the action <ACT> for <JAIL>
-                              composed only of digits +
--f, --filesystem=filesystem   edit data only on a specific filesystem +
--t, --edit-period             edit grace period +
--T, --edit-times              edit grace time of a user/group +
--h, --help                    display this help text and exit +
--V, --version                 display version information and exit+
  
-Rapports de bugs à jack@suse.cz+Report bugs to https://github.com/fail2ban/fail2ban/issues
 </code> </code>
  
-<WRAP center round important> +===Activer et Démarrer le Serveur===
-Pour mettre en place un quota par group, la procédure est similaire. Il suffit d'utiliser l'option -g de la commande edquota. +
-</WRAP>+
  
-====La Commande quotaon==== +Pour prendre en compte la configuration dans le fichier **/etc/fail2ban/jail.local**, activez et démarrez le server :
- +
-Appliquez maintenant les quotas :+
  
 <code> <code>
-[root@centos7 ~]# quotaon -a +[root@centos7 ~]# systemctl status fail2ban 
-</code>+● fail2ban.service Fail2Ban Service 
 +   Loaded: loaded (/usr/lib/systemd/system/fail2ban.service; disabled; vendor preset: disabled) 
 +   Active: inactive (dead) 
 +     Docs: man:fail2ban(1)
  
-Les options de la commande **quotaon** sont :+[root@centos7 ~]# systemctl enable fail2ban
  
-<code> +Created symlink from /etc/systemd/system/multi-user.target.wants/fail2ban.service to /usr/lib/systemd/system/fail2ban.service. 
-[root@centos7 ~]# quotaon --help + 
-quotaon: Usage: +[root@centos7 ~]# systemctl start fail2ban
- quotaon [-guvp] [-F quotaformat] [-x state] -a +
- quotaon [-guvp] [-F quotaformat] [-x state] filesys ...+
  
--a, --all                turn quotas on for all filesystems +[[root@centos7 ~]# ps aux | grep fail2ban-server 
--f, --off                turn quotas off +root     19229  0.5  2.3 399480 11532 ?        Sl   23:37   0:00 /usr/bin/python2 -s /usr/bin/fail2ban-server -s /var/run/fail2ban/fail2ban.sock -p /var/run/fail2ban/fail2ban.pid --b 
--u, --user               operate on user quotas +root     20004  0.0  0.1 112660   988 pts/1    S+   23:39   0:00 grep --color=auto fail2ban-server
--g, --group              operate on group quotas +
--p--print-state        print whether quotas are on or off +
--x, --xfs-command=cmd    perform XFS quota command +
--F, --format=formatname  operate on specific quota format +
--v, --verbose            print more messages +
--h, --help               display this help text and exit +
--V, --version            display version information and exit+
 </code> </code>
  
-De cette manière vous avez mis en place un quota **souple** pour fenestros de 8 000 Ko et un quota **stricte** de 10 000 Ko. +===Utiliser la Commande Fail2Ban-server==
  
-Quand l'utilisateur fenestros aura dépassé le quota **souple**il recevra un message d'avertissement. Quand il dépasse le quota **stricte**, il ne pourra plus enregistrer dans /home, sauf dans le cas où il supprime des fichiers pour retomber en dessous de la limite **stricte**.+Pour connaître le status de Fail2Ban-serversaisissez la commande suivante :
  
-Il est à noter que vous pouvez soit mettre en place un quota en taille, soit mettre en place un quota basé sur le nombre d'inodes utilisés par l'utilisateur. +<code
- +[root@centos7 ~]# fail2ban-client status 
-<WRAP center round important+Status 
-La commande pour désactivez les quotas est **quotaoff**.  +|- Number of jail: 1 
-</WRAP> +`- Jail list: sshd  
- +</code>
-====La Commande repquota====+
  
-Pour visualiser les quotas utilisez la commande **repquota** :+Il est aussi possible de se renseigner sur le statut d'un prison particulier :
  
 <code> <code>
-[root@centos7 ~]# repquota /home +[root@centos7 ~]# fail2ban-client status sshd 
-*** Rapport pour les quotas user sur le périphérique /dev/sdb1 +Status for the jailsshd 
-Période de sursis bloc : 7days ; période de sursis inode 7days +|- Filter 
-                        Block limits                File limits +|  |- Currently failed: 0 
-Utilisateur     utilisé souple stricte sursis utilisé souple stricte sursis +|  |Total failed: 0 
----------------------------------------------------------------------- +|  `Journal matches: _SYSTEMD_UNIT=sshd.service + _COMM=sshd 
-root      --      20                          2                +`Actions 
-trainee   --   20484             0            328                +   |Currently banned:
-   +   |Total banned:
 +   `- Banned IP list:
 </code> </code>
  
-<WRAP center round important> +La commande **fail2ban-client** peut être utilisée pour contrôler un prison :
-Notez que l'utilisateur fenestros ne figure pas dans la liste. Sous CentOS, le quota n'est pas visible tant que l'utilisateur ne s'est pas connecté pour la première fois. Notez aussi les période de grâce de **7** jours. +
-</WRAP> +
- +
-Les options de la commande **repquota** sont :+
  
 <code> <code>
-[root@centos7 ~]# repquota --help +[root@centos7 ~]# fail2ban-client stop sshd 
-repquota: Utility for reporting quotas. +Jail stopped
-Usage: +
-repquota [-vugsi] [-c|C] [-t|n] [-F quotaformat] (-a | mntpoint)+
  
--v, --verbose               display also users/groups without any usage +[root@centos7 ~]# fail2ban-client status sshd 
--u, --user                  display information about users +ERROR  NOK: ('sshd',) 
--g, --group                 display information about groups +Sorry but the jail 'sshd' does not exist
--s, --human-readable        show numbers in human friendly units (MBGB, ...+
--t, --truncate-names        truncate names to 9 characters +
--p, --raw-grace             print grace time in seconds since epoch +
--n, --no-names              do not translate uid/gid to name +
--i, --no-autofs             avoid autofs mountpoints +
--c, --cache                 translate big number of ids at once +
--C, --no-cache              translate ids one by one +
--F, --format=formatname     report information for specific format +
--a, --all                   report information for all mount points with quotas +
--h, --help                  display this help message and exit +
--V, --version               display version information and exit+
  
-Rapports de bugs à jack@suse.cz+[root@centos7 ~]# fail2ban-client reload 
 + 
 +[root@centos7 ~]# fail2ban-client status sshd 
 +Status for the jail: sshd 
 +|- Filter 
 +|  |- Currently failed: 0 
 +|  |- Total failed: 0 
 +|  `- Journal matches: _SYSTEMD_UNIT=sshd.service + _COMM=sshd 
 +`- Actions 
 +   |- Currently banned: 0 
 +   |- Total banned: 0 
 +   `- Banned IP list:
 </code> </code>
  
-====La Commande quota====+===Ajouter un Prison===
  
-Pour visualiser les quotas d'un utilisateur spécifique, il convient d'utiliser la commande **quota** :+Installez maintenant le serveur Apache si ce n'est pas déjà fait :
  
 <code> <code>
-[root@centos7 ~]# quota fenestros +[root@centos7 ~]# yum install httpd
-Disk quotas for user fenestros (uid 1001): aucun +
-[root@centos7 ~]# su - fenestros +
-[fenestros@centos7 ~]$ touch test +
-[fenestros@centos7 ~]$ exit +
-logout +
-[root@centos7 ~]# quota fenestros +
-Disk quotas for user fenestros (uid 1001):  +
-Système fichiers   blocs   quota  limite  sursisfichiers   quota  limite  sursis +
-      /dev/sdb1      24    8000   10000                                      +
 </code> </code>
  
-Les options de la commande **quota** sont :+Activez et démarrez le service Apache si ce n'est pas déjà lancé :
  
 <code> <code>
-[root@centos7 ~]# quota --help +[root@centos7 ~]# systemctl status httpd 
-quotaUsagequota [-guqvswim] [-l | [-Q | -A]] [-F quotaformat] +● httpd.service The Apache HTTP Server 
- quota [-qvswim] [-l | [-Q | -A]] [-F quotaformat] -u username ... +   Loadedloaded (/usr/lib/systemd/system/httpd.service; disabled; vendor presetdisabled) 
- quota [-qvswim] [-l | [-Q | -A]] [-F quotaformat] -g groupname ... +   Active: inactive (dead) 
- quota [-qvswugQm] [-F quotaformat] -f filesystem ...+     Docs: man:httpd(8) 
 +           man:apachectl(8)
  
--u, --user                display quota for user +[root@centos7 ~]# systemctl enable httpd
--g, --group               display quota for group +
--q, --quiet               print more terse message +
--v, --verbose             print more verbose message +
--s, --human-readable      display numbers in human friendly units (MB, GB...) +
-    --always-resolve      always try to translate name to id, even if it is +
-   composed of only digits +
--w, --no-wrap             do not wrap long lines +
--p, --raw-grace           print grace time in seconds since epoch +
--l, --local-only          do not query NFS filesystems +
--Q, --quiet-refuse        do not print error message when NFS server does +
-                          not respond +
--i, --no-autofs           do not query autofs mountpoints +
--F, --format=formatname   display quota of a specific format +
--f, --filesystem-list     display quota information only for given filesystems +
--A, --all-nfs             display quota for all NFS mountpoints +
--m, --no-mixed-pathnames  trim leading slashes from NFSv4 mountpoints +
-    --show-mntpoint       show mount point of the file system in output +
-    --hide-device         do not show file system device in output +
--h, --help                display this help message and exit +
--V, --version             display version information and exit+
  
-Rapports de bugs à : jack@suse.cz+Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. 
 + 
 +[root@centos7 ~]# systemctl start httpd
 </code> </code>
  
-====La Commande warnquota==== +Modifiez maintenant votre fichier **/etc/fail2ban/jail.local** :
- +
-La commande **warnquota** vérifie le ou les disques et envoie un message par mail à tout utilisateur qui a dépassé la limite soft. Elle est enrègle générale appelée par un job cron. Cependant elle peut aussi est appelée d'une manière intéractive. +
- +
-Sous RHEL/CentOS 7, warnquota n'est pas installé par défaut :+
  
 <code> <code>
-[root@centos7 ~]# yum install quota-warnquota +[root@centos7 ~]# vi /etc/fail2ban/jail.local 
-Modules complémentaires chargés : fastestmirror, langpacks +[root@centos7 ~]# cat /etc/fail2ban/jail.local 
-base                                                                                                                                             | 3.6 kB  00:00:00      +[DEFAULT] 
-extras                                                                                                                                           | 3.4 kB  00:00:00      +ignoreip = 127.0.0.1 10.0.2.15  
-updates                                                                                                                                          | 3.4 kB  00:00:00      +findtime = 3600 
-Loading mirror speeds from cached hostfile +bantime = 86400 
- * base: centos.quelquesmots.fr +maxretry = 5
- * extras: miroir.univ-paris13.fr +
- * updates: miroir.univ-paris13.fr +
-Résolution des dépendances +
---> Lancement de la transaction de test +
----> Le paquet quota-warnquota.x86_64 1:4.01-11.el7_2.1 sera installé +
---> Résolution des dépendances terminée+
  
-Dépendances résolues+[sshd] 
 +enabled = true
  
-======================================================================================================================================================================== +[apache-auth] 
- Package                                     Architecture                       Version                                       Dépôt                               Taille +enabled true
-======================================================================================================================================================================== +
-Installation : +
- quota-warnquota                             x86_64                             1:4.01-11.el7_2.1                             updates                              76 k +
- +
-Résumé de la transaction +
-======================================================================================================================================================================== +
-Installation   1 Paquet +
- +
-Taille totale des téléchargements : 76 k +
-Taille d'installation : 137 k +
-Is this ok [y/d/N]: y+
 </code> </code>
  
-Les options de la commande **warnquota** sont :+Appliquez la nouvelle configuration et constatez le résultat :
  
 <code> <code>
-[root@centos7 ~]# warnquota --help +[root@centos7 ~]# fail2ban-client reload 
-warnquota: Usage: +[root@centos7 ~]# fail2ban-client status 
-  warnquota [-ugsid[-F quotaformat] [-c configfile] [-q quotatabfile] [-a adminsfile] [filesystem...] +Status 
- +|Number of jail: 2 
--u, --user                      warn users +`Jail list: apache-authsshd
--g, --group                     warn groups +
--s, --human-readable            send information in more human friendly units +
--i, --no-autofs                 avoid autofs mountpoints +
--d, --no-details                do not send quota information itself +
--F, --format=formatname         use quotafiles of specific format +
--c, --config=config-file        non-default config file +
--q--quota-tab=quotatab-file   non-default quotatab +
--a, --admins-file=admins-file   non-default admins file +
--h, --help                      display this help message and exit +
--v, --version                   display version information and exit +
- +
-Rapports de bugs à jack@suse.cz+
 </code> </code>
  
 ----- -----
-<html> + 
-<div align="center"> +Copyright © 2023 Hugh Norris.
-Copyright © 2022 Hugh Norris. +
-</html>+
Menu