maj apikaz

This commit is contained in:
HPL 2024-10-08 09:56:27 +02:00
parent d62a0ee43a
commit 0e539b4cac

View File

@ -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