mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 11:23:10 +00:00
première passe de debug
This commit is contained in:
parent
51e312e4c9
commit
df6de3ef2f
2 changed files with 8 additions and 7 deletions
|
@ -193,14 +193,14 @@ def post_auth(data):
|
||||||
sw_name = switch["name"] or "?"
|
sw_name = switch["name"] or "?"
|
||||||
room = "Unknown port"
|
room = "Unknown port"
|
||||||
if port:
|
if port:
|
||||||
room = port.room or "Unknown room"
|
room = port["room"] or "Unknown room"
|
||||||
|
|
||||||
out = decide_vlan_switch(data_from_api, mac, nas_port)
|
out = decide_vlan_switch(data_from_api, mac, nas_port)
|
||||||
reason, vlan_id, decision, attributes = out
|
reason, vlan_id, decision, attributes = out
|
||||||
|
|
||||||
if decision:
|
if decision:
|
||||||
log_message = "(wired) %s -> %s [%s%s]" % (
|
log_message = "(wired) %s -> %s [%s%s]" % (
|
||||||
sw_name + ":" + port + "/" + str(room),
|
sw_name + ":" + nas_port + "/" + str(room),
|
||||||
mac,
|
mac,
|
||||||
vlan_id,
|
vlan_id,
|
||||||
(reason and ": " + reason),
|
(reason and ": " + reason),
|
||||||
|
@ -219,8 +219,8 @@ def post_auth(data):
|
||||||
(),
|
(),
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
log_message = "(fil) %s -> %s [Reject %s]" % (
|
log_message = "(wired) %s -> %s [Reject %s]" % (
|
||||||
sw_name + ":" + port + "/" + str(room),
|
sw_name + ":" + nas_port + "/" + str(room),
|
||||||
mac,
|
mac,
|
||||||
(reason and ": " + reason),
|
(reason and ": " + reason),
|
||||||
)
|
)
|
||||||
|
@ -270,7 +270,7 @@ def check_user_machine_and_register(nas_type, user, user_interface):
|
||||||
|
|
||||||
def set_radius_attributes_values(attributes, values):
|
def set_radius_attributes_values(attributes, values):
|
||||||
return (
|
return (
|
||||||
(str(attribute.attribute), str(attribute.value % values))
|
(str(attribute["attribute"]), str(attribute["value"] % values))
|
||||||
for attribute in attributes
|
for attribute in attributes
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ def decide_vlan_switch(data_from_api, user_mac, nas_port):
|
||||||
attributes_kwargs = {
|
attributes_kwargs = {
|
||||||
"client_mac": str(user_mac),
|
"client_mac": str(user_mac),
|
||||||
"switch_port": str(nas_port.split(".")[0].split("/")[-1][-2:]),
|
"switch_port": str(nas_port.split(".")[0].split("/")[-1][-2:]),
|
||||||
"switch_ip": str(switch.ipv4)
|
"switch_ip": str(switch["ipv4"])
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get port from switch and port number
|
# Get port from switch and port number
|
||||||
|
@ -424,7 +424,7 @@ def decide_vlan_switch(data_from_api, user_mac, nas_port):
|
||||||
# else: user OK, so we check MAC now
|
# else: user OK, so we check MAC now
|
||||||
|
|
||||||
# If we are authenticating with mac, we look for the interfaces and its mac address
|
# If we are authenticating with mac, we look for the interfaces and its mac address
|
||||||
if port_profile.radius_mode == "COMMON" or port_profile.radius_mode == "STRICT":
|
if port_profile["radius_mode"] == "COMMON" or port_profile["radius_mode"] == "STRICT":
|
||||||
# If mac is unknown,
|
# If mac is unknown,
|
||||||
if not user_interface:
|
if not user_interface:
|
||||||
# We try to register mac, if autocapture is enabled
|
# We try to register mac, if autocapture is enabled
|
||||||
|
|
|
@ -70,6 +70,7 @@ class VlanSerializer(Serializer):
|
||||||
class PortProfileSerializer(Serializer):
|
class PortProfileSerializer(Serializer):
|
||||||
vlan_untagged = VlanSerializer()
|
vlan_untagged = VlanSerializer()
|
||||||
radius_type = serializers.CharField()
|
radius_type = serializers.CharField()
|
||||||
|
radius_mode = serializers.CharField()
|
||||||
|
|
||||||
|
|
||||||
class SwitchSerializer(Serializer):
|
class SwitchSerializer(Serializer):
|
||||||
|
|
Loading…
Reference in a new issue