attr_rewrite replaced by ulang

Alan DeKok aland at deployingradius.com
Tue Sep 18 15:46:17 CEST 2018


On Sep 18, 2018, at 8:06 AM, Gabriel Marais <gabriel.j.marais at gmail.com> wrote:
> We are in the process of setting up a test environment so we can migrate from 2.x to 3.x

  That's good.

> Reading the documentation, attr_rewrite is obsolete and should be replaced by ulang...
> 
> 
> I have this in my sites-available/default
> 
> authorized {
> 	realmchange
> 	...
> }
> 
> 
> realmchange is referenced back to:-
> 
>        attr_rewrite realmchange {
>        attribute = realm
>        searchin = packet
>        searchfor = ".+"
>        replacewith = %{Called-Station-Id}
>        maxmatches = 1
>        new_attribute = yes
> }
> 
> 
> 1. How do I write this in ulang?

  if / then / else checks.  See "man unlang".

	if (Realm) {
		update request {
			Realm := "%{Called-Station-Id}"
		}
	}


  It's not difficult.  Write down what is supposed to happen, and then write that in unlang.

> 2. Do I put the ulang section under authorize { ... } section?

 If that's where you had the "attr_rewrite" module, yes.

  Alan DeKok.




More information about the Freeradius-Users mailing list