Update control in Post-Auth

Alan DeKok aland at deployingradius.com
Mon Aug 8 18:30:48 CEST 2016


On Aug 8, 2016, at 12:37 PM, Randeep <randeep123 at gmail.com> wrote:
> I want to check two things in pre-auth.
> 
> 1. Whether the user's network plan subscription is active or not.
> 2. Whether the data usage has crossed the Max-Data cap or not.
> 
> In post-auth,
...
> #check1
>        #Checking condition for plan subscription expiry   (days from
> subscription > plan duration)
>         if ("%{control:Tmp-Integer-3}" >  "%{control:Tmp-Integer-2}") {
>                update {
>                         control:Auth-Type := "Reject"

  "authenticate" and "Auth-Type" are run *before* the post-auth section.  So setting Auth-Type here does nothing.

  Just delete that line.

  Then, add a plain "reject" to the block.  i.e.

       #Checking whether usage exceeded the Max-Data cap
       if ("%{control:Tmp-Integer-0}" > "%{control:Tmp-Integer-1}") {
               update reply {
                      Mikrotik-Rate-Limit := "%{control:Tmp-String-1}"
                        }

 		reject
             }

  Alan DeKok.




More information about the Freeradius-Users mailing list