read value of host-ip in perl-module (freeRADIUS 2.2.0)

Phil Mayers p.mayers at imperial.ac.uk
Wed Feb 27 13:17:50 CET 2013


On 27/02/13 12:02, Wolfgang Burger wrote:
> Dear people,
>
> as you can see in this Access-Request:
>
> rad_recv: Access-Request packet from host 10.1.4.82 port 65201, id=37,
> length=79
>         User-Name = "test"
>         User-Password = "testpass"
>         NAS-IP-Address = 10.0.2.15
>         NAS-Port-Type = Virtual
>         NAS-Port = 1228
>         Calling-Station-Id = "10.0.2.15"
>         Service-Type = Login-User
>
>
> the client is entering incorrect data into the field "Calling-Station-Id".
> In the setup used, it should not differ from the host.
> But "10.0.2.15" != "10.1.4.82"
>
> Authentication is handled by a perl-module.
> The outcome of the module depends on the host sending the packet.
>
> How (if at all) can I access the value of "host" (10.1.4.82 in the
> example above) from within the perl-module?

There is a "virtual" attribute Client-IP-Address, that you can copy to a 
temporary attribute before calling the perl module e.g.

authorize {
   ...
   update request {
     Tmp-IP-Address-0 := "%{Client-IP-Address}"
   }
   myperl
   ...
}


More information about the Freeradius-Users mailing list