perl client for freeradius
- #!/usr/bin/perl
- use strict;
- use Authen::Radius;
- my $RadiusIP="192.168.56.101";
- my $RadiusKey="pterm_radius_56";
- my $r=new Authen::Radius(Host=>$RadiusIP,Secret=>$RadiusKey);
- if ($r->check_pwd("test","test")) {
- print "ok\n";
- } else {
- print "err\n";
- }
python client for freeradius
- #!/usr/bin/env python
- import pyrad.packet
- from pyrad.client import Client
- from pyrad.dictionary import Dictionary
- srv=Client(server="192.168.56.101",
- secret="pterm_radius_56",
- dict=Dictionary("dictionary"))
- req=srv.CreateAuthPacket(code=pyrad.packet.AccessRequest,
- User_Name="test")
- req["User-Password"]=req.PwCrypt("test")
- reply=srv.SendPacket(req)
- if reply.code==pyrad.packet.AccessAccept:
- print "access accepted"
- else:
- print "access denied"
dictionary文件
- #
- # Version $Id: dictionary,v 1.1.1.1 2002/10/11 12:25:39 wichert Exp $
- #
- # This file contains dictionary translations for parsing
- # requests and generating responses. All transactions are
- # composed of Attribute/Value Pairs. The value of each attribute
- # is specified as one of 4 data types. Valid data types are:
- #
- # string - 0-253 octets
- # ipaddr - 4 octets in network byte order
- # integer - 32 bit value in big endian order (high byte first)
- # date - 32 bit value in big endian order - seconds since
- # 00:00:00 GMT, Jan. 1, 1970
- #
- # FreeRADIUS includes extended data types which are not defined
- # in RFC 2865 or RFC 2866. These data types are:
- #
- # abinary - Ascend
阅读(1943) | 评论(0) | 转发(0) |