#! /usr/bin/env python3 import radiusd def instantiate(p): radiusd.radlog(radiusd.L_INFO, '*** example.py instantiate ***') return radiusd.RLM_MODULE_OK def authorize(p): radiusd.radlog(radiusd.L_INFO, '*** example.py authorize ***') # whatever password was supplied config = ( ('Cleartext-Password', p[1][1]), ) if p[0][1] == "ubuntu": msg = "Hello ubuntu!" status = radiusd.RLM_MODULE_OK reply = ( ('Reply-Message', msg), ) return (radiusd.RLM_MODULE_OK, reply, config) else: msg = "You are not ubuntu!" reply = ( ('Reply-Message', msg), ) status = radiusd.RLM_MODULE_REJECT return (status, reply, config) def detach(p): radiusd.radlog(radiusd.L_INFO, "*** example.py detach ***") return radiusd.RLM_MODULE_OK