EXAMPLE: unlang removing attribute inside a test

Mike O'Connor freeradius at pineview.net
Tue Jan 22 10:39:47 CET 2008


Hi Guys

I thought I would send an example of unlang being used to remove an 
attribute after proxying.

My attrs file add a Cisco-AVPair which needs removing if the customer is 
given a static ip address by the retail ISP.

authorize {
.....
        if("%{reply:Framed-IP-Address}") {
               update reply {
                       Cisco-AVPair -= "ip:addr-pool=ip_pool_1"
               }
               update reply {
                       Cisco-AVPair -= "ip:addr-pool=ip_pool_2"
               }
               update reply {
                       Cisco-AVPair -= "ip:addr-pool=ip_pool_3"
               }
        }
}

I also added the update option to the post-auth to remove the 
Cisco-AVPair in the case of a reject.

post-auth {
......

        Post-Auth-Type REJECT {
               update reply {
                       Cisco-AVPair -= "ip:addr-pool=ip_pool_1"
               }
               update reply {
                       Cisco-AVPair -= "ip:addr-pool=ip_pool_2"
               }
               update reply {
                       Cisco-AVPair -= "ip:addr-pool=ip_pool_3"
               }
                sql_log
        }
}

One issue I could not seem to find a way of removing an attribute unless 
both the attribute and value match, this means that I have to list each 
of the pool individually.


Cheers
Mike



More information about the Freeradius-Users mailing list