URL: https://linuxfr.org/forums/linux-debian-ubuntu/posts/tentatives-d-intrusion-statistiques Title: Tentatives d'intrusion : statistiques Authors: electro575 Date: 2023年09月26日T16:27:14+02:00 License: CC By-SA Tags: Score: 0 Bonjour à tous, Cela fait un moment que mes bécanes tournent. J'aimerais avoir des stats sur la fréquence des tentatives d'intrusions. S'ils sont élevés, alors je prendrais des mesures. J'ai étudié plusieurs solutions mais sans faire de linux régulièrement, je galère un peu. Mais l'idée réside dans les deux commandes ci-dessous. L'une donne le nombre de tentatives lié à une IP. L'autre donne le nombre de tentative lié à une plage horaire. Vous auriez une idée pour combiner ces deux besoins ? Merci beaucoup. Nombre de tentatives lié à une IP. ``` grep "authentication failure" auth.log | grep -Po "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | sort | un 4 1.11.62.189 2 1.202.82.212 2 1.28.86.66 ``` Nombre de tentative lié à une plage horaire. ``` grep 'authentication failure' auth.log | cut -d ':' -f1 | uniq -c 40 2023年09月24日T00 14 2023年09月24日T02 14 2023年09月24日T05 ``` Exemple de cas du auth.log : ``` 2023年09月25日T14:50:13.318740+02:00 myhost sshd[460029]: Failed password for invalid user root from 75.130.20.100 port 40358 ssh2 2023年09月25日T14:50:23.683302+02:00 myhost sshd[460029]: Failed password for invalid user root from 75.130.20.100 port 40358 ssh2 2023年09月25日T14:51:15.438862+02:00 myhost sshd[460029]: Failed password for invalid user root from 75.130.20.100 port 40358 ssh2 2023年09月24日T00:00:46.649222+02:00 myhost auth: pam_unix(dovecot:auth): check pass; user unknown 2023年09月24日T00:00:46.649418+02:00 myhost auth: pam_unix(dovecot:auth): authentication failure; logname= uid=0 euid=0 tty=dovecot ruser=mailer-daemon@domain.org rhost=219.128.15.190 2023年09月24日T00:00:48.942857+02:00 myhost auth: pam_unix(dovecot:auth): check pass; user unknown 2023年09月24日T00:00:48.943008+02:00 myhost auth: pam_unix(dovecot:auth): authentication failure; logname= uid=0 euid=0 tty=dovecot ruser=mailer-daemon@domain.org rhost=219.128.15.190 2023年09月24日T00:01:01.150765+02:00 myhost auth: pam_unix(dovecot:auth): check pass; user unknown 2023年09月24日T00:01:01.150917+02:00 myhost auth: pam_unix(dovecot:auth): authentication failure; logname= uid=0 euid=0 tty=dovecot ruser=mailer-daemon@domain.org rhost=182.225.134.13 2023年09月24日T00:01:02.837273+02:00 myhost auth: pam_unix(dovecot:auth): check pass; user unknown 2023年09月24日T00:01:02.837429+02:00 myhost auth: pam_unix(dovecot:auth): authentication failure; logname= uid=0 euid=0 tty=dovecot ruser=mailer-daemon@domain.org rhost=182.225.134.13 2023年09月24日T00:01:10.964225+02:00 myhost auth: pam_unix(dovecot:auth): check pass; user unknown ```