Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 templates add dictionary.rfc2865 November 26, 2010
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 History.txt
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 radiustar.gemspec
Octocat-spinner-32 version.txt
README.rdoc

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.

Something went wrong with that request. Please try again.