Gestion des IA sous Plesk Web 2/3

Posté le 07 octobre 2025 par cyprien 5 min

Gestion des IA sous Plesk Web 2/3

On a vu dans le précédent billet comment installer Crowdsec, et d'y ajouter un certain nombre de scénarios suivant nos propres besoins. Nous nous étions arrêté sur le fait de savoir si oui ou non Crowdsec bloquait par défaut.

Crowdsec trop permissif?

Par défaut, la solution n'a qu'une vision d'alertes sur les potentielles attaques en cours, Scan ou toute autre joyeuseté. Cependant, vu que nous avons installé le bouncer dans le précédent billet, qui va lui, cependant bloquer toutes les IPs reconnues comme étant malveillantes.

Vérifier le fonctionnement de Crowdsec

Dans un premier temps, il va être nécessaire de modifier le fichier profiles.yaml afin d'augmenter le temps de bannissement de ces adresses IP. En effet, par défaut, c'est un blocage de 4heures, ce qui est court comme répit.

Voici mon fichier profiles.yaml :

name: default_ip_remediation
#debug: true filters:
- Alert.Remediation == true && Alert.GetScope() == "Ip" decisions:
  - type: ban    duration: 72h
 #duration_expr: Sprintf('%dh', (GetDecisionsCount(Alert.GetValue()) + 1) * 4)
 # notifications:
 #   - slack_default  # Set the webhook in /etc/crowdsec/notifications/slack.yaml before enabling this.
 #   - splunk_default # Set the splunk url and token in /etc/crowdsec/notifications/splunk.yaml before enabling this.
 #   - http_default   # Set the required http parameters in /etc/crowdsec/notifications/http.yaml before enabling this.
 #   - email_default  # Set the required email parameters in /etc/crowdsec/notifications/email.yaml before enabling this.
 on_success: break
 --- name: default_range_remediation
 #debug: true filters:
  - Alert.Remediation == true && Alert.GetScope() == "Range" decisions:
  - type: ban    duration: 72h
 #duration_expr: Sprintf('%dh', (GetDecisionsCount(Alert.GetValue()) + 1) * 4)
 # notifications:
 #   - slack_default  # Set the webhook in /etc/crowdsec/notifications/slack.yaml before enabling this.
 #   - splunk_default # Set the splunk url and token in /etc/crowdsec/notifications/splunk.yaml before enabling this.
 #   - http_default   # Set the required http parameters in /etc/crowdsec/notifications/http.yaml before enabling this.
 #   - email_default  # Set the required email parameters in /etc/crowdsec/notifications/email.yaml before enabling this.
 on_success: break

On y remarque que j'ai opté pour 72heures de bannissement (là ou avant j'étais à 764 de mémoire). Egalement présent la configuration "notification" qui est commentée. Il est possible d'y ajouter des alertes via Télégram par exemple, personnellement j'ai cessé, recevant en moyenne 10K adresses IP bloquées par semaine - Infernal à gérer.

Plus qu'à attendre un peu, vérifier si tout fonctionne, et de voir si Crowdsec arrive bien à faire son boulot proprement.

Et bingo on a déjà des alertes :

> cscli alerts list
╭────┬────────────────────┬────────────────────────────────────────────┬─────────┬──────────────────────────────────────────────────────────────┬───────────┬─────────────────────────────────────────╮
│ ID │        value       │                   reason                   │ country │                              as                              │ decisions │                created_at               │
├────┼────────────────────┼────────────────────────────────────────────┼─────────┼──────────────────────────────────────────────────────────────┼───────────┼─────────────────────────────────────────┤
│ 17 │ Ip:34.73.187.102   │ crowdsecurity/http-bad-user-agent          │ US      │ 396982 GOOGLE-CLOUD-PLATFORM                                 │ ban:1     │ 2025-06-25 19:10:15.353841428 +0000 UTC │
│ 16 │ Ip:185.236.231.217 │ crowdsecurity/CVE-2017-9841                │ PT      │ 47674 Net Solutions - Consultoria Em Tecnologias De          │ ban:1     │ 2025-06-25 18:57:00.318732664 +0000 UTC │
│    │                    │                                            │         │ Informacao, Sociedade Unipessoal LDA                         │           │                                         │
│ 15 │ Ip:92.42.218.208   │ crowdsecurity/netgear_rce                  │ FR      │ 33835 Weaccess Group S.A.                                    │ ban:1     │ 2025-06-25 18:37:29.158830031 +0000 UTC │
│ 14 │ Ip:92.42.218.208   │ crowdsecurity/http-cve-probing             │ FR      │ 33835 Weaccess Group S.A.                                    │ ban:1     │ 2025-06-25 18:37:29.158691381 +0000 UTC │
│ 13 │ Ip:45.133.74.90    │ crowdsecurity/http-sensitive-files         │ DE      │ 58087 Florian Kolb                                           │ ban:1     │ 2025-06-25 18:36:51.383890753 +0000 UTC │
│ 11 │ Ip:20.65.195.126   │ crowdsecurity/http-bad-user-agent          │ US      │ 8075 MICROSOFT-CORP-MSN-AS-BLOCK                             │ ban:1     │ 2025-06-25 18:18:02.516768135 +0000 UTC │
│ 10 │ Ip:162.142.125.112 │ crowdsecurity/http-bad-user-agent          │ US      │ 398324 CENSYS-ARIN-01                                        │ ban:1     │ 2025-06-25 18:11:56.069098002 +0000 UTC │
│ 9  │ Ip:40.69.199.216   │ crowdsecurity/http-crawl-non_statics       │ IE      │ 8075 MICROSOFT-CORP-MSN-AS-BLOCK                             │ ban:1     │ 2025-06-25 17:10:54.675130481 +0000 UTC │
│ 8  │ Ip:40.69.199.216   │ crowdsecurity/http-crawl-non_statics       │ IE      │ 8075 MICROSOFT-CORP-MSN-AS-BLOCK                             │ ban:1     │ 2025-06-25 17:10:54.674743134 +0000 UTC │
│ 7  │ Ip:40.69.199.216   │ crowdsecurity/http-admin-interface-probing │ IE      │ 8075 MICROSOFT-CORP-MSN-AS-BLOCK                             │ ban:1     │ 2025-06-25 17:10:54.887003085 +0000 UTC │
│ 6  │ Ip:40.69.199.216   │ crowdsecurity/http-probing                 │ IE      │ 8075 MICROSOFT-CORP-MSN-AS-BLOCK                             │ ban:1     │ 2025-06-25 17:10:54.675030453 +0000 UTC │
│ 5  │ Ip:40.69.199.216   │ crowdsecurity/http-probing                 │ IE      │ 8075 MICROSOFT-CORP-MSN-AS-BLOCK                             │ ban:1     │ 2025-06-25 17:10:54.674530315 +0000 UTC │
│ 4  │ Ip:40.69.199.216   │ crowdsecurity/http-wordpress-scan          │ IE      │ 8075 MICROSOFT-CORP-MSN-AS-BLOCK                             │ ban:1     │ 2025-06-25 17:10:54.674735279 +0000 UTC │
│ 3  │ Ip:51.68.236.87    │ crowdsecurity/http-bad-user-agent          │ FR      │ 16276 OVH SAS                                                │ ban:1     │ 2025-06-25 17:01:58.975593096 +0000 UTC │
│ 2  │ Ip:176.65.149.182  │ crowdsecurity/http-open-proxy              │ NL      │ 51396 Pfcloud UG                                             │ ban:1     │ 2025-06-25 16:42:36.910931165 +0000 UTC │
╰────┴────────────

Ces alertes nous remontent pas mal de choses intéressantes, à savoir :

  • L'adresse IP
  • L'ASN dont dépend l'adresse IP
  • Et surtout pour quelle raison il y a eu une alerte !

Si l'on veut voir plus loin, afin de savoir si suite à ces alertes des IP ont été bloquées :

> cscli decisions list
╭───────┬──────────┬────────────────────┬──────────────────────────────────────┬────────┬─────────┬──────────────────────────────────────────────────────────────┬────────┬────────────┬──────────╮
│   ID  │  Source  │     Scope:Value    │                Reason                │ Action │ Country │                              AS                              │ Events │ expiration │ Alert ID │
├───────┼──────────┼────────────────────┼──────────────────────────────────────┼────────┼─────────┼──────────────────────────────────────────────────────────────┼────────┼────────────┼──────────┤
│ 30015 │ crowdsec │ Ip:34.73.187.102   │ crowdsecurity/http-bad-user-agent    │ ban    │ US      │ 396982 GOOGLE-CLOUD-PLATFORM                                 │ 2      │ 3h50m57s   │ 17       │
│ 30014 │ crowdsec │ Ip:185.236.231.217 │ crowdsecurity/CVE-2017-9841          │ ban    │ PT      │ 47674 Net Solutions - Consultoria Em Tecnologias De          │ 1      │ 3h37m41s   │ 16       │
│       │          │                    │                                      │        │         │ Informacao, Sociedade Unipessoal LDA                         │        │            │          │
│ 30013 │ crowdsec │ Ip:92.42.218.208   │ crowdsecurity/netgear_rce            │ ban    │ FR      │ 33835 Weaccess Group S.A.                                    │ 1      │ 3h18m10s   │ 15       │
│ 30011 │ crowdsec │ Ip:45.133.74.90    │ crowdsecurity/http-sensitive-files   │ ban    │ DE      │ 58087 Florian Kolb                                           │ 5      │ 3h17m32s   │ 13       │
│ 15010 │ crowdsec │ Ip:20.65.195.126   │ crowdsecurity/http-bad-user-agent    │ ban    │ US      │ 8075 MICROSOFT-CORP-MSN-AS-BLOCK                             │ 2      │ 2h58m43s   │ 11       │
│ 15009 │ crowdsec │ Ip:162.142.125.112 │ crowdsecurity/http-bad-user-agent    │ ban    │ US      │ 398324 CENSYS-ARIN-01                                        │ 2      │ 2h52m37s   │ 10       │
│ 15008 │ crowdsec │ Ip:40.69.199.216   │ crowdsecurity/http-crawl-non_statics │ ban    │ IE      │ 8075 MICROSOFT-CORP-MSN-AS-BLOCK                             │ 45     │ 1h51m38s   │ 9        │
│ 15002 │ crowdsec │ Ip:51.68.236.87    │ crowdsecurity/http-bad-user-agent    │ ban    │ FR      │ 16276 OVH SAS                                                │ 2      │ 1h42m40s   │ 3        │
│ 15001 │ crowdsec │ Ip:176.65.149.182  │ crowdsecurity/http-open-proxy        │ ban    │ NL      │ 51396 Pfcloud UG                                             │ 1      │ 1h23m18s   │ 2        │
╰───────┴──────────┴────────────────────┴──────────────────────────────────────┴────────┴─────────┴

Oui on a déjà quelques adresses de bloquées, dont des similitudes avec celles des précédentes alertes !

Quid des faux positifs?

Il en existe bien sûr, mais il est nécessaire de les traiter à la main, de façon nominative. Car s'il peut exister des faux positifs, il peut aussi exister des "vrais négatifs".

Le cas chez un client, il y a peu, une adresse IP est bloqué, et semble correspondre à du Google en interne. Soit sur le papier :

37   REJECT     all  --  226.215.130.34.bc.googleusercontent.com  anywhere             reject-with icmp-port-unreachable

Alors, quand on cherche plus loin ... On tombe sur un site nommé tekoai.com, qui est tout sauf une solution interne à Google.

Il se pose également le même soucis avec WPRocket, puisqu'une IA s'est appelée WPRocket/SAAS afin de duper les gens.