login | register
Thu 28 of Aug, 2008 [09:53 UTC]

voip-info.org

PortaOne Radius auth

Created by: gonzo,Last modification on Tue 18 of Sep, 2007 [11:13 UTC]

PortaOne's Radius client for Asterisk


Overview

This GPL project brings RADIUS AAA capabilities to Asterisk PBX.
It is written entirely in Perl, so it is 100% portable and easy to understand and customize!
RADIUS attributes are used as per Cisco VSA Voice Implementation Guide, which provides compatibility with many billing platforms (i.e. PortaBilling100)


You CAN:


Authentication:
  • authenticate users via RADIUS protocol
  • use global RADIUS server settings and individual RADIUS server settings for different extensions
  • authenticate by general "account + password", which can mean anything depending on the service you are willing to implement i.e. ANI authorization, prepaid cards...
  • authenticate SIP users via RADIUS (secure, pass Digest over RADIUS)
  • if "credit time" is provided in radius reply, then call timer will be set and asterisk will disconnect call automatically, or
  • you can process RADIUS reply attribures in extensions.conf in order to create IVR responce
  • accept and decrypt routing information from PortaBilling100, then you can pass resulting string directly to Dial application using this feature you can dial multiply SIP destinations using different user/pass pairs ! (requires path to Dial application)

Accounting:
  • generate Stop RADIUS records for incoming and outgoing call legs

You CAN NOT:

Accounting:
  • generate Start or Alive records, which is doable easily for connected calls, but
  • you can not generate Start - Stop records for failed calls, so you can not monitor your asterisk configuration failures via RADIUS. For instance you may have a dozen of call attempts on some channel failed due to some configuration error. This is limitation of Asterisk architecture and needs some serious work.

Installation


0. Download tarball from PortaOne. Apply patches located in patches/ directory to your asterisk sources (patches were made against asterisk 1.4.11)

1. Install from CPAN

sudo perl -MCPAN -e shell;

install Config::IniFiles
install Crypt::CBC
install Crypt::DES
install Authen::Radius

2. Install Asterisk::AGI and Asterisk::Manager (unfortunately it is not on CPAN yet!)

3. Include
load => res_agi.so
into Asterisk's modules.conf

4. Copy agi-rad-auth.pl into asterisk's agi directory, usually /usr/local/share/asterisk/agi-bin (defined in asterisk.conf)

5. Edit manager.conf using the example included, settings must correspond to settings in ast-rad-acc.pl

6. Include ast-rad-acc.pl into system startup sequence

7. Edit extensions.conf using example included

8. Make sure that your Asterisk includes all related bug fixes and patches, namely:
- SIPGetHeaders for chan_sip (derived from chan_sip2 )
- Outbound SIP cnannel DNID bug fix
- Outbound Zap cnannel DNID bug fix
- Manager API DNID bug fix
- Dial application patch Dial(SIP/number:secret:authid@host)
- chan_sip externalauth=yes
- Inbounnd ast_set_callerid chan_zap bug fix
- SIP remote ip for manager API


Configuration Examples


extensions.conf

[globals]
; RADIUS Client Configuration
; This is defaul configuration
;
RADIUS_Server=radius.mydomain.com
RADIUS_Secret=mytest
;
; NAS_IP_Address attribute to send in requests
;
NAS_IP_Address=192.168.0.56

; ANI authentication example
;
[outbound-analog]
; It is possible to use different RADIUS servers in different contexts
; if nothing is defined here then gloval values will be used
;
exten => _X.,1,Set(RADIUS_Server=radius.mydomain.com)
exten => _X.,n,Set(RADIUS_Secret=mytest)
exten => _X.,n,Set(NAS_IP_Address=192.168.0.56)
;
; Set account to authorize by
; It can be a prepaid calling card PIN, ANI, or SIP ID depending on your application
;
exten => _X.,n,Set(CDR(accountcode)=${CALLERID(num)})
exten => _X.,n,NoOp(${CALLERID(num)})
;
; RADIUS Authorize
; Called as:  agi-rad-auth.pl|parametr1=value1&parametr2=value2&parametr3=value3
; Possible parametrs:
; Routing=XXX will will send h323-ivr-out = 'PortaBilling_Routing:XXX' attribure (XXX is usually SIP)
; AuthorizeBy=SIP requires SIPGetHeader(SIP_Authorization=Proxy-Authorization) first + externalauth=yes in sip.conf
; AuthorizeBy=Account requires SetAccount(<username>) first
; Password=Password optional and may be used together with AuthorizeBy=Account
; IfFailed=DoNotHangup optional, used for custome authentication error processing i.e. IVR
;
;
exten => _X.,n,agi,agi-rad-auth.pl|AuthorizeBy=Account&Password=SecReT
;
exten => _X.,n,Dial(Zap/1/${EXTEN},60)
exten => _X.,n,Hangup

; Another example
;
[auth-error-processing]
exten => _X.,1,Set(CDR(accountcode)=${CALLERID(num)})
exten => _X.,n,NoOp(${CALLERID(num)})
exten => _X.,n,agi,agi-rad-auth.pl|AuthorizeBy=Account&IfFailed=DoNotHangup&Password=SecReT
exten => _X.,n,NoOp(${h323-return-code})
;
; You can add your custom IVR response here
;
exten => _X.,n,Dial(Zap/1/${EXTEN},60)
exten => _X.,n,Hangup

; Inbound SIP authentication
;
[sip-auth]
; SIP Authorization headers
;
exten => _X.,1,SIPGetHeader(SIP_Authorization=Proxy-Authorization)
;
; RADIUS Authorize
;
exten => _X.,n,agi,agi-rad-auth.pl|Routing=SIP&AuthorizeBy=SIP
;
; SIP username from Digest is returned in channel variable SIP_Username
; Set correct ACCOUNTCODE for the accounting
;
exten => _X.,n,Set(CDR(accountcode)=${SIP_Username})
;
; Routing information is returned in channel variable Dial_Info
; usually you must execute Dial(${Dial_Info})
; PortaBilling100 routing and authentication information returned as follows:
; SIP/number_to_dial:password:authuser@ip1/SIP/number_to_dial@ip2/
; This is example for two sip routes one with authorization on remote end and another is without
;
exten => _X.,n,NoOp(${Dial_Info})
;
; Number to dial is returned in channel variable DNID
;
exten => _X.,n,NoOp(${DNID})
;
exten => _X.,n,Dial(${Dial_Info})
exten => _X.,n,Hangup


See Also


Other Asterisk development by PortaOne



Comments

Comments Filter
222

333PortaOne Does Work with Asterisk

by khalenkov, Tuesday 10 of July, 2007 [18:59:46 UTC]
This is PortaOne official policy and it is 100% in line with what we state on our website.

PortaBilling100 allows doing both prepaid and postpaid billing for any RADIUS based equipment, for example, Cisco, NextTone, Quintum, Mera MVTS, and open source Asterisk. Currently, PortaOne has tens of clients that use PortaBilling100 with Asterisk.

However, PortaOne provides technical support for its products only. We do NOT provide configuration assistance for Asterisk, Cisco or any other equipment as a part of our technical support program.
222

333Porta-One Doesn't Support Asterisk

by mpatton, Sunday 17 of June, 2007 [01:13:04 UTC]
From the response I've received from Porta One, they do not support
integration of porta billing with any version of asterisk. They suggested
that we update the old module they released via GPL. I'm looking for
alternatives to Porta Billing for any future projects.
222

333

by calvin, Sunday 08 of October, 2006 [23:51:58 UTC]
Will this work with Asterisk 1.2.12.1 ?
222

333Re: patches no longer availble

by kapitan, Friday 28 of April, 2006 [00:38:57 UTC]
tzafrir: I have fixed the broken links on the page. Sorry for the inconvenience!
222

333patches no longer availble

by tzafrir, Sunday 23 of April, 2006 [11:34:32 UTC]
gonzo or anybody: the links to files under PortaOne's homepage seem to lead to be redirected to their homepage. Are the fles still avilable?
222

333radius authentication

by ww1509, Friday 06 of January, 2006 [06:40:49 UTC]
oh!myfriends,I am trying to add radius auth to the asterisk,I want to Know about list:
1:do I must user the portaone radius client?my radius server is my own!Is not the asterisk has It`s own config file for radius?
2:I have done it as above ,but the step one is wrong,I can`t connect to server at :install config::inifiles,but I have download the two files:ast-rad.gz and radius-ast.tar.gz from the portaone,what can I do next?
3:how to config it in sip.config about registe with radius!
THanks a lot!
222

333RADIUS client limitation

by madclicker, Friday 18 of November, 2005 [20:37:10 UTC]
I'm trying to understand why * can not generate stop RADIUS records for failed calls. This is a limitation listed on the PortaOne radius client for asterisk. Are there an work arounds for this? Thanks,


222

333RADIUS client limitation

by madclicker, Friday 18 of November, 2005 [16:30:27 UTC]
I'm trying to understand why * can not generate stop RADIUS records for failed calls. This is a limitation listed on the PortaOne radius client for asterisk. Are there an work arounds for this? Thanks,


222

333Re: HOW TO APPLY PATCH

by gonzo, Tuesday 18 of January, 2005 [22:23:49 UTC]
cd asterisk-1.0.X
cat /path/to/patches/patch-* | patch -p0
222

333HOW TO APPLY PATCH

by , Wednesday 12 of January, 2005 [20:50:37 UTC]
The patch tgz file has 4 files in it. How to actually apply this patch?

Can some give instructions to apply the patch. Can't get past that. :-(

Thanks,
Chris