Project

radiustar

0.04
No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
Ruby Radius Library
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 3.7.3

Runtime

 Project Readme

RADIUSTAR¶ ↑

Pretend this is ascii art of the “the more you know” star thing —=====*

by pjdavis github.com/pjdavis/radiustar

DESCRIPTION:¶ ↑

Ruby Radius Library

FEATURES¶ ↑

  • Import your own radius dictionaries

  • Authentication

  • Accounting

SYNOPSIS:¶ ↑

require 'rubygems'
require 'radiustar'

# Load dictionaries from freeradius directory
# NOTICE: here the Dictionary.new() only accept a parameter of "folder name" but not the dictionary file
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

REQUIREMENTS:¶ ↑

  • Ruby 1.8

INSTALL:¶ ↑

gem install radiustar

Thanks:¶ ↑

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

  • cbascom

  • Paulche

LICENSE:¶ ↑

Copyright © 2010 [PJ Davis], released under the CC0 1.0 Universal license.