feat(freeradius): add dynamic tenant VLAN assignment via unlang policy
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
vlan_test {
|
||||
|
||||
if (&User-Name =~ /.+@(.+)/) {
|
||||
|
||||
update control {
|
||||
Tmp-String-0 := "%{1}"
|
||||
}
|
||||
|
||||
update reply {
|
||||
Tunnel-Type := VLAN
|
||||
Tunnel-Medium-Type := IEEE-802
|
||||
Tunnel-Private-Group-Id := "%{sql:SELECT vlan_id FROM tenant_subnets WHERE tenant_id='%{control:Tmp-String-0}'}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -810,6 +810,8 @@ post-auth {
|
||||
reject
|
||||
}
|
||||
|
||||
# Query VLAN ID from your DB
|
||||
vlan_test
|
||||
|
||||
# Create the CUI value and add the attribute to Access-Accept.
|
||||
# Uncomment the line below if *returning* the CUI.
|
||||
|
||||
Reference in New Issue
Block a user