Installation de portsentry

Objet: bloquer les scanneurs de ports

Installation avec la méthode habituelle: apt install portsentry

Puis modification de certains paramètres dans le fichier /etc/portsentry/portsentry.conf :

##################
# Ignore Options #
##################
\[...]
# 0 = Do not block UDP/TCP scans.
# 1 = Block UDP/TCP scans.
# 2 = Run external command only (KILL_RUN_CMD)

BLOCK_UDP="2"
BLOCK_TCP="2"
###################
# External Command#
###################
\[...]
# The KILL_RUN_CMD_FIRST value should be set to "1" to force the command 
# to run \*before\* the blocking occurs and should be set to "0" to make the 
# command run \*after\* the blocking has occurred. 
#
KILL_RUN_CMD_FIRST = "1"
#
#
KILL_RUN_CMD="/home/unutilisateur/portsentry_ext_cmd.sh $TARGET$"
# for examples see /usr/share/doc/portsentry/examples/
Lire la suite “Installation de portsentry”

Fail2ban

Objet: Protection contre les attaques de type brute force.

Intallation: apt install fail2ban

Paramètrage: de base avec les modification suivantes:

Parametrage personnel pour les attaques répétitives avec recidive.conf placé dans le répertoire jail.d de fail2ban contenu de ce fichier:

[recidive]
enabled = true
filter = recidive
logpath = /var/log/fail2ban.log
banaction = nftables-allports
findtime = 86400 ; 1 jour
bantime = 2592000 ; 30 jours
maxretry = 3 ; au bout de trois tentatives
protocol = 0-255; ban de tous les protocoles

Lire la suite “Fail2ban”