Use python module to inject parameters to radius context
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@gmail.com <anuruddhapremalal@gmail.com>web : www.anuruddha.org <http://www.anuruddha.org>Sri Lanka.*
Hi Devs, Any thoughts on this? Thanks, Anuruddha. On Tue, May 17, 2016 at 5:58 AM, Anuruddha Premalal < anuruddhapremalal@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@gmail.com <anuruddhapremalal@gmail.com>web : www.anuruddha.org <http://www.anuruddha.org>Sri Lanka.*
-- *Anuruddha Premalala (MIEEE)Mobile : +94717213122E-mail : anuruddhapremalal@gmail.com <anuruddhapremalal@gmail.com>web : www.anuruddha.org <http://www.anuruddha.org>Sri Lanka.*
Hi Herwin, Discussion moved to users list as per your suggestion. Thanks, Anuruddha On Mon, May 23, 2016 at 11:29 AM, Herwin Weststrate < herwin@quarantainenet.nl> wrote:
On 21-05-16 02:25, Anuruddha Premalal wrote:
Hi Devs,
Any thoughts on this?
Actually, questions like this belong on the user list, not on the developer list.
-- Herwin Weststrate
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/devel.html
-- *Anuruddha Premalala (MIEEE)Mobile : +94717213122E-mail : anuruddhapremalal@gmail.com <anuruddhapremalal@gmail.com>web : www.anuruddha.org <http://www.anuruddha.org>Sri Lanka.*
participants (2)
-
Anuruddha Premalal -
Herwin Weststrate