pyrad is an implementation of a RADIUS client as described in RFC2138. It takes care of all the details like building RADIUS packets, sending them and decoding responses.
Here is an example of doing a authentication request:
from pyrad.client import Client from pyrad.dictionary import Dictionary
srv=Client("radius.my.domain") srv.secret="radius secret" srv.dict=Dictionary("/etc/radb/dictionary")
req=srv.CreatePacket() req.code=pyrad.client.AccessRequest req["User-Name"]="wichert" req["User-Password"]="password" req["NAS-Identifier"]="localhost"
reply=srv.SendPacket(req) if reply.code==pyrad.client.AccessAccept: print "access accepted" else: print "access denied"
print "Attributes returned by server:" for i in reply.keys(): print "%s: %s" % (i, reply[i])
REQUIREMENTS & INSTALLATION ---------------------------
pyrad requires Python 2.0 or later.
AUTHOR, COPYRIGHT, AVAILABILITY -------------------------------
pyrad was written by Wichert Akkerman wichert@deephackmode.org
The current version and documentation can be found at its homepage:
http://www.wiggy.net/code/pyrad/
Copyright 2002 Wichert Akkerman. All rights reserved. pyrad is distributed under the BSD license. Please see the source archive for the full license text.
python-announce-list@python.org