pyrad 0.5 - native python RADIUS implementation

Wichert Akkerman wichert@wiggy.net
Fri, 14 Feb 2003 18:54:10 +0100


pyrad is an implementation of a RADIUS client and server as described in
RFC2865, 2866, and others. It takes care of all the details like
building RADIUS packets, sending and receiving them, and en-/decoding
responses. (RADIUS is a common protocol used for authentication,
authorisation and accounting for remote access (and similar) services).

This release features more work related to handling of accounting
packets and introduces a new modules which allows one to use pyrad
within twisted.

Changes since previous release
------------------------------

* Fix typo in server class which broke handling of accounting packets
* Create seperate AuthPacket and AcctPacket classes; this resulted in
  a fair number of API changes
* Packets now know how to create and verify replies 
* Client now directs authentication and accounting packets to the
  correct port on the server
* Add twisted support via the new curved module
* Fix incorrect exception handling in client code
* Update example server to handle accounting packets
* Add example for sending account packets



Example
-------
Here is an example of a client doing authentication request:

  import pyrad.packet
  from pyrad.client import Client
  from pyrad.dictionary import Dictionary

  srv=Client(server="radius.my.domain", secret="s3cr3t",
        dict=Dictionary("dicts/dictionary", "dictionary.acc"))

  req=srv.CreateAuthPacket(code=pyrad.packet.AccessRequest,
                User_Name="wichert", NAS_Identifier="localhost")
  req["User-Password"]=req.PwCrypt("password")

  reply=srv.SendPacket(req)
  if reply.code==pyrad.packet.AccessAccept:
      print "access accepted"
  else:
      print "access denied"

  print "Attributes returned by server:"
  for i in reply.keys():
      print "%s: %s" % (i, reply[i])


And an example for a trivial RADIUS server:

  from pyrad import dictionary, packet, server
  
  class FakeServer(server.Server):
      def _HandleAuthPacket(self, fd, pkt):
          server.Server._HandleAuthPacket(self, fd, pkt)
  
          reply=self.CreateReplyPacket(pkt)
          reply.code=packet.AccessAccept
          self.SendReplyPacket(fd, reply)
  
  
  srv=FakeServer(dict=dictionary.Dictionary("dictionary"))
  srv.hosts["127.0.0.1"]=server.RemoteHost("127.0.0.1", "s3cr3t", "localhost")
  srv.BindToAddress("")
  srv.Run()


Requirements
------------

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.xhtml

Copyright 2002,2003 Wichert Akkerman. All rights reserved.
pyrad is distributed under the BSD license. Please see the source
archive for the full license text.

-- 
Wichert Akkerman <wichert@wiggy.net>           http://www.wiggy.net/
A random hacker