Question on Unlang

Olivier CALVANO o.calvano at gmail.com
Sat Mar 25 07:07:36 CET 2017


Hi

i request your help for know if it's possible in unlang

Actually, in policy.d/my.conf i have:

        if ((Tunnel-Server-Endpoint:0[0] != '172.16.1.1') && (User-Name =~
/\\.local/) && (User-Name !~ /network\\.local/) && (User-Name !~
/admin\\.local/) && (User-Name !~ /wifi\\.local/) &&
("%{Packet-Src-IP-Address}" == "192.168.20.1")) {
                update reply {
                          <...>
                }
        }
        elsif ((Tunnel-Server-Endpoint:0[0] != '172.16.1.1') && (User-Name
=~ /\\.local/) && (User-Name !~ /network\\.local/) && (User-Name !~
/admin\\.local/) && (User-Name !~ /wifi\\.local/) &&
("%{Packet-Src-IP-Address}" == "192.168.50.1")) {
                update reply {
                          <...>
                }
        }


i put only 3 in my sample of !~ (network,admin and wifi), but i have ~40
and i have ~30 of "elsif"
it's a long file ;)


i want know if it's possible in unlang to create a list:

SubRealm_Exclude {
     network.local
     admin.local
     wifi.local
}

and after put in if condition :

        if ((Tunnel-Server-Endpoint:0[0] != '172.16.1.1') && (User-Name =~
/\\.local/) && (User-Name !~ SubRealm_Exclude) &&
("%{Packet-Src-IP-Address}" == "192.168.20.1")) {
                update reply {
                          <...>
                }
        }
        elsif ((Tunnel-Server-Endpoint:0[0] != '172.16.1.1') && (User-Name
=~ /\\.local/) && (User-Name !~ SubRealm_Exclude) &&
("%{Packet-Src-IP-Address}" == "192.168.50.1")) {
                update reply {
                          <...>
                }
        }


Thanks for your help

regards


More information about the Freeradius-Users mailing list