Différences

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

Lien vers cette vue comparative

Prochaine révision
Révision précédente
elearning:workbooks:debian:11:sec:l107 [2025/11/30 15:24] – créée adminelearning:workbooks:debian:11:sec:l107 [2025/12/04 15:40] (Version actuelle) admin
Ligne 1: Ligne 1:
 ~~PDF:LANDSCAPE~~ ~~PDF:LANDSCAPE~~
- 
-OPENVPN 
  
 Version : **2026.01** Version : **2026.01**
Ligne 7: Ligne 5:
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
  
-======LDF407 - Cryptologie======+======LDF407 - Balayage des Ports======
  
-=====Contenu du module=====+=====Contenu du Module=====
  
-  * **LDF407 - Cryptologie** +  * **LDF407 - Balayage des Ports** 
-    * Contenu du module+    * Contenu du Module
     * Le Problématique     * Le Problématique
-    * LAB #1 - Utilisation de tcpdump +      * LAB #1 - Utilisation de nmap et de netcat 
-      * 1.1 - Utilisation +        * 1.1 - nmap 
-        L'option -i +          Installation 
-        L'option -x +          Utilisation 
-        L'option -X +          Fichiers de Configuration 
-        L'option -w +          Scripts 
-        * L'option -v +        * 1.2 - netcat 
-      * 1.2 - Filtrage à l'écoute+          * Utilisation
     * Les Contre-Mesures     * Les Contre-Mesures
-      * Introduction à la cryptologie +      * LAB #2 - Mise en place du Système de Détection d'Intrusion Snort 
-        * Définitions +        * 2.1 - Installation 
-        * Algorithmes à clé secrète +        * 2.2 - Configuration 
-          * Le Chiffrement Symétrique +        * 2.3 - Utilisation 
-        * Algorithmes à clef publique +      * LAB #3 - Mise en place du Système de Détection et de Prévention d'Intrusion Portsentry 
-          * Le Chiffrement Asymétrique +        * 3.1 - Installation 
-          * La Clef de Session +        * 3.2 - Configuration 
-        * Fonctions de Hachage +        * 3.3 - Utilisation
-        * Signature Numérique +
-        * PKI +
-          * Certificats X509 +
-    * LAB #2 - Utilisation de GnuPG +
-      * 2.1 - Présentation +
-      * 2.2 - Installation +
-      * 2.3 - Utilisation +
-        * Signer un message +
-        * Chiffrer un message +
-    * LAB #3 - Mise en place de SSH et SCP +
-      * 3.1 - Introduction +
-        * SSH-1 +
-        * SSH-2 +
-        * L'authentification par mot de passe +
-        * L'authentification par clef asymétrique +
-      * 3.2 - Configuration du Serveur +
-      * 3.3 - Utilisation +
- * 3.4 - Mise en place des clefs +
-      * 3.5 - Tunnels SSH +
-      * 3.6 - SCP +
-        * Introduction +
-        * Utilisation +
-    * LAB #4 - Mise en place d'un VPN avec OpenVPN +
-      * Présentation +
-      * Configuration commune au client et au serveur +
-      * Configuration du client +
-      * Configuration du serveur +
-      * Tests +
-        * Du client vers le serveur +
-        * Du serveur vers le client+
  
 =====Le Problématique===== =====Le Problématique=====
  
-Le **sniffing** des paquets de données est possible sur un réseau utilisant une technologie de diffusion tel un réseau **Ethernet**En effet certains protocoles ne cryptent pas les données avant de les envoyer dont :+Un **Cheval de Troie** est un binaire qui se cache dans un autreIl est exécuté suite à l'exécution du binaire hôte par la cible ou par un utilisateur. Le but principal du Cheval de Troie est d'ouvrir une //trappe// (//backdoor//). Les Chevaux de Troie les plus connus sont :
  
-  * Telnet+  * Back Orifice 2000 - tcp/8787, tcp/54320-21
-  * Rlogin+  * Backdoor - tcp/1999
-  * Ftp+  * Subseven - tcp/1243, tcp/ 2773, tcp/6711-6713, tcp/7215, tcp/27374, tcp/27573, tcp/54283
-  * Pop3.+  * Socket de Troie - tcp/5001, tcp/30303, tcp/50505.
  
-Un //sniffeur// est un logiciel qui captent les paquets circulant sur un réseau de type diffusion afin de les analyser. Le logiciel les plus utilisé est :+Le **scan** consiste à balayer les ports d'une machine afin de :
  
-  * Tcpdump.+  * connaître les ports qui sont ouverts, 
 +  * déterminer le système d'exploitation, 
 +  * identifier les services ouverts.
  
-=====LAB #1 - Utilisation de tcpdump=====+Plusieurs scanners existent dont :
  
-Le logiciel **tcpdump** sert à écouter le réseau en interceptant les paquets.+  nmap 
 +  netcat
  
-===1.1 - Utilisation===+====LAB #1 - Utilisation de nmap et de netcat====
  
-Installez **tcpdump** :+=== 1.1 - nmap ===
  
-<code> +==Installation==
-root@debian12:~# apt install tcpdump +
-</code> +
- +
-==L'option -i==+
  
-Pour écouter sur une **interface spécifique**, utilisez l'option **-i** :+Sous Debian 12, **nmap** n'est pas installé par défaut :
  
 <code> <code>
-root@debian12:~# tcpdump -i ens18 -c 10 +root@debian12:~# which nmap 
-tcpdumpverbose output suppressed, use -v[v]... for full protocol decode +root@debian12:~#
-listening on ens18, link-type EN10MB (Ethernet), snapshot length 262144 bytes +
-17:29:37.411395 IP 10.0.2.46.ssh > 10.0.2.1.42252: Flags [P.], seq 119569853:119570041, ack 3811519177, win 501, options [nop,nop,TS val 3553055771 ecr 1647876767], length 188 +
-17:29:37.411528 IP 10.0.2.1.42252 > 10.0.2.46.ssh: Flags [.], ack 188, win 10591, options [nop,nop,TS val 1647876791 ecr 3553055771], length 0 +
-17:29:37.493738 IP 10.0.2.46.36881 > dns.google.domain: 55995+ PTR? 1.2.0.10.in-addr.arpa. (39) +
-17:29:37.495598 IP dns.google.domain > 10.0.2.46.36881: 55995 NXDomain 0/0/0 (39) +
-17:29:37.495837 IP 10.0.2.46.33051 > dns.google.domain: 43187+ PTR? 46.2.0.10.in-addr.arpa. (40) +
-17:29:37.497464 IP dns.google.domain > 10.0.2.46.33051: 43187 NXDomain 0/0/0 (40) +
-17:29:37.497758 IP 10.0.2.46.ssh > 10.0.2.1.42252: Flags [P.], seq 188:536, ack 1, win 501, options [nop,nop,TS val 3553055857 ecr 1647876791], length 348 +
-17:29:37.497891 IP 10.0.2.1.42252 > 10.0.2.46.ssh: Flags [.], ack 536, win 10591, options [nop,nop,TS val 1647876877 ecr 3553055857], length 0 +
-17:29:37.597097 IP 10.0.2.46.52033 > dns.google.domain: 12468+ PTR? 8.8.8.8.in-addr.arpa. (38) +
-17:29:37.598847 IP dns.google.domain > 10.0.2.46.52033: 12468 1/0/0 PTR dns.google. (62) +
-10 packets captured +
-14 packets received by filter +
-0 packets dropped by kernel+
 </code> </code>
  
-Notez qu'à la fin, un résumé vous est présenté, par exemple :+Installez donc nmap en utilisant APT :
  
 <code> <code>
-... +root@debian12:~# apt install nmap
-10 packets captured +
-14 packets received by filter +
-0 packets dropped by kernel+
 </code> </code>
  
-<WRAP center round important> +==Utilisation==
-**Important** : L'option **-c** limite le nombre de paquets capturés. +
-</WRAP>+
  
-==L'option -x== +Pour connaître la liste des ports ouverts sur votre machine virtuellesaisissez la commande suivante :
- +
-Pour écouter sur une interface spécifique et voir le contenu en Hexadécimalutilisez les options -i et **-x** :+
  
 <code> <code>
-root@debian12:~# tcpdump -i ens18 -x -c 3 +root@debian12:~# nmap 127.0.0.1 
-tcpdump: verbose output suppressed, use -v[v]... for full protocol decode +Starting Nmap 7.93 ( https://nmap.org ) at 2025-11-27 16:48 CET 
-listening on ens18, link-type EN10MB (Ethernet), snapshot length 262144 bytes +Nmap scan report for localhost (127.0.0.1
-17:27:24.043320 IP 10.0.2.46.ssh > 10.0.2.1.42252Flags [P.], seq 119567701:119567889, ack 3811519061, win 501, options [nop,nop,TS val 3552922403 ecr 1647743397], length 188 +Host is up (0.0000090s latency)
-        0x0000:  4510 00f0 84b8 4000 4006 9d11 0a00 022e +Not shown996 closed tcp ports (reset
-        0x0010:  0a00 0201 0016 a50c 0720 7555 e32f 2a55 +PORT     STATE SERVICE 
-        0x0020:  8018 01f5 1911 0000 0101 080a d3c5 4b23 +22/tcp   open  ssh 
-        0x0030:  6236 91a5 0000 00b0 77fb cb1f c046 bb66 +80/tcp   open  http 
-        0x0040:  c32f 923b a994 d49b f063 5539 130e 764b +631/tcp  open  ipp 
-        0x0050:  06fe b5be f2d1 7cee ef79 8d3e ec6e 1e7f +5900/tcp open  vnc
-        0x0060:  c296 1fbf f4e8 67b0 f16d 5d98 1963 424c +
-        0x0070:  f6de 9287 5dbe 98c0 2b95 05cb 37f3 a653 +
-        0x0080:  dbff 81a1 d03f c288 bbaf 4756 41be 64ea +
-        0x0090:  706a 55ff 8322 e32e ea56 2e60 5210 43e6 +
-        0x00a0:  9eec 5bb1 e519 1936 4ee7 809b 6a18 675e +
-        0x00b0:  29b7 de38 921d a543 4ca7 7132 ff0f e399 +
-        0x00c0:  5338 304d 03a3 beed ddbe 4530 cb71 fea2 +
-        0x00d0:  618b b56d b45c 9ab6 9b71 563e 058d de9a +
-        0x00e0:  d249 d57e 7a53 f6b5 7bf6 5924 46f0 6c74 +
-17:27:24.043485 IP 10.0.2.1.42252 > 10.0.2.46.ssh: Flags [.], ack 188, win 10548, options [nop,nop,TS val 1647743423 ecr 3552922403], length 0 +
-        0x0000 4510 0034 41fb 4000 4006 e08a 0a00 0201 +
-        0x0010:  0a00 022e a50c 0016 e32f 2a55 0720 7611 +
-        0x0020:  8010 2934 1855 0000 0101 080a 6236 91bf +
-        0x0030:  d3c5 4b23 +
-17:27:24.125464 IP 10.0.2.46.42246 > dns.google.domain: 35092+ PTR? 1.2.0.10.in-addr.arpa. (39+
-        0x0000:  4500 0043 3869 4000 4011 e603 0a00 022e +
-        0x0010:  0808 0808 a506 0035 002f 1c7e 8914 0100 +
-        0x0020:  0001 0000 0000 0000 0131 0132 0130 0231 +
-        0x0030:  3007 696e 2d61 6464 7204 6172 7061 0000 +
-        0x0040:  0c00 01 +
-3 packets captured +
-10 packets received by filter +
-0 packets dropped by kernel +
-</code>+
  
-==L'option -X== +Nmap done: 1 IP address (host upscanned in 0.10 seconds
- +
-Pour écouter sur une interface spécifique et voir le contenu en Hexadécimal et en ASCII, utilisez les options -i et **-X** : +
- +
-<code> +
-root@debian12:~# tcpdump -i ens18 -X -c 3 +
-tcpdump: verbose output suppressed, use -v[v]... for full protocol decode +
-listening on ens18, link-type EN10MB (Ethernet), snapshot length 262144 bytes +
-13:07:32.922306 IP 10.0.2.46.ssh > 10.0.2.1.42252: Flags [P.], seq 119572449:119572637, ack 3811519901, win 501, options [nop,nop,TS val 3553115863 ecr 1647936856], length 188 +
-        0x0000:  4510 00f0 84d9 4000 4006 9cf0 0a00 022e  E.....@.@....... +
-        0x0010:  0a00 0201 0016 a50c 0720 87e1 e32f 2d9d  ............./-. +
-        0x0020:  8018 01f5 1911 0000 0101 080a d3c8 3ed7  ..............>+
-        0x0030:  6239 8558 0000 00b0 daef 47be bc64 8630  b9.X......G..d.0 +
-        0x0040:  968c 107d ba16 f8fb 45db 05ff e566 a1af  ...}....E....f.. +
-        0x0050:  728f e777 583b 64ac 09a6 f099 c570 ad4f  r..wX;d......p.O +
-        0x0060:  17d1 afa8 dbb3 1d59 122a 3e9d e4be 07f7  .......Y.*>..... +
-        0x0070:  7b85 75fc 49f4 e0fe 37ab f924 acc6 4f43  {.u.I...7..$..OC +
-        0x0080:  6231 f469 e3b2 ebb9 e9a4 6bfb cd89 66e2  b1.i......k...f. +
-        0x0090:  9fda ccf9 39ad 272a f373 167e 13e2 b56c  ....9.'*.s.~...l +
-        0x00a0:  3625 f2e2 7898 d061 6191 d5c4 a268 b1e0  6%..x..aa....h.. +
-        0x00b0:  1f4a a1f9 e319 18c9 e55a b700 e281 1f71  .J.......Z.....q +
-        0x00c0:  06fb 4e11 1145 23e2 a194 d91c 8e22 f8ef  ..N..E#......".. +
-        0x00d0:  5e96 6e34 f24f 1b67 754b 4c7e 5e51 a2cf  ^.n4.O.guKL~^Q.. +
-        0x00e0:  e2ed c5bb 409e eae3 c905 54ab cfc2 5a55  ....@.....T...ZU +
-13:07:32.922462 IP 10.0.2.1.42252 > 10.0.2.46.ssh: Flags [.], ack 188, win 10611, options [nop,nop,TS val 1647936883 ecr 3553115863], length 0 +
-        0x0000:  4510 0034 4232 4000 4006 e053 0a00 0201  E..4B2@.@..S.... +
-        0x0010:  0a00 022e a50c 0016 e32f 2d9d 0720 889d  ........./-..... +
-        0x0020:  8010 2973 1855 0000 0101 080a 6239 8573  ..)s.U......b9.s +
-        0x0030:  d3c8 3ed7                                ..>. +
-13:07:33.008324 IP 10.0.2.46.47533 > dns.google.domain: 49115+ PTR? 1.2.0.10.in-addr.arpa. (39) +
-        0x0000:  4500 0043 2e6b 4000 4011 f001 0a00 022e  E..C.k@.@....... +
-        0x0010:  0808 0808 b9ad 0035 002f 1c7e bfdb 0100  .......5./.~.... +
-        0x0020:  0001 0000 0000 0000 0131 0132 0130 0231  .........1.2.0.+
-        0x0030:  3007 696e 2d61 6464 7204 6172 7061 0000  0.in-addr.arpa.. +
-        0x0040:  0c00 01                                  ... +
-3 packets captured +
-10 packets received by filter +
-0 packets dropped by kernel +
-</code> +
- +
-==L'option -w== +
- +
-Pour écouter sur une interface spécifique et envoyer la sortie dans un fichier, utilisez les options -i et **-w** et patientez 5 minutes : +
- +
-<code> +
-root@debian12:~# tcpdump -i ens18 -w log.dump +
-tcpdump: listening on ens18, link-type EN10MB (Ethernet), snapshot length 262144 bytes +
-^C42 packets captured +
-45 packets received by filter +
-0 packets dropped by kernel +
- +
-root@debian12:~# ls -l log.dump +
--rw-r--r-- 1 tcpdump tcpdump 25555 Nov 28 13:11 log.dump+
 </code> </code>
  
 <WRAP center round important 50%> <WRAP center round important 50%>
-**Important** - Arrêtez la sortie de la commande à l'aide des touches **^C**.+**Important** - Pour connaître les ports ouverts sur une machine distante, la procédure est identique sauf que vous devez utiliser l'adresse IP de votre cible.
 </WRAP> </WRAP>
  
-Notez que le fichier log.dump est au format **libpcap** et non au format texteIl est donc inutile d'essayer de lire son contenu avec une commande telle **cat** :+==Fichiers de Configuration== 
 + 
 +**nmap** utilise un fichier spécifique pour identifier les portsCe fichier est **/usr/share/nmap/nmap-services**:
  
 <code> <code>
-root@debian12:~# file log.dump +root@debian12:~# more /usr/share/nmap/nmap-services 
-log.dumppcap capture file, microsecond ts (little-endian) - version 2.4 (Ethernet, capture length 262144)+# THIS FILE IS GENERATED AUTOMATICALLY FROM A MASTER - DO NOT EDIT
 +# EDIT /nmap-private-dev/nmap-services-all IN SVN INSTEAD. 
 +# Well known service port numbers -*- modefundamental; -*- 
 +# From the Nmap Security Scanner https://nmap.org/
 +
 +# $Id: nmap-services 38442 2022-08-31 22:53:46Z dmiller $ 
 +
 +# Derived from IANA data and our own research 
 +
 +# This collection of service data is (C1996-2020 by Insecure.Com 
 +# LLC.  It is distributed under the Nmap Public Source license as 
 +# provided in the LICENSE file of the source distribution or at 
 +# https://svn.nmap.org/nmap/LICENSE .  Note that this license 
 +# requires you to license your own work under a compatable open source 
 +# license.  If you wish to embed Nmap technology into proprietary 
 +# software, we sell alternative licenses (contact sales@insecure.com). 
 +# Dozens of software vendors already license Nmap technology such as 
 +# host discovery, port scanning, OS detection, and version detection. 
 +# For more details, see https://nmap.org/book/man-legal.html 
 +
 +# Fields in this file are: Service name, portnum/protocol, open-frequency, optional comments 
 +
 +tcpmux  1/tcp   0.001995        # TCP Port Service Multiplexer [rfc-1078] | TCP Port Service Multiplexer 
 +tcpmux  1/udp   0.001236        # TCP Port Service Multiplexer 
 +compressnet     2/tcp   0.000013        # Management Utility 
 +compressnet     2/udp   0.001845        # Management Utility 
 +compressnet     3/tcp   0.001242        # Compression Process 
 +compressnet     3/udp   0.001532        # Compression Process 
 +unknown 4/tcp   0.000477 
 +rje     5/tcp   0.000000        # Remote Job Entry 
 +rje     5/udp   0.000593        # Remote Job Entry 
 +unknown 6/tcp   0.000502 
 +echo    7/sctp  0.000000 
 +echo    7/tcp   0.004855 
 +echo    7/udp   0.024679 
 +unknown 8/tcp   0.000013 
 +discard 9/sctp  0.000000        # sink null 
 +discard 9/tcp   0.003764        # sink null 
 +discard 9/udp   0.015733        # sink null 
 +unknown 10/tcp  0.000063 
 +systat  11/tcp  0.000075        # Active Users 
 +systat  11/udp  0.000577        # Active Users 
 +unknown 12/tcp  0.000063 
 +daytime 13/tcp  0.003927 
 +daytime 13/udp  0.004827 
 +unknown 14/tcp  0.000038 
 +netstat 15/tcp  0.000038 
 +unknown 16/tcp  0.000050 
 +qotd    17/tcp  0.002346        # Quote of the Day 
 +qotd    17/udp  0.009209        # Quote of the Day 
 +msp     18/tcp  0.000000        # Message Send Protocol | Message Send Protocol (historic) 
 +msp     18/udp  0.000610        # Message Send Protocol 
 +chargen 19/tcp  0.002559        # ttytst source Character Generator | Character Generator 
 +chargen 19/udp  0.015865        # ttytst source Character Generator 
 +ftp-data        20/sctp 0.000000        # File Transfer [Default Data] | FTP 
 +--More--(0%)
 </code> </code>
  
-==L'option -v== +Le répertoire **/usr/share/nmap** contient d'autres fichiers importants :
- +
-Tcpdump peut être utilisé avec un de trois modes verbose. +
- +
-^ Mode ^ Option ^ +
-| Light verbose | -v | +
-| Medium verbose | -vv | +
-| Full verbose | -vvv |+
  
 <code> <code>
-root@debian12:~# tcpdump -i ens18 --c 3 +root@debian12:~# ls -l /usr/share/nmap 
-tcpdump: listening on ens18, link-type EN10MB (Ethernet), snapshot length 262144 bytes +total 9368 
-13:13:22.869956 IP (tos 0x10, ttl 64, id 34138, offset 0, flags [DF], proto TCP (6), length 176) +-rw-r--r-- 1 root root   10829 Jan 16  2023 nmap.dtd 
-    10.0.2.46.ssh > 10.0.2.1.42252: Flags [P.], cksum 0x18d1 (incorrect -> 0x3397), seq 119580817:119580941, ack 3811523793, win 501, options [nop,nop,TS val 3553465811 ecr 1648286807], length 124 +-rw-r--r-- 1 root root  824437 Jan 16  2023 nmap-mac-prefixes 
-13:13:22.870085 IP (tos 0x10, ttl 64, id 17171, offset 0, flags [DF], proto TCP (6), length 52) +-rw-r--r-- 1 root root 5032815 Jan 16  2023 nmap-os-db 
-    10.0.2.1.42252 > 10.0.2.46.ssh: Flags [.], cksum 0x1855 (incorrect -> 0x174a), ack 124, win 10660, options [nop,nop,TS val 1648286831 ecr 3553465811], length 0 +-rw-r--r-- 1 root root   21165 Jan 16  2023 nmap-payloads 
-13:13:22.951837 IP (tos 0x10, ttl 64, id 34139, offset 0, flags [DF], proto TCP (6), length 176) +-rw-r--r-- 1 root root    6845 Jan 16  2023 nmap-protocols 
-    10.0.2.46.ssh > 10.0.2.1.42252: Flags [P.], cksum 0x18d1 (incorrect -> 0x5f7e), seq 124:248, ack 1, win 501, options [nop,nop,TS val 3553465893 ecr 1648286831], length 124 +-rw-r--r-- root root   43529 Jan 16  2023 nmap-rpc 
-3 packets captured +-rw-r--r-- 1 root root 2506640 Jan 16  2023 nmap-service-probes 
-10 packets received by filter +-rw-r--r-- root root 1004557 Jan 16  2023 nmap-services 
-0 packets dropped by kernel+-rw-r--r-- 1 root root   31936 Jan 16  2023 nmap.xsl 
 +drwxr-xr-x 3 root root    4096 Nov 27 16:46 nselib 
 +-rw-r--r-- root root   49478 Jan 16  2023 nse_main.lua 
 +drwxr-xr-x 2 root root   36864 Nov 27 16:46 scripts
 </code> </code>
  
-===1.2 - Filtrage à l'écoute===+Voici la liste des fichiers les plus importants :
  
-Tcpdump peut effectuer du filtrage lors de l'écoute.+^ Fichier ^ Description ^ 
 +| /usr/share/nmap/nmap-protocols | Contient la liste des protocols reconnus par **nmap**. | 
 +| /usr/share/nmap/nmap-service-probes | Contient les règles de balayage utilisées par **nmap** pour identifier le service actif sur un port donné. | 
 +| /usr/share/nmap/nmap-mac-prefixes | Contient une liste de préfix d'adresses MAC par fabricant reconnu par **nmap**. | 
 +| /usr/share/nmap/nmap-rpc | Contient une liste des services RPC reconnus par **nmap**|
  
-Pour uniquement écouter les paquets en provenance de l'adresse IP 192.168.1.11, utilisez la condition **src host** :+==Scripts==
  
-  # tcpdump src host 192.168.1.11 [Entrée] +**nmap** utilise des scripts pour accomplir certaines tâches allant de la découverte simple de ports ouverts jusqu'à l'intrusion :
- +
-Pour uniquement écouter les paquets en provenance de l'adresse IP 192.168.1.11 et vers l'adresse 192.168.1.2, utilisez les conditions src host et **dst host** +
- +
-  # tcpdump src host 192.168.1.11 and dst host 192.168.1.2 [Entrée] +
- +
-Pour uniquement écouter les paquets d'un port précis, utilisez la condition **port** : +
- +
-  # tcpdump -i eth0 port 80 [Entrée] +
- +
-Pour uniquement écouter les paquets d'un protocole précis, utilisez une condition telle **ip**, **icmp**, **arp**, **rarp**, **udp** ou **tcp**: +
- +
-  # tcpdump -i eth0 udp [Entrée] +
- +
-Pour uniquement écouter les paquets d'une taille inférieure à 100 octets, utilisez la condition **less** : +
- +
-  # tcpdump -i eth0 less 100 [Entrée] +
- +
-Pour uniquement écouter les paquets d'une taille supérieure à 100 octets, utilisez la condition **great** : +
- +
-  # tcpdump -i eth0 greater 100 [Entrée] +
- +
-L'utilisation des ses options et conditions peut être combinée pour donner des commandes telles : +
- +
-  # tcpdump -i eth0 -X src host 192.168.1.11 and dst host 192.168.1.2 and port 21 and ftp [Entrée] +
- +
-===Options de la commande=== +
- +
-Les options de cette commande sont :+
  
 <code> <code>
-root@debian12:~# tcpdump --help +root@debian12:~# ls /usr/share/nmap/scripts/ 
-tcpdump version 4.99.3 +acarsd-info.nse                       fcrdns.nse                              https-redirect.nse               ms-sql-info.nse                 smb-flood.nse 
-libpcap version 1.10.3 (with TPACKET_V3) +address-info.nse                      finger.nse                              http-stored-xss.nse              ms-sql-ntlm-info.nse            smb-ls.nse 
-OpenSSL 3.0.17 1 Jul 2025 +afp-brute.nse                         fingerprint-strings.nse                 http-svn-enum.nse                ms-sql-query.nse                smb-mbenum.nse 
-Usage: tcpdump [-AbdDefhHIJKlLnNOpqStuUvxX#] [ -B size ] [ -c count ] [--count] +afp-ls.nse                            firewalk.nse                            http-svn-info.nse                ms-sql-tables.nse               smb-os-discovery.nse 
-                -C file_size ] [ -E algo:secret ] [ -F file ] [ -G seconds ] +afp-path-vuln.nse                     firewall-bypass.nse                     http-title.nse                   ms-sql-xp-cmdshell.nse          smb-print-text.nse 
-                -i interface ] [ --immediate-mode ] [ -j tstamptype ] +afp-serverinfo.nse                    flume-master-info.nse                   http-tplink-dir-traversal.nse    mtrace.nse                      smb-protocols.nse 
-                -M secret ] [ --number ] [ --print ] [ -Q in|out|inout ] +afp-showmount.nse                     fox-info.nse                            http-trace.nse                   murmur-version.nse              smb-psexec.nse 
-                -r file ] [ -s snaplen ] [ -T type ] [ --version ] +ajp-auth.nse                          freelancer-info.nse                     http-traceroute.nse              mysql-audit.nse                 smb-security-mode.nse 
-                -V file ] [ -w file ] [ -W filecount ] [ -y datalinktype ] +ajp-brute.nse                         ftp-anon.nse                            http-trane-info.nse              mysql-brute.nse                 smb-server-stats.nse 
-                --time-stamp-precision precision ] [ --micro ] [ --nano ] +ajp-headers.nse                       ftp-bounce.nse                          http-unsafe-output-escaping.nse  mysql-databases.nse             smb-system-info.nse 
-                -z postrotate-command ] [ -Z user ] [ expression ]+ajp-methods.nse                       ftp-brute.nse                           http-useragent-tester.nse        mysql-dump-hashes.nse           smb-vuln-conficker.nse 
 +ajp-request.nse                       ftp-libopie.nse                         http-userdir-enum.nse            mysql-empty-password.nse        smb-vuln-cve2009-3103.nse 
 +allseeingeye-info.nse                 ftp-proftpd-backdoor.nse                http-vhosts.nse                  mysql-enum.nse                  smb-vuln-cve-2017-7494.nse 
 +amqp-info.nse                         ftp-syst.nse                            http-virustotal.nse              mysql-info.nse                  smb-vuln-ms06-025.nse 
 +asn-query.nse                         ftp-vsftpd-backdoor.nse                 http-vlcstreamer-ls.nse          mysql-query.nse                 smb-vuln-ms07-029.nse 
 +auth-owners.nse                       ftp-vuln-cve2010-4221.nse               http-vmware-path-vuln.nse        mysql-users.nse                 smb-vuln-ms08-067.nse 
 +auth-spoof.nse                        ganglia-info.nse                        http-vuln-cve2006-3392.nse       mysql-variables.nse             smb-vuln-ms10-054.nse 
 +backorifice-brute.nse                 giop-info.nse                           http-vuln-cve2009-3960.nse       mysql-vuln-cve2012-2122.nse     smb-vuln-ms10-061.nse 
 +backorifice-info.nse                  gkrellm-info.nse                        http-vuln-cve2010-0738.nse       nat-pmp-info.nse                smb-vuln-ms17-010.nse 
 +bacnet-info.nse                       gopher-ls.nse                           http-vuln-cve2010-2861.nse       nat-pmp-mapport.nse             smb-vuln-regsvc-dos.nse 
 +banner.nse                            gpsd-info.nse                           http-vuln-cve2011-3192.nse       nbd-info.nse                    smb-vuln-webexec.nse 
 +bitcoin-getaddr.nse                   hadoop-datanode-info.nse                http-vuln-cve2011-3368.nse       nbns-interfaces.nse             smb-webexec-exploit.nse 
 +bitcoin-info.nse                      hadoop-jobtracker-info.nse              http-vuln-cve2012-1823.nse       nbstat.nse                      smtp-brute.nse 
 +bitcoinrpc-info.nse                   hadoop-namenode-info.nse                http-vuln-cve2013-0156.nse       ncp-enum-users.nse              smtp-commands.nse 
 +bittorrent-discovery.nse              hadoop-secondary-namenode-info.nse      http-vuln-cve2013-6786.nse       ncp-serverinfo.nse              smtp-enum-users.nse 
 +bjnp-discover.nse                     hadoop-tasktracker-info.nse             http-vuln-cve2013-7091.nse       ndmp-fs-info.nse                smtp-ntlm-info.nse 
 +broadcast-ataoe-discover.nse          hbase-master-info.nse                   http-vuln-cve2014-2126.nse       ndmp-version.nse                smtp-open-relay.nse 
 +broadcast-avahi-dos.nse               hbase-region-info.nse                   http-vuln-cve2014-2127.nse       nessus-brute.nse                smtp-strangeport.nse 
 +broadcast-bjnp-discover.nse           hddtemp-info.nse                        http-vuln-cve2014-2128.nse       nessus-xmlrpc-brute.nse         smtp-vuln-cve2010-4344.nse 
 +broadcast-db2-discover.nse            hnap-info.nse                           http-vuln-cve2014-2129.nse       netbus-auth-bypass.nse          smtp-vuln-cve2011-1720.nse 
 +broadcast-dhcp6-discover.nse          hostmap-bfk.nse                         http-vuln-cve2014-3704.nse       netbus-brute.nse                smtp-vuln-cve2011-1764.nse 
 +broadcast-dhcp-discover.nse           hostmap-crtsh.nse                       http-vuln-cve2014-8877.nse       netbus-info.nse                 sniffer-detect.nse 
 +broadcast-dns-service-discovery.nse   hostmap-robtex.nse                      http-vuln-cve2015-1427.nse       netbus-version.nse              snmp-brute.nse 
 +broadcast-dropbox-listener.nse        http-adobe-coldfusion-apsa1301.nse      http-vuln-cve2015-1635.nse       nexpose-brute.nse               snmp-hh3c-logins.nse 
 +broadcast-eigrp-discovery.nse         http-affiliate-id.nse                   http-vuln-cve2017-1001000.nse    nfs-ls.nse                      snmp-info.nse 
 +broadcast-hid-discoveryd.nse          http-apache-negotiation.nse             http-vuln-cve2017-5638.nse       nfs-showmount.nse               snmp-interfaces.nse 
 +broadcast-igmp-discovery.nse          http-apache-server-status.nse           http-vuln-cve2017-5689.nse       nfs-statfs.nse                  snmp-ios-config.nse 
 +broadcast-jenkins-discover.nse        http-aspnet-debug.nse                   http-vuln-cve2017-8917.nse       nje-node-brute.nse              snmp-netstat.nse 
 +broadcast-listener.nse                http-auth-finder.nse                    http-vuln-misfortune-cookie.nse  nje-pass-brute.nse              snmp-processes.nse 
 +broadcast-ms-sql-discover.nse         http-auth.nse                           http-vuln-wnr1000-creds.nse      nntp-ntlm-info.nse              snmp-sysdescr.nse 
 +broadcast-netbios-master-browser.nse  http-avaya-ipoffice-users.nse           http-waf-detect.nse              nping-brute.nse                 snmp-win32-services.nse 
 +broadcast-networker-discover.nse      http-awstatstotals-exec.nse             http-waf-fingerprint.nse         nrpe-enum.nse                   snmp-win32-shares.nse 
 +broadcast-novell-locate.nse           http-axis2-dir-traversal.nse            http-webdav-scan.nse             ntp-info.nse                    snmp-win32-software.nse 
 +broadcast-ospf2-discover.nse          http-backup-finder.nse                  http-wordpress-brute.nse         ntp-monlist.nse                 snmp-win32-users.nse 
 +broadcast-pc-anywhere.nse             http-barracuda-dir-traversal.nse        http-wordpress-enum.nse          omp2-brute.nse                  socks-auth-info.nse 
 +broadcast-pc-duo.nse                  http-bigip-cookie.nse                   http-wordpress-users.nse         omp2-enum-targets.nse           socks-brute.nse 
 +broadcast-pim-discovery.nse           http-brute.nse                          http-xssed.nse                   omron-info.nse                  socks-open-proxy.nse 
 +broadcast-ping.nse                    http-cakephp-version.nse                iax2-brute.nse                   openflow-info.nse               ssh2-enum-algos.nse 
 +broadcast-pppoe-discover.nse          http-chrono.nse                         iax2-version.nse                 openlookup-info.nse             ssh-auth-methods.nse 
 +broadcast-rip-discover.nse            http-cisco-anyconnect.nse               icap-info.nse                    openvas-otp-brute.nse           ssh-brute.nse 
 +broadcast-ripng-discover.nse          http-coldfusion-subzero.nse             iec-identify.nse                 openwebnet-discovery.nse        ssh-hostkey.nse 
 +broadcast-sonicwall-discover.nse      http-comments-displayer.nse             ike-version.nse                  oracle-brute.nse                ssh-publickey-acceptance.nse 
 +broadcast-sybase-asa-discover.nse     http-config-backup.nse                  imap-brute.nse                   oracle-brute-stealth.nse        ssh-run.nse 
 +broadcast-tellstick-discover.nse      http-cookie-flags.nse                   imap-capabilities.nse            oracle-enum-users.nse           sshv1.nse 
 +broadcast-upnp-info.nse               http-cors.nse                           imap-ntlm-info.nse               oracle-sid-brute.nse            ssl-ccs-injection.nse 
 +broadcast-versant-locate.nse          http-cross-domain-policy.nse            impress-remote-discover.nse      oracle-tns-version.nse          ssl-cert-intaddr.nse 
 +broadcast-wake-on-lan.nse             http-csrf.nse                           informix-brute.nse               ovs-agent-version.nse           ssl-cert.nse 
 +broadcast-wpad-discover.nse           http-date.nse                           informix-query.nse               p2p-conficker.nse               ssl-date.nse 
 +broadcast-wsdd-discover.nse           http-default-accounts.nse               informix-tables.nse              path-mtu.nse                    ssl-dh-params.nse 
 +broadcast-xdmcp-discover.nse          http-devframework.nse                   ip-forwarding.nse                pcanywhere-brute.nse            ssl-enum-ciphers.nse 
 +cassandra-brute.nse                   http-dlink-backdoor.nse                 ip-geolocation-geoplugin.nse     pcworx-info.nse                 ssl-heartbleed.nse 
 +cassandra-info.nse                    http-dombased-xss.nse                   ip-geolocation-ipinfodb.nse      pgsql-brute.nse                 ssl-known-key.nse 
 +cccam-version.nse                     http-domino-enum-passwords.nse          ip-geolocation-map-bing.nse      pjl-ready-message.nse           ssl-poodle.nse 
 +cics-enum.nse                         http-drupal-enum.nse                    ip-geolocation-map-google.nse    pop3-brute.nse                  sslv2-drown.nse 
 +cics-info.nse                         http-drupal-enum-users.nse              ip-geolocation-map-kml.nse       pop3-capabilities.nse           sslv2.nse 
 +cics-user-brute.nse                   http-enum.nse                           ip-geolocation-maxmind.nse       pop3-ntlm-info.nse              sstp-discover.nse 
 +cics-user-enum.nse                    http-errors.nse                         ip-https-discover.nse            port-states.nse                 stun-info.nse 
 +citrix-brute-xml.nse                  http-exif-spider.nse                    ipidseq.nse                      pptp-version.nse                stun-version.nse 
 +citrix-enum-apps.nse                  http-favicon.nse                        ipmi-brute.nse                   puppet-naivesigning.nse         stuxnet-detect.nse 
 +citrix-enum-apps-xml.nse              http-feed.nse                           ipmi-cipher-zero.nse             qconn-exec.nse                  supermicro-ipmi-conf.nse 
 +citrix-enum-servers.nse               http-fetch.nse                          ipmi-version.nse                 qscan.nse                       svn-brute.nse 
 +citrix-enum-servers-xml.nse           http-fileupload-exploiter.nse           ipv6-multicast-mld-list.nse      quake1-info.nse                 targets-asn.nse 
 +clamav-exec.nse                       http-form-brute.nse                     ipv6-node-info.nse               quake3-info.nse                 targets-ipv6-map4to6.nse 
 +clock-skew.nse                        http-form-fuzzer.nse                    ipv6-ra-flood.nse                quake3-master-getservers.nse    targets-ipv6-multicast-echo.nse 
 +coap-resources.nse                    http-frontpage-login.nse                irc-botnet-channels.nse          rdp-enum-encryption.nse         targets-ipv6-multicast-invalid-dst.nse 
 +couchdb-databases.nse                 http-generator.nse                      irc-brute.nse                    rdp-ntlm-info.nse               targets-ipv6-multicast-mld.nse 
 +couchdb-stats.nse                     http-git.nse                            irc-info.nse                     rdp-vuln-ms12-020.nse           targets-ipv6-multicast-slaac.nse 
 +creds-summary.nse                     http-gitweb-projects-enum.nse           irc-sasl-brute.nse               realvnc-auth-bypass.nse         targets-ipv6-wordlist.nse 
 +cups-info.nse                         http-google-malware.nse                 irc-unrealircd-backdoor.nse      redis-brute.nse                 targets-sniffer.nse 
 +cups-queue-info.nse                   http-grep.nse                           iscsi-brute.nse                  redis-info.nse                  targets-traceroute.nse 
 +cvs-brute.nse                         http-headers.nse                        iscsi-info.nse                   resolveall.nse                  targets-xml.nse 
 +cvs-brute-repository.nse              http-hp-ilo-info.nse                    isns-info.nse                    reverse-index.nse               teamspeak2-version.nse 
 +daap-get-library.nse                  http-huawei-hg5xx-vuln.nse              jdwp-exec.nse                    rexec-brute.nse                 telnet-brute.nse 
 +daytime.nse                           http-icloud-findmyiphone.nse            jdwp-info.nse                    rfc868-time.nse                 telnet-encryption.nse 
 +db2-das-info.nse                      http-icloud-sendmsg.nse                 jdwp-inject.nse                  riak-http-info.nse              telnet-ntlm-info.nse 
 +deluge-rpc-brute.nse                  http-iis-short-name-brute.nse           jdwp-version.nse                 rlogin-brute.nse                tftp-enum.nse 
 +dhcp-discover.nse                     http-iis-webdav-vuln.nse                knx-gateway-discover.nse         rmi-dumpregistry.nse            tls-alpn.nse 
 +dicom-brute.nse                       http-internal-ip-disclosure.nse         knx-gateway-info.nse             rmi-vuln-classloader.nse        tls-nextprotoneg.nse 
 +dicom-ping.nse                        http-joomla-brute.nse                   krb5-enum-users.nse              rpcap-brute.nse                 tls-ticketbleed.nse 
 +dict-info.nse                         http-jsonp-detection.nse                ldap-brute.nse                   rpcap-info.nse                  tn3270-screen.nse 
 +distcc-cve2004-2687.nse               http-litespeed-sourcecode-download.nse  ldap-novell-getpass.nse          rpc-grind.nse                   tor-consensus-checker.nse 
 +dns-blacklist.nse                     http-ls.nse                             ldap-rootdse.nse                 rpcinfo.nse                     traceroute-geolocation.nse 
 +dns-brute.nse                         http-majordomo2-dir-traversal.nse       ldap-search.nse                  rsa-vuln-roca.nse               tso-brute.nse 
 +dns-cache-snoop.nse                   http-malware-host.nse                   lexmark-config.nse               rsync-brute.nse                 tso-enum.nse 
 +dns-check-zone.nse                    http-mcmp.nse                           llmnr-resolve.nse                rsync-list-modules.nse          ubiquiti-discovery.nse 
 +dns-client-subnet-scan.nse            http-methods.nse                        lltd-discovery.nse               rtsp-methods.nse                unittest.nse 
 +dns-fuzz.nse                          http-method-tamper.nse                  lu-enum.nse                      rtsp-url-brute.nse              unusual-port.nse 
 +dns-ip6-arpa-scan.nse                 http-mobileversion-checker.nse          maxdb-info.nse                   rusers.nse                      upnp-info.nse 
 +dns-nsec3-enum.nse                    http-ntlm-info.nse                      mcafee-epo-agent.nse             s7-info.nse                     uptime-agent-info.nse 
 +dns-nsec-enum.nse                     http-open-proxy.nse                     membase-brute.nse                samba-vuln-cve-2012-1182.nse    url-snarf.nse 
 +dns-nsid.nse                          http-open-redirect.nse                  membase-http-info.nse            script.db                       ventrilo-info.nse 
 +dns-random-srcport.nse                http-passwd.nse                         memcached-info.nse               servicetags.nse                 versant-info.nse 
 +dns-random-txid.nse                   http-phpmyadmin-dir-traversal.nse       metasploit-info.nse              shodan-api.nse                  vmauthd-brute.nse 
 +dns-recursion.nse                     http-phpself-xss.nse                    metasploit-msgrpc-brute.nse      sip-brute.nse                   vmware-version.nse 
 +dns-service-discovery.nse             http-php-version.nse                    metasploit-xmlrpc-brute.nse      sip-call-spoof.nse              vnc-brute.nse 
 +dns-srv-enum.nse                      http-proxy-brute.nse                    mikrotik-routeros-brute.nse      sip-enum-users.nse              vnc-info.nse 
 +dns-update.nse                        http-put.nse                            mmouse-brute.nse                 sip-methods.nse                 vnc-title.nse 
 +dns-zeustracker.nse                   http-qnap-nas-info.nse                  mmouse-exec.nse                  skypev2-version.nse             voldemort-info.nse 
 +dns-zone-transfer.nse                 http-referer-checker.nse                modbus-discover.nse              smb2-capabilities.nse           vtam-enum.nse 
 +docker-version.nse                    http-rfi-spider.nse                     mongodb-brute.nse                smb2-security-mode.nse          vulners.nse 
 +domcon-brute.nse                      http-robots.txt.nse                     mongodb-databases.nse            smb2-time.nse                   vuze-dht-info.nse 
 +domcon-cmd.nse                        http-robtex-reverse-ip.nse              mongodb-info.nse                 smb2-vuln-uptime.nse            wdb-version.nse 
 +domino-enum-users.nse                 http-robtex-shared-ns.nse               mqtt-subscribe.nse               smb-brute.nse                   weblogic-t3-info.nse 
 +dpap-brute.nse                        http-sap-netweaver-leak.nse             mrinfo.nse                       smb-double-pulsar-backdoor.nse  whois-domain.nse 
 +drda-brute.nse                        http-security-headers.nse               msrpc-enum.nse                   smb-enum-domains.nse            whois-ip.nse 
 +drda-info.nse                         http-server-header.nse                  ms-sql-brute.nse                 smb-enum-groups.nse             wsdd-discover.nse 
 +duplicates.nse                        http-shellshock.nse                     ms-sql-config.nse                smb-enum-processes.nse          x11-access.nse 
 +eap-info.nse                          http-sitemap-generator.nse              ms-sql-dac.nse                   smb-enum-services.nse           xdmcp-discover.nse 
 +enip-info.nse                         http-slowloris-check.nse                ms-sql-dump-hashes.nse           smb-enum-sessions.nse           xmlrpc-methods.nse 
 +epmd-info.nse                         http-slowloris.nse                      ms-sql-empty-password.nse        smb-enum-shares.nse             xmpp-brute.nse 
 +eppc-enum-processes.nse               http-sql-injection.nse                  ms-sql-hasdbaccess.nse           smb-enum-users.nse              xmpp-info.nse
 </code> </code>
  
-=====Les Contre-Mesures===== +Les scripts sont regroupés dans des catégories : **auth**, **broadcast****brute****default**, **discovery**, **dos****exploit****external**, **fuzzer**, **intrusive****malware****safe****version** and **vuln**.
- +
-Les contre-mesures incluent l'utilisation du chiffrement sous la forme de SSH, de SCP et d'OpenVPN. +
- +
-====Introduction à la cryptologie==== +
- +
-===Définitions=== +
- +
-  * **La Cryptologie** +
-    La science qui étudie les aspects scientifiques de ces techniquesc'est-à-dire qu'elle englobe la cryptographie et la cryptanalyse.  +
-  * **La Cryptanalyse** +
-    Lorsque la clef de déchiffrement n'est pas connue de l'attaquant on parle alors de cryptanalyse ou cryptoanalyse (on entend souvent aussi le terme plus familier de cassage). +
-  * **La Cryptographie** +
-    Un terme générique désignant l'ensemble des techniques permettant de chiffrer des messagesc'est-à-dire permettant de les rendre inintelligibles sans une action spécifique. Les verbes crypter et chiffrer sont utilisés. +
-  * **Le Décryptement ou Décryptage*+
-    * Est le fait d'essayer de déchiffrer illégitimement le message (que la clé de déchiffrement soit connue ou non de l'attaquant). +
- +
-{{ :redhat:lx04:crypto1.gif|Cette image issue de Comment Ça Marche (www.commentcamarche.net) est mise à disposition sous les termes de la licence Creative Commons. Vous pouvez copiermodifier des copies de l'image, dans les conditions fixées par la licence, tant que cette note apparaît clairement. }} +
- +
-**La Cryptographie** +
- +
-La cryptographie apporte quatre points clefs:  +
- +
-  La confidentialité +
-    consiste à rendre l'information inintelligible à d'autres personnes que les acteurs de la transaction. +
-  L'intégrité +
-    consiste à déterminer si les données n'ont pas été altérées durant la communication (de manière fortuite ou intentionnelle). +
-  L'authentification +
-    consiste à assurer l'identité d'un utilisateur. +
-  La non-répudiation +
-    est la garantie qu'aucun des correspondants ne pourra nier la transaction.  +
- +
-La cryptographie est basée sur l'arithmétique. Il s'agitdans le cas d'un texte, de transformer les lettres qui composent le message en une succession de chiffres (sous forme de bits dans le cas de l'informatique), puis ensuite de faire des calculs sur ces chiffres pour: +
- +
-  Procéder au chiffrement +
-    Le résultat de cette modification (le message chiffré) est appelé cryptogramme (Ciphertext) par opposition au message initial, appelé message en clair (Plaintext) +
-  Procéder au déchiffrement +
- +
-Le chiffrement se fait à l'aide d'une clef de chiffrement. Le déchiffrement nécessite  une clef de déchiffrement. +
- +
-On distingue deux types de clefs: +
- +
-  Les clés symétriques:  +
-    * des clés utilisées pour le chiffrement ainsi que pour le déchiffrement. On parle alors de chiffrement symétrique ou de chiffrement à clé secrète. +
-  * Les clés asymétriques:  +
-    * des clés utilisées dans le cas du chiffrement asymétrique (aussi appelé chiffrement à clé publique). Dans ce casune clé différente est utilisée pour le chiffrement et pour le déchiffrement. +
- +
-**Le Chiffrement par Substitution** +
-  +
-Le chiffrement par substitution consiste à remplacer dans un message une ou plusieurs entités (généralement des lettres) par une ou plusieurs autres entités. On distingue généralement plusieurs types de cryptosystèmes par substitution : +
- +
-  La substitution **monoalphabétique** +
-    consiste à remplacer chaque lettre du message par une autre lettre de l'alphabet +
-  La substitution **polyalphabétique**  +
-    consiste à utiliser une suite de chiffres monoalphabétique réutilisée périodiquement +
-  La substitution **homophonique**  +
-    * permet de faire correspondre à chaque lettre du message en clair un ensemble possible d'autres caractères +
-  * La substitution de **polygrammes**   +
-    * consiste à substituer un groupe de caractères (polygramme) dans le message par un autre groupe de caractères +
- +
-===Algorithmes à clé secrète=== +
- +
-==Le Chiffrement Symétrique== +
- +
-Ce système est aussi appelé le système à **Clef Secrète** ou à **clef privée**. +
- +
-Ce système consiste à effectuer une opération de chiffrement par algorithme mais comporte un inconvénient, à savoir qu'il nécessite un canal sécurisé pour la transmission de la clef de chiffrement/déchiffrement. +
- +
-{{:redhat:lx04:crypto2.gif|Cette image issue de Comment Ça Marche (www.commentcamarche.net) est mise à disposition sous les termes de la licence Creative Commons. Vous pouvez copier, modifier des copies de l'image, dans les conditions fixées par la licence, tant que cette note apparaît clairement.}}+
  
 <WRAP center round important 50%> <WRAP center round important 50%>
-**Important** - Le système de Méthode du Masque Jetable (One Time Pad) fût mis au point dans les années 1920Il utilisait une clef générée aléatoirement à usage unique.+**Important** - Pour plus d'informations concernant ces catégories, consultez cette [[https://nmap.org/man/fr/man-nse.html|page]].
 </WRAP> </WRAP>
  
-Les algorithmes de chiffrement symétrique couramment utilisés en informatique sont: +La catégorie la plus utilisée est **default** qui est appelée par l'utilisation de l'option **-sC**. Cette catégorie contient une liste de scripts par défaut.
- +
-  * **[[wpfr>Data_Encryption_Standard|Data Encryption Standard]]** (DES), +
-  * **[[wpfr>Triple_DES|Triple DES]]** (3DES), +
-  * **[[wpfr>RC2]]**,  +
-  * **[[wpfr>Blowfish|Blowfish]]**, +
-  * **[[wpfr>International_Data_Encryption_Algorithm|International Data Encryption Algorithm]]** (IDEA), +
-  * **[[wpfr>Standard_de_chiffrement_avancé|Advanced Encryption Standard]]** (AES). +
- +
-===Algorithmes à clef publique=== +
- +
-==Le Chiffrement Asymétrique== +
- +
-Ce système est aussi appelé **Système à Clef Publique**. +
- +
-Ce système consiste à avoir deux clefs appelées des **bi-clefs**: +
- +
-  * Une clef **publique** pour le chiffrement +
-  * Une clef **secrète** ou **privée** pour le déchiffrement +
- +
-{{:redhat:lx04:crypto3.gif|Cette image issue de Comment Ça Marche (www.commentcamarche.net) est mise à disposition sous les termes de la licence Creative Commons. Vous pouvez copier, modifier des copies de l'image, dans les conditions fixées par la licence, tant que cette note apparaît clairement.}} +
- +
-  * L'utilisateur A (celui qui déchiffre) choisit une clef privée.  +
-  * A partir de cette clef il génère plusieurs clefs publiques grâce à un algorithme. +
-  * L'utilisateur B (celui qui chiffre) choisit une des clefs publiques à travers un canal non-sécurisé pour chiffrer les données à l'attention de l'utilisateur A. +
- +
-Ce système est basé sur ce que l'on appelle une **fonction à trappe à sens unique** ou **one-way trap door**. +
- +
-Il existe toutefois un problème – s'assurer que la clef publique récupérée est bien celle qui correspond au destinataire ! +
- +
-Les algorithmes de chiffrement asymétrique couramment utilisés en informatique sont: +
- +
-  * **[[wpfr>Digital_Signature_Algorithm|Digital Signature Algorithm]]** (DSA) +
-  * **[[wpfr>Rivest_Shamir_Adleman|Rivest, Shamir, Adleman]]** (RSA) +
- +
-==La Clef de Session== +
- +
-Ce système est un compromis entre le système symétrique et le système asymétrique. Il permet l'envoie de données chiffrées à l'aide d'un algorithme de chiffrement symétrique par un canal non-sécurisé et a été mis au point pour palier au problème de lenteur de déchiffrement du système asymétrique. +
- +
-{{:redhat:lx04:crypto4.gif|Cette image issue de Comment Ça Marche (www.commentcamarche.net) est mise à disposition sous les termes de la licence Creative Commons. Vous pouvez copier, modifier des copies de l'image, dans les conditions fixées par la licence, tant que cette note apparaît clairement.}} +
- +
-Ce système fonctionne de la façon suivante : +
- +
-  * L'utilisateur A chiffre une clef privée générée aléatoirement, appelée une « clef de session », en utilisant une des clefs publiques de l'utilisateur B. +
-  L'utilisateur A chiffre les données avec la clef de session. +
-  L'utilisateur B déchiffre la clef de session en utilisant sa propre clef privée. +
-  * L'utilisateur B déchiffre les données en utilisant la clef de session. +
- +
-===Fonctions de Hachage=== +
- +
-La fonction de **hachage**, aussi appelée une fonction de **condensation**, est à **sens unique** (one way function). Il « condense » un message en clair et produit un haché unique. +
- +
-{{:redhat:lx04:crypto5.gif|Cette image issue de Comment Ça Marche (www.commentcamarche.net) est mise à disposition sous les termes de la licence Creative Commons. Vous pouvez copier, modifier des copies de l'image, dans les conditions fixées par la licence, tant que cette note apparaît clairement.}} +
- +
-Les deux algorithmes de hachage utilisés sont:  +
- +
-  * **[[wpfr>MD5|Message Digest 5]]** (MD5)  +
-  * **[[wpfr>SHA-1|Secure Hash Algorithm]]** (SHA) +
- +
-Lors de son envoie, le message est accompagné de son haché et il est donc possible de garantir son intégrité: +
- +
-{{:redhat:lx04:crypto6.gif|Cette image issue de Comment Ça Marche (www.commentcamarche.net) est mise à disposition sous les termes de la licence Creative Commons. Vous pouvez copier, modifier des copies de l'image, dans les conditions fixées par la licence, tant que cette note apparaît clairement.}} +
-  +
-  * A la réception du message, le destinataire ou l’utilisateur B calcule le haché du message reçu et le compare avec le haché accompagnant le document.  +
-  * Si le message ou le haché a été falsifié durant la communication, les deux empreintes ne correspondront pas.  +
- +
-<WRAP center round important 50%> +
-**Important** - Ce système permet de vérifier que l'empreinte correspond bien au message reçu, mais ne permet pas de prouver que le message a bien été envoyé par l’utilisateur A. +
-</WRAP> +
- +
-===Signature Numérique=== +
- +
-Pour garantir l'authentification du message l‘utilisateur A va chiffrer ou **signer** le haché à l'aide de sa clé privée. Le haché signé est appelé un **sceau**. +
- +
-{{:redhat:lx04:crypto7.gif|Cette image issue de Comment Ça Marche (www.commentcamarche.net) est mise à disposition sous les termes de la licence Creative Commons. Vous pouvez copier, modifier des copies de l'image, dans les conditions fixées par la licence, tant que cette note apparaît clairement.}} +
- +
-  * L’utilisateur A envoie le sceau au destinataire. +
-  * A la réception du message L’utilisateur B déchiffre le sceau avec la clé publique de l’utilisateur A. +
-  * Il compare le haché obtenu au haché reçu en pièce jointe. +
-  +
-Ce mécanisme de création de sceau est appelé **scellement**. +
- +
-Ce mécanisme est identique au procédé utilisé par SSH lors d'une connexion  +
- +
-===PKI=== +
- +
-On appelle **[[wpfr>Public_Key_Infrastructure|PKI]]** (Public Key Infrastucture, ou en français **infrastructure à clé publique (ICP)**, parfois **infrastructure de gestion de clés (IGC)**) l’ensemble des solutions techniques basées sur la cryptographie à clé publique. +
- +
-Les cryptosystèmes à clés publiques permettent de s'affranchir de la nécessité d'avoir recours systématiquement à un canal sécurisé pour s'échanger les clés. En revanche, la publication de la clé publique à grande échelle doit se faire en toute confiance pour assurer que : +
- +
-    * La clé publique est bien celle de son propriétaire ; +
-    * Le propriétaire de la clé est digne de confiance ; +
-    * La clé est toujours valide.  +
- +
-Ainsi, il est nécessaire d'associer au bi-clé (ensemble clé publique / clé privée) un certificat délivré par un **tiers de confiance** : l'infrastructure de gestion de clés. +
- +
-Le tiers de confiance est une entité appelée communément autorité de certification (ou en anglais Certification authority, abrégé CA) chargée d'assurer la véracité des informations contenues dans le certificat de clé publique et de sa validité. +
- +
-Pour ce faire, l'autorité signe le certificat de clé publique à l'aide de sa propre clé en utilisant le principe de signature numérique. +
- +
-Le rôle de l'infrastructure de clés publiques est multiple et couvre notamment les champs suivants : +
- +
-    * enregistrer des demandes de clés en vérifiant l'identité des demandeurs ; +
-    * générer les paires de clés (clé privée / clé publique) ; +
-    * garantir la confidentialité des clés privées correspondant aux clés publiques ; +
-    * certifier l'association entre chaque utilisateurs et sa clé publique ; +
-    * révoquer des clés (en cas de perte par son propriétaire, d'expiration de sa date de validité ou de compromission).  +
- +
-Une infrastructure à clé publique est en règle générale composée de trois entités distinctes : +
- +
-    * L'autorité d'enregistrement (AE ou RA pour Recording authority), chargée des formalité administratives telles que la vérification de l'identité des demandeurs, le suivi et la gestion des demandes, etc.) ; +
-    * L'autorité de certification (AC ou CA pour Certification Authority), chargée des tâches techniques de création de certificats. L'autorité de certification est ainsi chargée de la signature des demandes de certificat (CSR pour Certificate Signing Request, parfois appelées PKCS#10, nom du format correspondant). L'autorité de certification a également pour mission la signature des listes de révocations (CRL pour Certificate Revocation List) ; +
-    * L'Autorité de dépôt (Repository) dont la mission est de conserver en sécurité les certificats. +
- +
-==Certificats X509== +
- +
-Pour palier aux problèmes liés à des clefs publiques piratées, un système de certificats a été mis en place. +
- +
-Le certificat permet d’associer la clef publique à une entité ou une personne. Les certificats sont délivrés par des Organismes de Certification. +
- +
-Les certificats sont des fichiers divisés en deux parties :  +
- +
-  * La partie contenant les informations  +
-  * La partie contenant la signature de l'autorité de certification +
- +
-La structure des certificats est normalisée par le standard **[[wpfr>X.509|X.509]]** de l’**[[wpfr>UIT|Union internationale des télécommunications]]**.  +
- +
-Elle contient :  +
- +
-  * Le nom de l'autorité de certification  +
-  * Le nom du propriétaire du certificat  +
-  * La date de validité du certificat  +
-  * L'algorithme de chiffrement utilisé  +
-  * La clé publique du propriétaire  +
- +
-Le Certificat est signé par l'autorité de certification: +
- +
-{{:redhat:lx04:crypto8.gif|Cette image issue de Comment Ça Marche (www.commentcamarche.net) est mise à disposition sous les termes de la licence Creative Commons. Vous pouvez copier, modifier des copies de l'image, dans les conditions fixées par la licence, tant que cette note apparaît clairement.}} +
- +
-La vérification se passe ainsi: +
- +
-{{:redhat:lx04:crypto9.gif|Cette image issue de Comment Ça Marche (www.commentcamarche.net) est mise à disposition sous les termes de la licence Creative Commons. Vous pouvez copier, modifier des copies de l'image, dans les conditions fixées par la licence, tant que cette note apparaît clairement.}} +
- +
-=====LAB #2 - Utilisation de GnuPG===== +
- +
-====2.1 - Présentation==== +
- +
-**GNU Privacy Guard** permet aux utilisateurs de transférer des messages chiffrés et/ou signés. +
- +
-====2.2 - Utilisation==== +
- +
-Pour initialiser %%GnuPG%%, saisissez la commande suivante :+
  
 <code> <code>
-root@debian12:~# gpg +root@debian12:~# nmap -v -sC localhost 
-gpgdirectory '/root/.gnupg' created +Starting Nmap 7.93 ( https://nmap.org ) at 2025-11-27 16:51 CET 
-gpgkeybox '/root/.gnupg/pubring.kbx' created +NSELoaded 125 scripts for scanning. 
-gpgWARNINGno command supplied.  Trying to guess what you mean ... +NSE: Script Pre-scanning
-gpgGo ahead and type your message ... +Initiating NSE at 16:51 
-^C +Completed NSE at 16:51, 0.00s elapsed 
-gpg: signal Interrupt caught ... exiting +Initiating NSE at 16:51 
-</code> +Completed NSE at 16:51, 0.00s elapsed 
- +Initiating SYN Stealth Scan at 16:51 
-<WRAP center round important 50%> +Scanning localhost (127.0.0.1) [1000 ports] 
-**Important** - Notez l'utilisation des touches **^C** après la ligne **gpg: Go ahead and type your message ...**. +Discovered open port 22/tcp on 127.0.0.1 
-</WRAP> +Discovered open port 5900/tcp on 127.0.0.1 
- +Discovered open port 80/tcp on 127.0.0.1 
-Pour générer les clefs, saisissez la commande suivante : +Discovered open port 631/tcp on 127.0.0.1 
- +Completed SYN Stealth Scan at 16:51, 0.03s elapsed (1000 total ports
-<WRAP center round important 50%> +NSEScript scanning 127.0.0.1
-**Important** - Lorsque le système vous demande une Passphrase, saisissez une valeur que n'allez **PAS** oublié+Initiating NSE at 16:51 
-</WRAP> +Completed NSE at 16:512.00s elapsed 
- +Initiating NSE at 16:51 
-<code> +Completed NSE at 16:51, 0.00s elapsed 
-root@debian12:~# gpg --full-generate-key +Nmap scan report for localhost (127.0.0.1) 
-gpg (GnuPG) 2.2.40; Copyright (C2022 g10 Code GmbH +Host is up (0.0000090s latency). 
-This is free softwareyou are free to change and redistribute it+Other addresses for localhost (not scanned): ::1 
-There is NO WARRANTYto the extent permitted by law+Not shown: 996 closed tcp ports (reset
- +PORT     STATE SERVICE 
-Please select what kind of key you want+22/tcp   open  ssh 
-   (1) RSA and RSA (default+| ssh-hostkey:  
-   (2DSA and Elgamal +|   256 738a4166831b9c8af2bfb567ed025c4d (ECDSA
-   (3) DSA (sign only+|_  256 86dcfbca68069284b2ddb0545cbc4e2b (ED25519
-   (4) RSA (sign only+80/tcp   open  http 
-  (14Existing key from card +| http-methods:  
-Your selection? 1 +|_  Supported Methods: GET POST OPTIONS HEAD 
-RSA keys may be between 1024 and 4096 bits long. +|_http-title: Apache2 Debian Default Page: It works 
-What keysize do you want? (3072)  +631/tcp  open  ipp 
-Requested keysize is 3072 bits +| ssl-cert: Subject: commonName=debian12/organizationName=debian12/stateOrProvinceName=Unknown/countryName=US 
-Please specify how long the key should be valid. +| Subject Alternative Name: DNS:debian12, DNS:debian12.local, DNS:localhost 
-         0 key does not expire +| Issuer: commonName=debian12/organizationName=debian12/stateOrProvinceName=Unknown/countryName=US 
-      <n>  key expires in n days +| Public Key type: rsa 
-      <n>key expires in n weeks +| Public Key bits: 2048 
-      <n>key expires in n months +| Signature Algorithm: sha256WithRSAEncryption 
-      <n>key expires in n years +| Not valid before: 2025-11-27T15:51:20 
-Key is valid for? (0)  +| Not valid after:  2035-11-25T15:51:20 
-Key does not expire at all +| MD5:   508d6d5d71e72656eeda3082e4fcfde0 
-Is this correct? (y/N) y +|_SHA-10bda6fab805a00a5cdc863da5357a3791a58eca6 
- +| http-methods:  
-GnuPG needs to construct a user ID to identify your key. +|_  Supported MethodsGET HEAD POST OPTIONS 
- +|_http-titleHome - CUPS 2.4.2 
-Real nameITTRAINING +|_ssl-date: TLS randomness does not represent time 
-Email addressinfos@ittraining.team +| http-robots.txt: 1 disallowed entry  
-CommentTest key +|_/ 
-You selected this USER-ID: +5900/tcp open  vnc 
-    "ITTRAINING (Test key) <infos@ittraining.team>" +| vnc-info:  
- +|   Protocol version3.8 
-Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit?+|   Security types:  
-We need to generate a lot of random bytesIt is a good idea to perform +|_    VNC Authentication (2)
-some other action (type on the keyboard, move the mouse, utilize the +
-disks) during the prime generation; this gives the random number +
-generator a better chance to gain enough entropy+
-We need to generate a lot of random bytes. It is a good idea to perform +
-some other action (type on the keyboard, move the mouse, utilize the +
-disks) during the prime generation; this gives the random number +
-generator a better chance to gain enough entropy. +
-gpg/root/.gnupg/trustdb.gpg: trustdb created +
-gpgdirectory '/root/.gnupg/openpgp-revocs.d' created +
-gpgrevocation certificate stored as '/root/.gnupg/openpgp-revocs.d/B6022CC107539B4036A90FAEABAD13CD27F9E686.rev' +
-public and secret key created and signed.+
  
-pub   rsa3072 2025-11-28 [SC] +NSE: Script Post-scanning. 
-      B6022CC107539B4036A90FAEABAD13CD27F9E686 +Initiating NSE at 16:51 
-uid                      ITTRAINING (Test key<infos@ittraining.team> +Completed NSE at 16:51, 0.00s elapsed 
-sub   rsa3072 2025-11-28 [E]+Initiating NSE at 16:51 
 +Completed NSE at 16:51, 0.00s elapsed 
 +Read data files from: /usr/bin/../share/nmap 
 +Nmap done: 1 IP address (1 host upscanned in 2.45 seconds 
 +           Raw packets sent: 1000 (44.000KB) | Rcvd: 2004 (84.176KB)
 </code> </code>
  
-La liste de clefs peut être visualisée avec la commande suivante : +<WRAP center round warning 50%> 
- +**Attention** - La catégorie par défaut **default** contient certains scripts de la catégorie **intrusive**. Vous ne devez donc jamais utiliser cette option sur un réseau sans avoir obtenu un accord au préalable.
-<code> +
-root@debian12:~# gpg --list-keys +
-gpg: checking the trustdb +
-gpg: marginals needed: 3  completes needed: 1  trust model: pgp +
-gpg: depth: 0  valid:    signed:    trust: 0-, 0q, 0n, 0m, 0f, 1u +
-/root/.gnupg/pubring.kbx +
------------------------- +
-pub   rsa3072 2025-11-28 [SC] +
-      B6022CC107539B4036A90FAEABAD13CD27F9E686 +
-uid           [ultimate] ITTRAINING (Test key) <infos@ittraining.team> +
-sub   rsa3072 2025-11-28 [E] +
-</code> +
- +
-Pour importer la clef d'un correspondant dans sa trousse de clefs il convient d'utiliser la commande suivante : +
- +
-<WRAP center round important 50%> +
-**Important** - La commande suivante est un exemple. Ne la saisissez **PAS**.+
 </WRAP> </WRAP>
  
-  # gpg --import la-clef.asc+==Options de la commande==
  
-Pour exporter sa clef publique, il convient d'utiliser la commande suivante :+Les options de cette commande sont :
  
 <code> <code>
-root@debian12:~# gpg --export --armor ITTRAINING > ~/mykey.asc +root@debian12:~# nmap --help 
- +Nmap 7.93 ( https://nmap.org ) 
-root@debian12:~# cat mykey.asc +Usage: nmap [Scan Type(s)] [Options] {target specification} 
------BEGIN PGP PUBLIC KEY BLOCK----- +TARGET SPECIFICATION: 
- +  Can pass hostnames, IP addresses, networks, etc
-mQGNBGkpk+gBDACq6M7rUNQFu/R6J+1p3RAB1+gwnszs/jZuBAo6y9i1buBsySP9 +  Ex: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0.0-255.1-254 
-oV9JmFfRe4P2QG/mgmSaGgeO0sE5m+r2Jhif2fShjHYLd6VTSVZRyfO+NW3MDbkm +  -iL <inputfilename>: Input from list of hosts/networks 
-MtIf4LlXRrTALGE5TclLWFz5a2iqRjtT8IjSPAu1M9TLUaMXtWXN6jQY1YOnjxPN +  -iR <num hosts>: Choose random targets 
-3HL8bwdaY0k8icKr8JRbmEijCWo2F4t2qTtdOXuRFAImxBpX49eJR0oC5bzXZPYx +  --exclude <host1[,host2][,host3],...>: Exclude hosts/networks 
-LbirNsEwSULIyQ71gdF5OUb0aOSiQLXLuTLAs2BnxAJ82tB/dM8qP0ez0lXLJvvF +  --excludefile <exclude_file>: Exclude list from file 
-+t0eHdWzUHH4qlXuNtBXK7pEbvjqftO69PJLDp/PwjEfUsELcxDyUFpphhZDJ8zN +HOST DISCOVERY: 
-qvRgll3fojjr91WWWqr8YTd4EiTvq9KfUyAiTOfKm8k4iRQRTJir267Fq8Mno8/B +  -sL: List Scan simply list targets to scan 
-My1tNeHWzCXMs3k/GKyi36Uu15wY50hRTPDYexa+aou0QEs4iY3EXjzaOD3BVvRQ +  -sn: Ping Scan - disable port scan 
-XTBUX/CS3ZmLC3MAEQEAAbQtSVRUUkFJTklORyAoVGVzdCBrZXkpIDxpbmZvc0Bp +  -Pn: Treat all hosts as online -- skip host discovery 
-dHRyYWluaW5nLnRlYW0+iQHOBBMBCgA4FiEEtgIswQdTm0A2qQ+uq60TzSf55oYF +  -PS/PA/PU/PY[portlist]: TCP SYN/ACK, UDP or SCTP discovery to given ports 
-Amkpk+gCGwMFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQq60TzSf55oZEsAv+ +  -PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes 
-Ky14vHWjMzU1ieE+XStqGYfjfAHhaNrpkWCz6miozuh+ESifNWpJd96bzwgNLGob +  -PO[protocol list]: IP Protocol Ping 
-E5mA9oja5jyAEQUGT+gEwgvkbYVe4sf4UcXPRrvDqKiEOkN5rra3kYYdhHhpiFes +  -n/-R: Never do DNS resolution/Always resolve [default: sometimes] 
-BmwQvW2dyElNO1ee/zzQOZ0Hd3vM/vdbmZRg8zKoV5eQz/MA2jpxF9IkXEDtUMzZ +  --dns-servers <serv1[,serv2],...>: Specify custom DNS servers 
-C5kqTMRXdoWR2ZP2HLZjUstRX7d9BP/8oeg+2lMq9UlULWrYyVaD85dEAmCt9mQz +  --system-dns: Use OS's DNS resolver 
-TqtAMmtp5IXalT+vKwhMu0MwUfyXyvl7ery4kxfmFtEeJQyxrdK2gihDxr0ndxBH +  --traceroute: Trace hop path to each host 
-mowlIoBiGYMhUr/aF0lM00blpRAUoGv1rO2DUWh8TXzRJq6FJ4pzo9XRwR0dP7A6 +SCAN TECHNIQUES: 
-VBlBdhX2SlE9XJOjLq9ppV5Vr9u6ZauwEI6kBLoagjWOF3t34Gnvel8zO+H5fhhq +  -sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans 
-UKMOAbC0SYmLVIPNUauHYoKiJlWb+Dlr96NsPm0sYBbB047hr0evBUmkJNrulI3N +  -sU: UDP Scan 
-uQGNBGkpk+gBDADZu1B0itmBIGzxjGmUjK9UagW3HNLNVX3jn2Jwe7yl3vL/d3Fk +  -sN/sF/sX: TCP Null, FIN, and Xmas scans 
-qBRydky32P4whbUSiJN71Tze9l+WOxeXGa0orKPPha/oQtlnmqyM6WBfOmvjSQkn +  --scanflags <flags>: Customize TCP scan flags 
-xCrS131SYjFb5dcQXoqTtUk8Wu4qoMHu/Mi9jtx8GrrENWzR7DFG2MDWwcM4TmUk +  -sI <zombie host[:probeport]>: Idle scan 
-zs6azU/jaQX/YrGmYU3vB/zpKEZSo89pJ/S2FQ/6Fr+nnh7El3thNJxLRH40UlZs +  -sY/sZ: SCTP INIT/COOKIE-ECHO scans 
-FIpfm95Q+wtC224wckro/Xf/+t7oBssSqCZEkCItN+AlDpm13h161dypVRpC1M5Y +  -sO: IP protocol scan 
-IITHq92gQSAKFhwSauaPtJ++oQNRgz5vJhCg78XfyBGpwDS6P0NM5RVEz6LMhQzI +  -b <FTP relay host>: FTP bounce scan 
-4LziGmYH/iWj0pv45Uze7hOZaWhBPlPWFixJ97nl3soxA7hV1MLt/Ohy5jxGC8U3 +PORT SPECIFICATION AND SCAN ORDER: 
-CrtEjyAIQxCmEUF0vPa7X1KB+FxCpJ8mYXBZ5w1DwBN7qsOnnHZKFcaPGW8r1am6 +  -p <port ranges>: Only scan specified ports 
-Ab25ee028mua9RkAEQEAAYkBtgQYAQoAIBYhBLYCLMEHU5tANqkPrqutE80n+eaG +    Ex: -p22; -p1-65535; -p U:53,111,137,T:21-25,80,139,8080,S:
-BQJpKZPoAhsMAAoJEKutE80n+eaGCRgMAJiG7Q8oF6oMkn6Xh7kXVH2yF4CKN9/j +  --exclude-ports <port ranges>: Exclude the specified ports from scanning 
-/qtImK/ikn14+/QNYpUbF4kIGadeCVgpKZZ+R9QLXTW7WQV4hgoOW3yiET3FTEBc +  -F: Fast mode - Scan fewer ports than the default scan 
-YoxDxegwlk9+gPiOMJ0+9R43IUs+jFrra1jcUpSg+1Nv2IijdPwape3HyPhYgDmZ +  -r: Scan ports sequentially - don't randomize 
-VxORrNtqBCkhtLpJO5VTiThAny+rNBHk1t1vQg4tEkCLGcOD8bsdxhACZnM0DVYY +  --top-ports <number>: Scan <number> most common ports 
-rA6afeDnm7CTfVtc3QFAi2+ltYcDIrMxMF0b1VASlbU14TE6ep2Ic30ScpDJL8De +  --port-ratio <ratio>: Scan ports more common than <ratio> 
-skhWi2/0v2WwhbmdGzfv5K5V3Z6NtoB3OUaHzKqzgEQeqjudgRaL440UsDtEFRHE +SERVICE/VERSION DETECTION: 
-vh6kVR0MPTFjg+8khUjjrSYUzqiiK6iJDxn+m0XJvHzQTeCHQlgRrPj9HGp7isyK +  -sV: Probe open ports to determine service/version info 
-o9Wf8fVvnksR8xc/2NcJwp0fo7ULwdADjgMtPUR155ukI8Xt9Aws+5OsYrIxBMMc +  --version-intensity <level>: Set from 0 (light) to 9 (try all probes) 
-DTh6aJal6iGcG4aXbTzwIFXHW9WipS5B4A== +  --version-light: Limit to most likely probes (intensity 2) 
-=rrxA +  --version-all: Try every single probe (intensity 9) 
------END PGP PUBLIC KEY BLOCK-----+  --version-trace: Show detailed version scan activity (for debugging) 
 +SCRIPT SCAN: 
 +  -sC: equivalent to --script=default 
 +  --script=<Lua scripts>: <Lua scripts> is a comma separated list of 
 +           directories, script-files or script-categories 
 +  --script-args=<n1=v1,[n2=v2,...]>: provide arguments to scripts 
 +  --script-args-file=filename: provide NSE script args in a file 
 +  --script-trace: Show all data sent and received 
 +  --script-updatedb: Update the script database. 
 +  --script-help=<Lua scripts>: Show help about scripts. 
 +           <Lua scripts> is a comma-separated list of script-files or 
 +           script-categories. 
 +OS DETECTION: 
 +  -O: Enable OS detection 
 +  --osscan-limit: Limit OS detection to promising targets 
 +  --osscan-guess: Guess OS more aggressively 
 +TIMING AND PERFORMANCE: 
 +  Options which take <time> are in seconds, or append 'ms' (milliseconds), 
 +  's' (seconds), 'm' (minutes), or 'h' (hours) to the value (e.g. 30m). 
 +  -T<0-5>: Set timing template (higher is faster) 
 +  --min-hostgroup/max-hostgroup <size>: Parallel host scan group sizes 
 +  --min-parallelism/max-parallelism <numprobes>: Probe parallelization 
 +  --min-rtt-timeout/max-rtt-timeout/initial-rtt-timeout <time>: Specifies 
 +      probe round trip time. 
 +  --max-retries <tries>: Caps number of port scan probe retransmissions. 
 +  --host-timeout <time>: Give up on target after this long 
 +  --scan-delay/--max-scan-delay <time>: Adjust delay between probes 
 +  --min-rate <number>: Send packets no slower than <number> per second 
 +  --max-rate <number>: Send packets no faster than <number> per second 
 +FIREWALL/IDS EVASION AND SPOOFING: 
 +  -f; --mtu <val>: fragment packets (optionally w/given MTU) 
 +  -D <decoy1,decoy2[,ME],...>: Cloak a scan with decoys 
 +  -S <IP_Address>: Spoof source address 
 +  -e <iface>: Use specified interface 
 +  -g/--source-port <portnum>: Use given port number 
 +  --proxies <url1,[url2],...>: Relay connections through HTTP/SOCKS4 proxies 
 +  --data <hex string>: Append a custom payload to sent packets 
 +  --data-string <string>: Append a custom ASCII string to sent packets 
 +  --data-length <num>: Append random data to sent packets 
 +  --ip-options <options>: Send packets with specified ip options 
 +  --ttl <val>: Set IP time-to-live field 
 +  --spoof-mac <mac address/prefix/vendor name>: Spoof your MAC address 
 +  --badsum: Send packets with a bogus TCP/UDP/SCTP checksum 
 +OUTPUT: 
 +  -oN/-oX/-oS/-oG <file>: Output scan in normal, XML, s|<rIpt kIddi3, 
 +     and Grepable format, respectively, to the given filename. 
 +  -oA <basename>: Output in the three major formats at once 
 +  -v: Increase verbosity level (use -vv or more for greater effect) 
 +  -d: Increase debugging level (use -dd or more for greater effect) 
 +  --reason: Display the reason a port is in a particular state 
 +  --open: Only show open (or possibly open) ports 
 +  --packet-trace: Show all packets sent and received 
 +  --iflist: Print host interfaces and routes (for debugging) 
 +  --append-output: Append to rather than clobber specified output files 
 +  --resume <filename>: Resume an aborted scan 
 +  --noninteractive: Disable runtime interactions via keyboard 
 +  --stylesheet <path/URL>: XSL stylesheet to transform XML output to HTML 
 +  --webxml: Reference stylesheet from Nmap.Org for more portable XML 
 +  --no-stylesheet: Prevent associating of XSL stylesheet w/XML output 
 +MISC: 
 +  -6: Enable IPv6 scanning 
 +  -A: Enable OS detection, version detection, script scanning, and traceroute 
 +  --datadir <dirname>: Specify custom Nmap data file location 
 +  --send-eth/--send-ip: Send using raw ethernet frames or IP packets 
 +  --privileged: Assume that the user is fully privileged 
 +  --unprivileged: Assume the user lacks raw socket privileges 
 +  -V: Print version number 
 +  -h: Print this help summary page. 
 +EXAMPLES: 
 +  nmap -v -A scanme.nmap.org 
 +  nmap -v -sn 192.168.0.0/16 10.0.0.0/
 +  nmap -v -iR 10000 -Pn -p 80 
 +SEE THE MAN PAGE (https://nmap.org/book/man.html) FOR MORE OPTIONS AND EXAMPLES
 </code> </code>
  
-Cette clef peut ensuite être jointe à des messages électroniques ou bien déposée sur un serveur de clefs tel http://www.keyserver.net.+===1.2 - netcat ===
  
-===Signer un message===+**netcat** est un couteau suisse. Il permet non seulement de scanner des ports mais aussi de lancer la connexion lors de la découverte d'un port ouvert.
  
-Créez maintenant un message à signer :+==Utilisation==
  
-<code> +Dans l'exemple qui suite, un scan est lancé sur le port 80 puis sur le port 25 :
-root@debian12:~# vi message.txt +
- +
-root@debian12:~# cat message.txt +
-# ~/message.txt +
-Ceci est un message de test pour GnuPG +
-</code> +
- +
-Pour signer ce message en format binaire, il convient d'utiliser la commande suivante : +
- +
-<WRAP center round important 50%> +
-**Important** - Entrez votre Passphrase quand gpg vous la demande. +
-</WRAP>+
  
 <code> <code>
-root@debian12:~# gpg --default-key ITTRAINING --detach-sign message.txt +root@debian12:~# nc 127.0.0.1 80 -w 1 -vv 
-gpg: using "ITTRAINING" as default secret key for signing+localhost [127.0.0.1] 80 (http) open 
 +[ENTREE] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Appuyez sur la touche Entrée 
 +HTTP/1.1 400 Bad Request 
 +Date: Thu, 27 Nov 2025 15:53:56 GMT 
 +Server: Apache/2.4.65 (Debian) 
 +Content-Length: 301 
 +Connection: close 
 +Content-Type: text/html; charset=iso-8859-1
  
-root@debian12:~# ls -l | grep message +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"
--rw-r--r-- 1 root    root         55 Nov 28 13:28 message.txt +<html><head> 
--rw-r--r-- 1 root    root        461 Nov 28 13:28 message.txt.sig +<title>400 Bad Request</title> 
- +</head><body> 
-root@debian12:~# cat message.txt.sig +<h1>Bad Request</h1> 
- +<p>Your browser sent a request that this server could not understand.<br /> 
-4!,S@6'i)infos@ittraining.team +</p> 
-        '| +<hr
-                M<~,#5@^0F6ܝӎl`6fA(897>"Bj\     N!M.=F[3tC"%Fk@{6ƒbbEcc2'Smhlwmޚ)<AICA$U^*DPI0ʘ)'p-4d{EiU\P`9}%L0RНGڕ(-y$i'fǬCBH^c      ;pQbٜbJeqKh7I/6FLc7kUi}/%3xeOv;i13Ĭ +<address>Apache/2.4.65 (DebianServer at 127.0.0.1 Port 80</address
-</code+</body></html
- + sent 1, rcvd 483
-Pour signer ce message en format ascii, il convient d'utiliser la commande suivante : +
- +
-<code> +
-root@debian12:~#  gpg --default-key ITTRAINING --armor --detach-sign message.txt +
- +
-gpg: using "ITTRAINING" as default secret key for signing +
- +
-root@debian12:~# ls -l | grep message +
--rw-r--r-- 1 root    root         55 Nov 28 13:28 message.txt +
--rw-r--r-- 1 root    root        691 Nov 28 13:31 message.txt.asc +
--rw-r--r-- 1 root    root        461 Nov 28 13:28 message.txt.sig +
- +
-root@debian12:~# cat message.txt.asc +
------BEGIN PGP SIGNATURE----- +
- +
-iQHKBAABCgA0FiEEtgIswQdTm0A2qQ+uq60TzSf55oYFAmkplgkWHGluZm9zQGl0 +
-dHJhaW5pbmcudGVhbQAKCRCrrRPNJ/nmhiteC/kBXVFzjOQYIzdt4ALI37gCmd7x +
-Ml72F9permfoLc83fj+zZfigUxZe4DHx0TslVtFhntkg+7wF1H3MmUyKOhwCXFO4 +
-ccyE9/DDJR384muuAP1q05bnXz0SHkTQaXVteCvAfHB8kzqQg04ePCBcIWK6YQVv +
-MBVm2O4pFDXWu1+0S69YnAelElZrzoqCaqprkQCcJvekBSV2NUNPLcwcBGq966+q +
-T9bGxPtW/5oTaPfFRzWwT/47ajpB66v3kEyGlc+gMpD4PFKZhLoEpgpByBWRWvhm +
-ZQsz2eby3oyv5KduA2emMnstQGCBq6zukYUpTgtzXB6jF1S71okiow11NsPra0m+ +
-9CAcg3tiylnkUJEgsvfZ45uctN+2UqBNAXMgVsHGUhJtugfPzfwWpfC/BMMdLS46 +
-g2nTttJexAGjjtw4Y0uFIYbNI0xXeH8ooh0AgQcXS5IOVH2zYs0GIdMxzRYFhRmc +
-nVRd/mHfQ21Mi1C5AnxDkqx6RpeH1maaLsPOFlo= +
-=2N1N +
------END PGP SIGNATURE-----  +
-</code> +
- +
-Pour signer ce message **dans le message lui-même** en format ascii, il convient d'utiliser la commande suivante : +
- +
-<code> +
-root@debian12:~# gpg --default-key ITTRAINING --clearsign message.txt +
-gpg: using "ITTRAINING" as default secret key for signing +
-File 'message.txt.asc' exists. Overwrite? (y/N+
- +
-root@debian12:~# ls -l | grep message +
--rw-r--r-- 1 root    root         55 Nov 28 13:28 message.txt +
--rw-r--r-- 1 root    root        795 Nov 28 13:33 message.txt.asc +
--rw-r--r-- root    root        461 Nov 28 13:28 message.txt.sig +
- +
-root@debian12:~# cat message.txt.asc +
------BEGIN PGP SIGNED MESSAGE----- +
-Hash: SHA512 +
- +
-# ~/message.txt +
-Ceci est un message de test pour GnuPG +
------BEGIN PGP SIGNATURE----- +
- +
-iQHKBAEBCgA0FiEEtgIswQdTm0A2qQ+uq60TzSf55oYFAmkplpsWHGluZm9zQGl0 +
-dHJhaW5pbmcudGVhbQAKCRCrrRPNJ/nmhopQC/wJYnC83AnA54x9O9FzHIQ0YVqO +
-QzcoDIIDMF71lizXIQ4DL2GCKhO3pelEWfyofUxd1sddT2qIHIsRTULaqHPRRjOU +
-9e/Wm9i65aUnQ/o5oDLSuHooi/r3HYPr8tHDhNSXT81a/QQ0BYVpMHVW/LREtw+L +
-qNPNlSZ4kzim3LyASyg8SYTGfft35S1S+7bjoY7LHfJUlGuSFRtlDMlhTbrrDqhI +
-S3TL6EeNFCdEVoxCPamsAKvuk4BV8Fe2rCjQqm/D6f0l+bgdnGFnd5y+nCiz0xXF +
-i7lQkZz+IjoTqwrjboL1mPWt6DMgiBX0IWas4kxKiBeZzyDZm6HGNeeMsqnReTcR +
-TPNM9FdDmpcxYzrRbYAoWTmdhiPdD/aXPEp+McyNIwwHgduUWuRGcifP2PVw6j0N +
-i3yOFw/rJEZMQnjwuL0GUSO3o8j1WMcSsTOHqsgu5FSKSjiIelNK2gzHTkuFiJ/+
-scYMCHrlrUfErpkLD1H6eFhSA4StmdZPmAA5DBA= +
-=07RM +
------END PGP SIGNATURE----- +
-</code> +
- +
-Pour vérifier la signature d'un message signé en mode ascii, il convient d'utiliser la commande : +
- +
-<code> +
-root@debian12:~# gpg --verify message.txt.asc +
-gpg: Signature made Fri 28 Nov 2025 01:33:31 PM CET +
-gpg:                using RSA key B6022CC107539B4036A90FAEABAD13CD27F9E686 +
-gpg:                issuer "infos@ittraining.team" +
-gpg: Good signature from "ITTRAINING (Test key) <infos@ittraining.team>" [ultimate] +
-gpg: WARNING: not a detached signature; file 'message.txt' was NOT verified!+
 </code> </code>
  
 <WRAP center round important 50%> <WRAP center round important 50%>
-**Important** - Pour vérifier la signature d'un message signé en mode ascii et produit en dehors du message lui-même, il convient d'utiliser la commande : +**Important** - Notez que **netcat** se connecte au port 80 qui est ouvert.
- +
-  # gpg --verify message.txt.asc message.txt+
 </WRAP> </WRAP>
  
-===Chiffrer un message===+==Options de la commande==
  
-Pour chiffrer un message, il faut disposer de la clef publique du destinataire du message. Ce dernier utilisera ensuite sa clef privée pour déchiffrer le message. Il convient de préciser le destinataire du message, ou plus précisément la clef publique à utiliser, lors d'un chiffrement : +Les options de cette commande sont :
- +
-    gpg --recipient <destinataire> --encrypt <message> +
- +
-  * //<destinataire>// représente toute information permettant de distinguer sans ambigüité une clef publique dans votre trousseau. Cette information peut-être le nom ou l'adresse email associé à la clef publique que vous voulez utiliser,  +
-  * //<message>// représente le message à chiffrer. +
- +
-Par exemple pour chiffrer un message en mode binaire, il convient de saisir la commande suivante :+
  
 <code> <code>
-root@debian12:~# gpg --recipient ITTRAINING --encrypt message.txt +root@debian12:~# nc -
- +[v1.10-47] 
-root@debian12:~# ls -l | grep message +connect to somewhere:   nc [-options] hostname port[s] [ports] ...  
--rw-r--r-- 1 root    root         55 Nov 28 13:28 message.txt +listen for inbound    nc -l -p port [-options] [hostname] [port] 
--rw-r--r-- 1 root    root        795 Nov 28 13:33 message.txt.asc +options
--rw-r--r-- 1 root    root        510 Nov 28 13:35 message.txt.gpg +        -c shell commands       as `-e'; use /bin/sh to exec [dangerous!!] 
--rw-r--r-- 1 root    root        461 Nov 28 13:28 message.txt.sig +        -e filename             program to exec after connect [dangerous!!] 
- +        -b                      allow broadcasts 
-root@debian12:~# cat message.txt.gpg +        -g gateway              source-routing hop point[s], up to 8 
-ӛS4 +        -G num                  source-routing pointer4, 8, 12, ... 
-   t>25H@H:x+H  n֩ˁ+B.^2Zھ~~~´4sd27J    ~:W^}ĀzmI]/e=kS׈n9tȘQ=Cj5{Q +        -h                      this cruft 
-                                                                   #0"  @qw,\[B$(:BU舏9^8_Qa  +        -i secs                 delay interval for lines sent, ports scanned 
-                                                                                             e^4,鹫     k/Pj#y:j~PU(}K#tTT-AZu  1z!%]t{ +        -k                      set keepalive option on socket 
-                                                                                                                                        5?"a5Vdnn$\V#(ctWhce6/-qThy^Ъmk-$$Dn +        -l                      listen mode, for inbound connects 
-                                                                                                                                                                            ^&Mw.*ԬYrɺޕr}o/Q[X_)Wr?U0gMV,">9Croot@debian12:~#+        -n                      numeric-only IP addresses, no DNS 
 +        -o file                 hex dump of traffic 
 +        -p port                 local port number 
 +        -r                      randomize local and remote ports 
 +        -q secs                 quit after EOF on stdin and delay of secs 
 +        -s addr                 local source address 
 +        -T tos                  set Type Of Service 
 +        -t                      answer TELNET negotiation 
 +        -u                      UDP mode 
 +        -v                      verbose [use twice to be more verbose] 
 +        -w secs                 timeout for connects and final net reads 
 +        -C                      Send CRLF as line-ending 
 +        -z                      zero-I/O mode [used for scanning] 
 +port numbers can be individual or rangeslo-hi [inclusive]; 
 +hyphens in port names must be backslash escaped (e.g. 'ftp\-data').
 </code> </code>
  
-Et pour chiffrer un message en mode ascii, il convient de saisir la commande suivante :+=====Les Contre-Mesures=====
  
-<code> +Les contre-mesures incluent l'utilisation d'un **S**ystème de **D**étection d'**I**ntrusion (**SDI** - **N**etwork **I**ntrusion **D**etection **S**ystem ou NIDS en anglais), par exemple **Snort** ou un **S**ystème de **D**étection et de **Prévention** d'**I**ntrusion, par exemple **portsentry**.
-root@debian12:~# gpg --recipient ITTRAINING --armor --encrypt message.txt +
-File 'message.txt.ascexists. Overwrite? (y/N) y+
  
-root@debian12:~ls -l | grep message +====LAB #Mise en place du Système de Détection d'Intrusion Snort====
--rw-r--r-- 1 root    root         55 Nov 28 13:28 message.txt +
--rw-r--r-- 1 root    root        752 Nov 28 13:38 message.txt.asc +
--rw-r--r-- 1 root    root        510 Nov 28 13:36 message.txt.gpg +
--rw-r--r-- 1 root    root        461 Nov 28 13:28 message.txt.sig+
  
-root@debian12:~# cat message.txt.asc +Snort est un **S**ystème de **D**étection d'**I**ntrusion (SDI) qui surveille les requêtes entrantes, vous avertit en cas d'anomalie et enregistre les traces de toute tentative d'intrusion.
------BEGIN PGP MESSAGE-----+
  
-hQGMA9ObUzTZ86GvAQwAxAGoxKHBMh53+bPqHs338vhWjxAZs19aItMm+CM2pKu5 +=== 2.1 Installation ===
-i4euJ36o+oVfbVTcqVNh4Q8I72QTOYTRTeXRWaUtVjp055A07BtlxGPbps9GXkVv +
-1faIs8viwHF1FHDC3Iz/SSf7u7tSF6sxbU6B4c/fHPneKjUxesH0XmKjduEdpDPj +
-ylZxPngzTOR4RDbMbkZ5OvJKXNrOOiHUSDOMmI9o9nu7sxnMiPP3NUqilN/0NtFz +
-xveV/mqDOEHT7Q1IHR+kN0e7WHqCl4NOvh0BXhL5u+9m18pgRe6ZvC6E94e+yPxZ +
-21umlYbcIPtw87+h9twBj7vK5FUi7j8C5QWoDoM4XERf/v21A1fTlx2cDn8E1lOC +
-dTaZlgTtxM3CY7/iWlG7TXWfUQfdZWhf/Mz1bHguljeOqVMGTI/zCElDnS3Ezzhg +
-bIlrpLbs6yqtjant1bkZ5PuNhB1bRNxrSKZUZKdEMeY5M+C0GjKskjN84+OqgjRV +
-39GkfPDwqw/eBj0ldvc60m0B5H2ZIIRApWl4j9RGhe2ZbvS+ZmI2vSf75RPDcNyH +
-PKDwHyTKCGN3NQKOIrw9LbIXehYEdrdFwGizGUXba1EWwVs+qMsmFueoQfcvA19N +
-CJ2HPuO3qAVIDpYyX+vwdKQASbb8AMQIIksoQv7i +
-=481C +
------END PGP MESSAGE----- +
-</code>+
  
-Pour décrypter un message il convient d'utiliser la commande suivante :+Sous Debian 12, **snort** n'est pas installé par défaut. Qui plus est **snort** ne se trouve pas dans les dépôts standards.
  
-<code> +Commencez donc par installer les dépendances de snort à partir des dépôts standards :
-root@debian12:~# gpg --decrypt message.txt.asc +
-gpg: encrypted with 3072-bit RSA key, ID D39B5334D9F3A1AF, created 2025-11-28 +
-      "ITTRAINING (Test key) <infos@ittraining.team>" +
-# ~/message.txt +
-Ceci est un message de test pour GnuPG +
-</code> +
- +
-=====LAB #3 - Mise en place de SSH et SCP===== +
- +
-====3.1 - Introduction==== +
- +
-La commande **[[wpfr>Ssh|ssh]]** est le successeur et la remplaçante de la commande **[[wpfr>Rlogin|rlogin]]**. Il permet d'établir des connexions sécurisées avec une machine distante. SSH comporte cinq acteurs : +
- +
-  * Le **serveur SSH** +
-    * le démon sshd, qui s'occupe des authentifications et autorisations des clients,  +
-  * Le **client SSH** +
-    * ssh ou scp, qui assure la connexion et le dialogue avec le serveur, +
-  * La **session** qui représente la connexion courante et qui commence juste après l'authentification réussie, +
-  * Les **clefs** +
-    * **Couple de clef utilisateur asymétriques** et persistantes qui assurent l'identité d'un utilisateur et qui sont stockés sur disque dur, +
-    * **Clef hôte asymétrique et persistante** garantissant l'identité du serveur er qui est conservé sur disque dur +
-    * **Clef serveur asymétrique et temporaire** utilisée par le protocole SSH1 qui sert au chiffrement de la clé de session, +
-    * **Clef de session symétrique qui est générée aléatoirement** et qui permet le chiiffrement de la communication entre le client et le serveur. Elle est détruite en fin de session. SSH-1 utilise une seule clef tandis que SSH-2 utilise une clef par direction de la communication, +
-  * La **base de données des hôtes connus** qui stocke les clés des connexions précédentes. +
- +
-SSH fonctionne de la manière suivante pour la la mise en place d'un canal sécurisé: +
- +
-  * Le client contacte le serveur sur son port 22, +
-  * Les client et le serveur échangent leur version de SSH. En cas de non-compatibilité de versions, l'un des deux met fin au processus, +
-  * Le serveur SSH s'identifie auprès du client en lui fournissant : +
-    * Sa clé hôte, +
-    * Sa clé serveur, +
-    * Une séquence aléatoire de huit octets à inclure dans les futures réponses du client, +
-    * Une liste de méthodes de chiffrage, compression et authentification, +
-  * Le client et le serveur produisent un identifiant identique, un haché MD5 long de 128 bits contenant la clé hôte, la clé serveur et la séquence aléatoire, +
-  * Le client génère sa clé de session symétrique et la chiffre deux fois de suite, une fois avec la clé hôte du serveur et la deuxième fois avec la clé serveur. Le client envoie cette clé au serveur accompagnée de la séquence aléatoire et un choix d'algorithmes supportés, +
-  * Le serveur déchiffre la clé de session, +
-  * Le client et le serveur mettent en place le canal sécurisé. +
- +
-===SSH-1=== +
- +
-SSH-1 utilise une paire de clefs de type RSA1. Il assure l'intégrité des données par une **[[wpfr>Contrôle_de_redondance_cyclique|Contrôle de Redondance Cyclique]]** (CRC) et est un bloc dit **monolithique**. +
- +
-Afin de s'identifier, le client essaie chacune des six méthodes suivantes : +
- +
-  * **Kerberos**, +
-  * **Rhosts**, +
-  * **%%RhostsRSA%%**, +
-  * Par **clef asymétrique**, +
-  * **TIS**, +
-  * Par **mot de passe**. +
- +
-===SSH-2=== +
- +
-SSH-2 utilise **DSA**,  **RSA**, **ecdsa** ou **ed25519**. Il assure l'intégrité des données par l'algorithme **HMAC**. SSH-2 est organisé en trois **couches** : +
- +
-  * **SSH-TRANS** – Transport Layer Protocol, +
-  * **SSH-AUTH** – Authentification Protocol, +
-  * **SSH-CONN** – Connection Protocol. +
- +
-SSH-2 diffère de SSH-1 essentiellement dans la phase authentification.  +
- +
-Trois méthodes d'authentification : +
- +
-  * Par **clef asymétrique**, +
-    * Identique à SSH-1 sauf avec l'algorithme **DSA**, **ecdsa** ou **ed25519**, +
-  * **%%RhostsRSA%%**, +
-  * Par **mot de passe**. +
- +
-===L'authentification par mot de passe=== +
- +
-L'utilisateur fournit un mot de passe au client ssh. Le client ssh le transmet de façon sécurisée au serveur ssh puis  le serveur vérifie le mot de passe et l'accepte ou non. +
- +
-Avantage: +
-  * Aucune configuration de clef asymétrique n'est nécessaire. +
- +
-Inconvénients: +
-  * L'utilisateur doit fournir à chaque connexion un identifiant et un mot de passe, +
-  * Moins sécurisé qu'un système par clef asymétrique. +
- +
-===L'authentification par clef asymétrique=== +
- +
-  * Le **client** envoie au serveur une requête d'authentification par clé asymétrique qui contient le module de la clé à utiliser, +
-  * Le **serveur** recherche une correspondance pour ce module dans le fichier des clés autorisés **~/.ssh/authorized_keys**, +
-    * Dans le cas où une correspondance n'est pas trouvée, le serveur met fin à la communication, +
-    * Dans le cas contraire le serveur génère une chaîne aléatoire de 256 bits appelée un **challenge** et la chiffre avec la **clé publique du client**, +
-  * Le **client** reçoit le challenge et le décrypte avec la partie privée de sa clé. Il combine le challenge avec l'identifiant de session et chiffre le résultat. Ensuite il envoie le résultat chiffré au serveur. +
-  * Le **serveur** génère le même haché et le compare avec celui reçu du client. Si les deux hachés sont identiques, l'authentification est réussie. +
- +
-====3.2 - Configuration du Serveur==== +
- +
-La configuration du serveur s'effectue dans le fichier **/etc/ssh/sshd_config** :+
  
 <code> <code>
-root@debian12:~# cat /etc/ssh/sshd_config +root@debian12:~# apt-get install -y build-essential libpcre3-dev libdumbnet-dev bison flex zlib1g-dev liblzma-dev libssl-dev libluajit-5.1-dev pkg-config libhwloc-dev cmake libpcap-dev libdaq-dev libnetfilter-queue-dev libmnl-dev libnghttp2-dev autoconf libtool cmake git
- +
-# This is the sshd server system-wide configuration file.  See +
-# sshd_config(5) for more information. +
- +
-# This sshd was compiled with PATH=/usr/local/bin:/usr/bin:/bin:/usr/games +
- +
-# The strategy used for options in the default sshd_config shipped with +
-# OpenSSH is to specify options with their default value where +
-# possible, but leave them commented.  Uncommented options override the +
-# default value. +
- +
-Include /etc/ssh/sshd_config.d/*.conf +
- +
-#Port 22 +
-#AddressFamily any +
-#ListenAddress 0.0.0.0 +
-#ListenAddress :: +
- +
-#HostKey /etc/ssh/ssh_host_rsa_key +
-#HostKey /etc/ssh/ssh_host_ecdsa_key +
-#HostKey /etc/ssh/ssh_host_ed25519_key +
- +
-# Ciphers and keying +
-#RekeyLimit default none +
- +
-# Logging +
-#SyslogFacility AUTH +
-#LogLevel INFO +
- +
-# Authentication: +
- +
-#LoginGraceTime 2m +
-#PermitRootLogin prohibit-password +
-#StrictModes yes +
-#MaxAuthTries 6 +
-#MaxSessions 10 +
- +
-#PubkeyAuthentication yes +
- +
-# Expect .ssh/authorized_keys2 to be disregarded by default in future. +
-#AuthorizedKeysFile     .ssh/authorized_keys .ssh/authorized_keys2 +
- +
-#AuthorizedPrincipalsFile none +
- +
-#AuthorizedKeysCommand none +
-#AuthorizedKeysCommandUser nobody +
- +
-# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts +
-#HostbasedAuthentication no +
-# Change to yes if you don't trust ~/.ssh/known_hosts for +
-# HostbasedAuthentication +
-#IgnoreUserKnownHosts no +
-# Don't read the user's ~/.rhosts and ~/.shosts files +
-#IgnoreRhosts yes +
- +
-# To disable tunneled clear text passwords, change to no here! +
-#PasswordAuthentication yes +
-#PermitEmptyPasswords no +
- +
-# Change to yes to enable challenge-response passwords (beware issues with +
-# some PAM modules and threads) +
-KbdInteractiveAuthentication no +
- +
-# Kerberos options +
-#KerberosAuthentication no +
-#KerberosOrLocalPasswd yes +
-#KerberosTicketCleanup yes +
-#KerberosGetAFSToken no +
- +
-# GSSAPI options +
-#GSSAPIAuthentication no +
-#GSSAPICleanupCredentials yes +
-#GSSAPIStrictAcceptorCheck yes +
-#GSSAPIKeyExchange no +
- +
-# Set this to 'yes' to enable PAM authentication, account processing, +
-# and session processing. If this is enabled, PAM authentication will +
-# be allowed through the KbdInteractiveAuthentication and +
-# PasswordAuthentication.  Depending on your PAM configuration, +
-# PAM authentication via KbdInteractiveAuthentication may bypass +
-# the setting of "PermitRootLogin prohibit-password"+
-# If you just want the PAM account and session checks to run without +
-# PAM authentication, then enable this but set PasswordAuthentication +
-# and KbdInteractiveAuthentication to 'no'+
-UsePAM yes +
- +
-#AllowAgentForwarding yes +
-#AllowTcpForwarding yes +
-#GatewayPorts no +
-X11Forwarding yes +
-#X11DisplayOffset 10 +
-#X11UseLocalhost yes +
-#PermitTTY yes +
-PrintMotd no +
-#PrintLastLog yes +
-#TCPKeepAlive yes +
-#PermitUserEnvironment no +
-#Compression delayed +
-#ClientAliveInterval 0 +
-#ClientAliveCountMax 3 +
-#UseDNS no +
-#PidFile /run/sshd.pid +
-#MaxStartups 10:30:100 +
-#PermitTunnel no +
-#ChrootDirectory none +
-#VersionAddendum none +
- +
-# no default banner path +
-#Banner none +
- +
-# Allow client to pass locale environment variables +
-AcceptEnv LANG LC_* +
- +
-# override default of no subsystems +
-Subsystem       sftp    /usr/lib/openssh/sftp-server+
  
-# Example of overriding settings on a per-user basis +apt install build-essential libpcap-dev libpcre3-dev libnet1-dev zlib1g-dev luajit hwloc libdumbnet-dev bison flex liblzma-dev openssl libssl-dev pkg-config libhwloc-dev cmake cpputest libsqlite3-dev uuid-dev libcmocka-dev libnetfilter-queue-dev libmnl-dev autotools-dev libluajit-5.1-dev libunwind-dev libcrep2-dev git -y
-#Match User anoncvs +
-#       X11Forwarding no +
-#       AllowTcpForwarding no +
-#       PermitTTY no +
-#       ForceCommand cvs server+
 </code> </code>
  
-Pour ôter les lignes de commentaires dans ce fichier, utilisez la commande suivante :+Créez ensuite le fichier **/etc/ld.so.conf.d/local.conf** qui contient les chemins vers les bibliothèques pour **snort** :
  
 <code> <code>
-root@debian12:~# cd /tmp ; grep -E -v '^(#|$)'  /etc/ssh/sshd_config > sshd_config+root@debian12:~# vi /etc/ld.so.conf.d/local.conf
  
-root@debian12:/tmp# cat sshd_config +root@debian12:~# cat /etc/ld.so.conf.d/local.conf 
-Include /etc/ssh/sshd_config.d/*.conf +/usr/local/lib 
-KbdInteractiveAuthentication no +/usr/local/lib64 
-UsePAM yes +/usr/local/snort/bin
-X11Forwarding yes +
-PrintMotd no +
-AcceptEnv LANG LC_* +
-Subsystem       sftp    /usr/lib/openssh/sftp-server+
 </code> </code>
  
-Pour sécuriser le serveur ssh, ajoutez ou modifiez les directives suivantes : +Créez le répertoire **~/snort-source-files** et clonez le dépôt **https://github.com/snort3/libdaq.git** :
- +
-<file> +
-AllowGroups adm +
-Banner /etc/issue.net +
-HostbasedAuthentication no +
-IgnoreRhosts yes +
-LoginGraceTime 60 +
-LogLevel INFO +
-PermitEmptyPasswords no +
-PermitRootLogin no +
-PrintLastLog yes +
-Protocol 2 +
-StrictModes yes +
-X11Forwarding no +
-</file> +
- +
-Votre fichier ressemblera à celui-ci :+
  
 <code> <code>
-root@debian12:/tmpcat sshd_config +root@debian12:~mkdir ~/snort-source-files
-Include /etc/ssh/sshd_config.d/*.conf +
-KbdInteractiveAuthentication no +
-UsePAM yes +
-PrintMotd no +
-AcceptEnv LANG LC_* +
-AllowGroups adm +
-HostbasedAuthentication no +
-IgnoreRhosts yes +
-LoginGraceTime 60 +
-LogLevel INFO +
-PermitEmptyPasswords no +
-PermitRootLogin no +
-PrintLastLog yes +
-Protocol 2 +
-StrictModes yes +
-X11Forwarding no +
-Subsystem       sftp    /usr/lib/openssh/sftp-server +
-</code>+
  
-Mettez l'utilisateur **trainee** dans le groupe **adm**+root@debian12:~# cd snort-source-files/
  
-<code> +root@debian12:~/snort-source-filesgit clone https://github.com/snort3/libdaq.git 
-root@debian12:/tmpgroups trainee +Cloning into 'libdaq'... 
-trainee trainee cdrom floppy audio dip video plugdev netdev lpadmin scanner vboxusers +remoteEnumerating objects: 2617, done. 
- +remote: Counting objects: 100% (239/239), done. 
-root@debian12:/tmp# usermod -a -G adm trainee +remoteCompressing objects: 100% (78/78), done. 
- +remote: Total 2617 (delta 199), reused 169 (delta 161), pack-reused 2378 (from 2) 
-root@debian12:/tmp# groups trainee +Receiving objects100% (2617/2617), 1.18 MiB | 13.31 MiB/s, done. 
-trainee trainee adm cdrom floppy audio dip video plugdev netdev lpadmin scanner vboxusers+Resolving deltas100% (1891/1891), done.
 </code> </code>
  
-Renommez le fichier **/etc/ssh/sshd_config** en **/etc/ssh/sshd_config.old** puis copiez le fichier **/tmp/sshd_config** vers **/etc/ssh/** :+Procédez à la compilation et à l'installation de **libdaq** :
  
 <code> <code>
-root@debian12:/tmpmv /etc/ssh/sshd_config /etc/ssh/sshd_config.old+root@debian12:~/snort-source-filescd libdaq/
  
-root@debian12:/tmpcp sshd_config /etc/ssh +root@debian12:~/snort-source-files/libdaq./bootstrap 
-</code>++ autoreconf -ivf --warnings=all 
 +autoreconf: export WARNINGS=all 
 +autoreconf: Entering directory '.' 
 +autoreconf: configure.ac: not using Gettext 
 +autoreconf: running: aclocal --force -I m4 
 +autoreconf: configure.ac: tracing 
 +autoreconf: running: libtoolize --copy --force 
 +libtoolize: putting auxiliary files in '.'
 +libtoolize: copying file './ltmain.sh' 
 +libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'
 +libtoolize: copying file 'm4/libtool.m4' 
 +libtoolize: copying file 'm4/ltoptions.m4' 
 +libtoolize: copying file 'm4/ltsugar.m4' 
 +libtoolize: copying file 'm4/ltversion.m4' 
 +libtoolize: copying file 'm4/lt~obsolete.m4' 
 +autoreconf: configure.ac: not using Intltool 
 +autoreconf: configure.ac: not using Gtkdoc 
 +autoreconf: running: aclocal --force -I m4 
 +autoreconf: running: /usr/bin/autoconf --force 
 +configure.ac:27: warning: The macro `AC_PROG_CC_C99' is obsolete. 
 +configure.ac:27: You should run autoupdate. 
 +./lib/autoconf/c.m4:1659: AC_PROG_CC_C99 is expanded from... 
 +configure.ac:27: the top level 
 +autoreconf: running: /usr/bin/autoheader --force 
 +autoreconf: running: automake --add-missing --copy --force-missing 
 +configure.ac:29: installing './ar-lib' 
 +configure.ac:26: installing './compile' 
 +configure.ac:34: installing './config.guess' 
 +configure.ac:34: installing './config.sub' 
 +configure.ac:19: installing './install-sh' 
 +configure.ac:19: installing './missing' 
 +api/Makefile.am: installing './depcomp' 
 +parallel-tests: installing './test-driver' 
 +autoreconf: Leaving directory '.'
  
-Redémarrez ensuite le serveur ssh :+root@debian12:~/snort-source-files/libdaq# ./configure 
 +... 
 +config.status: executing libtool commands
  
-<code> +    libdaq 3.0.23
-root@debian12:/tmp# systemctl restart ssh+
  
-root@debian12:/tmp# systemctl status ssh +    prefix        /usr/local 
-● ssh.service - OpenBSD Secure Shell server +    sysconfdir:     ${prefix}/etc 
-     Loadedloaded (/lib/systemd/system/ssh.service; enabled; presetenabled) +    libdir        ${exec_prefix}/lib 
-     Active: active (running) since Fri 2025-11-28 15:18:55 CET; 7s ago +    includedir:     ${prefix}/include
-       Docs: man:sshd(8) +
-             man:sshd_config(5) +
-    Process10882 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS) +
-   Main PID10883 (sshd) +
-      Tasks: 1 (limit: 19123) +
-     Memory: 1.4M +
-        CPU: 28ms +
-     CGroup: /system.slice/ssh.service +
-             └─10883 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"+
  
-Nov 28 15:18:55 debian12 systemd[1]Starting ssh.service OpenBSD Secure Shell server... +    cc            gcc 
-Nov 28 15:18:55 debian12 sshd[10883]: Server listening on 0.0.0.0 port 22. +    cppflags       
-Nov 28 15:18:55 debian12 sshd[10883]: Server listening on :: port 22. +    am_cppflags    -fvisibility=hidden -Wall -Wmissing-declarations -Wpointer-arith -Wcast-align -Wcast-qual -Wformat -Wformat-nonliteral -Wformat-security -Wundef -Wwrite-strings -Wextra -Wsign-compare -Wno-unused-parameter -fno-strict-aliasing -fdiagnostics-show-option 
-Nov 28 15:18:55 debian12 systemd[1]: Started ssh.service - OpenBSD Secure Shell server. +    cflags        -g -O2 
-</code>+    am_cflags      -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wnested-externs 
 +    ldflags        
 +    am_ldflags     
 +    libs:           
  
-Pour générer les clefs sur le serveur saisissez la commande suivante en tant que **root**:+    code_coverage_enabled no 
 +    code_coverage_cppflags:  
 +    code_coverage_cflags:    
 +    code_coverage_ldflags:  
  
-<WRAP center round important 50%> +    Build AFPacket DAQ module.. : yes 
-**Important** - Lors de la génération de la clef, la passphrase doit être **vide**+    Build BPF DAQ module....... : yes 
-</WRAP>+    Build Divert DAQ module.... : no 
 +    Build Dump DAQ module...... : yes 
 +    Build FST DAQ module....... : yes 
 +    Build netmap DAQ module.... : no 
 +    Build NFQ DAQ module....... : yes 
 +    Build PCAP DAQ module...... : yes 
 +    Build Savefile DAQ module.. : yes 
 +    Build Trace DAQ module..... : yes 
 +    Build GWLB DAQ module...... : yes
  
-<code> +root@debian12:~/snort-source-files/libdaq# make 
-root@debian12:/tmp# ssh-keygen -t dsa +..
-Generating public/private dsa key pair+make[2]: Leaving directory '/root/snort-source-files/libdaq/example' 
-Enter file in which to save the key (/root/.ssh/id_dsa): /etc/ssh/ssh_host_dsa_key +Making all in test 
-Enter passphrase (empty for no passphrase):  +make[2]Entering directory '/root/snort-source-files/libdaq/test' 
-Enter same passphrase again +make[2]: Nothing to be done for 'all'. 
-Your identification has been saved in /etc/ssh/ssh_host_dsa_key +make[2]Leaving directory '/root/snort-source-files/libdaq/test' 
-Your public key has been saved in /etc/ssh/ssh_host_dsa_key.pub +make[2]Entering directory '/root/snort-source-files/libdaq
-The key fingerprint is: +make[2]: Leaving directory '/root/snort-source-files/libdaq' 
-SHA256:mP/fGCXEcyZQ+afGDrQK4S1TYVIw3pnBre25MPU2b3g root@debian12 +make[1]: Leaving directory '/root/snort-source-files/libdaq'
-The key's randomart image is: +
-+---[DSA 1024]----+ +
-|        o++o..   | +
-|       ..o+*o    | +
-|        .o++=.o +
-|       o. o.+=. .| +
-|      o.S+ +.=.o | +
-|       .= + =oB  | +
-|        .+ +.* + | +
-|         .. .+o E| +
-|          ..o .o | +
-+----[SHA256]-----+ +
-</code>+
  
-<WRAP center round important 50%> +root@debian12:~/snort-source-files/libdaq# make install 
-**Important** Le chemin à indiquer pour le fichier est **/etc/ssh/ssh_host_dsa_key**De la même façon, il est possible de générer les clefs au format **[[https://fr.wikipedia.org/wiki/Chiffrement_RSA|RSA]]**, **[[https://fr.wikipedia.org/wiki/Elliptic_curve_digital_signature_algorithm|ECDSA]]** et **[[https://fr.wikipedia.org/wiki/EdDSA|ED25519]]**.  +... 
-</WRAP> +---------------------------------------------------------------------- 
- + /usr/bin/mkdir -p '/usr/local/lib/pkgconfig' 
-Les clefs publiques générées possèdent l'extension **.pub**. Les clefs privées n'ont pas d'extension + /usr/bin/install -c -m 644 afpacket/libdaq_static_afpacket.pc bpf/libdaq_static_bpf.pc dump/libdaq_static_dump.pc fst/libdaq_static_fst.pc nfq/libdaq_static_nfq.pc pcap/libdaq_static_pcap.pc savefile/libdaq_static_savefile.pc trace/libdaq_static_trace.pc gwlb/libdaq_static_gwlb.pc '/usr/local/lib/pkgconfig' 
- +make[2]: Leaving directory '/root/snort-source-files/libdaq/modules' 
-<code> +make[1]: Leaving directory '/root/snort-source-files/libdaq/modules' 
-root@debian12:/tmp# ls /etc/ssh +Making install in example 
-moduli      ssh_config.d  sshd_config.d    ssh_host_dsa_key      ssh_host_ecdsa_key      ssh_host_ed25519_key      ssh_host_rsa_key +make[1]: Entering directory '/root/snort-source-files/libdaq/example' 
-ssh_config  sshd_config   sshd_config.old  ssh_host_dsa_key.pub  ssh_host_ecdsa_key.pub  ssh_host_ed25519_key.pub  ssh_host_rsa_key.pub+make[2]Entering directory '/root/snort-source-files/libdaq/example' 
 + /usr/bin/mkdir -p '/usr/local/bin' 
 +  /bin/bash ../libtool   --mode=install /usr/bin/install -c daqtest daqtest-static '/usr/local/bin' 
 +libtool: install: /usr/bin/install -c .libs/daqtest /usr/local/bin/daqtest 
 +libtool: install: /usr/bin/install -c daqtest-static /usr/local/bin/daqtest-static 
 +make[2]: Nothing to be done for 'install-data-am'
 +make[2]: Leaving directory '/root/snort-source-files/libdaq/example' 
 +make[1]: Leaving directory '/root/snort-source-files/libdaq/example' 
 +Making install in test 
 +make[1]: Entering directory '/root/snort-source-files/libdaq/test' 
 +make[2]: Entering directory '/root/snort-source-files/libdaq/test' 
 +make[2]Nothing to be done for 'install-exec-am'. 
 +make[2]: Nothing to be done for 'install-data-am'. 
 +make[2]: Leaving directory '/root/snort-source-files/libdaq/test' 
 +make[1]: Leaving directory '/root/snort-source-files/libdaq/test' 
 +make[1]Entering directory '/root/snort-source-files/libdaq' 
 +make[2]: Entering directory '/root/snort-source-files/libdaq' 
 +make[2]: Nothing to be done for 'install-exec-am'
 + /usr/bin/mkdir -p '/usr/local/lib/pkgconfig' 
 + /usr/bin/install -c -m 644 libdaq.pc '/usr/local/lib/pkgconfig' 
 +make[2]: Leaving directory '/root/snort-source-files/libdaq' 
 +make[1]: Leaving directory '/root/snort-source-files/libdaq'
 </code> </code>
- 
-Re-démarrez ensuite le service sshd : 
  
 <code> <code>
-root@debian12:/tmp# systemctl restart ssh 
 </code> </code>
  
-Saisissez maintenant les commandes suivantes en tant que **trainee** : +Téléchargez et désarchivez**snort** :
- +
-<WRAP center round important 50%> +
-**Important** - Lors de la génération des clefs, la passphrase doit être **vide**. +
-</WRAP>+
  
 <code> <code>
-root@debian12:/tmpexit +root@debian12:~/snort-source-files/libdaqcd ..
-logout+
  
-trainee@debian12:~$ ssh-keygen -t dsa +root@debian12:~/snort-source-files# git clone https://github.com/snort3/snort3.git 
-Generating public/private dsa key pair. +Cloning into 'snort3'..
-Enter file in which to save the key (/home/trainee/.ssh/id_dsa):  +remoteEnumerating objects123479, done
-Created directory '/home/trainee/.ssh'+remoteCounting objects100% (12552/12552), done
-Enter passphrase (empty for no passphrase) +remoteCompressing objects100% (1884/1884), done
-Enter same passphrase again +remoteTotal 123479 (delta 11054), reused 10808 (delta 10668), pack-reused 110927 (from 5
-Your identification has been saved in /home/trainee/.ssh/id_dsa +Receiving objects100% (123479/123479), 91.19 MiB | 26.35 MiB/s, done
-Your public key has been saved in /home/trainee/.ssh/id_dsa.pub +Resolving deltas100% (104744/104744), done.
-The key fingerprint is: +
-SHA256:97XNFS0p/j8IaR7sByO1jVTE3sP23l/qDRUwU9TFRpw trainee@debian12 +
-The key's randomart image is: +
-+---[DSA 1024]----+ +
-|            o=o**| +
-|             o+E*| +
-|            + =+.| +
-|           + o *o| +
-|        S = * o =| +
-|         + =o| +
-|          = * =.=| +
-|           o o *+| +
-|            ..o *| +
-+----[SHA256]-----+ +
- +
-trainee@debian12:~$ ssh-keygen -t rsa +
-Generating public/private rsa key pair. +
-Enter file in which to save the key (/home/trainee/.ssh/id_rsa):  +
-Enter passphrase (empty for no passphrase):  +
-Enter same passphrase again:  +
-Your identification has been saved in /home/trainee/.ssh/id_rsa +
-Your public key has been saved in /home/trainee/.ssh/id_rsa.pub +
-The key fingerprint is: +
-SHA256:p2xPZdoPCICy/D5x0g+nHilsV6Ar4UMwmHeRnHDnBQw trainee@debian12 +
-The key's randomart image is: +
-+---[RSA 3072]----+ +
-|  .oE=o..        | +
-|.. .+=..         | +
-|= o o +          | +
-| = + . o         | +
-|  = ..  S . o    | +
-| o +o.++.+ *     | +
-|  + *++=+ + o    | +
-|   =.o.o.o     | +
-|    .o.     +
-+----[SHA256]-----+ +
- +
-trainee@debian12:~$ ssh-keygen -t ecdsa +
-Generating public/private ecdsa key pair. +
-Enter file in which to save the key (/home/trainee/.ssh/id_ecdsa):  +
-Enter passphrase (empty for no passphrase) +
-Enter same passphrase again +
-Your identification has been saved in /home/trainee/.ssh/id_ecdsa +
-Your public key has been saved in /home/trainee/.ssh/id_ecdsa.pub +
-The key fingerprint is: +
-SHA256:zA3muePCJZ7SCIvuKe+X5veMqWpP0UTr6HAVv+LPBCo trainee@debian12 +
-The key'randomart image is: +
-+---[ECDSA 256]---+ +
-|      o          | +
-|     +         | +
-|      + +        | +
-|     * = =       | +
-|  . + = S .      | +
-|  .+ +.o..       | +
-| .Eo+*.++        | +
-|o +o* BO .       | +
-|+B+*++oo*        | +
-+----[SHA256]-----+ +
- +
-trainee@debian12:~$ ssh-keygen -t ed25519 +
-Generating public/private ed25519 key pair. +
-Enter file in which to save the key (/home/trainee/.ssh/id_ed25519):  +
-Enter passphrase (empty for no passphrase):  +
-Enter same passphrase again:  +
-Your identification has been saved in /home/trainee/.ssh/id_ed25519 +
-Your public key has been saved in /home/trainee/.ssh/id_ed25519.pub +
-The key fingerprint is: +
-SHA256:f5GzguZoS5SN2EQDyj7zAqES+7PDOBSJRg+lD+vpn3Q trainee@debian12 +
-The key's randomart image is: +
-+--[ED25519 256]--+ +
-|  ....o          | +
-| +.. . .         | +
-|=o*            | +
-|oO+. + +       | +
-|*.=.. = S      | +
-|o+.+ .       | +
-|.=+..E. o o o    | +
-|+ ++o..+       | +
-| oo+ .o..        | +
-+----[SHA256]-----++
 </code> </code>
  
-<WRAP center round important 50%> +Procédez à la compilation et à l'installation de **snort3** :
-**Important** - Les clés générées seront placées dans le répertoire **~/.ssh/**. +
-</WRAP> +
- +
-====3.3 - Utilisation==== +
- +
-La commande ssh prend la forme suivante: +
- +
-  ssh -l nom_de_compte numero_ip (nom_de_machine) +
- +
-En saisissant cette commande sur votre propre machine, vous obtiendrez un résultat similaire à celle-ci :+
  
 <code> <code>
-trainee@debian12:~$ su - +root@debian12:~/snort-source-filescd snort3/
-Password: fenestros +
-root@debian12:~#+
  
-root@debian12:~# ssh -l trainee localhost +root@debian12:~/snort-source-files/snort3# ./configure_cmake.sh 
-The authenticity of host 'localhost (::1)' can't be established. +..
-ED25519 key fingerprint is SHA256:SS9CpX7JFHIB54TWQWTtyswnwaXZ/Y8Kvr6dxPtisgE. +------------------------------------------------------- 
-This key is not known by any other names. +snort version 3.10.0.0
-Are you sure you want to continue connecting (yes/no/[fingerprint])? yes +
-Warning: Permanently added 'localhost' (ED25519) to the list of known hosts+
-trainee@localhost's password:  +
-Linux debian12 6.1.0-41-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.158-1 (2025-11-09) x86_64+
  
-The programs included with the Debian GNU/Linux system are free software; +Install options: 
-the exact distribution terms for each program are described in the +    prefix:     /usr/local/snort 
-individual files in /usr/share/doc/*/copyright.+    includes:   /usr/local/snort/include/snort 
 +    plugins:    /usr/local/snort/lib/snort
  
-Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent +Compiler options: 
-permitted by applicable law. +    CC:             /usr/bin/cc 
-Last loginThu Nov 27 17:21:12 2025 from 10.0.2.1 +    CXX:            /usr/bin/c++ 
-</code>+    CFLAGS           -fvisibility=hidden   -DNDEBUG -g -ggdb    -O2 -g -DNDEBUG 
 +    CXXFLAGS         -fvisibility=hidden   -DNDEBUG -g -ggdb    -O2 -g -DNDEBUG 
 +    EXE_LDFLAGS        
 +    MODULE_LDFLAGS:     
  
-====3.4 Mise en place des clefs====+Feature options: 
 +    DAQ Modules:    Static (afpacket;bpf;dump;fst;gwlb;nfq;pcap;savefile;trace) 
 +    libatomic:      System-provided 
 +    Hyperscan:      OFF 
 +    ICONV:          ON 
 +    Libunwind:      ON 
 +    LZMA:           ON 
 +    RPC DB:         Built-in 
 +    SafeC:          OFF 
 +    TCMalloc:       OFF 
 +    JEMalloc:       OFF 
 +    UUID:           ON 
 +    NUMA:           ON 
 +    LibML:          OFF 
 +-------------------------------------------------------
  
-Il convient maintenant de se connecter sur le <<serveur>> en utilisant ssh et vérifiez la présence du répertoire ~/.ssh :+-- Configuring done 
 +-- Generating done 
 +-- Build files have been written to/root/snort-source-files/snort3/build
  
-En saisissant cette commande, vous obtiendrez une fenêtre similaire à celle-ci :+root@debian12:~/snort-source-files/snort3# cd build
  
-<code> +root@debian12:~/snort-source-files/snort3/buildmake 
-root@debian12:~# exit +... 
-logout+[ 98%] Built target preprocessor_states 
 +[ 98%] Building CXX object tools/snort2lua/CMakeFiles/snort2lua.dir/snort2lua.cc.o 
 +[ 98%] Building CXX object tools/snort2lua/CMakeFiles/snort2lua.dir/init_state.cc.o 
 +[ 98%] Linking CXX executable snort2lua 
 +[ 98%] Built target snort2lua 
 +[ 98%] Building C object daqs/CMakeFiles/daq_file.dir/daq_file.c.o 
 +[ 98%] Linking C shared module daq_file.so 
 +[ 98%] Built target daq_file 
 +[ 98%] Building C object daqs/CMakeFiles/daq_hext.dir/daq_hext.c.o 
 +[100%] Linking C shared module daq_hext.so 
 +[100%] Built target daq_hext
  
-trainee@debian12:~$ ssh -l trainee 127.0.0.1 +root@debian12:~/snort-source-files/snort3/build# make install 
-trainee@127.0.0.1's password: trainee +... 
-Linux debian12 6.1.0-41-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.158-1 (2025-11-09) x86_64 +-- Up-to-date: /usr/local/snort/share/doc/snort/overview.txt 
- +-- Installing: /usr/local/snort/share/doc/snort/snort2lua.txt 
-The programs included with the Debian GNU/Linux system are free software; +-- Installing: /usr/local/snort/share/doc/snort/snort_upgrade.txt 
-the exact distribution terms for each program are described in the +-- Installing/usr/local/snort/share/doc/snort/config_changes.txt 
-individual files in /usr/share/doc/*/copyright+-- Installing: /usr/local/snort/share/doc/snort/snort_upgrade.text 
- +-- Installing: /usr/local/snort/share/doc/snort/snort_devel.txt 
-Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent +-- Installing: /usr/local/snort/share/doc/snort/extending.txt 
-permitted by applicable law+-- Installing/usr/local/snort/share/doc/snort/style.txt 
-Last loginFri Nov 28 15:31:58 2025 from 10.0.2.46 +-- Installing/usr/local/snort/share/doc/snort/versions.txt
- +
-trainee@debian12:~$ ls -la | grep .ssh +
-drwx------   2 trainee trainee 4096 Nov 28 15:29 .ssh +
- +
-trainee@debian12:~$ exit +
-logout +
-Connection to 127.0.0.1 closed.+
 </code> </code>
  
-<WRAP center round important 50%> +Dernièrementmodifiez la valeur $PATH de root :
-**Important** - Si le dossier distant .ssh n'existe pas dans le répertoire personnel de l'utilisateur connecté, il faut le créer avec des permissions de 700. Dans votre cas, puisque votre machine joue le rôle de serveur **et** du client, le dossier /home/trainee/.ssh existe **déjà**. +
-</WRAP> +
- +
-Ensuiteil convient de transférer le fichier local **.ssh/id_ecdsa.pub** du <<client>> vers le <<serveur>> en le renommant en **authorized_keys** :+
  
 <code> <code>
-trainee@debian12:~$ scp .ssh/id_ecdsa.pub trainee@127.0.0.1:/home/trainee/.ssh/authorized_keys +root@debian12:~/snort-source-files/snort3/build# echo $PATH 
-trainee@127.0.0.1's password +/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
-id_ecdsa.pub                                                                                                                                                                    100%  178   399.6KB/s   00:00  +
-</code>+
  
-Connectez-vous via ssh et insérer les clefs publiques restantes dans le fichier .ssh/authorized_keys :+root@debian12:~/snort-source-files/snort3/build# PATH="/usr/local/snort/bin:$PATH"
  
-<code> +root@debian12:~/snort-source-files/snort3/buildecho $PATH 
-trainee@debian12:~$ ssh -l trainee localhost +/usr/local/snort/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
-Linux debian12 6.1.0-41-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.158-1 (2025-11-09) x86_64+
  
-The programs included with the Debian GNU/Linux system are free software; +root@debian12:~/snort-source-files/snort3/build# vi /root/.profile
-the exact distribution terms for each program are described in the +
-individual files in /usr/share/doc/*/copyright.+
  
-Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent +root@debian12:~/snort-source-files/snort3/build# cat /root/.profile 
-permitted by applicable law+# ~/.profile: executed by Bourne-compatible login shells.
-Last login: Fri Nov 28 15:57:32 2025 from 127.0.0.1+
  
-trainee@debian12:~cat .ssh/id_rsa.pub >> .ssh/authorized_keys+if [ "$BASH" ]; then 
 +  if [ -f ~/.bashrc ]; then 
 +    ~/.bashrc 
 +  fi 
 +fi
  
-trainee@debian12:~cat .ssh/id_dsa.pub >> .ssh/authorized_keys+PATH=/usr/local/snort/bin:$PATH:$HOME/bin 
 +export $PATH
  
-trainee@debian12:~$ cat .ssh/id_ed25519.pub >> .ssh/authorized_keys +mesg n 2> /dev/null || true
- +
-trainee@debian12:~$ cat .ssh/authorized_keys +
-ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBwIXLMYJtWVgqSTqJfsFjS2ubtP+mHkC7XRU1rBWTBLYoJp8VOwtpKK1NTFSaeJhnjCvFuhYm8egqHI0gp3oBA= trainee@debian12 +
-ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDcV1OmeHZlWhLumCozdg7snul5MrkzhZjiUKWNJmGBBOauOq2CgMGYWYIhjyeVeaeiezq+wSe0jO09p8a1EbvYUibJsY9FOi8JcXTpxvlcqpuawudErjSsOf6JaIlbGpwDIMzmjeubfQx9jMZzfQIW9zfTDUi2tGquR/1TQPocGmmI9JFtoMqylk4+KsIHpriMBEVD/aKiGr1wjLHR1v3er8P1o8YOd+9tZXouJxWLHIA1swrnpXt8doVWYGx0E9jWsScqI4JPTy8kb2hfWeZWqONIqgJty0kOeTt6IynOauf9fSjxOG9Y4jyTV/OvTrBrmOCabjTIVMaIOWjLIPjNKJ8+eLnv+FuKUCc9mrAjbkXaP8T3JF43ofaBgSk09S3yo6wI3XI8ZlgROLDt7xxbFKosK/tYe8uOkpladNQHq3+EhAmzsfZJIstY0tNeK7aQ2KlsH6hZkLpqHsoKdzsLhRpMuPnV7wNlrikrbcvousDdQBpnzhNaXcm2BW+jmOs= trainee@debian12 +
-ssh-dss AAAAB3NzaC1kc3MAAACBAMbFW6WkZFJ/ueao6xjxBb+wbbIhIyiH/GM6W/7ayiNmCfFlYCxw9nNAVghYJYNcP2hB+l0qZ0JYrOMUX82sXAvtYbbO1xSZWNTTrbYEyR+o2ZWlgYBDz0DYj++dLCl0zCGHOfRq2VHtCx93mCxCiw5NXNflxOuy2WoY7hawxV/RAAAAFQDURMf0f29i5or5GrE4JWlFVZbiIwAAAIBqGpwpz+uQTKpJmgiisVA1t/0MRP2YstUVnU29Nr/C7EJ3bom3wx4At/bbQEfc7iVf0pwRUSJhdTy4t2vnFWghoeoj2ALUA4QVarVr7m0TY7m8bYgAlPVBx674DDmHfUh99PTwYcrcJUJMpVd+mwVccnXGigpHhs84QvD6csmxCwAAAIAEtC/YVdYAxFUd+ScG0zrBSsPHA/cigCF5cywNeu+OZqrK2y6yiJwp9T9bCL2nvzTWeTg/2Ev7v7Zh2oNKE5/mUoTDDn22omefi9Ecxl9W6Pyi8R6PxV+8mXtjHKPVNEQyqA8tAG1VN33MMgWz5HUEdwdUrOcmrkpyXNsRzvgD6w== trainee@debian12 +
-ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILP736HSOOTZBe6+CHy8PINQ4gb9kKB4xj0JWWZy1Wgl trainee@debian12+
 </code> </code>
  
-<WRAP center round important 50%> +Vérifiez la bonne installation de snort3 :
-**Important** - Notez que lors de la connexion au serveur, l'authentification utilise le couple de clefs asymétrique et aucun mot de passe n'est requis. +
-</WRAP> +
- +
-===Options de la commande=== +
- +
-Les options de cette commande sont : +
- +
-<code> +
-trainee@debian12:~$ ssh --help +
-unknown option -- - +
-usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface] +
-           [-b bind_address] [-c cipher_spec] [-D [bind_address:]port] +
-           [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11] +
-           [-i identity_file] [-J [user@]host[:port]] [-L address] +
-           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port] +
-           [-Q query_option] [-R address] [-S ctl_path] [-W host:port] +
-           [-w local_tun[:remote_tun]] destination [command [argument ...]] +
-</code> +
- +
-====3.5 - Tunnels SSH==== +
- +
-Le protocole SSH peut être utilisé pour sécuriser les protocoles tels telnet, pop3 etc.. En effet, on peut créer un //tunnel// SSH dans lequel passe les communications du protocole non-sécurisé. +
- +
-La commande pour créer un tunnel ssh prend la forme suivante : +
- +
-  ssh -N -f compte@<hôte_local> -L<port-local>:<hôte_distant>:<port_distant> +
- +
-Dans votre cas, vous allez créer un tunnel entre Debian 12 et CentOS 8 entre le port 15023 et le port 23 :+
  
 <code> <code>
-trainee@debian12:~$ su - +root@debian12:~/snort-source-files/snort3/build# snort --version
-Password: fenestros+
  
-root@debian12:~# ssh -N -f trainee@localhost -L15023:10.0.2.45:23+   ,,    -*> Snort++ <*- 
 +  o"  )  Version 3.10.0.0 
 +   ''''    By Martin Roesch & The Snort Team 
 +           http://snort.org/contact#team 
 +           Copyright (C) 2014-2025 Cisco and/or its affiliates. All rights reserved. 
 +           Copyright (C) 1998-2013 Sourcefire, Inc., et al. 
 +           Using DAQ version 3.0.23 
 +           Using libpcap version 1.10.3 (with TPACKET_V3) 
 +           Using LuaJIT version 2.1.0-beta3 
 +           Using LZMA version 5.4.1 
 +           Using OpenSSL 3.0.17 1 Jul 2025 
 +           Using PCRE2 version 10.42 2022-12-11 
 +           Using ZLIB version 1.2.13
 </code> </code>
  
-Installez maintenant le client et le serveur telnet dans la VM CentOS 8:+==Options de la commande==
  
 <code> <code>
-root@debian12:~# ssh -l trainee 10.0.2.45 +root@debian12:~/snort-source-files/snort3/build# snort --help
-The authenticity of host '10.0.2.45 (10.0.2.45)' can't be established. +
-ED25519 key fingerprint is SHA256:YRt3r4qD/pZ8PoJ2irS3bH2miZj6/O3/kS4CBlcbz84. +
-This key is not known by any other names. +
-Are you sure you want to continue connecting (yes/no/[fingerprint])? yes +
-Warning: Permanently added '10.0.2.45' (ED25519) to the list of known hosts. +
-trainee@10.0.2.45's password: trainee +
-Activate the web console with: systemctl enable --now cockpit.socket+
  
-Last loginThu Nov  6 04:13:03 2025 from 10.0.2.45+Snort has several options to get more help:
  
-[trainee@centos8 ~]$ su +-? list command line options (same as --help) 
-Password: fenestros+--help this overview of help 
 +--help-commands [<module prefix>output matching commands 
 +--help-config [<module prefix>] output matching config options 
 +--help-counts [<module prefix>] output matching peg counts 
 +--help-limits print the int upper bounds denoted by max* 
 +--help-module <module> output description of given module 
 +--help-modules list all available modules with brief help 
 +--help-modules-json dump description of all available modules in JSON format 
 +--help-plugins list all available plugins with brief help 
 +--help-options [<option prefix>] output matching command line options 
 +--help-signals dump available control signals 
 +--list-buffers output available inspection buffers 
 +--list-builtin [<module prefix>] output matching builtin rules 
 +--list-gids [<module prefix>] output matching generators 
 +--list-modules [<module type>] list all known modules 
 +--list-plugins list all known modules 
 +--show-plugins list module and plugin versions
  
-[root@centos8 ~]# dnf install telnet-server +--help* and --list* options preempt other processing so should be last on the 
-</code> +command line since any following options are ignored To ensure options like 
- +--markup and --plugin-path take effect, place them ahead of the help or list 
-Telnet n'est ni démarré ni activé. Il convient donc de le démarrer et de l'activer : +options.
- +
-<code> +
-[root@centos8 ~]# systemctl status telnet.socket +
-● telnet.socket Telnet Server Activation Socket +
-   Loaded: loaded (/usr/lib/systemd/system/telnet.socket; disabled; vendor preset: disabled) +
-   Active: inactive (dead) +
-     Docs: man:telnetd(8) +
-   Listen: [::]:23 (Stream) +
- Accepted: 0; Connected: 0; +
- +
-[root@centos8 ~]# systemctl start telnet.socket +
- +
-[root@centos8 ~]# systemctl status telnet.socket +
-● telnet.socket Telnet Server Activation Socket +
-   Loaded: loaded (/usr/lib/systemd/system/telnet.socket; disabled; vendor preset: disabled) +
-   Active: active (listening) since Fri 2025-11-28 09:42:52 EST; 2s ago +
-     Docs: man:telnetd(8) +
-   Listen: [::]:23 (Stream) +
- Accepted: 0; Connected: 0; +
-   CGroup: /system.slice/telnet.socket +
- +
-Nov 28 09:42:52 centos8.ittraining.loc systemd[1]: Listening on Telnet Server Activation Socket. +
- +
-[root@centos8 ~]# systemctl enable telnet.socket +
-Created symlink /etc/systemd/system/sockets.target.wants/telnet.socket → /usr/lib/systemd/system/telnet.socket.+
  
-[root@centos8 ~]# systemctl status telnet.socket +Options that filter output based on a matching prefix, such as --help-config 
-● telnet.socket Telnet Server Activation Socket +won't output anything if there is no match.  If no prefix is given, everything 
-   Loaded: loaded (/usr/lib/systemd/system/telnet.socket; enabled; vendor preset: disabled) +matches.
-   Active: active (listening) since Fri 2025-11-28 09:42:52 EST; 43s ago +
-     Docs: man:telnetd(8) +
-   Listen: [::]:23 (Stream) +
- Accepted: 0; Connected: 0; +
-   CGroup: /system.slice/telnet.socket+
  
-Nov 28 09:42:52 centos8.ittraining.loc systemd[1]: Listening on Telnet Server Activation Socket.+Report bugs to bugs@snort.org.
 </code> </code>
  
-Arrêtez le service firewalld :+Snort 3 utilise des modules. Pour consulter la liste des modules, utilisez la commande suivante :
  
 <code> <code>
-[root@centos8 ~]systemctl stop firewalld +root@debian12:~/snort-source-files/snort3/buildsnort --help-modules | more 
- +ac_bnfa (search_engine): Aho-Corasick Binary NFA (low memory, low performance) MPSE 
-[root@centos8 ~]# iptables -L +ac_full (search_engine): Aho-Corasick Full (high memory, best performance), implements search_all() 
-Chain INPUT (policy ACCEPT+ack (ips_option): rule option to match on TCP ack numbers 
-target     prot opt source               destination          +active (basic): configure responses 
- +address_space_selector (policy_selector): configure traffic processing based on address space 
-Chain FORWARD (policy ACCEPT+alert (ips_action): manage the counters for the alert action 
-target     prot opt source               destination          +alert_csv (logger): output event in csv format 
- +alert_fast (logger): output event with brief text format 
-Chain OUTPUT (policy ACCEPT+alert_full (logger): output event with full packet dump 
-target     prot opt source               destination+alert_json (logger): output event in json format 
 +alert_syslog (logger): output event to syslog 
 +alert_talos (logger): output event in Talos alert format 
 +alert_unixsock (logger): output event over unix socket 
 +alerts (basic): configure alerts 
 +appid (inspector): application and service identification 
 +appids (ips_option): detection option for application ids 
 +arp (codec): support for address resolution protocol 
 +arp_spoof (inspector): detect ARP attacks and anomalies 
 +attribute_table (basic): configure hosts loading 
 +auth (codec): support for IP authentication header 
 +back_orifice (inspector): back orifice detection 
 +base64_decode (ips_option): rule option to decode base64 data - must be used with base64_data option 
 +ber_data (ips_option): rule option to move to the data for a specified BER element 
 +ber_skip (ips_option): rule option to skip BER element 
 +binder (inspector): configure processing based on CIDRs, ports, services, etc. 
 +block (ips_action): manage the counters for the block action 
 +bufferlen (ips_option): rule option to check length of current buffer 
 +byte_extract (ips_option): rule option to convert data to an integer variable 
 +byte_jump (ips_option): rule option to move the detection cursor 
 +byte_math (ips_option): rule option to perform mathematical operations on extracted value and a specified value or existing variable 
 +byte_test (ips_option): rule option to convert data to integer and compare 
 +cip (inspector): cip inspection 
 +cip_attribute (ips_option): detection option to match CIP attribute 
 +cip_class (ips_option): detection option to match CIP class 
 +cip_conn_path_class (ips_option): detection option to match CIP Connection Path Class 
 +cip_instance (ips_option): detection option to match CIP instance 
 +cip_req (ips_option): detection option to match CIP request 
 +cip_rsp (ips_option): detection option to match CIP response 
 +cip_service (ips_option): detection option to match CIP service 
 +cip_status (ips_option): detection option to match CIP response status 
 +ciscometadata (codec): support for cisco metadata 
 +classifications (basic): define rule categories with priority 
 +classtype (ips_option): general rule option for rule classification 
 +content (ips_option): payload rule option for basic pattern matching 
 +cvs (ips_option): payload rule option for detecting specific attacks 
 +daq (basic): configure packet acquisition interface 
 +dce_http_proxy (inspector): dce over http inspection - client to/from proxy 
 +dce_http_server (inspector): dce over http inspection - proxy to/from server 
 +dce_iface (ips_option): detection option to check dcerpc interface 
 +dce_opnum (ips_option): detection option to check dcerpc operation number 
 +dce_smb (inspector): dce over smb inspection 
 +dce_stub_data (ips_option): sets the cursor to dcerpc stub data 
 +dce_tcp (inspector): dce over tcp inspection 
 +dce_udp (inspector): dce over udp inspection 
 +decode (basic): general decoder rules 
 +--More--
 </code> </code>
  
-Connectez-vous ensuite via telnet sur CentOS 8 en utilisant le port 15023 de votre VM Debian 12 :+Pour obtenir une aide sur un module spécifique, utilisez la commande **snort --help-module <nom_module>** :
  
 <code> <code>
-root@debian12:~# telnet localhost 15023 +root@debian12:~/snort-source-files/snort3/buildsnort --help-module ac_bnfa
-Trying ::1... +
-Connected to localhost. +
-Escape character is '^]'.+
  
-Kernel 4.18.0-348.7.1.el8_5.x86_64 on an x86_64 +ac_bnfa
-centos8 login: trainee +
-Password:  +
-Last login: Fri Nov 28 09:45:22 from 10.0.2.46+
  
-[trainee@centos8 ~]$ pwd 
-/home/trainee 
  
-[trainee@centos8 ~]$ exit +HelpAho-Corasick Binary NFA (low memory, low performance) MPSE
-logout +
-Connection closed by foreign host. +
-root@debian12:~#  +
-</code>+
  
-<WRAP center round important 50%> +Type: search_engine
-**Important** - Notez bien que votre communication telnet passe par le tunnel SSH. +
-</WRAP>+
  
-====3.6 - SCP====+Usage: global
  
-===Introduction===+Peg counts: 
  
-La commande **scp** est le successeur et la remplaçante de la commande **rcp** de la famille des commandes **remote**Il permet de faire des transferts sécurisés à partir d'une machine distante : +ac_bnfa.searchesnumber of search attempts (sum
- +ac_bnfa.matchesnumber of times a match was found (sum
-  $ scp compte@numero_ip(nom_de_machine):/chemin_distant/fichier_distant /chemin_local/fichier_local +ac_bnfa.bytestotal bytes searched (sum)
- +
-ou vers une machine distante : +
- +
-  $ scp /chemin_local/fichier_local compte@numero_ip(nom_de_machine):/chemin_distant/fichier_distant +
- +
-===Utilisation=== +
- +
-Nous allons maintenant utiliser **scp** pour chercher un fichier sur le <<serveur>> : +
- +
-Créez le fichier **/home/trainee/scp_test** : +
- +
-<code> +
-trainee@debian12:~$ touch /home/trainee/scp_test+
 </code> </code>
  
-Récupérez le fichier **scp_test** en utilisant scp :+Dernièrement, vous pouvez obtenir de l'aide sur la configuration de snort avec la commande suivante :
  
 <code> <code>
- +root@debian12:~/snort-source-files/snort3/build# snort --help-config | more 
-trainee@debian12:~$ scp trainee@127.0.0.1:/home/trainee/scp_test /tmp/scp_test +interval ack.~range: check if TCP ack value is 'value | min<>max | <max | >min'0: } 
- +int active.attempts = 0: number of TCP packets sent per response (with varying sequence numbers) { 0:255 } 
-trainee@debian12:~ls /tmp/scp_test +string active.device: use 'ip' for network layer responses or 'eth0' etc for link layer 
-/tmp/scp_test+string active.dst_mac: use format '01:23:45:67:89:ab' 
 +int active.max_responses = 0: maximum number of responses { 0:255 } 
 +int active.min_interval = 255: minimum number of seconds between responses { 1:255 } 
 +string address_space_selector[].addr_spaces: list of address space IDs to match 
 +string address_space_selector[].fileuse configuration in given file 
 +bool alert_csv.file = false: output to alert_csv.txt instead of stdout 
 +multi alert_csv.fields = 'timestamp pkt_num proto pkt_gen pkt_len dir src_ap dst_ap rule action': selected fields will be output in given order left to right { action | class | b64_data | client_bytes | client_ 
 +pkts | dir | dst_addr | dst_ap | dst_port | eth_dst | eth_len | eth_src | eth_type | flowstart_time | geneve_vni | gid | icmp_code | icmp_id | icmp_seq | icmp_type | iface | ip_id | ip_len | msg | mpls | pkt_ge 
 +n | pkt_len | pkt_num | priority | proto | rev | rule | seconds | server_bytes | server_pkts | service | sgt| sid | src_addr | src_ap | src_port | target | tcp_ack | tcp_flags | tcp_len | tcp_seq | tcp_win | ti 
 +mestamp | tos | ttl | udp_len | vlan } 
 +int alert_csv.limit = 0: set maximum size in MB before rollover (0 is unlimited) { 0:maxSZ } 
 +string alert_csv.separator = ', ': separate fields with this character sequence 
 +bool alert_fast.file = false: output to alert_fast.txt instead of stdout 
 +bool alert_fast.packet = false: output packet dump with alert 
 +enum alert_fast.buffers = 'none': output IPS buffer dump (evaluated by IPS rule or an inspector) { 'none' | 'rule' | 'inspector' | 'both'
 +int alert_fast.buffers_depth = 0: number of IPS buffer bytes to dump per buffer (0 is unlimited) { 0:maxSZ } 
 +int alert_fast.limit = 0: set maximum size in MB before rollover (0 is unlimited) { 0:maxSZ } 
 +bool alert_full.file = false: output to alert_full.txt instead of stdout 
 +int alert_full.limit = 0: set maximum size in MB before rollover (0 is unlimited) { 0:maxSZ } 
 +bool alert_json.file = false: output to alert_json.txt instead of stdout 
 +multi alert_json.fields = 'timestamp pkt_num proto pkt_gen pkt_len dir src_ap dst_ap rule action': selected fields will be output in given order left to right { action | class | b64_data | client_bytes | client 
 +_pkts | dir | dst_addr | dst_ap | dst_port | eth_dst | eth_len | eth_src | eth_type | flowstart_time | geneve_vni | gid | icmp_code | icmp_id | icmp_seq | icmp_type | iface | ip_id | ip_len | msg | mpls | pkt_g 
 +en | pkt_len | pkt_num | priority | proto | rev | rule | seconds | server_bytes | server_pkts | service | sgt| sid | src_addr | src_ap | src_port | target | tcp_ack | tcp_flags | tcp_len | tcp_seq | tcp_win | t 
 +imestamp | tos | ttl | udp_len | vlan } 
 +int alert_json.limit = 0: set maximum size in MB before rollover (0 is unlimited) { 0:maxSZ } 
 +string alert_json.separator = ', ': separate fields with this character sequence 
 +enum alert_syslog.facility = 'auth': part of priority applied to each message { 'auth' | 'authpriv' | 'daemon' | 'user' | 'local0' | 'local1' | 'local2' | 'local3' | 'local4' | 'local5' | 'local6' | 'local7'
 +enum alert_syslog.level = 'info': part of priority applied to each message { 'emerg' | 'alert' | 'crit' | 'err' | 'warning' | 'notice' | 'info' | 'debug'
 +multi alert_syslog.options: used to open the syslog connection { cons | ndelay | perror | pid } 
 +bool alerts.alert_with_interface_name = false: include interface in alert info (fast, full, or syslog only) 
 +int alerts.detection_filter_memcap = 1048576: set available MB of memory for detection_filters { 0:max32 } 
 +int alerts.event_filter_memcap = 1048576: set available MB of memory for event_filters { 0:max32 } 
 +bool alerts.log_references = false: include rule references in alert info (full only) 
 +string alerts.order: change the order of rule action application 
 +int alerts.rate_filter_memcap = 1048576: set available MB of memory for rate_filters { 0:max32 } 
 +string alerts.reference_net: set the CIDR for homenet (for use with -l or -B, does NOT change $HOME_NET in IDS mode) 
 +string alerts.tunnel_verdicts: let DAQ handle non-allow verdicts for gtp|teredo|6in4|4in6|4in4|6in6|gre|mpls|vxlan traffic 
 +int appid.memcap = 1048576: max size of the service cache before we start pruning the cache { 1024:maxSZ } 
 +bool appid.log_stats = false: enable logging of appid statistics 
 +int appid.app_stats_period = 300: time period for collecting and logging appid statistics { 1:max32 } 
 +int appid.app_stats_rollover_size = 20971520: max file size for appid stats before rolling over the log file { 0:max32 } 
 +string appid.app_detector_dir: directory to load appid detectors from 
 +bool appid.list_odp_detectors = false: enable logging of odp detectors statistics 
 +string appid.tp_appid_path: path to third party appid dynamic library 
 +string appid.tp_appid_config: path to third party appid configuration file 
 +bool appid.tp_appid_stats_enable: enable collection of stats and print stats on exit in third party module 
 +bool appid.tp_appid_config_dump: print third party configuration on startup 
 +bool appid.log_all_sessions = false: enable logging of all appid sessions 
 +bool appid.enable_rna_filter = false: monitor only the networks specified in rna configuration 
 +string appid.rna_conf_path: path to rna configuration file 
 +string appids.~: comma separated list of application names 
 +ip4 arp_spoof.hosts[].ip: host ip address 
 +--More--
 </code> </code>
  
-=====LAB #4 Mise en place d'un VPN avec OpenVPN=====+===2.2 Configuration de Snort===
  
-====4.1 - Présentation==== +Pour vérifier la configuration actuelle de snortexécutez la commande suivante :
- +
-**%%OpenVPN%%** : +
- +
-  * permet à des pairs de s'authentifier entre eux à l'aide : +
-    * d'une **clé privée partagée** à l'avance +
-    * de **certificats** ou,  +
-    * à partir de la version 2.0 et à condition que le serveur possède un certificat, de **couples de noms d'utilisateur/mot de passe** sans besoin d'un certificat client +
-  * utilise de manière intensive la bibliothèque d'authentification **%%OpenSSL%%** ainsi que le protocole **SSLv3/TLSv1**,  +
-  * n'est pas compatible avec IPsec ou d'autres logiciels VPN.  +
- +
-====Configuration commune au client et au serveur==== +
- +
-Installez le paquet openvpn :+
  
 <code> <code>
-root@debian12:~# apt install openvpn +root@debian12:~/snort-source-files/snort3/build# cd ~
-</code>+
  
-Naviguez au répertoire **/etc/openvpn** et créez la clef partagée :+root@debian12:~# snort -c /usr/local/snort/etc/snort/snort.lua 
 +-------------------------------------------------- 
 +o")~   Snort++ 3.10.0.0 
 +-------------------------------------------------- 
 +Loading /usr/local/snort/etc/snort/snort.lua: 
 +Loading snort_defaults.lua: 
 +Finished snort_defaults.lua: 
 +        output 
 +        active 
 +        alerts 
 +        daq 
 +        decode 
 +        host_cache 
 +        host_tracker 
 +        hosts 
 +        network 
 +        packets 
 +        process 
 +        search_engine 
 +        so_proxy 
 +        stream 
 +        stream_ip 
 +        stream_icmp 
 +        stream_udp 
 +        stream_user 
 +        stream_file 
 +        arp_spoof 
 +        back_orifice 
 +        imap 
 +        netflow 
 +        normalizer 
 +        pop 
 +        sip 
 +        ssh 
 +        ssl 
 +        telnet 
 +        cip 
 +        dnp3 
 +        iec104 
 +        mms 
 +        modbus 
 +        opcua 
 +        s7commplus 
 +        dce_smb 
 +        dce_tcp 
 +        dce_udp 
 +        dce_http_proxy 
 +        dce_http_server 
 +        gtp_inspect 
 +        port_scan 
 +        smtp 
 +        ftp_server 
 +        ftp_client 
 +        ftp_data 
 +        http_inspect 
 +        http2_inspect 
 +        file_policy 
 +        js_norm 
 +        appid 
 +        wizard 
 +        ips 
 +        binder 
 +        references 
 +        classifications 
 +        file_id 
 +        rpc_decode 
 +        dns 
 +        stream_tcp 
 +        trace 
 +Finished /usr/local/snort/etc/snort/snort.lua: 
 +Loading file_id.rules_file: 
 +Loading file_magic.rules: 
 +Finished file_magic.rules: 
 +Finished file_id.rules_file: 
 +-------------------------------------------------- 
 +ips policies rule stats 
 +              id  loaded  shared enabled    file 
 +                   219           219    /usr/local/snort/etc/snort/snort.lua 
 +-------------------------------------------------- 
 +rule counts 
 +       total rules loaded: 219 
 +               text rules: 219 
 +            option chains: 219 
 +            chain headers: 1 
 +-------------------------------------------------- 
 +service rule counts          to-srv  to-cli 
 +                  file_id:      219     219 
 +                    total:      219     219 
 +-------------------------------------------------- 
 +fast pattern groups 
 +                to_server: 1 
 +                to_client: 1 
 +-------------------------------------------------- 
 +search engine (ac_bnfa) 
 +                instances: 2 
 +                 patterns: 438 
 +            pattern chars: 2602 
 +               num states: 1832 
 +         num match states: 392 
 +             memory scale: KB 
 +             total memory: 71.2812 
 +           pattern memory: 19.6484 
 +        match list memory: 28.4375 
 +        transition memory: 22.9453 
 +appid: MaxRss diff: 3084 
 +appid: patterns loaded300 
 +-------------------------------------------------- 
 +pcap DAQ configured to passive.
  
-<code> +Snort successfully validated the configuration (with 0 warnings). 
-[root@centos7 ~]# cd /etc/openvpn/ +o")  Snort exiting
- +
-root@debian12:/etc/openvpn# openvpn --genkey secret static.key +
- +
-root@debian12:/etc/openvpn# cat static.key +
-+
-# 2048 bit OpenVPN static key +
-+
------BEGIN OpenVPN Static key V1----- +
-77b47829a9d17aacc71b05a2bfa9bcba +
-e90370cc07238a5adb74ef479e87547d +
-fc18a69c3c5307bdc1ca27c7aa6f3a35 +
-e09e815a27f50c28699be3af28decd3c +
-b319923c2fe3826c2afb41d2e0239229 +
-fee9bc33566941e09e2f905f1bcbb59a +
-55cf8d535334ac46eda3f35be0b7e22b +
-c3261de182f7cde5cc7d756420907514 +
-0399672d104cebee31a44ca6d89663c7 +
-784b928e893c4d3a6e7d294e94266e1b +
-5a98f80f797651199069902be01d2bbd +
-94765d310f8d0466484a0e7cbf10bb98 +
-d247127aa53a6c18a6def6ed73a28b69 +
-b7d052209318057e2ccb9660fc42543b +
-d79dab314ecbc19a6b8936255c17d673 +
-fb0bdc3856a034ffc3931a7d645d6d96 +
------END OpenVPN Static key V1-----+
 </code> </code>
  
-<code> +=== 2.3 - Utilisation de snort ===
-root@debian12:~# scp /etc/openvpn/static.key trainee@10.0.2.45:/tmp/static.key +
-trainee@10.0.2.45's password:  +
-static.key                                                                                                                                                                      100%  636     1.2MB/  00:00 +
-</code>+
  
-====Configuration du client====+Pour lancer Snort 3 en tant qu'outil de détection d'instrusion, utilisez la commande suivante :
  
 <code> <code>
-root@debian12:/etc/openvpn# ssh -l trainee 10.0.2.45 +root@debian12:~# snort -c /usr/local/snort/etc/snort/snort.lua -i ens18 -A alert_fast -s 65535 -k none & 
-trainee@10.0.2.45's password: trainee +[2] 28057
-Activate the web console with: systemctl enable --now cockpit.socket+
  
-Last loginFri Nov 28 09:47:05 2025 from ::ffff:10.0.2.46+root@debian12:~# -------------------------------------------------- 
 +o")~   Snort++ 3.10.0.0 
 +-------------------------------------------------- 
 +Loading /usr/local/snort/etc/snort/snort.lua: 
 +Loading snort_defaults.lua: 
 +Finished snort_defaults.lua: 
 +        active 
 +        alerts 
 +        daq 
 +        decode 
 +        host_cache 
 +        host_tracker 
 +        hosts 
 +        packets 
 +        process 
 +        search_engine 
 +        so_proxy 
 +        stream 
 +        stream_ip 
 +        stream_icmp 
 +        stream_tcp 
 +        stream_udp 
 +        stream_user 
 +        stream_file 
 +        arp_spoof 
 +        back_orifice 
 +        dns 
 +        imap 
 +        netflow 
 +        normalizer 
 +        pop 
 +        rpc_decode 
 +        sip 
 +        ssh 
 +        ssl 
 +        telnet 
 +        cip 
 +        dnp3 
 +        iec104 
 +        modbus 
 +        opcua 
 +        s7commplus 
 +        dce_smb 
 +        dce_tcp 
 +        dce_udp 
 +        dce_http_proxy 
 +        dce_http_server 
 +        gtp_inspect 
 +        smtp 
 +        ftp_server 
 +        ftp_client 
 +        ftp_data 
 +        http_inspect 
 +        http2_inspect 
 +        file_policy 
 +        appid 
 +        wizard 
 +        binder 
 +        ips 
 +        classifications 
 +        js_norm 
 +        file_id 
 +        port_scan 
 +        mms 
 +        output 
 +        references 
 +        network 
 +        trace 
 +Finished /usr/local/snort/etc/snort/snort.lua: 
 +Loading file_id.rules_file: 
 +Loading file_magic.rules: 
 +Finished file_magic.rules: 
 +Finished file_id.rules_file: 
 +-------------------------------------------------- 
 +ips policies rule stats 
 +              id  loaded  shared enabled    file 
 +                   219           219    /usr/local/snort/etc/snort/snort.lua 
 +-------------------------------------------------- 
 +rule counts 
 +       total rules loaded: 219 
 +               text rules: 219 
 +            option chains: 219 
 +            chain headers: 1 
 +-------------------------------------------------- 
 +service rule counts          to-srv  to-cli 
 +                  file_id:      219     219 
 +                    total:      219     219 
 +-------------------------------------------------- 
 +fast pattern groups 
 +                to_server: 1 
 +                to_client: 1 
 +-------------------------------------------------- 
 +search engine (ac_bnfa) 
 +                instances: 2 
 +                 patterns: 438 
 +            pattern chars: 2602 
 +               num states: 1832 
 +         num match states: 392 
 +             memory scale: KB 
 +             total memory: 71.2812 
 +           pattern memory: 19.6484 
 +        match list memory: 28.4375 
 +        transition memory: 22.9453 
 +appid: MaxRss diff: 3408 
 +appid: patterns loaded: 300 
 +-------------------------------------------------- 
 +pcap DAQ configured to passive. 
 +Commencing packet processing 
 +Retry queue interval is: 200 ms 
 +++ [0] ens18 
 +[Entrée]
  
-[trainee@centos8 ~]$ su +root@debian12:~# ps aux | grep 28057 
-Passwordfenestros+root       28057  1.9  0.3 188032 56952 pts/3    Sl   15:52   0:03 snort -c /usr/local/snort/etc/snort/snort.lua -i ens18 -A alert_fast -s 65535 -k none 
 +root       28065  0.0  0.0   6340  2056 pts/3    S+   15:54   0:00 grep 28057
 </code> </code>
  
-<code> +Tuez le processus de Snort 3 :
-[root@centos8 ~]# dnf install epel-release +
-</code>+
  
 <code> <code>
-[root@centos8 ~]dnf install openvpn +root@debian12:~# kill 28057 
-</code>+root@debian12:~# ** caught term signal 
 +== stopping 
 +-- [0] ens18 
 +-------------------------------------------------- 
 +Packet Statistics 
 +-------------------------------------------------- 
 +daq 
 +                 received: 1070 
 +                 analyzed: 1067 
 +                    allow: 1067 
 +                 rx_bytes: 201558 
 +-------------------------------------------------- 
 +codec 
 +                    total: 1067         (100.000%) 
 +                      arp: 12            1.125%) 
 +                      eth: 1067         (100.000%) 
 +                    icmp4: 1            (  0.094%) 
 +                 icmp4_ip: 1            (  0.094%) 
 +                    icmp6: 1            (  0.094%) 
 +                     ipv4: 1054         ( 98.782%) 
 +                     ipv6: 1            (  0.094%) 
 +                      tcp: 1052         ( 98.594%) 
 +                      udp: 1            (  0.094%) 
 +-------------------------------------------------- 
 +Module Statistics 
 +-------------------------------------------------- 
 +ac_full 
 +                 searches:
 +                    bytes: 184 
 +-------------------------------------------------- 
 +appid 
 +                  packets: 1055 
 +        processed_packets: 1048 
 +          ignored_packets:
 +           total_sessions:
 +       service_cache_adds:
 +             bytes_in_use: 168 
 +             items_in_use:
 +-------------------------------------------------- 
 +arp_spoof 
 +                  packets: 12 
 +-------------------------------------------------- 
 +back_orifice 
 +                  packets: 1 
 +-------------------------------------------------- 
 +binder 
 +              raw_packets: 19 
 +                new_flows: 5 
 +                 inspects: 24 
 +-------------------------------------------------- 
 +detection 
 +                 analyzed: 1067 
 +-------------------------------------------------- 
 +port_scan 
 +                  packets: 1055 
 +                 trackers:
 +-------------------------------------------------- 
 +stream 
 +                    flows: 5 
 +             total_prunes:
 +idle_prunes_proto_timeout:
 +       udp_timeout_prunes:
 +      icmp_timeout_prunes:
 +-------------------------------------------------- 
 +stream_icmp 
 +                 sessions:
 +                      max: 2 
 +                  created: 2 
 +                 released:
 +-------------------------------------------------- 
 +stream_tcp 
 +                 sessions:
 +                      max: 2 
 +                  created: 2 
 +                 released:
 +                 timeouts:
 +             instantiated:
 +                   setups:
 +            data_trackers:
 +              segs_queued: 639 
 +            segs_released: 639 
 +                segs_used: 638 
 +          rebuilt_packets: 144 
 +            rebuilt_bytes: 131204 
 +          client_cleanups:
 +          server_cleanups:
 +        partial_fallbacks:
 +                 max_segs: 199 
 +                max_bytes: 9608 
 +-------------------------------------------------- 
 +stream_udp 
 +                 sessions:
 +                      max: 1 
 +                  created: 1 
 +                 released:
 +              total_bytes: 92 
 +-------------------------------------------------- 
 +wizard 
 +                tcp_scans: 292 
 +               tcp_misses:
 +                udp_scans: 1 
 +               udp_misses:
 +-------------------------------------------------- 
 +Appid Statistics 
 +-------------------------------------------------- 
 +detected apps and services 
 +              Application: Services   Clients    Users      Payloads   Misc       Referred   
 +                  unknown: 2          0          0          0          0          0          
 +-------------------------------------------------- 
 +Summary Statistics 
 +-------------------------------------------------- 
 +process 
 +                  signals: 1 
 +-------------------------------------------------- 
 +timing 
 +                  runtime: 00:10:13 
 +                  seconds: 613.666561 
 +                 pkts/sec: 2 
 +o")~   Snort exiting
  
-<code> +[2]+  Done                    snort -c /usr/local/snort/etc/snort/snort.lua -i ens18 -A alert_fast -s 65535 -k none  (wd: /usr/local/snort/etc/snort) 
-[root@centos8 ~]# mv /tmp/static.key /etc/openvpn +(wd now: ~)
-[root@centos8 ~]# ls /etc/openvpn +
-client  server  static.key+
 </code> </code>
  
-Créez le fichier **/etc/openvpn/client/client.conf** :+====LAB #3 - Mise en place du Système de Détection et de Prévention d'Intrusion Portsentry====
  
-<code> +Portsentry est un **S**ystème de **D**étection et de **Prévention** d'**I**ntrusion (SDPI) qui surveille les requêtes entrantes et en cas d'anomalie bloque l'adresse IP de l'attaquant en inscrivant une règle dans le pare-feu NetFilter (Iptables).
-[root@centos8 ~]# vi /etc/openvpn/client/client.conf +
-[root@centos8 ~]# cat /etc/openvpn/client/client.conf +
-remote 10.0.2.46 +
-dev tun +
-port 1194 +
-proto udp +
-comp-lzo +
-ifconfig 10.0.0.2 10.0.0.1 +
-secret /etc/openvpn/static.key +
-</code>+
  
-Lancez openvpn en ligne de commande et en arrière plan en spécifiant une journalisation :+===3.1 - Installation ===
  
-<code> +Utilisez simplement APT pour installer portsentry :
-[root@centos8 ~]# openvpn --config /etc/openvpn/client/client.conf > /var/log/vpn 2>&1 & +
-[1] 14598 +
-</code> +
- +
-Vérifiez ensuite que le **socket** d'openvpn soit ouvert :+
  
 <code> <code>
-[root@centos8 ~]netstat -an | grep 1194 +root@debian12:~# apt install portsentry
-udp        0      0 0.0.0.0:1194            0.0.0.0:   +
 </code> </code>
  
-Constatez ensuite la table de routage :+===3.2 - Configuration===
  
-<code>                             +Modifiez le fichier **/etc/portsentry/portsentry.conf** en mofifiant les lignes 135, 135 et 213 et en ajoutant la ligne **270** :
-[root@centos8 ~]# netstat -ar +
-Kernel IP routing table +
-Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface +
-default         _gateway        0.0.0.0         UG        0 0          0 ens18 +
-10.0.0.1        0.0.0.0         255.255.255.255 UH        0 0          0 tun0 +
-10.0.2.0        0.0.0.0         255.255.255.0           0 0          0 ens18 +
-192.168.122.0   0.0.0.0         255.255.255.0           0 0          0 virbr0 +
-</code> +
- +
-Notez la présence de la route via **tun0**+
- +
-Constatez ensuite le montage du tunnel en regardant le contenu du fichier de journalisation **/var/log/vpn** :+
  
 <code> <code>
-[root@centos7 ~]tail /var/log/vpn+root@debian12:~# vi /etc/portsentry/portsentry.conf 
 +... 
 +   131 # 0 = Do not block UDP/TCP scans. 
 +   132 # 1 = Block UDP/TCP scans. 
 +   133 # 2 = Run external command only (KILL_RUN_CMD) 
 +   134  
 +   135 BLOCK_UDP="1" 
 +   136 BLOCK_TCP="1" 
 +... 
 +   211 # iptables support for Linux with limit and LOG support. Logs only 
 +   212 # a limited number of packets to avoid a denial of service attack. 
 +   213 KILL_ROUTE="/sbin/iptables -I INPUT -s $TARGET$ -j DROP && /sbin/iptables -I INPUT -s $TARGET$ -m limit --limit 3/minute --limit-burst 5 -j LOG --log-level DEBUG --log-prefix 'Portsentry: dropping: '" 
 +... 
 +    268 #KILL_RUN_CMD="/some/path/here/script $TARGET$ $PORT$ $MODE$" 
 +    269 # for examples see /usr/share/doc/portsentry/examples/ 
 +    270 KILL_RUN_CMD="/bin/mail -s 'Portscan from $TARGET$ on port $PORT$' root@localhost < /dev/null" 
 +...
 </code> </code>
  
-L'architecture réseau sera donc la suivante :+===3.3 - Utilisation===
  
-<file> +Redémarrez le service **portsentry** :
-                                   serveur <------------Votre réseau-------------> client +
-                                      |                                               | +
-                                      |                                               | +
-                                  eth0@ifxxx                                      eth0@ifxxx +
-                                  172.yy.0.3                                      172.yy.0.4  +
-</file> +
- +
-====Configuration du serveur==== +
- +
-Créez le fichier **/etc/openvpn/server/server.conf** :+
  
 <code> <code>
-root@debian12:~# vi /etc/openvpn/server/server.conf +root@debian12:~# systemctl restart portsentry
- +
-root@debian12:~# cat /etc/openvpn/server/server.conf +
-dev tun +
-ifconfig 10.0.0.1 10.0.0.2 +
-secret /etc/openvpn/static.key +
-port 1194 +
-proto udp +
-user nobody +
-group nobody +
-daemon +
-comp-lzo +
-keepalive 10 60 +
-ping-timer-rem +
-persist-tun +
-persist-key +
-log /var/log/vpn +
-verb 1 +
-</code> +
- +
-Arrêtez le service **firewalld** : +
- +
-<code> +
-root@debian12:~# systemctl stop firewalld +
- +
-root@debian12:~# iptables -L +
-Chain INPUT (policy ACCEPT) +
-target     prot opt source               destination         +
  
-Chain FORWARD (policy ACCEPT+root@debian12:~# systemctl status portsentry 
-target     prot opt source               destination         +● portsentry.service - LSB: # start and stop portsentry 
 +     Loaded: loaded (/etc/init.d/portsentry; generated
 +     Active: active (running) since Thu 2025-12-04 16:10:22 CET; 2s ago 
 +       Docs: man:systemd-sysv-generator(8) 
 +    Process: 28347 ExecStart=/etc/init.d/portsentry start (code=exited, status=0/SUCCESS) 
 +      Tasks: 2 (limit: 19123) 
 +     Memory: 768.0K 
 +        CPU: 84ms 
 +     CGroup: /system.slice/portsentry.service 
 +             ├─28360 /usr/sbin/portsentry -tcp 
 +             └─28364 /usr/sbin/portsentry -udp
  
-Chain OUTPUT (policy ACCEPT) +Dec 04 16:10:22 debian12 portsentry[28364]: adminalert: Going into listen mode on UDP port: 34555 
-target     prot opt source               destination+Dec 04 16:10:22 debian12 portsentry[28364]: adminalert: Going into listen mode on UDP port: 31335 
 +Dec 04 16:10:22 debian12 portsentry[28364]: adminalert: Going into listen mode on UDP port: 32770 
 +Dec 04 16:10:22 debian12 portsentry[28364]: adminalert: Going into listen mode on UDP port: 32771 
 +Dec 04 16:10:22 debian12 portsentry[28364]: adminalert: Going into listen mode on UDP port: 32772 
 +Dec 04 16:10:22 debian12 portsentry[28364]: adminalert: Going into listen mode on UDP port: 32773 
 +Dec 04 16:10:22 debian12 portsentry[28364]: adminalert: Going into listen mode on UDP port: 32774 
 +Dec 04 16:10:22 debian12 portsentry[28364]: adminalert: Going into listen mode on UDP port: 31337 
 +Dec 04 16:10:22 debian12 portsentry[28364]: adminalert: Going into listen mode on UDP port: 54321 
 +Dec 04 16:10:22 debian12 portsentry[28364]: adminalert: PortSentry is now active and listening.
 </code> </code>
  
-Lancez openvpn en ligne de commande et en arrière plan en spécifiant une journalisation :+Consultez les processus de Portsentry :
  
 <code> <code>
-root@debian12:~# openvpn --config /etc/openvpn/server/server.conf > /var/log/vpn 2>&1 & +root@debian12:~# ps aux | grep portsentry 
-[1] 11644 +root       28360  0.0  0.0   2500   112 ?        Ss   16:10   0:00 /usr/sbin/portsentry -tcp 
-</code> +root       28364  0.0  0.0   2500   112 ?        Ss   16:10   0:00 /usr/sbin/portsentry -udp 
- +root       28369  0.0  0.0   6340  2160 pts/   S+   16:10   0:00 grep portsentry
-Vérifiez ensuite que le **socket** d'openvpn soit ouvert : +
- +
-<code> +
-[root@centos7 ~]# netstat -an | grep 1194 +
-udp        0      0 0.0.0.0:1194                0.0.0.0:    +
-</code> +
- +
-Constatez ensuite la table de routage : +
- +
-<code>                             +
-[root@centos7 ~]# netstat -ar  +
-Kernel IP routing table +
-Destination     Gateway         Genmask         Flags   MSS Fenêtre irtt Iface +
-0.0.0.0         10.0.2.2        0.0.0.0         UG        0 0          0 enp0s3 +
-10.0.0.1        0.0.0.0         255.255.255.255 UH        0 0          0 tun0 +
-10.0.2.0        0.0.0.0         255.255.255.0   U         0          0 enp0s3 +
-</code> +
- +
-Constatez ensuite le montage du tunnel en regardant le contenu du fichier de journalisation **/var/log/vpn** : +
- +
-<code> +
-[root@centos7 ~]# tail /var/log/vpn +
-</code> +
- +
-====Tests==== +
- +
-===Du client vers le serveur=== +
- +
-Sur le client, utilisez la commande ping pour envoyer des paquets dans le tunnel : +
- +
-<code> +
-[root@centos6 ~]# ping -c3 10.0.0.1 +
-PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. +
-64 bytes from 10.0.0.1icmp_seq=1 ttl=64 time=7.62 ms +
-64 bytes from 10.0.0.1icmp_seq=2 ttl=64 time=1.35 ms +
-64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=0.000 ms +
- +
---- 10.0.0.1 ping statistics --- +
-3 packets transmitted, 3 received, 0% packet loss, time 2047ms +
-rtt min/avg/max/mdev = 0.000/2.994/7.629/3.323 ms +
-</code> +
- +
-===Du serveur vers le client=== +
- +
-Sur le serveur, utilisez la commande ping pour envoyer des paquets dans le tunnel : +
- +
-<code> +
-[root@centos7 ~]# ping -c5 10.0.0.2 +
-PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data. +
-64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=2.59 ms +
-64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=9.08 ms +
-64 bytes from 10.0.0.2: icmp_seq=ttl=64 time=7.24 ms +
-64 bytes from 10.0.0.2icmp_seq=4 ttl=64 time=7.03 ms +
-64 bytes from 10.0.0.2icmp_seq=5 ttl=64 time=4.08 ms +
- +
---- 10.0.0.2 ping statistics --- +
-5 packets transmitted, 5 received, 0% packet loss, time 4034ms +
-rtt min/avg/max/mdev = 2.597/6.008/9.084/2.340 ms+
 </code> </code>
  
 ----- -----
 Copyright © 2025 Hugh Norris. Copyright © 2025 Hugh Norris.
Menu