8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-25 04:43:10 +00:00

Merge branch '350-radius-fix' into 'dev'

Draft: Resolve "Radius script doesn't check cotisation/ban/whitelist when from a proxy"

See merge request re2o/re2o!643
This commit is contained in:
chapeau 2024-03-23 15:21:15 +00:00
commit f80eae4d44

View file

@ -163,10 +163,22 @@ def post_auth(data):
nas_instance = find_nas_from_request(nas)
# All non proxified requests
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")
return radiusd.RLM_MODULE_OK
nas_type = Nas.objects.filter(nas_type=nas_instance.machine_type).first()
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!")
return radiusd.RLM_MODULE_OK