|
|
|
@ -34,12 +34,12 @@ https://github.com/FreeRADIUS/freeradius-server/blob/master/src/modules/rlm_pyth |
|
|
|
Inspired by Daniel Stan in Crans |
|
|
|
""" |
|
|
|
|
|
|
|
import logging |
|
|
|
import os |
|
|
|
import sys |
|
|
|
import logging |
|
|
|
import traceback |
|
|
|
import radiusd # Magic module freeradius (radiusd.py is dummy) |
|
|
|
|
|
|
|
import radiusd # Magic module freeradius (radiusd.py is dummy) |
|
|
|
from django.core.wsgi import get_wsgi_application |
|
|
|
from django.db.models import Q |
|
|
|
|
|
|
|
@ -54,11 +54,10 @@ os.chdir(proj_path) |
|
|
|
# This is so models get loaded. |
|
|
|
application = get_wsgi_application() |
|
|
|
|
|
|
|
from machines.models import Interface, IpList, Nas, Domain |
|
|
|
from machines.models import Domain, Interface, IpList, Nas |
|
|
|
from preferences.models import RadiusOption |
|
|
|
from topologie.models import Port, Switch |
|
|
|
from users.models import User |
|
|
|
from preferences.models import RadiusOption |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Logging |
|
|
|
@ -97,7 +96,7 @@ def radius_event(fun): |
|
|
|
""" |
|
|
|
|
|
|
|
def new_f(auth_data): |
|
|
|
""" The function transforming the tuples as dict """ |
|
|
|
"""The function transforming the tuples as dict """ |
|
|
|
if isinstance(auth_data, dict): |
|
|
|
data = auth_data |
|
|
|
else: |
|
|
|
@ -162,8 +161,7 @@ def authorize(data): |
|
|
|
|
|
|
|
@radius_event |
|
|
|
def post_auth(data): |
|
|
|
""" Function called after the user is authenticated |
|
|
|
""" |
|
|
|
""" Function called after the user is authenticated""" |
|
|
|
|
|
|
|
nas = data.get("NAS-IP-Address", data.get("NAS-Identifier", None)) |
|
|
|
nas_instance = find_nas_from_request(nas) |
|
|
|
|