Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
elearning:workbooks:centos:6:avance:l107 [2022/04/23 11:16] – created admin | elearning:workbooks:centos:6:avance:l107 [2023/02/15 15:56] (Version actuelle) – admin | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
~~PDF: | ~~PDF: | ||
- | Version : **2022.01** | + | Version : **2021.01** |
Dernière mise-à-jour : ~~LASTMOD~~ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
- | ======LCF307 | + | ======LCF306 |
=====Contenu du Module===== | =====Contenu du Module===== | ||
- | * **LCF307 | + | * **LCF306 |
* 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' | + | * La commande lastlog |
- | * Paramétrage du noyau | + | * La Commande lastb |
- | * Compiler le Noyau | + | * / |
- | * 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' |
- | * La Commande quota | + | * Installation |
- | * La Commande | + | * Configuration |
+ | * Le répertoire / | ||
+ | * Le fichier fail2ban.conf | ||
+ | * Le répertoire / | ||
+ | * Le répertoire / | ||
+ | * Commandes | ||
+ | * Activer et Démarrer le Serveur | ||
+ | * Utiliser la Commande | ||
+ | * Ajouter un Prison | ||
- | =====Rôle du noyau===== | + | =====Le Problématique===== |
- | Le noyau ou //kernel// est la partie du système d' | + | Un pirate peut utiliser un logiciel de **crackage** pour tenter de découvrir un mot de passe. |
- | * la diminution | + | Le principe |
- | * la prise en charge de nouveau matériel, | + | |
- | * l' | + | |
- | * l' | + | |
- | * la correction | + | |
- | * le besoin d'une fonctionnalité expérimentale. | + | |
- | Commencez par identifier le noyau utilisé par votre machine : | + | ====LAB #1 - John the Ripper==== |
- | < | + | ===Installation=== |
- | [root@centos7 ~]# uname -r | + | |
- | 3.10.0-327.13.1.el7.x86_64 | + | |
- | </ | + | |
- | Dans le cas d'une utilisation courante | + | Créez |
< | < | ||
- | [root@centos7 ~]# ls /lib/modules/ | + | [trainee@centos7 ~]$ su - |
- | build | + | Password: fenestros |
- | extra | + | Last login: Mon Apr 23 17:23:14 CEST 2018 on tty1 |
- | kernel | + | [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 " | ||
+ | cd | ||
+ | wget http:// | ||
+ | wget http://www.openwall.com/ | ||
+ | wget http:// | ||
+ | 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:// | ||
</ | </ | ||
- | Les commandes pour manipuler les modules sont : | + | Rendez-le exécutable |
- | + | ||
- | * insmod | + | |
- | * rmmod | + | |
- | * lsmod | + | |
- | * modprobe | + | |
- | + | ||
- | Par exemple | + | |
< | < | ||
- | [root@centos7 ~]# lsmod | + | [root@centos7 ~]# chmod u+x john.sh |
- | Module | + | |
- | ip6t_rpfilter | + | |
- | ip6t_REJECT | + | |
- | ipt_REJECT | + | |
- | xt_conntrack | + | |
- | ebtable_nat | + | |
- | ebtable_broute | + | |
- | bridge | + | |
- | stp 12976 1 bridge | + | |
- | llc 14552 2 stp, | + | |
- | ebtable_filter | + | |
- | ebtables | + | |
- | ip6table_nat | + | |
- | nf_conntrack_ipv6 | + | |
- | nf_defrag_ipv6 | + | |
- | nf_nat_ipv6 | + | |
- | ip6table_mangle | + | |
- | ip6table_security | + | |
- | ip6table_raw | + | |
- | ip6table_filter | + | |
- | ip6_tables | + | |
- | iptable_nat | + | |
- | nf_conntrack_ipv4 | + | |
- | nf_defrag_ipv4 | + | |
- | nf_nat_ipv4 | + | |
- | nf_nat | + | |
- | nf_conntrack | + | |
- | iptable_mangle | + | |
- | iptable_security | + | |
- | iptable_raw | + | |
- | iptable_filter | + | |
- | dm_mirror | + | |
- | dm_region_hash | + | |
- | dm_log | + | |
- | dm_mod | + | |
- | crc32_pclmul | + | |
- | ghash_clmulni_intel | + | |
- | aesni_intel | + | |
- | lrw 13286 1 aesni_intel | + | |
- | gf128mul | + | |
- | glue_helper | + | |
- | snd_intel8x0 | + | |
- | ablk_helper | + | |
- | cryptd | + | |
- | snd_ac97_codec | + | |
- | ac97_bus | + | |
- | ppdev 17671 0 | + | |
- | snd_seq | + | |
- | snd_seq_device | + | |
- | snd_pcm | + | |
- | pcspkr | + | |
- | sg | + | |
- | parport_pc | + | |
- | parport | + | |
- | snd_timer | + | |
- | snd 83425 8 snd_ac97_codec, | + | |
- | soundcore | + | |
- | i2c_piix4 | + | |
- | video 24400 0 | + | |
- | i2c_core | + | |
- | nfsd 302418 | + | |
- | auth_rpcgss | + | |
- | nfs_acl | + | |
- | lockd 93600 1 nfsd | + | |
- | grace 13295 2 nfsd, | + | |
- | sunrpc | + | |
- | ip_tables | + | |
- | xfs | + | |
- | libcrc32c | + | |
- | sd_mod | + | |
- | crc_t10dif | + | |
- | crct10dif_generic | + | |
- | sr_mod | + | |
- | cdrom 42556 1 sr_mod | + | |
- | ata_generic | + | |
- | pata_acpi | + | |
- | ahci | + | |
- | libahci | + | |
- | ata_piix | + | |
- | crct10dif_pclmul | + | |
- | crct10dif_common | + | |
- | crc32c_intel | + | |
- | serio_raw | + | |
- | libata | + | |
- | e1000 | + | |
</ | </ | ||
- | Pour ajouter un module, on peut utiliser la commande **insmod** ou **modprobe**. Cette dernière ajoute non seulement | + | Exécutez |
< | < | ||
- | [root@centos7 ~]# modprobe bonding | + | [root@centos7 ~]# ./ |
- | [root@centos7 ~]# lsmod | more | + | |
- | Module | + | |
- | bonding | + | |
- | ip6t_rpfilter | + | |
- | ip6t_REJECT | + | |
- | ipt_REJECT | + | |
- | xt_conntrack | + | |
- | ebtable_nat | + | |
- | ebtable_broute | + | |
- | bridge | + | |
- | stp 12976 1 bridge | + | |
- | llc 14552 2 stp, | + | |
- | ebtable_filter | + | |
- | ebtables | + | |
- | ip6table_nat | + | |
- | nf_conntrack_ipv6 | + | |
- | nf_defrag_ipv6 | + | |
- | nf_nat_ipv6 | + | |
- | ip6table_mangle | + | |
- | ip6table_security | + | |
- | ip6table_raw | + | |
- | ip6table_filter | + | |
- | ip6_tables | + | |
- | y, | + | |
- | --More-- | + | |
</ | </ | ||
- | Pour supprimer un module, on peut utiliser la commande | + | ===Utilisation=== |
+ | |||
+ | Placez-vous dans le répertoire | ||
< | < | ||
- | [root@centos7 ~]# modprobe | + | [root@centos7 ~]# cd john-1.8.0/run/ |
- | [root@centos7 ~]# lsmod | more | + | |
- | Module | + | |
- | ip6t_rpfilter | + | |
- | ip6t_REJECT | + | |
- | ipt_REJECT | + | |
- | xt_conntrack | + | |
- | ebtable_nat | + | |
- | ebtable_broute | + | |
- | bridge | + | |
- | stp 12976 1 bridge | + | |
- | llc 14552 2 stp, | + | |
- | ebtable_filter | + | |
- | ebtables | + | |
- | ip6table_nat | + | |
- | nf_conntrack_ipv6 | + | |
- | nf_defrag_ipv6 | + | |
- | nf_nat_ipv6 | + | |
- | ip6table_mangle | + | |
- | ip6table_security | + | |
- | ip6table_raw | + | |
- | ip6table_filter | + | |
- | ip6_tables | + | |
- | y, | + | |
- | iptable_nat | + | |
- | --More-- | + | |
</ | </ | ||
- | Les dépendances des modules sont résolues par la commande | + | Utilisez l' |
< | < | ||
- | [root@centos7 | + | [root@centos7 |
- | kernel/arch/x86/kernel/cpu/ | + | |
- | kernel/ | + | |
- | kernel/ | + | |
- | kernel/ | + | |
- | kernel/ | + | |
- | kernel/ | + | |
- | kernel/ | + | |
- | kernel/ | + | |
- | to/lrw.ko kernel/ | + | |
- | kernel/ | + | |
- | kernel/ | + | |
- | el/ | + | |
- | kernel/ | + | |
- | helper.ko kernel/ | + | |
- | kernel/ | + | |
- | kernel/ | + | |
- | kernel/ | + | |
- | kernel/ | + | |
- | kernel/ | + | |
- | kernel/ | + | |
- | kernel/ | + | |
- | f128mul.ko kernel/ | + | |
- | kernel/ | + | |
- | --More--(0%) | + | |
</ | </ | ||
- | Il est possible d' | + | Consultez le fichier |
< | < | ||
- | [root@centos7 | + | [root@centos7 |
- | filename: | + | root:$6$TX12b5lW9UXD8Ld6$l/PjTA.XrBAbsayGCaSFaM5ibLo2xBBeYNCyEdVv9uMUctxq9Q0YBxLwCvS2bCdgr.BeSmXvi6BwD55KKscaJ.:0:0:root:/root:/bin/bash |
- | author: Thomas Davis, tadavis@lbl.gov and many others | + | bin: |
- | description: | + | daemon:*:2: |
- | version: 3.7.1 | + | adm:*:3: |
- | license: GPL | + | lp:*:4:7: |
- | alias: | + | sync:*: |
- | rhelversion: 7.2 | + | shutdown:*: |
- | srcversion: 49765A3F5CDFF2C3DCFD8E6 | + | halt:*:7:0:halt:/ |
- | depends: | + | mail:*: |
- | intree: Y | + | operator: |
- | vermagic: 3.10.0-327.13.1.el7.x86_64 SMP mod_unload modversions | + | games:*: |
- | signer: CentOS Linux kernel signing key | + | ftp:*:14:50:FTP User:/var/ftp:/ |
- | 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:/:/ |
- | sig_hashalgo: sha256 | + | avahi-autoipd:!!:170:170:Avahi IPv4LL Stack:/ |
- | parm: max_bonds:Max number of bonded devices (int) | + | systemd-bus-proxy:!!:999: |
- | parm: tx_queues:Max number of transmit queues (default = 16) (int) | + | systemd-network:!!: |
- | parm: num_grat_arp:Number of peer notifications to send on failover event (alias of num_unsol_na) (int) | + | dbus:!!:81: |
- | parm: num_unsol_na:Number of peer notifications to send on failover event (alias of num_grat_arp) (int) | + | polkitd:!!:997: |
- | parm: miimon:Link check interval in milliseconds (int) | + | abrt:!!:173: |
- | parm: updelay:Delay before considering link up, in milliseconds (int) | + | usbmuxd:!!:113: |
- | parm: downdelay:Delay before considering link down, in milliseconds (int) | + | colord:!!:996: |
- | parm: use_carrier:Use netif_carrier_ok (vs MII ioctls) in miimon; 0 for off, 1 for on (default) (int) | + | libstoragemgmt:!!:995: |
- | parm: mode:Mode of operation; 0 for balance-rr, 1 for active-backup, | + | setroubleshoot:!!:994: |
- | parm: primary:Primary network device to use (charp) | + | rpc:!!:32: |
- | 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: |
- | parm: lacp_rate:LACPDU tx rate to request from 802.3ad partner; 0 for slow, 1 for fast (charp) | + | chrony:!!:993: |
- | parm: ad_select:803.ad aggregation selection logic; 0 for stable (default), 1 for bandwidth, 2 for count (charp) | + | unbound:!!:992: |
- | parm: min_links:Minimum number of available links before turning on carrier (int) | + | tss:!!:59: |
- | 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: |
- | parm: arp_interval:arp interval in milliseconds (int) | + | ntp:!!:38: |
- | parm: arp_ip_target:arp targets in n.n.n.n form (array of charp) | + | sssd:!!:990: |
- | 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:/ |
- | parm: arp_all_targets:fail on any/all arp targets timeout; 0 for any (default), 1 for all (charp) | + | nfsnobody:!!:65534: |
- | 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:!!: |
- | 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: |
- | parm: resend_igmp:Number of IGMP membership reports to send on link failure (int) | + | gnome-initial-setup:!!:989: |
- | 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:/ |
- | parm: lp_interval:The number of seconds between instances where the bonding driver sends learning packets to each slaves peer switch. The default is 1. (uint) | + | postfix:!!:89: |
+ | sshd:!!:74: | ||
+ | tcpdump:!!:72: | ||
+ | trainee: | ||
+ | vboxadd: | ||
</ | </ | ||
- | Dernièrement, | + | Lancez |
< | < | ||
- | [root@centos7 | + | [root@centos7 |
- | mlx4.conf | + | Loaded 2 password hashes with 2 different salts (crypt, generic crypt(3) [?/64]) |
- | + | Press ' | |
- | [root@centos7 ~]# cat /etc/modprobe.d/mlx4.conf | + | 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=0 num_vfs=0 | + | 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=0 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 | + | [q] < |
- | #options mlx4_core debug_level=1 probe_vf=1 num_vfs=7 | + | Use the " |
- | # | + | 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 | + | |
</ | </ | ||
- | =====Compilation et installation du noyau et des modules===== | + | Consultez la liste des mots de passe craqués |
- | + | ||
- | Commencez par installer les paquets necessaires | + | |
< | < | ||
- | [root@centos7 | + | [root@centos7 |
- | Loaded plugins: fastestmirror, | + | trainee:trainee:1000:1000:trainee:/ |
- | 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 Dependency: libstdc++-devel = 4.8.5-4.el7 for package: gcc-c++-4.8.5-4.el7.x86_64 | + | |
- | ---> Package libXi-devel.x86_64 0:1.7.4-2.el7 will be installed | + | |
- | --> Processing Dependency: xorg-x11-proto-devel for package: libXi-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: | + | |
- | ---> Package qt3-devel.x86_64 0: | + | |
- | --> 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: | + | |
- | --> Processing Dependency: pkgconfig(expat) for package: fontconfig-devel-2.10.95-7.el7.x86_64 | + | |
- | ---> Package freetype-devel.x86_64 0: | + | |
- | --> Processing Dependency: zlib-devel for package: freetype-devel-2.4.11-11.el7.x86_64 | + | |
- | ---> Package libICE-devel.x86_64 0: | + | |
- | ---> Package libSM-devel.x86_64 0: | + | |
- | ---> Package libX11-devel.x86_64 0: | + | |
- | --> 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: | + | |
- | ---> Package libXext-devel.x86_64 0: | + | |
- | ---> Package libXfixes-devel.x86_64 0: | + | |
- | ---> Package libXft-devel.x86_64 0: | + | |
- | ---> Package libXinerama-devel.x86_64 0: | + | |
- | ---> Package libXrandr-devel.x86_64 0: | + | |
- | ---> Package libXrender-devel.x86_64 0: | + | |
- | ---> Package libXt-devel.x86_64 0: | + | |
- | ---> Package libjpeg-turbo-devel.x86_64 0: | + | |
- | ---> Package libmng.x86_64 0: | + | |
- | ---> Package libmng-devel.x86_64 0: | + | |
- | ---> Package libpng-devel.x86_64 2: | + | |
- | ---> Package libstdc++-devel.x86_64 0: | + | |
- | ---> Package mesa-libGL-devel.x86_64 0: | + | |
- | --> 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: | + | |
- | ---> Package qt3.x86_64 0: | + | |
- | ---> Package rpm-build.x86_64 0: | + | |
- | --> Processing Dependency: system-rpm-config for package: rpm-build-4.11.3-17.el7.x86_64 | + | |
- | --> Processing Dependency: perl(Thread:: | + | |
- | ---> Package xorg-x11-proto-devel.noarch 0: | + | |
- | --> Running transaction check | + | |
- | ---> Package expat-devel.x86_64 0: | + | |
- | ---> Package gl-manpages.noarch 0: | + | |
- | ---> Package libXdamage-devel.x86_64 0: | + | |
- | ---> Package libXxf86vm-devel.x86_64 0: | + | |
- | ---> Package libdrm-devel.x86_64 0: | + | |
- | ---> Package libxcb-devel.x86_64 0: | + | |
- | --> 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: | + | |
- | ---> Package redhat-rpm-config.noarch 0: | + | |
- | --> 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: | + | |
- | --> Running transaction check | + | |
- | ---> Package dwz.x86_64 0: | + | |
- | ---> Package libXau-devel.x86_64 0: | + | |
- | ---> Package perl-srpm-macros.noarch 0:1-8.el7 will be installed | + | |
- | --> Finished Dependency Resolution | + | |
- | Dependencies Resolved | + | 1 password hash cracked, |
- | + | ||
- | ======================================================================================================================================================================== | + | |
- | | + | |
- | ======================================================================================================================================================================== | + | |
- | Installing: | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | Installing for dependencies: | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | + | ||
- | Transaction Summary | + | |
- | ======================================================================================================================================================================== | + | |
- | Install | + | |
- | + | ||
- | Total download size: 27 M | + | |
- | Installed size: 90 M | + | |
- | Is this ok [y/d/N]: y | + | |
</ | </ | ||
- | <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' | + | |
- | </ | + | |
- | ====Déplacer /home==== | + | ====La commande last==== |
- | <WRAP center round todo> | + | Cette commande indique les dates et heures |
- | Arrêtez votre machine virtuelle. Ajoutez un deuxième disque de 20 Go au contrôleur SATA en utilisant la section **Stockage** | + | |
- | </WRAP> | + | |
- | + | ||
- | Créez une seule partition sur **/dev/sdb** : | + | |
< | < | ||
- | [root@centos7 ~]# fdisk /dev/sdb | + | [root@centos7 ~]# last |
- | Welcome to fdisk (util-linux 2.23.2). | + | trainee |
+ | trainee | ||
+ | trainee | ||
+ | trainee | ||
+ | trainee | ||
+ | reboot | ||
+ | trainee | ||
+ | reboot | ||
+ | trainee | ||
+ | reboot | ||
+ | reboot | ||
+ | trainee | ||
+ | trainee | ||
+ | reboot | ||
+ | trainee | ||
+ | trainee | ||
+ | reboot | ||
+ | trainee | ||
+ | reboot | ||
+ | trainee | ||
+ | trainee | ||
+ | trainee | ||
+ | (unknown :0 : | ||
+ | reboot | ||
+ | trainee | ||
+ | trainee | ||
+ | reboot | ||
+ | trainee | ||
+ | reboot | ||
+ | trainee | ||
+ | trainee | ||
+ | reboot | ||
+ | trainee | ||
+ | trainee | ||
+ | (unknown :0 : | ||
+ | reboot | ||
+ | trainee | ||
+ | trainee | ||
+ | (unknown :0 : | ||
+ | reboot | ||
+ | trainee | ||
+ | reboot | ||
+ | trainee | ||
+ | trainee | ||
+ | (unknown :0 : | ||
+ | reboot | ||
+ | trainee | ||
+ | trainee | ||
+ | trainee | ||
+ | trainee | ||
+ | trainee | ||
+ | (unknown :0 : | ||
+ | reboot | ||
- | 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. | + | </ |
- | Device does not contain a recognized partition table | + | ====La commande lastlog==== |
- | Building a new DOS disklabel with disk identifier 0x88708329. | + | |
- | Command (m for help): n | + | Cette commande indique les dates et heures de la connexion au système la plus récente des utilisateurs |
- | Partition type: | + | |
- | | + | |
- | | + | |
- | Select (default p): p | + | |
- | Partition number (1-4, default 1): | + | |
- | First sector (2048-41943039, | + | |
- | Using default value 2048 | + | |
- | Last sector, +sectors or +size{K, | + | |
- | Using default value 41943039 | + | |
- | Partition 1 of type Linux and of size 20 GiB is set | + | |
- | Command (m for help): w | + | < |
- | The partition table has been altered! | + | [root@centos7 ~]# lastlog |
- | + | Username | |
- | Calling ioctl() to re-read partition table. | + | root |
- | Syncing disks. | + | bin **Never logged in** |
+ | daemon | ||
+ | adm **Never logged in** | ||
+ | lp | ||
+ | sync | ||
+ | shutdown | ||
+ | halt | ||
+ | mail | ||
+ | operator | ||
+ | games **Never logged in** | ||
+ | ftp **Never logged in** | ||
+ | nobody | ||
+ | avahi-autoipd | ||
+ | systemd-bus-proxy | ||
+ | systemd-network | ||
+ | dbus | ||
+ | polkitd | ||
+ | abrt | ||
+ | usbmuxd | ||
+ | colord | ||
+ | libstoragemgmt | ||
+ | setroubleshoot | ||
+ | rpc **Never logged in** | ||
+ | rtkit **Never logged in** | ||
+ | chrony | ||
+ | unbound | ||
+ | tss **Never logged in** | ||
+ | geoclue | ||
+ | ntp **Never logged in** | ||
+ | sssd | ||
+ | rpcuser | ||
+ | nfsnobody | ||
+ | pulse **Never logged in** | ||
+ | gdm :0 Sat Apr 30 15:22:30 +0200 2016 | ||
+ | gnome-initial-setup | ||
+ | avahi **Never logged in** | ||
+ | postfix | ||
+ | sshd | ||
+ | tcpdump | ||
+ | trainee | ||
+ | vboxadd | ||
+ | snort **Never logged in** | ||
+ | apache | ||
</ | </ | ||
- | 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 | ||
< | < | ||
- | [root@centos7 ~]# mkfs.ext4 | + | [root@centos7 ~]# lastb |
- | mke2fs 1.42.9 (28-Dec-2013) | + | root pts/0 Tue Jun 19 16:37 - 16:37 |
- | Filesystem label= | + | |
- | OS type: Linux | + | |
- | Block size=4096 | + | |
- | 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 tables: done | + | btmp begins Tue Jun 19 16:37:18 2018 |
- | Writing inode tables: done | + | |
- | Creating journal (32768 blocks): done | + | |
- | Writing superblocks and filesystem accounting information: | + | |
</ | </ | ||
- | Montez **/dev/sdb1** sur /mnt : | + | ====/var/log/secure==== |
- | < | + | Sous RHEL/CentOS ce fichier contient la journalisation des opérations |
- | [root@centos7 ~]# mount /dev/sdb1 /mnt | + | |
- | </ | + | |
- | + | ||
- | Copiez le contenu | + | |
< | < | ||
- | [root@centos7 ~]# cp -a /home/* /mnt | + | [root@centos7 ~]# tail -n 15 /var/log/secure |
+ | Jun 19 22:03:57 centos7 polkitd[532]: | ||
+ | Jun 19 22:04:06 centos7 polkitd[532]: | ||
+ | Jun 19 22:04:07 centos7 polkitd[532]: | ||
+ | Jun 19 23:45:43 centos7 su: pam_unix(su-l: | ||
+ | Jun 19 23:46:13 centos7 su: pam_unix(su-l: | ||
+ | Jun 19 23:48:25 centos7 su: pam_unix(su-l: | ||
+ | Jun 19 23:48:25 centos7 su: pam_unix(su-l: | ||
+ | Jun 19 23:52:22 centos7 su: pam_unix(su-l: | ||
+ | Jun 19 23:52:27 centos7 su: pam_unix(su-l: | ||
+ | Jun 19 23:54:35 centos7 su: pam_unix(su-l: | ||
+ | Jun 19 23:55:33 centos7 su: pam_unix(su-l: | ||
+ | Jun 20 00:01:21 centos7 su: pam_unix(su-l: | ||
+ | Jun 20 00:01:50 centos7 su: pam_unix(su-l: | ||
+ | Jun 20 00:01:53 centos7 su: pam_unix(su-l: | ||
+ | Jun 20 00:02:19 centos7 su: pam_unix(su-l: | ||
</ | </ | ||
- | Démontez /dev/sdb1 et déplacez /home vers /root : | + | =====Les Contre-Mesures===== |
- | < | + | Les contre-mesures incluent le renforcement de la sécurité des comptes et l' |
- | [root@centos7 ~]# umount /mnt | + | |
- | [root@centos7 ~]# mv /home /root | + | |
- | </ | + | |
- | Identifiez l'UUID de /dev/sdb1 : | + | ====LAB #2 - Renforcer la sécurité des comptes==== |
- | < | + | Passez en revue le fichier **/etc/passwd** : |
- | [root@centos7 ~]# ls -l / | + | |
- | lrwxrwxrwx. 1 root root 10 9 août 06:47 a5e2457f-7337-41f4-b958-e403eb419f94 -> ../ | + | |
- | </ | + | |
- | + | ||
- | Editez | + | |
- | + | ||
- | <file txt / | + | |
- | # | + | |
- | # / | + | |
- | # Created by anaconda on Sat Apr 30 11:27:02 2016 | + | |
- | # | + | |
- | # Accessible filesystems, | + | |
- | # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info | + | |
- | # | + | |
- | UUID=e65fe7da-cda8-4f5a-a827-1b5cabe94bed / | + | |
- | UUID=2d947276-66e8-41f4-8475-b64b67d7a249 /boot | + | |
- | UUID=3181601a-7295-4ef0-a92c-f21f76b18e64 swap swap defaults | + | |
- | UUID=a5e2457f-7337-41f4-b958-e403eb419f94 / | + | |
+ | < | ||
+ | root: | ||
+ | bin: | ||
+ | daemon: | ||
+ | adm: | ||
+ | lp: | ||
+ | sync: | ||
+ | shutdown: | ||
+ | halt: | ||
+ | mail: | ||
+ | uucp: | ||
+ | operator: | ||
+ | games: | ||
+ | gopher: | ||
+ | ftp: | ||
+ | nobody: | ||
+ | dbus: | ||
+ | usbmuxd: | ||
+ | avahi-autoipd: | ||
+ | vcsa: | ||
+ | rpc: | ||
+ | rtkit: | ||
+ | abrt: | ||
+ | nscd: | ||
+ | tcpdump: | ||
+ | haldaemon: | ||
+ | apache: | ||
+ | nslcd: | ||
+ | saslauth: | ||
+ | postfix: | ||
+ | avahi: | ||
+ | ntp: | ||
+ | rpcuser: | ||
+ | nfsnobody: | ||
+ | sshd: | ||
+ | pulse: | ||
+ | gdm: | ||
+ | trainee: | ||
+ | vboxadd: | ||
+ | prison: | ||
</ | </ | ||
- | Créez le point de montage | + | <WRAP center round important 50%> |
+ | **Important** : Notez que la valeur | ||
+ | </WRAP> | ||
- | < | + | Chaque ligne est constituée de 7 champs : |
- | [root@centos7 ~]# mkdir /home | + | |
- | </ | + | |
- | Montez | + | * Le nom d' |
+ | * 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' | ||
+ | * Le nom complet. Ce champs optionnel est aussi appelé **GECOS** | ||
+ | * Le répertoire personnel de l' | ||
+ | * Le shell de l' | ||
- | < | + | Notez d' |
- | [root@centos7 ~]# mount -a | + | |
- | [root@centos7 ~]# mount | + | |
- | sysfs on /sys type sysfs (rw,nosuid, | + | |
- | proc on /proc type proc (rw, | + | |
- | devtmpfs on /dev type devtmpfs (rw, | + | |
- | securityfs on / | + | |
- | tmpfs on /dev/shm type tmpfs (rw, | + | |
- | devpts on /dev/pts type devpts (rw, | + | |
- | tmpfs on /run type tmpfs (rw, | + | |
- | tmpfs on / | + | |
- | cgroup on / | + | |
- | pstore on / | + | |
- | cgroup on / | + | |
- | cgroup on / | + | |
- | cgroup on / | + | |
- | cgroup on / | + | |
- | cgroup on / | + | |
- | cgroup on / | + | |
- | cgroup on / | + | |
- | cgroup on / | + | |
- | cgroup on / | + | |
- | configfs on / | + | |
- | /dev/sda2 on / type xfs (rw, | + | |
- | selinuxfs on / | + | |
- | systemd-1 on / | + | |
- | debugfs on / | + | |
- | hugetlbfs on / | + | |
- | mqueue on /dev/mqueue type mqueue (rw, | + | |
- | tmpfs on /tmp type tmpfs (rw, | + | |
- | sunrpc on / | + | |
- | nfsd on / | + | |
- | /dev/sda1 on /boot type xfs (rw, | + | |
- | /dev/sdb1 on /home type ext4 (rw, | + | |
- | tmpfs on / | + | |
- | </ | + | |
- | Notez la taille de /home : | + | < |
+ | lp: | ||
+ | </ | ||
- | < | + | 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 | + | |
- | / | + | |
- | devtmpfs | + | |
- | tmpfs 245M | + | |
- | tmpfs 245M 4,7M 240M 2% /run | + | |
- | tmpfs 245M | + | |
- | tmpfs 245M | + | |
- | / | + | |
- | / | + | |
- | tmpfs | + | |
- | </ | + | |
- | <WRAP center round todo> | + | # userdel |
- | Fermez la session de root et connectez-vous en tant que trainee. | + | |
- | </ | + | |
- | ====Créer un Nouveau Noyau==== | + | # groupdel lp [Entree] |
- | Pour créer l' | + | Pour les utilisateurs restants, utilisez |
< | < | ||
- | [trainee@centos7 ~]$ rpmdev-setuptree | + | [root@centos7 ~]# cat /etc/shadow |
- | [trainee@centos7 ~]$ ls -laR rpmbuild/ | + | root:$6$TX12b5lW9UXD8Ld6$l/PjTA.XrBAbsayGCaSFaM5ibLo2xBBeYNCyEdVv9uMUctxq9Q0YBxLwCvS2bCdgr.BeSmXvi6BwD55KKscaJ.:: |
- | rpmbuild/: | + | bin: |
- | total 28 | + | daemon: |
- | drwxrwxr-x. | + | adm: |
- | drwx------. 15 trainee trainee 4096 9 août 06:56 .. | + | lp: |
- | drwxrwxr-x. | + | sync: |
- | drwxrwxr-x. | + | shutdown: |
- | drwxrwxr-x. | + | halt: |
- | drwxrwxr-x. | + | mail: |
- | drwxrwxr-x. | + | operator: |
+ | games: | ||
+ | ftp: | ||
+ | nobody: | ||
+ | avahi-autoipd: | ||
+ | systemd-bus-proxy: | ||
+ | systemd-network: | ||
+ | dbus: | ||
+ | polkitd: | ||
+ | abrt: | ||
+ | usbmuxd: | ||
+ | colord: | ||
+ | libstoragemgmt: | ||
+ | setroubleshoot: | ||
+ | rpc: | ||
+ | rtkit: | ||
+ | chrony: | ||
+ | unbound: | ||
+ | tss: | ||
+ | geoclue: | ||
+ | ntp: | ||
+ | sssd: | ||
+ | rpcuser: | ||
+ | nfsnobody: | ||
+ | pulse: | ||
+ | gdm: | ||
+ | gnome-initial-setup: | ||
+ | avahi: | ||
+ | postfix: | ||
+ | sshd: | ||
+ | tcpdump: | ||
+ | trainee:$6$4PW9kfdOIOmWmSSO$8vikc1pyXgVc.C8xKP5EvIbBwe1fWd3DSvgWGQ5FAr7jwyMCbLQOOWbvomS9z1Q6V8IqZjBSREWafNzOYjKqC0:: | ||
+ | vboxadd: | ||
+ | </ | ||
- | rpmbuild/ | + | Chaque ligne est constituée de 8 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' |
- | total 8 | + | * Le mot de passe **crypté** de l' |
- | drwxrwxr-x. 2 trainee trainee 4096 9 août 06:56 . | + | * **!!** - Le mot de passe n'a pas encore été défini et l' |
- | drwxrwxr-x. 7 trainee trainee 4096 9 août 06:56 .. | + | * ***** - L' |
+ | * **vide** - aucun mot de passe sera demandé pour l' | ||
+ | * Le nombre de jours entre le **01/ | ||
+ | * Le nombre de jours que le mot de passe est encore valide. Une valeur de **0** dans ce champs indique sue le mot de passe n' | ||
+ | | ||
+ | * Le nombre de jours avant la date de modification forcée que l' | ||
+ | * Le nombre de jours après l' | ||
+ | * Le **numéro** du jour après le **01/ | ||
- | rpmbuild/SOURCES: | + | =====LAB #3 - PAM sous RHEL/CentOS |
- | total 8 | + | |
- | drwxrwxr-x. 2 trainee trainee 4096 9 août 06:56 . | + | |
- | drwxrwxr-x. | + | |
- | rpmbuild/SPECS: | + | **PAM** ( //Pluggable Authentification Modules// ou Modules d' |
- | 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-x. 2 trainee trainee 4096 9 août 06:56 . | + | |
- | drwxrwxr-x. 7 trainee trainee 4096 9 août 06:56 .. | + | |
- | </ | + | |
- | + | ||
- | Téléchargez le rpm source du noyau : | + | |
< | < | ||
- | [trainee@centos7 ~]$ uname -a | + | [root@centos7 ~]# ls /etc/pam.d |
- | Linux centos7.fenestros.loc 3.10.0-327.13.1.el7.x86_64 | + | atd |
- | + | chfn other smtp.postfix | |
- | [trainee@centos7 ~]$ wget http:// | + | chsh passwd |
- | --2016-08-09 06:57:08-- | + | config-util |
- | Résolution de vault.centos.org (vault.centos.org)... 88.208.217.170, | + | crond |
- | Connexion vers vault.centos.org (vault.centos.org)|88.208.217.170|: | + | cups pluto sudo-i |
- | requête HTTP transmise, en attente de la réponse...200 OK | + | fingerprint-auth polkit-1 su-l |
- | Longueur: 83047820 (79M) [application/ | + | fingerprint-auth-ac |
- | Sauvegarde en : «kernel-3.10.0-327.13.1.el7.src.rpm» | + | gdm-autologin |
- | + | gdm-fingerprint | |
- | 100%[==============================================================================================================================> | + | gdm-launch-environment |
- | + | gdm-password | |
- | 2016-08-09 07:00:00 (471 KB/s) - «kernel-3.10.0-327.13.1.el7.src.rpm» sauvegardé [83047820/ | + | gdm-pin |
+ | gdm-smartcard | ||
+ | ksu | ||
+ | liveinst | ||
</ | </ | ||
- | 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' |
< | < | ||
- | [trainee@centos7 ~]$ su - | + | [root@centos7 ~]# ls /lib64/security |
- | Mot de passe : fenestros | + | pam_access.so |
- | [root@centos7 ~]# yum-builddep | + | pam_cap.so pam_krb5.so pam_sepermit.so |
- | Loaded plugins: fastestmirror, | + | pam_chroot.so |
- | Enabling base-source repository | + | pam_console.so pam_limits.so pam_sss.so |
- | Enabling extras-source repository | + | pam_cracklib.so |
- | Enabling updates-source repository | + | pam_debug.so pam_localuser.so |
- | base-source | + | pam_deny.so |
- | extras-source | + | pam_echo.so |
- | updates-source | + | pam_env.so pam_mkhomedir.so |
- | (1/3): extras-source/ | + | pam_exec.so |
- | (2/3): base-source/ | + | pam_faildelay.so pam_namespace.so |
- | (3/3): updates-source/ | + | pam_faillock.so |
- | Loading mirror speeds from cached hostfile | + | pam_filter |
- | * base: centos.mirrors.ovh.net | + | pam_filter.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 |
- | Checking for new repos for mirrors | + | pam_gnome_keyring.so pam_pwquality.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 |
- | | + | pam_keyinit.so pam_securetty.so |
- | --> Already installed : bash-4.2.46-19.el7.x86_64 | + | pam_krb5 |
- | --> 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: | + | |
- | --> 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 | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | --> Running transaction check | + | |
- | ---> Package asciidoc.noarch 0: | + | |
- | --> 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: | + | |
- | ---> Package m4.x86_64 0: | + | |
- | ---> Package newt-devel.x86_64 0: | + | |
- | --> Processing Dependency: slang-devel for package: newt-devel-0.52.15-4.el7.x86_64 | + | |
- | ---> Package perl-ExtUtils-Embed.noarch 0: | + | |
- | --> Processing Dependency: perl-devel for package: perl-ExtUtils-Embed-1.30-286.el7.noarch | + | |
- | ---> Package python-devel.x86_64 0: | + | |
- | ---> Package xmlto.x86_64 0: | + | |
- | --> 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: | + | |
- | --> Processing Dependency: sgml-common for package: docbook-dtds-1.0-60.el7.noarch | + | |
- | ---> Package docbook-style-xsl.noarch 0: | + | |
- | ---> Package flex.x86_64 0: | + | |
- | ---> Package graphviz.x86_64 0: | + | |
- | --> Processing Dependency: libXaw.so.7()(64bit) for package: graphviz-2.30.1-19.el7.x86_64 | + | |
- | ---> Package lynx.x86_64 0: | + | |
- | ---> Package perl-devel.x86_64 4: | + | |
- | --> Processing Dependency: systemtap-sdt-devel for package: 4: | + | |
- | --> Processing Dependency: perl(ExtUtils:: | + | |
- | --> Processing Dependency: perl(ExtUtils:: | + | |
- | --> Processing Dependency: perl(ExtUtils:: | + | |
- | --> Processing Dependency: libdb-devel for package: 4: | + | |
- | --> Processing Dependency: gdbm-devel for package: 4: | + | |
- | ---> Package slang-devel.x86_64 0: | + | |
- | ---> Package source-highlight.x86_64 0: | + | |
- | --> 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: | + | |
- | ---> Package ctags.x86_64 0: | + | |
- | ---> Package gdbm-devel.x86_64 0: | + | |
- | ---> Package libXaw.x86_64 0: | + | |
- | ---> Package libdb-devel.x86_64 0: | + | |
- | ---> Package perl-ExtUtils-Install.noarch 0: | + | |
- | ---> Package perl-ExtUtils-MakeMaker.noarch 0: | + | |
- | --> Processing Dependency: perl(Test:: | + | |
- | --> Processing Dependency: perl(ExtUtils:: | + | |
- | ---> Package perl-ExtUtils-ParseXS.noarch 1: | + | |
- | ---> Package sgml-common.noarch 0: | + | |
- | ---> Package systemtap-sdt-devel.x86_64 0: | + | |
- | --> Running transaction check | + | |
- | ---> Package perl-ExtUtils-Manifest.noarch 0: | + | |
- | ---> Package perl-Test-Harness.noarch 0: | + | |
- | --> Finished Dependency Resolution | + | |
- | Dependencies Resolved | + | Les modules les plus importants sont : |
- | ======================================================================================================================================================================== | + | ^ Module ^ Description ^ |
- | Package | + | | pam_access.so | Ce module est utilisé pour interdire l' |
- | ======================================================================================================================================================================== | + | | 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 **/ |
- | | + | | pam_listfile.so | Ce module est utilisé pour consulter un fichier spécifique pour vérifier les authiorisations. Par exemple, le service ftp utilise ce module pour consulter le fichier **/ |
- | hmaccalc | + | | pam_nologin.so | Ce module interdit les connexions d' |
- | m4 x86_64 | + | | pam_pwquality.so | Ce module est utilisé pour vérifier la qualité du mot de passe d'un utilisateur | |
- | | + | | 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 **/ |
- | perl-ExtUtils-Embed | + | | pam_unix.so | Ce module est utilisé pour vérifier les informations suivantes ; expire, last_change, |
- | | + | |
- | xmlto | + | |
- | Installing for dependencies: | + | |
- | | + | |
- | ctags | + | |
- | docbook-dtds | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | Transaction Summary | + | Chaque fichier dans /etc/pam.d contient les règles PAM utilisées pendant l' |
- | ======================================================================================================================================================================== | + | |
- | Install | + | |
- | + | ||
- | Total download size: 9.0 M | + | |
- | Installed size: 43 M | + | |
- | Is this ok [y/d/N]: y | + | |
- | </ | + | |
- | + | ||
- | Installez maintenant | + | |
< | < | ||
- | [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=bad] pam_securetty.so |
- | Mise à jour / installation... | + | auth |
- | | + | auth |
- | attention : utilisateur builder inexistant | + | account |
- | attention : groupe builder inexistant - utilisation de root | + | account |
- | attention : utilisateur builder inexistant - utilisation de root | + | password |
- | attention : groupe builder inexistant | + | # pam_selinux.so close should be the first session rule |
- | attention : utilisateur builder inexistant | + | session |
- | attention : groupe builder inexistant - utilisation de root | + | session |
- | attention : utilisateur builder inexistant - utilisation de root | + | session |
- | 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 |
- | attention : groupe builder inexistant - utilisation de root | + | session |
- | attention : utilisateur builder inexistant - utilisation de root | + | session |
- | attention : groupe builder inexistant - utilisation de root | + | session |
- | attention : utilisateur builder inexistant - utilisation de root | + | session |
- | attention : groupe builder inexistant | + | -session |
- | attention : utilisateur builder inexistant - utilisation de root | + | |
- | attention : groupe builder inexistant | + | |
- | 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 | + | |
</ | </ | ||
- | <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. | + | |
- | </ | + | |
- | ====Préparer l' | + | Ce fichier, tout comme les autres, est ensuite structuré de la façon suivante : |
- | Naviguez vers le repertoire | + | |
+ | | ||
- | < | + | 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 cibles: x86_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 | + | |
- | </ | + | |
- | <WRAP center round important> | + | ^ Type ^ Description ^ |
- | Notez qu'il existe toujours | + | | **auth** | Utilisé pour authentifier un utilisateur ou les pré-requis système ( par exemple / |
- | </ | + | | **account** | Utilisé pour vérifier si l'utilisateur peut s' |
+ | | **password** | Utilisé pour vérifier si l' | ||
+ | | **session** | Utilisé pour gérer la session après l' | ||
- | Redevenez root et installez les dépendances | + | Le **deuxième champs** est le // |
- | < | + | ^ Control-flag ^ Description ^ |
- | [trainee@centos7 SPECS]$ cd - | + | | **required** | La réussite de ce module est indispensable. L' |
- | /home/trainee | + | | **requisite** | La réussite de ce module est indispensable. L' |
- | [trainee@centos7 ~]$ su - | + | | **sufficient** | La réussite de ce module est suffisant pour authoriser l' |
- | Mot de passe : | + | | **optional** | La réussite ou l' |
- | Dernière connexion : lundi 8 août 2016 à 16:39:54 CEST sur pts/0 | + | | **include** | Ce control-flag permet d' |
- | [root@centos7 ~]# yum install elfutils-devel binutils-devel bison audit-libs-devel numactl-devel pciutils-devel pesign | + | |
- | ... | + | |
- | </code> | + | |
- | Vous pouvez maintenant utilisez | + | Le **troisième champs** stipule le // |
- | < | + | Le **quatrième champs** contient éventuellement les **arguments**. |
- | [root@centos7 ~]# exit | + | |
- | logout | + | |
- | [trainee@centos7 ~]$ cd ~/ | + | |
- | [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 / | + | |
- | + umask 022 | + | |
- | + cd / | + | |
- | + patch_command=' | + | |
- | + cd / | + | |
- | + rm -rf kernel-3.10.0-327.13.1.el7 | + | |
- | + / | + | |
- | + cd kernel-3.10.0-327.13.1.el7 | + | |
- | + /usr/bin/xz -dc / | + | |
- | + / | + | |
- | ... | + | |
- | </ | + | |
- | A l'issu du processus, examinez l' | + | Ouvrez maintenant le fichier **password-auth-ac** |
< | < | ||
- | [trainee@centos7 | + | [root@centos7 |
- | total 824 | + | #%PAM-1.0 |
- | drwxr-xr-x. 24 trainee trainee | + | # This file is auto-generated. |
- | drwxr-xr-x. | + | # User changes will be destroyed the next time authconfig is run. |
- | drwxr-xr-x. | + | auth required |
- | drwxr-xr-x. | + | auth sufficient |
- | -rw-r--r--. | + | auth requisite |
- | -rw-r--r--. 1 trainee trainee 126420 | + | auth required |
- | drwxr-xr-x. 2 trainee trainee | + | |
- | -rw-r--r--. 1 trainee trainee | + | |
- | -rw-r--r--. 1 trainee trainee | + | |
- | drwxr-xr-x. | + | |
- | drwxr-xr-x. 101 trainee trainee | + | |
- | drwxr-xr-x. 114 trainee trainee | + | |
- | drwxr-xr-x. | + | |
- | drwxr-xr-x. | + | |
- | -rw-r--r--. | + | |
- | drwxr-xr-x. | + | |
- | drwxr-xr-x. | + | |
- | drwxr-xr-x. | + | |
- | -rw-r--r--. | + | |
- | -rw-r--r--. | + | |
- | drwxr-xr-x. | + | |
- | drwxr-xr-x. | + | |
- | -rw-r--r--. | + | |
- | -rw-r--r--. | + | |
- | -rw-r--r--. | + | |
- | drwxr-xr-x. | + | |
- | drwxr-xr-x. | + | |
- | -rw-r--r--. | + | |
- | -rw-r--r--. | + | |
- | drwxr-xr-x. | + | |
- | -rw-r--r--. | + | |
- | drwxr-xr-x. | + | |
- | drwxr-xr-x. | + | |
- | drwxr-xr-x. | + | |
- | drwxr-xr-x. | + | |
- | drwxr-xr-x. | + | |
- | drwxr-xr-x. | + | |
- | </ | + | |
- | A l' | + | account |
+ | account | ||
+ | account | ||
+ | account | ||
- | < | + | password |
- | [trainee@centos7 SPECS]$ more ~/ | + | password |
- | # | + | password |
- | # Automatically generated file; DO NOT EDIT. | + | |
- | # Linux/ | + | |
- | # | + | |
- | CONFIG_64BIT=y | + | |
- | CONFIG_X86_64=y | + | |
- | CONFIG_X86=y | + | |
- | CONFIG_INSTRUCTION_DECODER=y | + | |
- | CONFIG_OUTPUT_FORMAT=" | + | |
- | CONFIG_ARCH_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=" | + | |
- | CONFIG_ARCH_SUPPORTS_UPROBES=y | + | |
- | CONFIG_DEFCONFIG_LIST="/ | + | |
- | CONFIG_IRQ_WORK=y | + | |
- | CONFIG_BUILDTIME_EXTABLE_SORT=y | + | |
- | # | + | session |
- | --Plus--(1%) | + | session |
+ | -session | ||
+ | session | ||
+ | session | ||
</ | </ | ||
- | Ce fichier | + | Dans ce fichier, si la règle |
- | * make config | + | ===Bloquer un Compte après N Echecs de Connexion=== |
- | * make menuconfig | + | |
- | * make xconfig | + | |
- | Dans ce fichier, vous pouvez constater la présence | + | Le module PAM **pam_tally.so** permet |
- | * **y** | + | < |
- | * 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** | + | </ |
- | * 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 | + | Dans ce cas, après trois tentatives infructueuses de connexion, |
- | * 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' | + | Certains modules de PAM peuvent être configurés grâce aux fichiers présents dans le répertoire |
< | < | ||
- | [trainee@centos7 | + | [root@centos7 ~]# ls /etc/security |
- | VERSION = 3 | + | access.conf |
- | PATCHLEVEL = 10 | + | chroot.conf |
- | SUBLEVEL = 0 | + | console.apps group.conf |
- | EXTRAVERSION = | + | console.handlers |
- | NAME = Unicycling Gorilla | + | </ |
- | 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/// |
- | # 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); | + | | **// |
- | # o print " | + | | **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 |
- | 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: | + | |
- | # their own directory. If in some directory we have a dependency on | + | |
- | # a file in another dir (which doesn' | + | |
- | # 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%) | + | |
- | </ | + | |
- | + | ||
- | <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 | + | |
</ | </ | ||
- | Utilisez maintenant | + | Dernièrement, |
< | < | ||
- | [trainee@centos7 | + | [root@centos7 |
- | [trainee@centos7 linux-3.10.0-327.13.1.el7.x86_64]$ make oldconfig | + | #%PAM-1.0 |
- | scripts/ | + | auth |
- | # | + | account |
- | # configuration written to .config | + | password required |
- | # | + | session |
</ | </ | ||
- | <WRAP center round important> | + | =====LAB #4 - Mise en place du Système de Prévention d'Intrusion Fail2Ban===== |
- | Cette commande lit le fichier .config | + | |
- | </ | + | |
- | ====Paramétrage du noyau==== | + | Fail2Ban est un **S**ystème de **P**révention d' |
- | 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 | + | ====Installation==== |
+ | |||
+ | Sous RHEL/CentOS 7, beaucoup d' | ||
< | < | ||
- | [trainee@centos7 | + | [root@centos7 |
- | 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=" | + | |
</ | </ | ||
- | Renommez le fichier .config en le plaçant dans le répertoire **~/ | + | Ensuite installez Fail2Ban |
< | < | ||
- | [trainee@centos7 linux-3.10.0-327.13.1.el7.x86_64]$ cp .config | + | [root@centos6 |
- | [trainee@centos7 linux-3.10.0-327.13.1.el7.x86_64]$ ls ~/ | + | |
- | centos.cer | + | |
- | centos-kpatch.x509 | + | |
- | centos-ldup.x509 | + | |
- | check-kabi | + | |
- | config-x86_64-generic | + | |
- | cpupower.config | + | |
</ | </ | ||
- | <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**. | + | |
- | </ | + | |
- | Editez la directive **buildid** | + | La configuration de Fail2Ban se trouve |
< | < | ||
- | [trainee@centos7 | + | [root@centos7 |
- | [trainee@centos7 SPECS]$ vi kernel.spec | + | # |
- | [trainee@centos7 SPECS]$ head kernel.spec | + | # WARNING: heavily refactored in 0.9.0 release. |
- | # We have to override | + | # customize settings for your setup. |
- | %global __spec_install_pre %{___build_pre} | + | # |
+ | # Changes: | ||
+ | # file, but provide customizations in jail.local file, | ||
+ | # or separate | ||
+ | # | ||
+ | # 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/ | ||
+ | # For example | ||
+ | # 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 a kernel released | + | # Comments: use '#' |
- | # For internal testing builds during development, | + | |
- | %global released_kernel 1 | + | |
- | </ | + | |
- | ====Compiler le Noyau==== | ||
- | La compilation du noyau peut prendre beaucoup de temps. La commande utilisée est la suivante : | + | [INCLUDES] |
- | < | + | #before = paths-distro.conf |
- | [trainee@centos7 SPECS]$ rpmbuild | + | --More--(4%) |
</ | </ | ||
- | A l'issu du processus, les rpm se trouvent | + | Dans ce fichier |
< | < | ||
... | ... | ||
- | Vérification des fichiers non empaquetés : / | + | [sshd] |
- | Écrit : / | + | |
- | Écrit : / | + | |
- | Écrit : / | + | |
- | Écrit : / | + | |
- | Écrit : / | + | |
- | Écrit : / | + | |
- | Écrit : / | + | |
- | Écrit : / | + | |
- | Écrit : / | + | |
- | Écrit : / | + | |
- | Écrit : / | + | |
- | Écrit : / | + | |
- | Écrit : / | + | |
- | Écrit : / | + | |
- | Écrit : / | + | |
- | Écrit : / | + | |
- | Exécution_de(%clean) : /bin/sh -e / | + | |
- | + umask 022 | + | |
- | + cd / | + | |
- | + cd kernel-3.10.0-327.13.1.el7 | + | |
- | + rm -rf / | + | |
- | + exit 0 | + | |
- | </ | + | |
- | Notez que la génération du nouveau noyau a consommé plus de 9 Go d' | + | port = ssh |
+ | logpath = %(sshd_log)s | ||
+ | ... | ||
+ | </ | ||
- | < | + | Ces sections, appelé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 | + | |
- | / | + | |
- | devtmpfs | + | |
- | tmpfs 245M | + | |
- | tmpfs 245M 4,7M 240M 2% /run | + | |
- | tmpfs 245M | + | |
- | tmpfs 245M | + | |
- | / | + | |
- | / | + | |
- | tmpfs | + | |
- | </ | + | |
- | ====Installer | + | ^ Directive ^ Description ^ |
+ | | enabled | Indique si oui (true) ou non (false) | ||
+ | | port | Le port à bloquer dans iptables. | | ||
+ | | filter | Le nom du filtre, une expression régulière, | ||
+ | | logpath | Le nom et le chemin du journal à examiner. | | ||
+ | | maxretry | Le nombre maximal de tentatives. | | ||
+ | | action | Spécifie l' | ||
- | 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 |
< | < | ||
- | [root@centos7 ~]# rpm -ivh /home/trainee/rpmbuild/ | + | [root@centos7 ~]# vi /etc/fail2ban/jail.local |
- | Preparing... | + | [root@centos7 ~]# cat /etc/fail2ban/jail.local |
- | Updating / installing... | + | [DEFAULT] |
- | | + | ignoreip = 127.0.0.1 172.YY+20.0.3 |
- | [root@centos7 ~]# rpm -ivh /home/trainee/rpmbuild/ | + | findtime = 3600 |
- | Preparing... | + | bantime = 86400 |
- | Updating / installing... | + | maxretry = 5 |
- | 1: | + | |
+ | [sshd] | ||
+ | enabled = true | ||
</ | </ | ||
- | Installez en dernier | + | Il est à noter que les directives dans le fichier |
- | < | + | * **/etc/fail2ban/jail.d/*.conf** dans l' |
- | [root@centos7 ~]# rpm -ivh --force --nodeps | + | * **/etc/fail2ban/ |
- | Preparing... ################################# | + | * **/ |
- | installing package kernel-3.10.0-327.13.1.el7.i2tch.x86_64 needs 30MB on the /boot filesystem | + | |
- | </ | + | |
- | <WRAP center round important> | + | <WRAP center round important |
- | **Important** | + | **Important** |
</ | </ | ||
- | Lister maintenant | + | Dans ce fichier, |
- | < | + | ^ 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' |
- | kernel-3.10.0-327.el7.x86_64 | + | | findtime | L' |
- | 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. | |
- | </ | + | | maxretry | Le nombre maximal de tentatives. La 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 |
- | + | ||
- | < | + | |
- | [root@centos7 ~]# yum remove kernel-3.10.0-327.el7.x86_64 | + | |
- | Loaded plugins: fastestmirror, | + | |
- | Resolving Dependencies | + | |
- | --> Running transaction check | + | |
- | ---> Package kernel.x86_64 0: | + | |
- | --> Finished Dependency Resolution | + | |
- | + | ||
- | Dependencies Resolved | + | |
- | + | ||
- | ======================================================================================================================================================================== | + | |
- | | + | |
- | ======================================================================================================================================================================== | + | |
- | Removing: | + | |
- | | + | |
- | + | ||
- | Transaction Summary | + | |
- | ======================================================================================================================================================================== | + | |
- | Remove | + | |
- | + | ||
- | Installed size: 136 M | + | |
- | Is this ok [y/N]: y | + | |
- | </ | + | |
- | Installez le nouveau noyau avec la commande | + | Le répertoire |
< | < | ||
- | [root@centos7 ~]# rpm -ivh --force --nodeps / | + | [root@centos7 ~]# ls -l / |
- | Preparing... ################################# | + | 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 ################################# | + | -rw-r--r--. 1 root root 2328 May 11 2017 fail2ban.conf |
+ | drwxr-xr-x. 2 root root 6 Jul 13 2017 fail2ban.d | ||
+ | drwxr-xr-x. 3 root root 4096 Jun 8 22:51 filter.d | ||
+ | -rw-r--r--. 1 root root 21502 Jul 13 2017 jail.conf | ||
+ | drwxr-xr-x. 2 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 | ||
+ | -rw-r--r--. | ||
+ | -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 | ||
</ | </ | ||
- | Lister maintenant les noyaux installés : | + | ==Le fichier fail2ban.conf== |
- | < | + | Ce fichier définit les configurations globales de Fail2Ban, telles le **pidfile**, |
- | [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 | + | |
- | </ | + | |
- | + | ||
- | Constatez la création d'un nouveau grub.cfg | + | |
< | < | ||
- | [root@centos7 ~]# grep i2tch /boot/grub2/grub.cfg | + | [root@centos7 ~]# cat /etc/fail2ban/fail2ban.conf |
- | menuentry | + | # 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 / | + | # Comments: use '#' |
- | </ | + | # |
+ | # Changes: | ||
+ | # file, but provide customizations in fail2ban.local file, e.g.: | ||
+ | # | ||
+ | # [Definition] | ||
+ | # loglevel | ||
+ | # | ||
- | <WRAP center round important> | + | [Definition] |
- | **Important** : Re-démarrez votre VM en utilisant le nouveau noyau. | + | |
- | </ | + | |
- | Vérifiez ensuite l' | + | # Option: loglevel |
+ | # Notes.: Set the log level output. | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # Values: [ LEVEL ] Default: ERROR | ||
+ | # | ||
+ | loglevel = INFO | ||
- | < | + | # Option: logtarget |
- | [root@centos7 ~]# uname -r | + | # Notes.: Set the log target. This 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 | ||
+ | # | ||
+ | # (e.g. / | ||
+ | # Values: [ STDOUT | STDERR | SYSLOG | FILE ] Default: STDERR | ||
+ | # | ||
+ | logtarget = /var/ | ||
- | =====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 | ||
- | Sous Linux il est possible | + | # Option: socket |
- | quotas par partition. L' | + | # 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 | ||
+ | # | ||
+ | # Values: [ FILE ] Default: / | ||
+ | # | ||
+ | socket = / | ||
- | 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 | ||
+ | # | ||
+ | # Values: [ FILE ] Default: / | ||
+ | # | ||
+ | pidfile = / | ||
- | Avant de mettre en place des quotas, configurer SELINUX en mode **permissive** afin de ne pas avoir d' | + | # Options: dbfile |
+ | # Notes.: Set the file for the fail2ban persistent data to be stored. | ||
+ | # A value of ": | ||
+ | # and data is lost when fail2ban is stopped. | ||
+ | # A value of " | ||
+ | # Values: [ None :memory: FILE ] Default: / | ||
+ | dbfile = / | ||
- | < | + | # Options: dbpurgeage |
- | [root@centos7 ~]# getenforce | + | # Notes.: Sets age at which bans should be purged from the database |
- | Enforcing | + | # Values: |
- | [root@centos7 ~]# setenforce permissive | + | dbpurgeage = 86400 |
- | [root@centos7 ~]# getenforce | + | |
- | Permissive | + | |
</ | </ | ||
- | Editez ensuite le fichier | + | ==Le répertoire |
+ | |||
+ | Ce répertoire contient les fichiers appelés par les directives **filter** dans les sections des prisons | ||
< | < | ||
- | [root@centos7 ~]# vi /etc/sysconfig/selinux | + | [root@centos7 ~]# ls -l /etc/fail2ban/filter.d/ |
- | [root@centos7 ~]# cat / | + | 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 |
- | # | + | -rw-r--r--. 1 root root 1273 May 11 2017 apache-botsearch.conf |
- | # | + | -rw-r--r--. 1 root root 813 May 11 2017 apache-common.conf |
- | # | + | -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 |
- | # | + | -rw-r--r--. 1 root root 1187 May 11 2017 apache-noscript.conf |
- | # | + | -rw-r--r--. 1 root root 2000 May 11 2017 apache-overflows.conf |
- | # | + | -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 | ||
</ | </ | ||
- | Commencez par vérifiez que le paquet **quota** est bien installé : | + | ==Le répertoire / |
- | < | + | Ce répertoire contient les fichiers appelés par les directives |
- | [root@centos7 ~]# rpm -qa | grep quota | + | |
- | quota-4.01-11.el7_2.1.x86_64 | + | |
- | quota-nls-4.01-11.el7_2.1.noarch | + | |
- | </ | + | |
- | + | ||
- | Editez le fichier | + | |
< | < | ||
- | [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, | + | -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 / | + | -rw-r--r--. 1 root root 1133 May 11 2017 dummy.conf |
- | UUID=2d947276-66e8-41f4-8475-b64b67d7a249 /boot | + | -rw-r--r--. 1 root root 1538 May 11 2017 firewallcmd-allports.conf |
- | UUID=3181601a-7295-4ef0-a92c-f21f76b18e64 swap swap defaults | + | -rw-r--r--. 1 root root 1530 May 11 2017 firewallcmd-ipset.conf |
- | UUID=a080ac6a-d15c-48e2-8461-a7b1aa3ebf1a / | + | -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--. | ||
+ | -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 | ||
</ | </ | ||
- | Démontez puis remontez /home : | + | ====Commandes==== |
- | + | ||
- | < | + | |
- | [root@centos7 ~]# umount /home | + | |
- | [root@centos7 ~]# mount -a | + | |
- | </ | + | |
- | 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 |
< | < | ||
- | [root@centos7 ~]# cat /etc/mtab | + | [root@centos7 ~]# which fail2ban-client |
- | rootfs | + | /bin/fail2ban-client |
- | sysfs /sys sysfs rw, | + | [root@centos7 ~]# which fail2ban-server |
- | proc /proc proc rw, | + | /bin/fail2ban-server |
- | devtmpfs /dev devtmpfs rw, | + | |
- | securityfs / | + | |
- | tmpfs /dev/shm tmpfs rw, | + | |
- | devpts /dev/pts devpts rw, | + | |
- | tmpfs /run tmpfs rw, | + | |
- | tmpfs / | + | |
- | cgroup / | + | |
- | pstore | + | |
- | cgroup / | + | |
- | cgroup / | + | |
- | cgroup / | + | |
- | cgroup / | + | |
- | cgroup / | + | |
- | cgroup / | + | |
- | cgroup / | + | |
- | cgroup / | + | |
- | cgroup / | + | |
- | configfs / | + | |
- | /dev/sda2 / xfs rw, | + | |
- | selinuxfs / | + | |
- | systemd-1 / | + | |
- | debugfs / | + | |
- | hugetlbfs / | + | |
- | tmpfs /tmp tmpfs rw,seclabel 0 0 | + | |
- | mqueue /dev/mqueue mqueue rw, | + | |
- | sunrpc / | + | |
- | nfsd / | + | |
- | /dev/sda1 /boot xfs rw, | + | |
- | tmpfs /run/user/0 tmpfs rw, | + | |
- | /dev/sdb1 /home ext4 rw, | + | |
</ | </ | ||
- | ====La Commande quotacheck==== | + | L' |
- | Pour activer les quotas sur /home, il convient d' | + | Les options de la commande **fail2ban-server** sont : |
< | < | ||
- | [root@centos7 ~]# quotacheck | + | [root@centos7 ~]# fail2ban-server |
- | quotacheck: Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown. | + | Usage: /bin/fail2ban-server |
- | quotacheck: Parcours de /dev/sdb1 [/home] terminé | + | |
- | quotacheck: Cannot stat old user quota file / | + | |
- | quotacheck: Cannot stat old group quota file / | + | |
- | quotacheck: Cannot stat old user quota file / | + | |
- | quotacheck: Cannot stat old group quota file / | + | |
- | quotacheck: Vérifié 100 répertoires et 230 fichiers | + | |
- | quotacheck: Ancien fichier non trouvé. | + | |
- | quotacheck: Ancien fichier non trouvé. | + | |
- | </ | + | |
- | 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. | ||
- | < | + | Only use this command for debugging purpose. Start the server with |
- | [root@centos7 ~]# quotacheck | + | fail2ban-client instead. The default behaviour is to start the server |
- | Utility for checking and repairing quota files. | + | in background. |
- | quotacheck [-gucbfinvdmMR] [-F < | + | |
- | -u, --user | + | Options: |
- | -g, --group | + | -b start in background |
- | -c, --create-files | + | -f start in foreground |
- | -b, --backup | + | -s < |
- | -f, --force | + | -p < |
- | -i, --interactive | + | -x force execution |
- | -n, --use-first-dquot | + | -h, --help |
- | -v, --verbose | + | -V, --version |
- | -d, --debug | + | |
- | -m, --no-remount | + | |
- | -M, --try-remount | + | |
- | continue even if it fails | + | |
- | -R, --exclude-root | + | |
- | -F, --format=formatname | + | |
- | -a, --all check all filesystems | + | |
- | -h, --help | + | |
- | -V, --version | + | |
- | Rapports de bugs à jack@suse.cz | + | Report |
</ | </ | ||
- | Les quotas ont été activés et les fichier | + | Les options de la commande |
< | < | ||
- | [root@centos7 ~]# ls -la /home | + | [root@centos7 ~]# fail2ban-client |
- | total 44 | + | Usage: / |
- | 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-------. | + | |
- | -rw-------. | + | |
- | drwx------. | + | |
- | drwx------. 14 trainee 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 / | + | -c <DIR> |
- | [root@centos7 ~]# passwd fenestros | + | -s < |
- | Changement de mot de passe pour l' | + | -p < |
- | Nouveau mot de passe : fenestros | + | |
- | MOT DE PASSE INCORRECT : Le mot de passe contient le nom d' | + | |
- | Retapez le nouveau mot de passe : fenestros | + | |
- | passwd : mise à jour réussie de tous les jetons d' | + | |
- | [root@centos7 ~]# | + | |
- | </ | + | |
+ | | ||
+ | -h, --help | ||
+ | -V, --version | ||
- | ====La Commande edquota==== | + | Command: |
+ | | ||
+ | start starts the server and the jails | ||
+ | reload | ||
+ | reload < | ||
+ | stop stops all jails and terminate the | ||
+ | | ||
+ | status | ||
+ | | ||
+ | ping tests if the server is alive | ||
+ | help | ||
+ | version | ||
- | Mettez en place maintenant un quota de 10Mo pour l' | + | |
+ | set loglevel < | ||
+ | | ||
+ | | ||
+ | get loglevel | ||
+ | set logtarget < | ||
+ | Can be STDOUT, STDERR, SYSLOG or a | ||
+ | | ||
+ | get logtarget | ||
+ | set syslogsocket auto|< | ||
+ | auto or < | ||
+ | | ||
+ | get syslogsocket | ||
+ | flushlogs | ||
+ | and reopens it. For log rotation. | ||
- | <code> | + | |
- | [root@centos ~]# edquota -u fenestros -f /home | + | set dbfile |
- | </code> | + | persistent datastore. Set to |
+ | " | ||
+ | get dbfile | ||
+ | | ||
+ | set dbpurgeage | ||
+ | | ||
+ | get dbpurgeage | ||
+ | | ||
- | L' | + | JAIL CONTROL |
+ | add < | ||
+ | start < | ||
+ | stop < | ||
+ | | ||
+ | status < | ||
+ | with optional flavor or extended | ||
+ | info | ||
- | <file> | + | JAIL CONFIGURATION |
- | Quotas disque pour user fenestros | + | set <JAIL> idle on|off |
- | Système de fichiers | + | set < |
- | / | + | < |
- | </file> | + | set < |
+ | of < | ||
+ | set < | ||
+ | of < | ||
+ | the ' | ||
+ | ' | ||
+ | set < | ||
+ | list of < | ||
+ | set < | ||
+ | files for < | ||
+ | set < | ||
+ | of < | ||
+ | set < | ||
+ | filter of < | ||
+ | set < | ||
+ | < | ||
+ | for < | ||
+ | set < | ||
+ | < | ||
+ | set < | ||
+ | set < | ||
+ | < | ||
+ | to exclude for < | ||
+ | set < | ||
+ | | ||
+ | set < | ||
+ | for which the filter will look | ||
+ | back for < | ||
+ | set < | ||
+ | a host will be banned for < | ||
+ | set < | ||
+ | date/times for < | ||
+ | set < | ||
+ | set < | ||
+ | set < | ||
+ | set < | ||
+ | < | ||
+ | for < | ||
+ | set < | ||
+ | | ||
+ | set < | ||
+ | adds a new action named <ACT> for | ||
+ | < | ||
+ | based action, a < | ||
+ | < | ||
+ | else will be a Command Action | ||
+ | set < | ||
+ | < | ||
- | Modifiez ce fichier ainsi : | + | |
+ | set < | ||
+ | sets the start command <CMD> of | ||
+ | the action <ACT> for < | ||
+ | set < | ||
+ | | ||
+ | set < | ||
+ | sets the check command <CMD> of | ||
+ | the action <ACT> for < | ||
+ | set < | ||
+ | | ||
+ | set < | ||
+ | sets the unban command <CMD> of | ||
+ | the action <ACT> for < | ||
+ | set < | ||
+ | sets < | ||
+ | | ||
+ | < | ||
- | <file> | + | |
- | Quotas disque pour user fenestros (uid 1001) : | + | set <JAIL> action <ACT> < |
- | Système de fichiers | + | sets the < |
- | / | + | the action <ACT> for < |
- | </file> | + | |
+ | calls the < | ||
+ | < | ||
+ | for <JAIL> | ||
- | Les options de la commande **edquota** sont : | + | JAIL INFORMATION |
+ | get < | ||
+ | files for < | ||
+ | get < | ||
+ | for < | ||
+ | get < | ||
+ | < | ||
+ | get < | ||
+ | | ||
+ | get < | ||
+ | get < | ||
+ | | ||
+ | | ||
+ | get < | ||
+ | | ||
+ | to ignore for < | ||
+ | get < | ||
+ | will look back for failures for | ||
+ | < | ||
+ | get < | ||
+ | < | ||
+ | get < | ||
+ | | ||
+ | get < | ||
+ | get < | ||
+ | | ||
+ | get < | ||
+ | for < | ||
+ | get < | ||
- | <code> | + | |
- | [root@centos7 ~]# edquota --help | + | get <JAIL> action <ACT> actionstart |
- | edquota: Usage: | + | action <ACT> for < |
- | edquota [-rm] [-u] [-F formatname] [-p username] [-f filesystem] username ... | + | get < |
- | edquota [-rm] -g [-F formatname] [-p groupname] [-f filesystem] groupname ... | + | action <ACT> for < |
- | edquota [-u|g] [-F formatname] [-f filesystem] -t | + | get < |
- | edquota [-u|g] [-F formatname] [-f filesystem] -T username|groupname ... | + | action <ACT> for < |
+ | get < | ||
+ | | ||
+ | get < | ||
+ | | ||
+ | get < | ||
+ | | ||
+ | < | ||
- | -u, --user | + | |
- | -g, --group | + | get < |
- | -r, --remote | + | action <ACT> for < |
- | -m, --no-mixed-pathnames | + | |
- | -F, --format=formatname | + | action <ACT> for < |
- | -p, --prototype=name | + | get < |
- | | + | the action <ACT> for < |
- | composed only of digits | + | |
- | -f, --filesystem=filesystem | + | |
- | -t, --edit-period | + | |
- | -T, --edit-times | + | |
- | -h, --help | + | |
- | -V, --version | + | |
- | Rapports de bugs à : jack@suse.cz | + | Report |
</ | </ | ||
- | <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' | + | |
- | </ | + | |
- | ====La Commande quotaon==== | + | Pour prendre en compte la configuration dans le fichier **/ |
- | + | ||
- | Appliquez maintenant les quotas | + | |
< | < | ||
- | [root@centos7 ~]# quotaon | + | [root@centos7 ~]# systemctl status fail2ban |
- | </code> | + | ● fail2ban.service |
+ | Loaded: loaded (/usr/ | ||
+ | | ||
+ | Docs: man: | ||
- | Les options de la commande **quotaon** sont : | + | [root@centos7 ~]# systemctl enable fail2ban |
- | < | + | Created symlink from / |
- | [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 |
- | -u, --user | + | root |
- | -g, --group | + | |
- | -p, --print-state | + | |
- | -x, --xfs-command=cmd | + | |
- | -F, --format=formatname | + | |
- | -v, --verbose | + | |
- | -h, --help | + | |
- | -V, --version | + | |
</ | </ | ||
- | 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' | + | Pour connaître |
- | 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' | + | <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 |
< | < | ||
- | [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 jail: sshd |
- | Période de sursis bloc : 7days ; période de sursis inode : 7days | + | |- Filter |
- | Block limits | + | | |- Currently failed: 0 |
- | Utilisateur | + | | |- Total failed: 0 |
- | ---------------------------------------------------------------------- | + | | `- Journal matches: |
- | root | + | `- Actions |
- | trainee | + | |- Currently banned: 0 |
- | + | |- Total banned: 0 | |
+ | `- Banned IP list: | ||
</ | </ | ||
- | <WRAP center round important> | + | La commande **fail2ban-client** peut être utilisée pour contrôler un prison |
- | Notez que l' | + | |
- | </ | + | |
- | + | ||
- | Les options de la commande **repquota** sont : | + | |
< | < | ||
- | [root@centos7 ~]# repquota | + | [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 | + | [root@centos7 ~]# fail2ban-client status sshd |
- | -u, --user | + | ERROR NOK: (' |
- | -g, --group | + | Sorry but the jail ' |
- | -s, --human-readable | + | |
- | -t, --truncate-names | + | |
- | -p, --raw-grace | + | |
- | -n, --no-names | + | |
- | -i, --no-autofs | + | |
- | -c, --cache | + | |
- | -C, --no-cache | + | |
- | -F, --format=formatname | + | |
- | -a, --all | + | |
- | -h, --help | + | |
- | -V, --version | + | |
- | 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: | ||
+ | `- Actions | ||
+ | |- Currently banned: 0 | ||
+ | |- Total banned: 0 | ||
+ | `- Banned IP list: | ||
</ | </ | ||
- | ====La Commande quota==== | + | ===Ajouter un Prison=== |
- | Pour visualiser les quotas d'un utilisateur spécifique, | + | Installez maintenant le serveur Apache si ce n'est pas déjà fait : |
< | < | ||
- | [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 | + | |
- | / | + | |
</ | </ | ||
- | Les options de la commande **quota** sont : | + | Activez et démarrez le service Apache si ce n'est pas déjà lancé |
< | < | ||
- | [root@centos7 ~]# quota --help | + | [root@centos7 ~]# systemctl status httpd |
- | quota: Usage: quota [-guqvswim] [-l | [-Q | -A]] [-F quotaformat] | + | ● httpd.service |
- | quota [-qvswim] [-l | [-Q | -A]] [-F quotaformat] -u username ... | + | Loaded: loaded (/ |
- | quota [-qvswim] [-l | [-Q | -A]] [-F quotaformat] -g groupname ... | + | Active: inactive (dead) |
- | quota [-qvswugQm] [-F quotaformat] -f filesystem ... | + | Docs: man: |
+ | man: | ||
- | -u, --user | + | [root@centos7 ~]# systemctl enable httpd |
- | -g, --group | + | |
- | -q, --quiet | + | |
- | -v, --verbose | + | |
- | -s, --human-readable | + | |
- | --always-resolve | + | |
- | composed of only digits | + | |
- | -w, --no-wrap | + | |
- | -p, --raw-grace | + | |
- | -l, --local-only | + | |
- | -Q, --quiet-refuse | + | |
- | not respond | + | |
- | -i, --no-autofs | + | |
- | -F, --format=formatname | + | |
- | -f, --filesystem-list | + | |
- | -A, --all-nfs | + | |
- | -m, --no-mixed-pathnames | + | |
- | --show-mntpoint | + | |
- | --hide-device | + | |
- | -h, --help | + | |
- | -V, --version | + | |
- | Rapports de bugs à : jack@suse.cz | + | Created symlink from / |
+ | |||
+ | [root@centos7 ~]# systemctl start httpd | ||
</ | </ | ||
- | ====La Commande warnquota==== | + | Modifiez maintenant votre fichier |
- | + | ||
- | La commande | + | |
- | + | ||
- | Sous RHEL/CentOS 7, warnquota n'est pas installé par défaut | + | |
< | < | ||
- | [root@centos7 ~]# yum install quota-warnquota | + | [root@centos7 ~]# vi / |
- | Modules complémentaires chargés : fastestmirror, | + | [root@centos7 ~]# cat / |
- | base | 3.6 kB 00: | + | [DEFAULT] |
- | extras | + | ignoreip = 127.0.0.1 10.0.2.15 |
- | updates | + | 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: | + | |
- | --> Résolution des dépendances terminée | + | |
- | Dépendances résolues | + | [sshd] |
+ | enabled = true | ||
- | ======================================================================================================================================================================== | + | [apache-auth] |
- | | + | enabled |
- | ======================================================================================================================================================================== | + | |
- | Installation : | + | |
- | quota-warnquota | + | |
- | + | ||
- | Résumé de la transaction | + | |
- | ======================================================================================================================================================================== | + | |
- | Installation | + | |
- | + | ||
- | Taille totale des téléchargements : 76 k | + | |
- | Taille d' | + | |
- | Is this ok [y/d/N]: y | + | |
</ | </ | ||
- | Les options de la commande **warnquota** sont : | + | Appliquez |
< | < | ||
- | [root@centos7 ~]# warnquota | + | [root@centos7 ~]# fail2ban-client reload |
- | warnquota: Usage: | + | [root@centos7 ~]# fail2ban-client status |
- | | + | Status |
- | + | |- Number | |
- | -u, --user | + | `- Jail list: |
- | -g, --group | + | |
- | -s, --human-readable | + | |
- | -i, --no-autofs | + | |
- | -d, --no-details | + | |
- | -F, --format=formatname | + | |
- | -c, --config=config-file | + | |
- | -q, --quota-tab=quotatab-file | + | |
- | -a, --admins-file=admins-file | + | |
- | -h, --help | + | |
- | -v, --version | + | |
- | + | ||
- | Rapports de bugs à jack@suse.cz | + | |
</ | </ | ||
----- | ----- | ||
- | < | + | |
- | <div align=" | + | Copyright © 2023 Hugh Norris. |
- | Copyright © 2022 Hugh Norris. | + | |
- | </ | + |