Fwd: checkrad patch to support Juniper's BRAS

Guilherme Franco guilhermefranco at gmail.com
Tue Nov 13 23:35:14 CET 2012


Hi,

As bugs.freeradius.org is not working, I'm posting it here:

I would like to submit a new version of this Patch, which uses snmpget
instead of snmpwalk (to increase performance). It also fixes a problem with
checkrad complaining about lack of $ in the "out" variable:

+++ C:/Users/brgufr1/Downloads/checkrad.pl.in.txt Tue Nov 13 20:00:06 2012
@@ -24,7 +24,7 @@
 # digitro_rusers 1.1 Author: accdias at sst.com.br
 # cyclades_snmp 1.0 Author: accdias at sst.com.br
 # usrhiper_snmp    1.0    Author: igor at ipass.net
-# juniper_e_snmp   1.0    Author: guilhermefranco at gmail.com
+# juniper_e_snmp   1.1    Author: guilhermefranco at gmail.com
 # multitech_snmp   1.0    Author: ehonzay at willmar.com
 # netserver_telnet 1.0 Author: mts at interplanet.es
 # versanet_snmp    1.0    Author: support at versanetcomm.com
@@ -467,19 +467,24 @@
 }

 #
-#       Check the subscriber name on a Juniper JunosE E-Series BRAS (ERX,
E120, E320 )
+#       Check the subscriber name on a Juniper JunosE E-Series BRAS (ERX,
E120, E320). Requires "radius acct-session-id-format decimal" configuration
in the BRAS.
 #
 #       Author: Guilherme Franco <guilhermefranco at gmail.com>
 #
 sub juniper_e_snmp {

+                #receives acct_session
+                my $temp = $ARGV[4];
+                #removes the leading 0s
+                my $clean_temp = int $temp;

-out=snmpwalk($ARGV[1],$cmmty_string,".1.3.6.1.4.1.4874.2.2.20.1.8.4.1.2");
+                $out=snmpget($ARGV[1], $cmmty_string,
".1.3.6.1.4.1.4874.2.2.20.1.8.4.1.2.$clean_temp");
                 if($out=~/\"$ARGV[3]\"/){
                         return 1;
                 }else{
                         return 0;
                 }
+
 }

 #


Thank you.


Regards,

Guilherme de Oliveira Franco
guilhermefranco at gmail.com


On Wed, Jun 13, 2012 at 8:30 PM, Guilherme Franco <guilhermefranco at gmail.com
> wrote:

> Hello,
>
> I would like to submit a patch to checkrad (freeradius-server-2.1.12),
> adding support for Juniper's E-Series BRAS (ERX, E120, E320).
>
> It adds the possibility to query the subscriber's username using SNMP.
> If the subscriber is found, it returns 1 "Returning 1 (double
> detected)", else, returns 0 "Returning 0 (login ok)".
>
> On clients.conf, the nastype should be set to juniper.
>
> ---
> C:/Users/brgufr1/Downloads/freeradius-server-2.1.12/freeradius-server-2.1.12/src/main/
> checkrad.pl.in
>        Fri
> Sep 30 11:12:07 2011
> +++ C:/Users/brgufr1/Desktop/checkrad   Wed Jun 13 18:49:32 2012
> @@ -24,6 +24,7 @@
>  #              digitro_rusers   1.1    Author: accdias at sst.com.br
>  #              cyclades_snmp    1.0    Author: accdias at sst.com.br
>  #              usrhiper_snmp    1.0    Author: igor at ipass.net
> +#              juniper_e_snmp   1.0    Author: guilhermefranco at gmail.com
>  #              multitech_snmp   1.0    Author: ehonzay at willmar.com
>  #              netserver_telnet 1.0    Author: mts at interplanet.es
>  #              versanet_snmp    1.0    Author: support at versanetcomm.com
> @@ -466,6 +467,21 @@
>  }
>
>  #
> +#       Check the subscriber name on a Juniper JunosE E-Series BRAS (
> ERX, E120, E320 )
> +#
> +#       Author: Guilherme Franco <guilhermefranco at gmail.com>
> +#
> +sub juniper_e_snmp {
> +
> +
> $out=snmpwalk($ARGV[1],$cmmty_string,".1.3.6.1.4.1.4874.2.2.20.1.8.4.1.2");
> +                if($out=~/\"$ARGV[3]\"/){
> +                        return 1;
> +                }else{
> +                        return 0;
> +                }
> +}
> +
> +#
>  #       Check a MultiTech CommPlete Server ( CC9600 & CC2400 )
>  #
>  #       Author: Eric Honzay of Bennett Office Products <
> ehonzay at willmar.com>
> @@ -1434,6 +1450,8 @@
>        $ret = &cisco_snmp;
>  } elsif ($ARGV[0] eq 'cvx') {
>        $ret = &cvx_snmp;
> +} elsif ($ARGV[0] eq 'juniper') {
> +        $ret = &juniper_e_snmp;
>  } elsif ($ARGV[0] eq 'multitech') {
>        $ret = &multitech_snmp;
>  } elsif ($ARGV[0] eq 'computone') {
>
> Regards,
>
> Guilherme de Oliveira Franco
> guilhermefranco at gmail.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-devel/attachments/20121113/38130c8e/attachment.html>


More information about the Freeradius-Devel mailing list