Lookup lists / arrays?

David Hartburn D.J.Hartburn at kent.ac.uk
Wed Nov 2 16:57:46 CET 2016


> You could store the list in a text file and read it with rlm_passwd, or
> a users file with rlm_files. We've got a couple of "outside-of-SQL"
> exceptions stored in things like that.
>
> You can iterate over the list with foreach.

Thanks for the suggestion. Do you have any examples you can offer of 
using foreach with rlm_files? I can not find much in the way of examples 
or documentation.

In mods-enables/files, I have:

files eduroam_static_ip {
	key = "%{Calling-Station-ID}"
	
	usersfile = ${confdir}/eduroam_static_ip
}


The file itself just contains the MAC address I am testing with:
42-42-42-42-42-42

Then in the sites file post auth, I have tried:
foreach (eduroam_static_ip) {
	if (%{Foreach-Variable-0} == %{Calling-Station-Id}) {
		update reply {
			Tunnel-Type := VLAN
			Tunnel-Medium-Type := IEEE-802
			Tunnel-Private-Group-ID := 641
		}
	}			
}

/etc/raddb-kent/sites-enabled/kent-eduroam[559]: Parse error after 
"foreach": unexpected token "("
Errors reading or parsing /etc/raddb-kent/radiusd.conf

It looks like I'm missing the syntax for telling it to use the file as a 
list of attributes.

Cheers

Dave


More information about the Freeradius-Users mailing list