From: Arran Cudbard-Bell Date: Thu, 4 Mar 2021 17:40:26 +0000 (+0000) Subject: Add new models in checkrad script for Juniper MX and Ericsson SSR (#3968) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e971296d52da636f290ecb8bbf7f72613d092d82;p=thirdparty%2Ffreeradius-server.git Add new models in checkrad script for Juniper MX and Ericsson SSR (#3968) Cherry pick from #3234 Co-authored-by: Jorge Pereira --- diff --git a/src/bin/checkrad.in b/src/bin/checkrad.in index c0cf4401062..fe70343874a 100644 --- a/src/bin/checkrad.in +++ b/src/bin/checkrad.in @@ -33,6 +33,8 @@ # mikrotik_telnet 1.1 Author: Evren Yurtesen # mikrotik_snmp 1.0 Author: Evren Yurtesen # redback_telnet Author: Eduardo Roldan +# juniper_mx Author: Nitzan Tzelniker +# ericsson_ssr_snmp Author: Nitzan Tzelniker # # Config: $debug is the file you want to put debug messages in # $snmpget is the location of your ``snmpget'' program @@ -1418,6 +1420,57 @@ sub redback_telnet { return 0; } +sub juniper_mx_snmp { + #receives acct_session + my $temp = $ARGV[4]; + #removes the leading 0s + my $clean_temp = int $temp; + # Look up community string in naspasswd file. + my ($login, $pass) = naspasswd($ARGV[1], 1); + + if ($login eq '') { + $pass = $cmmty_string; + } elsif ($login ne 'SNMP') { + if ($debug) { + print LOG + " Error: Need SNMP community string for $ARGV[1]\n"; + } + return 2; + } + + $out=snmpget($ARGV[1], $pass, ".1.3.6.1.4.1.2636.3.64.1.1.1.3.1.3.0.$clean_temp"); + if($out=~/^$ARGV[3](\@.+)?$/) { + return 1; + } else { + return 0; + } +} + +sub ericsson_ssr_snmp { + #receives acct_session + my $temp = $ARGV[4]; + $clean_temp = ascii_to_oid($temp); + # Look up community string in naspasswd file. + my ($login, $pass) = naspasswd($ARGV[1], 1); + + if ($login eq '') { + $pass = $cmmty_string; + } elsif ($login ne 'SNMP') { + if ($debug) { + print LOG + " Error: Need SNMP community string for $ARGV[1]\n"; + } + return 2; + } + + $out=snmpget($ARGV[1], $pass, ".1.3.6.1.4.1.2352.2.27.1.1.6.1.1.25$clean_temp"); + if ($out=~/^$ARGV[3](\@.+)?$/) { + return 1; + } else { + return 0; + } +} + ############################################################################### # Poor man's getopt (for -d)