From 0e539b4cac82c5bea5864d120934ab4e0bfd6a20 Mon Sep 17 00:00:00 2001 From: hpl Date: Tue, 8 Oct 2024 09:56:27 +0200 Subject: [PATCH] maj apikaz --- dockers/apikaz/source/app.py | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/dockers/apikaz/source/app.py b/dockers/apikaz/source/app.py index 35d5794..73afee3 100644 --- a/dockers/apikaz/source/app.py +++ b/dockers/apikaz/source/app.py @@ -64,30 +64,17 @@ swagger = Swagger(app, template={ #TODO: # check variables -# fail2ban (ou alors sur traefik) -# découper app.py en service +# fail2ban (ou alors sur traefik: https://github.com/tomMoulard/fail2ban) # quels scripts bash garder ? #fin TODO #************************************************* #Filtrer les IP qui peuvent accéder à l'api -#TODO: au lieu d'avoir les IP en dur, prendre le fichier allow_ip' +#fait par traeffik -trusted_ips = [ -"176.180.83.10", -"82.64.20.246", -"31.39.14.228", -"51.75.112.172", -"80.11.47.59", -"90.121.138.71", -"109.190.2.75", -"89.234.177.115", -"80.215.140.40", -"80.67.176.91", -"89.234.177.119", -"78.127.1.19", -"80.215.236.243" -] +# trusted_ips = [ +# "1.2.3.4", +# ] #************************************************* @@ -111,10 +98,10 @@ mail = Mail(app) #************************************************* -@app.before_request -def limit_remote_addr(): - if request.environ['HTTP_X_FORWARDED_FOR'] not in trusted_ips: - abort(jsonify(message="Et pis quoi encore ?"), 400) +# @app.before_request +# def limit_remote_addr(): +# if request.environ['HTTP_X_FORWARDED_FOR'] not in trusted_ips: +# abort(jsonify(message="Et pis quoi encore ?"), 400) #************************************************* #authent mdp/pass basique