How to use rewrite.called_station_id IN dynamic clients authorize section

Ben Humpert ben at an3k.de
Thu Mar 26 14:41:57 CET 2015


2015-03-26 9:35 GMT+01:00 James Wood <james.wood at purplewifi.com>:
> I tried using the rewrite.called_station_id module from policy.conf and whilst it does not error it doesn't rewrite the incoming Called-Station-Id to the format I require.

My NAS always send in the correct format, however I have set
rewrite.called_station_id at the very first in authorize {} because it
should be the first thing to be done. I could sanitize it just when
sending it to LDAP but then Radius would always use the wrong format.
That is why you don't want to sanitize it just in the SQL query.

What you should do is modifying the regex used in the
rewrite.called_station_id policy to also match 001122334455 formats.
In authorize at least &Called-Station-Id is available, probably also
%{Called-Station-Id}.

There is a nice regex tester at http://www.freeformatter.com/regex-tester.html

The default regex used is
^([0-9a-f]{2})[^0-9a-f]?([0-9a-f]{2})[^0-9a-f]?([0-9a-f]{2})[^0-9a-f]?([0-9a-f]{2})[^0-9a-f]?([0-9a-f]{2})[^0-9a-f]?([0-9a-f]{2})([^0-9a-f](.+))?$
and this matches 00-11-22-33-44-55 and 00:11:22:33:44:55 and
001122334455 as well as other formats.


More information about the Freeradius-Users mailing list