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:8:avance:l114 [2024/10/02 15:56] – admin | elearning:workbooks:centos:8:avance:l114 [2024/10/18 07:58] (Version actuelle) – admin | ||
---|---|---|---|
Ligne 9: | Ligne 9: | ||
=====Contenu du Module===== | =====Contenu du Module===== | ||
- | * **LCF606 - Gestion de Netfilter et de Firewalld** | + | * **LCF606 - Gestion de la Sécurité** |
* Contenu du Module | * Contenu du Module | ||
* Le Pare-feu Netfilter/ | * Le Pare-feu Netfilter/ | ||
Ligne 1095: | Ligne 1095: | ||
<WRAP center round important 50%> | <WRAP center round important 50%> | ||
- | **Important** - Attention ! La règle ajoutée avec l' | + | **Important** - Attention ! La règle ajoutée avec l' |
</ | </ | ||
Ligne 1394: | Ligne 1394: | ||
====Les fichiers .rhosts==== | ====Les fichiers .rhosts==== | ||
- | Le systeme | + | Le système |
# find / -name " | # find / -name " | ||
Ligne 1400: | Ligne 1400: | ||
====Les fichiers et les repertoires sans proprietaire==== | ====Les fichiers et les repertoires sans proprietaire==== | ||
- | Afin de dresser la liste des fichiers et des groupes sans proprietaires | + | Afin de dresser la liste des fichiers et des groupes sans propriétaires |
# find / -nouser -exec ls -l \{\} \; 2> sans_pro.txt [Entree] | # find / -nouser -exec ls -l \{\} \; 2> sans_pro.txt [Entree] | ||
Ligne 1416: | Ligne 1416: | ||
====Limiter le delai d' | ====Limiter le delai d' | ||
- | Une session de shell laissee | + | Une session de shell laissée |
< | < | ||
Ligne 1507: | Ligne 1507: | ||
</ | </ | ||
- | A ce fichier doivent | + | A ce fichier doivent |
< | < | ||
Ligne 3437: | Ligne 3437: | ||
====LAB #4 - Mise en place du Système de Prévention d' | ====LAB #4 - Mise en place du Système de Prévention d' | ||
+ | |||
+ | <WRAP center round important 50%> | ||
+ | **Important** - Pour continuer, il faut travailler sur un CentOS 8 Stream. | ||
+ | </ | ||
Fail2Ban est un **S**ystème de **P**révention d' | Fail2Ban est un **S**ystème de **P**révention d' | ||
Ligne 3543: | Ligne 3547: | ||
| action | Spécifie l' | | action | Spécifie l' | ||
- | Il n'est pas recommendé | + | Il n'est pas recommandé |
< | < | ||
Ligne 5116: | Ligne 5120: | ||
</ | </ | ||
+ | =====Système de Fichiers===== | ||
+ | |||
+ | ==== LAB #7 - Mise en place du File Integrity Checker Afick ==== | ||
+ | |||
+ | ===Présentation=== | ||
+ | |||
+ | **[[http:// | ||
+ | un logiciel dédié à la sécurité informatique, | ||
+ | |||
+ | ===Installation=== | ||
+ | |||
+ | Téléchargez la dernière version d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# wget https:// | ||
+ | </ | ||
+ | |||
+ | Pour installer **Afick**, utilisez la commande suivante : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# dnf localinstall afick-3.8.1-1.noarch.rpm --nogpgcheck | ||
+ | </ | ||
+ | |||
+ | ===Configuration=== | ||
+ | |||
+ | La configuration d' | ||
+ | |||
+ | Dans ce fichier, plusieurs sections nous intéressent : | ||
+ | |||
+ | ==La Section Directives== | ||
+ | |||
+ | < | ||
+ | #################### | ||
+ | # directives section | ||
+ | #################### | ||
+ | # binary values can be : yes/1/true or no/0/false | ||
+ | # database : name with full path to database file | ||
+ | database: | ||
+ | # history : full path to history file | ||
+ | history := / | ||
+ | # archive : full path to directory for archived results | ||
+ | archive := / | ||
+ | # report_url : where to send the result : stdout/ | ||
+ | report_url := stdout | ||
+ | # report_syslog : send output to syslog ? | ||
+ | report_syslog := no | ||
+ | # mask_sysupdate : report packages update | ||
+ | mask_sysupdate := no | ||
+ | # verbose : (obsolete) boolean value for debugging messages | ||
+ | # use debug parameter below | ||
+ | verbose := no | ||
+ | # debug : set a level of debugging messages, from 0 (none) to 4 (full) | ||
+ | debug := 0 | ||
+ | # warn_dead_symlinks : boolean : if set, warn about dead symlinks | ||
+ | warn_dead_symlinks := no | ||
+ | # follow_symlinks : boolean : if set, do checksum on target file (else on target file name) | ||
+ | follow_symlinks := no | ||
+ | # allow_overload : boolean : if set, allow to overload rules (the last rule wins), else put a warning | ||
+ | allow_overload := yes | ||
+ | # report_context : boolean : if set, display all changed attributes, not just those selected by rules | ||
+ | report_context := no | ||
+ | # report_full_newdel : boolean : if set, report all changes, if not set, report only a summary on top directories | ||
+ | report_full_newdel := no | ||
+ | # report_summary : boolean ; if set, report the summary section | ||
+ | report_summary := yes | ||
+ | # warn_missing_file | ||
+ | warn_missing_file := no | ||
+ | # running_files : boolean : if set, warn about files changed during a program run | ||
+ | running_files := yes | ||
+ | # timing : boolean : if set, print timing statistics about the job | ||
+ | timing := yes | ||
+ | # ignore_case : boolean : if set, ignore case on file name | ||
+ | ignore_case := no | ||
+ | # max_checksum_size : numeric : only compute checksum on first max_checksum_size bytes ( 0 means unlimited) | ||
+ | max_checksum_size := 10000000 | ||
+ | # allow_relativepath : boolean : if set, afick files, config and databases are stored as relative path | ||
+ | allow_relativepath := 0 | ||
+ | # utc_time : boolean; if set display date in utc time, else in local time | ||
+ | utc_time := 0 | ||
+ | |||
+ | # only_suffix : list of suffix to scan (and just this ones) : is empty (disabled) by default | ||
+ | # not very usefull on unix, but is ok on windows | ||
+ | # this will speed up the scan, but with a lesser security | ||
+ | # only_suffix := | ||
+ | |||
+ | # the 3 next directives : exclude_suffix exclude_prefix exclude_re | ||
+ | # can be written on several lines | ||
+ | # exclude_suffix : list of suffixes to ignore | ||
+ | # text files | ||
+ | exclude_suffix := log LOG html htm HTM txt TXT xml | ||
+ | # help files | ||
+ | exclude_suffix := hlp pod chm | ||
+ | # old files | ||
+ | exclude_suffix := tmp old bak | ||
+ | # fonts | ||
+ | exclude_suffix := fon ttf TTF | ||
+ | # images | ||
+ | exclude_suffix := bmp BMP jpg JPG gif png ico | ||
+ | # audio | ||
+ | exclude_suffix := wav WAV mp3 avi | ||
+ | # python | ||
+ | exclude_suffix := pyc | ||
+ | |||
+ | # exclude_prefix : list of prefixes to ignore | ||
+ | exclude_prefix := __pycache__ | ||
+ | |||
+ | # exclude_re : a file pattern (using regex syntax) to ignore (apply on full path) | ||
+ | # one pattern by line | ||
+ | #exclude_re := | ||
+ | </ | ||
+ | |||
+ | Cette section définit les directives globales et notamment : | ||
+ | |||
+ | * l' | ||
+ | |||
+ | < | ||
+ | database: | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 50%> | ||
+ | **Important** - Veuillez à sauvegarder régulièrement votre base de données. En effet, dans le cas où votre système est compromis, sans sauvegarde de votre base, vous ne serez plus certain de l' | ||
+ | </ | ||
+ | |||
+ | * l' | ||
+ | |||
+ | < | ||
+ | exclude_suffix := log LOG html htm HTM txt TXT xml | ||
+ | </ | ||
+ | |||
+ | ==La Section Alias== | ||
+ | |||
+ | < | ||
+ | ############### | ||
+ | # alias section | ||
+ | ############### | ||
+ | # action : a list of item to check : | ||
+ | # md5 : md5 checksum | ||
+ | # sha1 : sha-1 checksum | ||
+ | # sha256 : sha-256 checksum | ||
+ | # sha512 : sha-512 checksum | ||
+ | # d : device | ||
+ | # i : inode | ||
+ | # p : permissions | ||
+ | # n : number of links | ||
+ | # u : user | ||
+ | # g : group | ||
+ | # s : size | ||
+ | # b : number of blocks | ||
+ | # m : mtime | ||
+ | # c : ctime | ||
+ | # a : atime | ||
+ | # acl : acl | ||
+ | |||
+ | #all: p+d+i+n+u+g+s+b+m+c+md5+acl | ||
+ | #R: p+d+i+n+u+g+s+m+c+md5 | ||
+ | #L: p+d+i+n+u+g | ||
+ | #P: p+n+u+g+s+md5 | ||
+ | #E: '' | ||
+ | |||
+ | # action alias may be configured with | ||
+ | # your_alias = another_alias|item[+item][-item] | ||
+ | # all is a pre-defined alias for all items except " | ||
+ | DIR = p+i+n+u+g | ||
+ | ETC = p+d+u+g+s+md5 | ||
+ | Logs = p+n+u+g | ||
+ | MyRule = p+d+n+u+g+s+b+md5 | ||
+ | </ | ||
+ | |||
+ | Cette partie du fichier de configuration détaille les combinaisons de vérifications de fichiers à réaliser : | ||
+ | |||
+ | < | ||
+ | DIR=p+i+n+u+g | ||
+ | ETC = p+d+i+u+g+s+md5 | ||
+ | Logs = p+n+u+g | ||
+ | MyRule = p+d+n+u+g+s+b+md5 | ||
+ | </ | ||
+ | |||
+ | Les options détaillées sont : | ||
+ | |||
+ | ^ Option ^ Description ^ | ||
+ | | md5 | Vérifie la somme de contrôle md5 du contenu du fichier | | ||
+ | | sha1 | Vérifie la somme de contrôle sha1 du contenu du fichier | | ||
+ | | d | Vérifie pour un périphérique son "major number" | ||
+ | | i | Vérifie le numéro d' | ||
+ | | p | Vérifie les droits d' | ||
+ | | n | Vérifie le nombre de liens | | ||
+ | | u | Vérifie l' | ||
+ | | g | Vérifie le groupe propriétaire du fichier | | ||
+ | | s | Vérifie la taille du fichier | | ||
+ | | b | Vérifie le nombre de blocs alloués au fichier | | ||
+ | | m | Vérifie la date de la dernière modification du contenu du fichier | | ||
+ | | c | Vérifie la date de la dernière modification de l' | ||
+ | | a | Vérifie la date du dernier accès | | ||
+ | |||
+ | ==La Section File== | ||
+ | |||
+ | < | ||
+ | ############## | ||
+ | # file section | ||
+ | ############## | ||
+ | # 3 syntaxe are available : | ||
+ | # file action | ||
+ | # to scan a file/ | ||
+ | # ! file | ||
+ | # to remove file from scan | ||
+ | # = directory action | ||
+ | # to scan the directory but not sub-directories | ||
+ | # file with blank character have to be quoted | ||
+ | # | ||
+ | # action is the list of attribute used to detect a change | ||
+ | |||
+ | = / DIR | ||
+ | |||
+ | /bin MyRule | ||
+ | |||
+ | /boot | ||
+ | # ! /boot/map | ||
+ | # ! / | ||
+ | |||
+ | /dev p+n | ||
+ | # ! / | ||
+ | # ! / | ||
+ | # ! / | ||
+ | # ! / | ||
+ | ! /dev/bsg | ||
+ | ! /dev/bus | ||
+ | ! /dev/pts | ||
+ | ! /dev/shm | ||
+ | # to avoid problems with pending usb | ||
+ | # = /dev/scsi p+n | ||
+ | |||
+ | /etc ETC | ||
+ | /etc/mtab ETC - md5 - s | ||
+ | / | ||
+ | # / | ||
+ | # / | ||
+ | /etc/motd ETC | ||
+ | # / | ||
+ | # / | ||
+ | # / | ||
+ | # / | ||
+ | ! /etc/cups | ||
+ | # ! /etc/map | ||
+ | # ! / | ||
+ | # ! / | ||
+ | # ! / | ||
+ | # ! / | ||
+ | # ! / | ||
+ | |||
+ | /lib MyRule | ||
+ | / | ||
+ | / | ||
+ | # / | ||
+ | |||
+ | /root MyRule | ||
+ | ! / | ||
+ | ! / | ||
+ | # ! /root/.mc | ||
+ | # ! /root/tmp | ||
+ | ! / | ||
+ | |||
+ | /sbin | ||
+ | |||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | |||
+ | /var/ftp MyRule | ||
+ | /var/log Logs | ||
+ | # ! / | ||
+ | = / | ||
+ | # ! / | ||
+ | /var/www MyRule | ||
+ | # ! / | ||
+ | </ | ||
+ | |||
+ | Cette partie du fichier de configuration détaille les vérifications de fichiers à réaliser, en voici un extrait : | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | /etc ETC | ||
+ | /etc/mtab ETC - md5 - s | ||
+ | / | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Cet extrait indique que : | ||
+ | |||
+ | * le répertoire /etc sera vérifié selon l' | ||
+ | * le fichier /etc/mtab sera vérifié selon l' | ||
+ | * le fichier / | ||
+ | |||
+ | ===Utilisation=== | ||
+ | |||
+ | Commencez par créer la base de données d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# afick -i | ||
+ | # Afick (3.8.1) init at 2024/10/03 11:16:16 with options (/ | ||
+ | # archive: | ||
+ | # database: | ||
+ | # exclude_prefix: | ||
+ | # exclude_suffix: | ||
+ | # history: | ||
+ | # max_checksum_size: | ||
+ | # running_files: | ||
+ | # timing:=1 | ||
+ | # dbm: | ||
+ | # ################################################################# | ||
+ | # MD5 hash of / | ||
+ | |||
+ | # Hash database created successfully. 46551 files entered. | ||
+ | # user time : 18.88; system time : 6.49; real time : 117 | ||
+ | </ | ||
+ | |||
+ | Au moment où vous souhaitez vérifier l' | ||
+ | |||
+ | * **afick -k** | ||
+ | |||
+ | En cas de modifications, | ||
+ | |||
+ | Il est aussi nécessaire de mettre à jour votre base de données chaque fois que vous installez un nouveau paquet ou que vous mettez à jour un paquet déjà installé. Dans ce cas, utilisez la commande suivante : | ||
+ | |||
+ | * **afick -u** | ||
+ | |||
+ | ===Automatiser Afick=== | ||
+ | |||
+ | Lors de l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | # | ||
+ | ############################################################################### | ||
+ | # | ||
+ | # it's a part of the afick project | ||
+ | # | ||
+ | # Copyright (C) 2002, 2003 by Eric Gerbier | ||
+ | # Bug reports to: eric.gerbier@tutanota.com | ||
+ | # $Id$ | ||
+ | # | ||
+ | # This program is free software; you can redistribute it and/or modify | ||
+ | # it under the terms of the GNU General Public License as published by | ||
+ | # the Free Software Foundation; either version 2 of the License, or | ||
+ | # (at your option) any later version. | ||
+ | # | ||
+ | # This program is distributed in the hope that it will be useful, | ||
+ | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
+ | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
+ | # GNU General Public License for more details. | ||
+ | # | ||
+ | ############################################################################### | ||
+ | # script for cron job | ||
+ | # this script use the " | ||
+ | # the goals are : | ||
+ | # - set the nice priority | ||
+ | # - truncate too long reports to avoid big mails | ||
+ | # - avoid mails if no changes detected | ||
+ | # - sent report to the specicified email adress | ||
+ | # - write reports to / | ||
+ | # - archive retention management | ||
+ | |||
+ | AFICK="/ | ||
+ | PATH="/ | ||
+ | LOGDIR="/ | ||
+ | LOGFILE=" | ||
+ | ERRORLOG=" | ||
+ | CONFFILE="/ | ||
+ | |||
+ | # the default action is " | ||
+ | ACTION=" | ||
+ | |||
+ | ############################################################################### | ||
+ | treat_log() { | ||
+ | if [ -n " | ||
+ | then | ||
+ | echo "# This is an automated report generated by Another File Integrity Checker on $FQDN $DATE." | ||
+ | fi | ||
+ | |||
+ | # " | ||
+ | if [ -s $LOGFILE ]; then | ||
+ | loglines=`wc -l $LOGFILE | awk '{ print $1 }'` | ||
+ | if [ ${loglines: | ||
+ | echo "# TRUNCATED (!) output of the daily afick run:" | ||
+ | echo "# Output is $loglines lines, truncated to $LINES." | ||
+ | head -$LINES $LOGFILE | ||
+ | echo "# The full output can be found in $LOGFILE." | ||
+ | else | ||
+ | echo "# Output of the daily afick run:" | ||
+ | cat $LOGFILE | ||
+ | fi | ||
+ | elif [ -n " | ||
+ | then | ||
+ | echo "# afick detected no changes." | ||
+ | fi | ||
+ | |||
+ | # afick errors | ||
+ | if [ -s $ERRORLOG ]; then | ||
+ | errorlines=`wc -l $ERRORLOG | awk '{ print $1 }'` | ||
+ | if [ ${errorlines: | ||
+ | echo "# TRUNCATED (!) output of errors produced:" | ||
+ | echo "# Error output is $errorlines lines, truncated to $LINES." | ||
+ | head -$LINES $ERRORLOG | ||
+ | echo "# The full output can be found in $ERRORLOG." | ||
+ | else | ||
+ | echo "# Errors produced:" | ||
+ | cat $ERRORLOG | ||
+ | fi | ||
+ | elif [ -n " | ||
+ | then | ||
+ | echo "# afick produced no errors." | ||
+ | fi | ||
+ | |||
+ | # check end of report (summary) | ||
+ | if [ -s $LOGFILE ]; then | ||
+ | summary=` grep "MD5 hash of" $LOGFILE ` | ||
+ | if [ -z " | ||
+ | then | ||
+ | echo " | ||
+ | fi | ||
+ | fi | ||
+ | |||
+ | } | ||
+ | ############################################################################### | ||
+ | # extract macro value from config file | ||
+ | macro () { | ||
+ | key=$1 | ||
+ | grep -m 1 " | ||
+ | } | ||
+ | ############################################################################### | ||
+ | send_mail() { | ||
+ | echo " | ||
+ | } | ||
+ | ############################################################################### | ||
+ | send_nagios() { | ||
+ | NAGIOS_STATUS=3 # UNKNOWN initial status | ||
+ | if [ -s $LOGFILE ] | ||
+ | then | ||
+ | NAGIOS_MSG=`tail -4 $LOGFILE | head -1 | sed -e " | ||
+ | NUM_CHANGES=`echo $NAGIOS_MSG | cut -d " " -f 4` | ||
+ | if [ $NUM_CHANGES -gt 0 ] | ||
+ | then | ||
+ | if [ $NUM_CHANGES -ge $NAGIOS_CRITICAL_CHANGES ] | ||
+ | then | ||
+ | NAGIOS_STATUS=2 # CRITICAL | ||
+ | else | ||
+ | NAGIOS_STATUS=1 # WARNING | ||
+ | fi | ||
+ | else | ||
+ | NAGIOS_STATUS=0 # OK | ||
+ | fi | ||
+ | fi | ||
+ | HOST=`hostname` | ||
+ | echo " | ||
+ | } | ||
+ | ############################################################################### | ||
+ | # MAIN | ||
+ | ############################################################################### | ||
+ | |||
+ | [ -x $AFICK ] || exit 0 | ||
+ | |||
+ | # hostname -f only exists on GNU systems, | ||
+ | # on others (HPUX, AIX, Solaris, Tru64), it return an error on stderr | ||
+ | # and a usage message on stdout | ||
+ | FQDN=`( hostname -f || hostname ) 2>/ | ||
+ | DATE=`date +"at %X on %x"` | ||
+ | MAILTO=`macro MAILTO` | ||
+ | LINES=`macro LINES` | ||
+ | VERBOSE=`macro VERBOSE` | ||
+ | REPORT=`macro REPORT` | ||
+ | NICE=`macro NICE` | ||
+ | BATCH=`macro BATCH` | ||
+ | MOUNT=`macro MOUNT` | ||
+ | NAGIOS=`macro NAGIOS` | ||
+ | NAGIOS_SERVER=`macro NAGIOS_SERVER` | ||
+ | NAGIOS_CONFIG=`macro NAGIOS_CONFIG` | ||
+ | NAGIOS_CHECK_NAME=`macro NAGIOS_CHECK_NAME` | ||
+ | NAGIOS_CRITICAL_CHANGES=`macro NAGIOS_CRITICAL_CHANGES` | ||
+ | NAGIOS_NSCA=`macro NAGIOS_NSCA` | ||
+ | ARCHIVE_RETENTION=`macro ARCHIVE_RETENTION` | ||
+ | |||
+ | # default values | ||
+ | [ -z " | ||
+ | [ -z " | ||
+ | [ -z " | ||
+ | [ -z " | ||
+ | [ -z " | ||
+ | [ -z " | ||
+ | [ -z " | ||
+ | [ -z " | ||
+ | [ -z " | ||
+ | [ -z " | ||
+ | [ -z " | ||
+ | [ -z " | ||
+ | [ -z " | ||
+ | [ -z " | ||
+ | |||
+ | #echo " | ||
+ | |||
+ | if [ " | ||
+ | then | ||
+ | exit 0 | ||
+ | fi | ||
+ | |||
+ | if [ " | ||
+ | then | ||
+ | # verbose mail | ||
+ | export VERBOSE_AFICK=1 | ||
+ | fi | ||
+ | |||
+ | # the mount point must be already defined in /etc/fstab | ||
+ | if [ -n " | ||
+ | then | ||
+ | mount $MOUNT | ||
+ | fi | ||
+ | |||
+ | # launch command | ||
+ | nice -n $NICE $AFICK -c $CONFFILE $ACTION > $LOGFILE 2> $ERRORLOG | ||
+ | |||
+ | # archive retention | ||
+ | if [ " | ||
+ | then | ||
+ | echo "###############" | ||
+ | echo "# afick_archive" | ||
+ | / | ||
+ | fi | ||
+ | |||
+ | if [ -n " | ||
+ | then | ||
+ | umount $MOUNT | ||
+ | fi | ||
+ | |||
+ | # nagios ? | ||
+ | if [ " | ||
+ | then | ||
+ | send_nagios | ||
+ | fi | ||
+ | |||
+ | if [ " | ||
+ | then | ||
+ | # no report | ||
+ | exit | ||
+ | fi | ||
+ | |||
+ | # filter output to send by mail | ||
+ | OUTPUT=`treat_log` | ||
+ | if [ " | ||
+ | then | ||
+ | send_mail | ||
+ | else | ||
+ | # skip comments and empty lines | ||
+ | OUTPUT_FILTRE=`echo " | ||
+ | if [ -n " | ||
+ | then | ||
+ | send_mail | ||
+ | fi | ||
+ | fi | ||
+ | </ | ||
+ | |||
+ | Ce fichier permet d' | ||
+ | |||
+ | L' | ||
+ | |||
+ | < | ||
+ | ################# | ||
+ | # macros section | ||
+ | ################# | ||
+ | # used by cron job (afick_cron) | ||
+ | # define the mail adress to send cron job result | ||
+ | @@define MAILTO root@localhost | ||
+ | # truncate the result sended by mail to the number of lines (avoid too long mails) | ||
+ | @@define LINES 1000 | ||
+ | # REPORT = 1 to enable mail reports, =0 to disable report | ||
+ | @@define REPORT 1 | ||
+ | # VERBOSE = 1 to have one mail by run, =0 to have a mail only if changes are detected | ||
+ | @@define VERBOSE 0 | ||
+ | # define the nice value : from 0 to 19 (priority of the job) | ||
+ | @@define NICE 18 | ||
+ | # = 1 to allow cron job, = 0 to suppress cron job | ||
+ | @@define BATCH 1 | ||
+ | # (optionnal, for unix) specify a file system to mount before the scan | ||
+ | # it must be defined in /etc/fstab | ||
+ | #@@define MOUNT /mnt/dist | ||
+ | # if set to 0, keep all archives, else define the number of days to keep | ||
+ | # with the syntaxe nS , n for a number, S for the scale | ||
+ | # (d for day, w for week, m for month, y for year) | ||
+ | # ex : for 5 months : 5m | ||
+ | @@define ARCHIVE_RETENTION 0 | ||
+ | |||
+ | # send nagios messages by NSCA (= 1 to allow, = 0 to block) | ||
+ | @@define NAGIOS 0 | ||
+ | # address of the nagios server to send messages to | ||
+ | @@define NAGIOS_SERVER my.nagios.server.org | ||
+ | # NSCA configuration file | ||
+ | # @@define NAGIOS_CONFIG / | ||
+ | # name used for nagios passive check on the nagios server side | ||
+ | @@define NAGIOS_CHECK_NAME Another File Integrity Checker | ||
+ | # number c of the changes that are considered critical => nagios state CRITICAL | ||
+ | # (0 changes => nagios state OK; 0> and <c changes => nagios state WARNING) | ||
+ | @@define NAGIOS_CRITICAL_CHANGES 2 | ||
+ | # path to nsca binary | ||
+ | # @@define NAGIOS_NSCA / | ||
+ | </ | ||
+ | |||
+ | ====Root Kits==== | ||
+ | |||
+ | Un **rootkit** est un paquet logiciel qui permet à un utilisateur non-autorisé d' | ||
+ | |||
+ | Les rootkits sont essentiellement de deux types, voire un mélange des deux : | ||
+ | |||
+ | * des modules du noyau, | ||
+ | * des paquets logiciels d'un utilisateur qui prennent la place de binaires système. | ||
+ | |||
+ | Les rootkits de type modules du noyau insèrent des modules qui remplacent des appels systèmes et cachent des informations concernant certains processus spécifiques. | ||
+ | |||
+ | Les rootkits de type paquets logiciels remplacement en règle générale des binaires système tels **ps**, **login** etc. Les binaires de remplacement cachent des processus et des répertoires de l' | ||
+ | |||
+ | ===LAB #8 - Mise en place de rkhunter=== | ||
+ | |||
+ | **rkhunter** est un logiciel utilisé pour détecter les rootkits présents sur votre machine. | ||
+ | |||
+ | ==Installation== | ||
+ | |||
+ | L' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# dnf install rkhunter | ||
+ | </ | ||
+ | |||
+ | ==Les options de la commande== | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# rkhunter --help | ||
+ | |||
+ | Usage: rkhunter {--check | --unlock | --update | --versioncheck | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | Current options are: | ||
+ | | ||
+ | | ||
+ | -c, --check | ||
+ | -C, --config-check | ||
+ | --cs2, --color-set2 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | (Do not use unless asked to do so) | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | NONE | < | ||
+ | | ||
+ | -h, --help | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | -l, --logfile [file] | ||
+ | | ||
+ | | ||
+ | | ||
+ | for disabled tests (only valid with --disable) | ||
+ | | ||
+ | | ||
+ | --nomow, --no-mail-on-warning | ||
+ | --ns, --nosummary | ||
+ | | ||
+ | | ||
+ | BSDng | SOLARIS | or verify file property values. | ||
+ | | ||
+ | | ||
+ | package]... | ||
+ | -q, --quiet | ||
+ | --rwo, --report-warnings-only | ||
+ | --sk, --skip-keypress | ||
+ | | ||
+ | (This is the default) | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | --vl, --verbose-logging | ||
+ | -V, --version | ||
+ | | ||
+ | -x, --autox | ||
+ | -X, --no-autox | ||
+ | </ | ||
+ | |||
+ | ==Utilisation== | ||
+ | |||
+ | Lancez **rkhunter** simplement en appelant son exécutable. A l'issu de son exécution, vous observerez un résumé : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# rkhunter -c | ||
+ | ... | ||
+ | System checks summary | ||
+ | ===================== | ||
+ | |||
+ | File properties checks... | ||
+ | Required commands check failed | ||
+ | Files checked: 137 | ||
+ | Suspect files: 4 | ||
+ | |||
+ | Rootkit checks... | ||
+ | Rootkits checked : 498 | ||
+ | Possible rootkits: 0 | ||
+ | |||
+ | Applications checks... | ||
+ | All checks skipped | ||
+ | |||
+ | The system checks took: 2 minutes and 10 seconds | ||
+ | |||
+ | All results have been written to the log file: / | ||
+ | |||
+ | One or more warnings have been found while checking the system. | ||
+ | Please check the log file (/ | ||
+ | </ | ||
+ | |||
+ | ==Configuration== | ||
+ | |||
+ | **rkhunter** peut être configuré soit par des options sur la ligne de commande soit par l' | ||
----- | ----- | ||
Copyright © 2024 Hugh Norris. | Copyright © 2024 Hugh Norris. |