Use python module to inject parameters to radius context

Anuruddha Premalal anuruddhapremalal at gmail.com
Sat May 21 02:25:53 CEST 2016


Hi Devs,

Any thoughts on this?

Thanks,
Anuruddha.

On Tue, May 17, 2016 at 5:58 AM, Anuruddha Premalal <
anuruddhapremalal at gmail.com> wrote:

> Hi Devs,
>
> I'm trying to urlencode a string and put that value in a vendor specific
> attribute via python; and later refer that in  site configuration.
>
> Here's a snippet of the site configuration authenticate section
>
> authenticate {
> Auth-Type PAP {
>     python_custom
>              update reply {
>                     User-Name = "%{User-Name}"
>                     My-Redirection-URL = "%{*My-URL-Param*}"
>                     My-ACL-Policy = "default_unauth_sla"
>                     My-QoS-Policy = "32M_Full"
>                     Calling-Station-Id = "%{Calling-Station-Id}"
>              }
>
>             }
> }
> digest
> eap
> }
>
>
> Here's the python code snippet in python_custom module
>
> def authenticate(p):
>     username = ''
>     clientmac = ''
>     apmac =''
>     ssid = 'Benu_Test'
>
>     for authdata in p:
>         if authdata[0] == 'User-Name':
>             username = authdata[1]
>         if authdata[0] == 'Calling-Station-Id':
>             clientmac = authdata[1]
>         if authdata[0] == 'Called-Station-Id':
>             apmac = authdata[1]
>     # how can I inject this VSA to radius context so that it can referenced in the site configuration?
>     My-URL-Param = "http://my.org" + urllib.quote('?clientmac=' + clientmac + '&apmac=' + apmac + '&ssid=' + ssid )
>
>     return radiusd.RLM_MODULE_OK
>
>
> Appreciate your help in finding a solution for this.
>
> Thanks & Regards,
> --
> *Anuruddha Premalala (MIEEE)Mobile : +94717213122 <%2B94717213122>E-mail
>  : anuruddhapremalal at gmail.com <anuruddhapremalal at gmail.com>web      :
> www.anuruddha.org <http://www.anuruddha.org>Sri Lanka.*
>



-- 
*Anuruddha Premalala (MIEEE)Mobile : +94717213122E-mail  :
anuruddhapremalal at gmail.com <anuruddhapremalal at gmail.com>web      :
www.anuruddha.org <http://www.anuruddha.org>Sri Lanka.*


More information about the Freeradius-Devel mailing list