8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 07:23:46 +00:00

Fix radius proxy bug

This commit is contained in:
chapeau 2024-03-23 09:12:10 +01:00 committed by chapeau
parent aa0d9df5ac
commit 028a2cd28d

View file

@ -163,10 +163,22 @@ def post_auth(data):
nas_instance = find_nas_from_request(nas) nas_instance = find_nas_from_request(nas)
# All non proxified requests # All non proxified requests
if not nas_instance: if not nas_instance:
user = data.get("User-Name", "")
user = user.split("@", 1)[0]
user = User.objects.filter(pseudo__iexact=username).first()
if not user or not user.has_access():
logger.info("Proxified request, user has no internet access: %s" % (username))
return radiusd.RLM_MODULE_REJECT
logger.info("Proxified request, nas unknown") logger.info("Proxified request, nas unknown")
return radiusd.RLM_MODULE_OK return radiusd.RLM_MODULE_OK
nas_type = Nas.objects.filter(nas_type=nas_instance.machine_type).first() nas_type = Nas.objects.filter(nas_type=nas_instance.machine_type).first()
if not nas_type: if not nas_type:
user = data.get("User-Name", "")
user = user.split("@", 1)[0]
user = User.objects.filter(pseudo__iexact=username).first()
if not user or not user.has_access():
logger.info("Proxified request, user has no internet access: %s" % (username))
return radiusd.RLM_MODULE_REJECT
logger.info("This kind of nas is not registered in the database!") logger.info("This kind of nas is not registered in the database!")
return radiusd.RLM_MODULE_OK return radiusd.RLM_MODULE_OK