Semantics of !~ operator

Gerald Vogt vogt at spamcop.net
Tue Apr 28 08:54:12 CEST 2015


Thanks for the tips. So here is what I have done now to get rid of those 
regexes in the users file:

1. added local/private attributes to hold the information I need in 
/etc/raddb/dictionary

ATTRIBUTE       Local-SSID              3000    string

2. added a file policy.d/ssid to extract the SSID from the 
Called-Station-Id attribute as sent by my controller:

ssid {
         if ( Called-Station-Id ) {
                 if ( Called-Station-Id =~ /^[-A-Fa-f0-9]+:(.*)$/ ) {
                         update {
                                 Local-SSID = "%{1}"
                         }
                 }
         }
}

3. Then add a call ssid before files in the authorize section of the 
sites-enabled/default and sites-enabled/inner-tunnel files,

...
authorize {
...
  ssid
  files
...

4. and now I can use the attribute Local-SSID with simple == and != 
operators in the users file, e.g.

DEFAULT Local-SSID == "eduroam"
   Reply-Message += "Welcome to eduroam"
   Fall-Through = Yes


Please let me know if someone thinks I did something fundamentally wrong 
with this kind of set up. As far as I have tested this it works as intended.

Thanks,

Gerald


On 24/04/15 22:00, Stefan Paetow wrote:
>> Thus, conception ally: what would be the best approach to get those
>> policies working again the way they worked in v2?
>
> Just to follow up on what Alan says, you don't have to shove a bunch of unlang into the section either. I'm sure you know about policy.d :-)
>
> With Regards
>
> Stefan Paetow
> Moonshot Industry & Research Liaison Coordinator
>
> t: +44 (0)1235 822 125
> gpg: 0x3FCE5142
> xmpp: stefanp at jabber.dev.ja.net
> skype: stefan.paetow.janet
>
> jisc.ac.uk
>
> Jisc is a registered charity (number 1149740) and a company limited by guarantee which is registered in England under Company No. 5747339, VAT No. GB 197 0632 86. Jisc’s registered office is: One Castlepark, Tower Hill, Bristol, BS2 0JA. T 0203 697 5800.
>
> Jisc Collections and Janet Ltd. is a wholly owned Jisc subsidiary and a company limited by guarantee which is registered in England under Company No. number 2881024, VAT No. GB 197 0632 86. The registered office is: Lumen House, Library Avenue, Harwell, Didcot, Oxfordshire, OX11 0SG. T 01235 822200.
>
>
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
>


More information about the Freeradius-Users mailing list