Home
Softono

Tephra

Open source BSD-3-Clause JavaScript
14
Stars
0
Forks
5
Issues
5
Watchers
9 months
Last Commit

 About Tephra

An event-driven RADIUS server micro-framework

Platforms

Web Self-hosted

Languages

JavaScript

Links

Need Help Installing Tephra?

We provide expert installation service for this software. Our team will install, configure, and secure Tephra on your server. plans start at just $30.

tephra

An event-driven RADIUS server micro-framework based on node-radius. Now it's easier than ever to write a RADIUS server that isn't standards-compliant! ;)

Example

var tephra = require('tephra')

var users = {user1: 'secret_password'}

var server = new tephra(
  'shared_secret',
  1812,   // authentication port
  1813,   // accounting port
  3799,   // change of authorisation port
  [       // add dictionaries for vendor-specific attributes
    {
      name: 'quux_vendor',
      path: '/path/to/quux_vendor/dictionary',
      id: 12345
    }
  ]
)

server.on('Access-Request', function(packet, rinfo, accept, reject) {
  var username = packet.attributes['User-Name']
  var password = packet.attributes['User-Password']

  if (!(username in users && users[username] === password)) {
    reject([], {}, console.log)
    return
  }

  var attributes = [
    ['foo', 'bar'],
    ['baz', 'qux']
  ]

  var vendor_attributes = {
    quux_vendor: [
      ['foo', 'bar']
    ]
  }

  accept(attributes, vendor_attributes, console.log)

}).on('Accounting-Request', function(packet, rinfo, respond) {

  // catch all accounting-requests
  respond([], {}, console.log)

}).on('Accounting-Request-Start', function(packet, rinfo, respond) {

  // or just catch specific accounting-request status types...
  respond([], {}, console.log)

}).on('Accounting-Request-Interim-Update', function(packet, rinfo, respond) {

  respond([], {}, console.log)

}).on('Accounting-Request-Stop', function(packet, rinfo, respond) {

  respond([], {}, console.log)

})

server.bind()