Project

General

Profile

Demande #3551

Configurer nginx@bastion pour limiter les requêtes

Added by Quentin Gibeaux over 4 years ago. Updated 6 days ago.

Status:
En cours de traitement
Priority:
Normale
Assignee:
Category:
-
Target version:
Start date:
01/10/2019
Due date:
% Done:

20%

Estimated time:
Difficulté:
2 Facile

Description

Pour éviter que l'infra complexe ne tombe avec les crawler, il faudrait configurer nginx sur bastion pour limiter les requêtes d'une même IP a un taux de requête/sec donnée.


Related issues

Related to Admins - Demande #3773: Augmenter les ressources de la VM adlFermé06/17/2019

Actions

History

#1

Updated by François Poulain over 4 years ago

Exemple de inspiré de config livrée par défaut dans discourse (https://github.com/discourse/discourse_docker/blob/master/templates/web.ratelimited.template.yml) :

limit_req_zone $binary_remote_addr zone=flood:10m rate=12r/s;
limit_req_zone $binary_remote_addr zone=bot:10m  rate=200r/m;
limit_req_status 429;

limit_conn_zone $binary_remote_addr zone=connperip:10m;
limit_conn_status 429;

limit_conn connperip 20;
limit_req zone=flood burst=12  nodelay;
limit_req zone=bot   burst=100 nodelay;

La doc nginx: https://www.nginx.com/blog/rate-limiting-nginx/

#2

Updated by Christian P. Momon almost 4 years ago

  • Related to Demande #3773: Augmenter les ressources de la VM adl added
#3

Updated by Quentin Gibeaux over 2 years ago

  • Assignee set to Romain H.

voir dry run pour avoir une vue de ce qui serait bloqué sur une semaine

#4

Updated by Quentin Gibeaux over 2 years ago

  • Target version changed from Backlog to Décembre 2020
#5

Updated by Romain H. over 2 years ago

  • essayer en mode dry run dans un premier temps pour voir s'il y a des faux positifs
  • attention aux requêtes DAV vers la valise qui sont fréquentes et marchent souvent par essai/erreur (lpoujoulat)
#6

Updated by Romain H. over 2 years ago

La directive limit_req_dry_run n'existe que depuis nginx version 1.17.1.
Debian Buster propose nginx version 1.14.2.
Debian Bullseye propose nginx version 1.18.0.

Cette directive n'est donc pas utilisable sur bastion qui est en Buster.
Je ne trouve pas d'alternative à cette directive.

Est-ce qu'on se lance avec une configuration directement en prod ou on attend Bullseye (=~ 6 mois) pour avoir le mode dry run ?

#7

Updated by Quentin Gibeaux over 2 years ago

je propose d'attendre bullseye

#8

Updated by Quentin Gibeaux over 2 years ago

  • Target version changed from Décembre 2020 to Janvier 2021
#9

Updated by Quentin Gibeaux over 2 years ago

  • Target version changed from Janvier 2021 to Février 2021
#10

Updated by Quentin Gibeaux over 2 years ago

  • Target version changed from Février 2021 to Mars 2021
#11

Updated by Quentin Gibeaux about 2 years ago

  • Target version changed from Mars 2021 to Avril 2021
#12

Updated by Quentin Gibeaux about 2 years ago

  • Target version changed from Avril 2021 to Mai 2021
#13

Updated by Quentin Gibeaux about 2 years ago

  • Target version changed from Mai 2021 to Juin 2021
#14

Updated by Quentin Gibeaux almost 2 years ago

  • Target version changed from Juin 2021 to Été 2021
#15

Updated by Quentin Gibeaux almost 2 years ago

  • Target version changed from Été 2021 to Septembre 2021
#16

Updated by Quentin Gibeaux over 1 year ago

  • Target version changed from Septembre 2021 to Octobre 2021
#17

Updated by Quentin Gibeaux over 1 year ago

  • Target version changed from Octobre 2021 to Novembre 2021
#18

Updated by Quentin Gibeaux over 1 year ago

  • Target version changed from Novembre 2021 to Décembre 2021
#19

Updated by Quentin Gibeaux over 1 year ago

  • Target version changed from Décembre 2021 to Janvier 2022
#20

Updated by Quentin Gibeaux over 1 year ago

  • Target version changed from Janvier 2022 to Février 2022
#21

Updated by Quentin Gibeaux over 1 year ago

  • Target version changed from Février 2022 to Mars 2022
#22

Updated by Quentin Gibeaux about 1 year ago

  • Target version changed from Mars 2022 to Avril 2022
#23

Updated by Quentin Gibeaux about 1 year ago

  • Target version changed from Avril 2022 to Mai 2022
#24

Updated by Quentin Gibeaux about 1 year ago

  • Target version changed from Mai 2022 to Juin 2022
#25

Updated by Quentin Gibeaux 11 months ago

  • Target version changed from Juin 2022 to Été 2022
#26

Updated by Quentin Gibeaux 9 months ago

  • Target version changed from Été 2022 to Septembre 2022
#27

Updated by Romain H. 8 months ago

  • Status changed from Nouveau to En cours de traitement
  • % Done changed from 0 to 20

J'ai activé la limite en mode dry run (commit 32e95e88fc6e17326eaa99b6f7ecfa7d97667862).

En cas de dépassement d'une limite, un message est journalisé dans le error.log du virtualhost.
Le message ressemble à ça :

2022/09/27 00:00:00 [error] X#Y: *Z limiting requests, excess: 12.784 by zone "flood", client: A.B.C.D, server: www.april.org, request: "GET / HTTP/1.1", host: "www.april.org", referrer: "https://www.april.org/" 

Je laisse tourner quelques jours et je regarderai les logs pour voir la quantité de faux positifs et voir s'il faut modifier les seuils.

#28

Updated by Quentin Gibeaux 8 months ago

  • Target version changed from Septembre 2022 to Octobre 2022
#29

Updated by Quentin Gibeaux 7 months ago

  • Target version changed from Octobre 2022 to Novembre 2022
#30

Updated by Quentin Gibeaux 6 months ago

  • Target version changed from Novembre 2022 to Décembre 2022
#31

Updated by Quentin Gibeaux 5 months ago

  • Target version changed from Décembre 2022 to Janvier 2023
#32

Updated by Quentin Gibeaux 4 months ago

  • Target version changed from Janvier 2023 to Février 2023
#33

Updated by Frédéric Couchet 3 months ago

  • Target version changed from Février 2023 to Mars 2023
#34

Updated by Quentin Gibeaux 2 months ago

  • Target version changed from Mars 2023 to Avril 2023
#35

Updated by Quentin Gibeaux about 1 month ago

  • Target version changed from Avril 2023 to Mai 2023
#36

Updated by Quentin Gibeaux 6 days ago

  • Target version changed from Mai 2023 to Juin 2023

Also available in: Atom PDF