.….….….….….….….….….….….….….….….….….….….….….….….….. .….….….….….….….….….….….….….….….….….…..H.….….….….…… .….….….….….….….….….….….….….….….….….….HHH.….….….….….. .….….….….….….….….….….….….….….….….….…HHHHH.….….….….…. .….….….….….….….….….….….….….….….….…..HHHHHHHH.….….….….… .….….….….….….….….….….….….….….……@_’’’@HHHHHHHHHHH3HdHdddHd’.….… .….….….….….….….….….….….….……dWE9p_^^&@d3HHHHHHHHHHHHHHHdHHHH@.….….. .….….….….….….….….….….….….…z933333HHHHHHHHHHHHHHHHHHHHddHdddd’.….…… .….….….….….….….….….….….…..pWp33Hdd@&&dHHHHHHHHHHHHHHHddHHHHd.….….….. .….….….….….….….….….….…33p3p3H@&&_@&@&&__^&3HHHHHHHHHHHHddHdH^.….….…… .….….….….….….….….….…W3Hd&_&&_&@&_^@WN7WH3H_’.HHHHHHHHHHHHddHdd.….….….… .….….….….….….….……WWpHd@&_’’^^@HpNW7JJEENppd’&3HHHHHHHHHHHHddHd&.….….…… .….….….….….….….…pH@d&&&@&__^&&d@HW7JzJEJJ7N3@’3HHHHHdHHHHHHHHHHHd.….….…… .….….….….….…3ppW3d@^_&__^^&&_^^_d3d39QzEEEE97EENp3&H333HHHdddHHH33HdHdH^.….….….. .….….….….….dd@@dd@&&_^^&__&&d@dHddH@@3EJEWWN7W7EN3H&^p3HHdddHdH&…&dHHHdd.….….….. .….….….…&&^__@&_@_^^_^^_&&dpWd3H&&&_HdpWW9EWppHWWHHH&^d3HHHHHHHH’.….…’_d’.….….…. .….….…_&@@@&&_^’’^_&@&HH33HpWW3dHd^^_’33pp97NWWHHHd@@^’^3HdddHHd^.….….….….….…… .….…&d__@’’’’_^’’_&@&@&&3dH@@Hdd&_@__&@Hd@H@@_’’’’’.…’^H&HHHH.….….….….….….…. .…@@__^’^__^’&&@@@@H3d&@ddd@d^^^@__^d&_’.’’.….….….….HHH.….….….….….….…… Hdd@@_^&&dd@@d_d__&&__&@^’&_^’’.’.….….….….….….….….….….….….….…… @__&&__@&&&_&@@dH&^&^^^’^^^_^’’.….….….….….….….….….….….….….….….…… &_ddd@@@&_&&_&’^^’.’’.….….….….….….….….….….….….….….….….….……
by pjdavis github.com/pjdavis/radiustar
Ruby Radius Library
-
Import your own radius dictionaries
-
Authentication
-
Accounting
require 'rubygems' require 'radiustar' # Load dictionaries from freeradius directory dict = Radiustar::Dictionary.new('/usr/share/freeradius/') # Lets get authenticated auth_custom_attr = { 'Framed-Address' => '127.0.0.1', 'NAS-Port' => 0, 'NAS-Port-Type' => 'Ethernet' } req = Radiustar::Request.new('127.0.0.1', { :dict => dict }) reply = req.authenticate('John Doe', 'hello', 'testing123', auth_custom_attr) if reply[:code] == 'Access-Accept' req = Radiustar::Request.new('127.0.0.1:1813', { :dict => dict }) acct_custom_attr = { 'Framed-Address' => '127.0.0.1', 'NAS-Port' => 0, 'NAS-Port-Type' => 'Ethernet', 'Acct-Session-Time' => 0 } timings = Time.now reply = req.accounting_start('John Doe', 'testing123', '123456', acct_custom_attr) sleep(rand 5) acct_custom_attr['Acct-Session-Time'] = Time.now - timings reply = req.accounting_update('John Doe', 'testing123', '123456', acct_custom_attr) sleep(rand 5) acct_custom_attr['Acct-Session-Time'] = Time.now - timings reply = req.accounting_stop('John Doe', 'testing123', '123456', acct_custom_attr) end
-
Ruby 1.8
gem install radiustar
Thanks to everyone who has contributed to this project. Without your help and support, this would not have been possible.
-
charl
-
Mark Bryars
-
jamesotron
-
dguerri
-
gderosa
-
mkocher
-
bwlang
Copyright © 2010 [PJ Davis], released under the CC0 1.0 Universal license.