3 # checkrad.pl See if a user is (still) logged in on a certain port.
5 # This is used by the cistron-radius server to check
6 # if its idea of a user logged in on a certain port/nas
7 # is correct if a double login is detected.
9 # Called as: nas_type nas_ip nas_port login session_id
11 # Returns: 0 = no duplicate, 1 = duplicate, >1 = error.
15 # livingston_snmp 1.1 Author: miquels@cistron.nl
16 # cvx_snmp 1.0 Author: miquels@cistron.nl
17 # portslave_finger 1.0 Author: miquels@cistron.nl
18 # max40xx_finger 1.0 Author: costa@mdi.ca
19 # ascend_snmp 1.1 Author: blaz@amis.net
20 # computone_finger 1.2 Author: pacman@world.std.com
21 # sub tc_tccheck 1.1 Author: alexisv@compass.com.ph
22 # cyclades_telnet 1.2 Author: accdias@sst.com.br
23 # patton_snmp 1.0 Author: accdias@sst.com.br
24 # digitro_rusers 1.1 Author: accdias@sst.com.br
25 # cyclades_snmp 1.0 Author: accdias@sst.com.br
26 # usrhiper_snmp 1.0 Author: igor@ipass.net
27 # multitech_snmp 1.0 Author: ehonzay@willmar.com
28 # netserver_telnet 1.0 Author: mts@interplanet.es
29 # versanet_snmp 1.0 Author: support@versanetcomm.com
30 # bay_finger 1.0 Author: chris@shenton.org
32 # Config: $debug is the file you want to put debug messages in
33 # $snmpget is the location of your ``snmpget'' program
34 # $snmpwalk is the location of your ``snmpwalk'' program
35 # $rusers is the location of your ``rusers'' program
36 # $naspass is the location of your NAS admin password file
40 $localstatedir = "@localstatedir@";
42 $sysconfdir = "@sysconfdir@";
43 $raddbdir = "@raddbdir@";
46 #$debug = "$logdir/checkrad.log";
48 $snmpget = "@SNMPGET@";
49 $snmpwalk = "@SNMPWALK@";
51 $naspass = "$raddbdir/naspasswd";
54 # PM3: $lv_offs is where the last S port is before one or two
55 # ports are skipped (22 or 29, for US or Europe)
56 # $lv_hole is the size of the hole (1 or 2, for US or Europe).
62 # USR-Hiper: $hiper_density is the reported port density (default 256
63 # but 24 makes more sense)
68 # Try to load Net::Telnet, SNMP_Session etc.
69 # Do not complain if we cannot find it.
70 # Prefer a locally installed copy.
73 unshift @INC, "/usr/local/lib/site_perl";
75 eval "use Net::Telnet 3.00;";
76 $::HAVE_NET_TELNET = ($@ eq "");
78 eval "use SNMP_Session;";
81 $::HAVE_SNMP_SESSION = ($@ eq "");
87 # Get password from /etc/raddb/naspasswd file.
88 # Returns (login, password).
91 my ($terminalserver, $emptyok) = @_;
92 my ($login, $password);
93 my ($ts, $log, $pass);
95 unless (open(NFD, $naspass)) {
97 print LOG "checkrad: naspasswd file not found; " .
98 "possible match for $ARGV[3]\n" if ($debug);
99 print STDERR "checkrad: naspasswd file not found; " .
100 "possible match for $ARGV[3]\n";
106 next if (m/^(#|$|[\t ]+$)/);
107 ($ts, $log, $pass) = split(/\s+/, $_, 3);
108 if ($ts eq $terminalserver) {
115 if ($password eq "" && !$emptyok) {
116 print LOG "checkrad: password for $ARGV[1] is null; " .
117 "possible match for $ARGV[3] on " .
118 "port $ARGV[2]\n" if ($debug);
119 print STDERR "checkrad: password for $ARGV[1] is null; " .
120 "possible match for $ARGV[3] on port $ARGV[2]\n";
126 # See if Net::Telnet is there.
128 sub check_net_telnet {
129 if (!$::HAVE_NET_TELNET) {
131 " checkrad: Net::Telnet 3.00+ CPAN module not installed\n"
134 "checkrad: Net::Telnet 3.00+ CPAN module not installed\n";
141 # Do snmpget by calling snmpget.
144 my ($host, $community, $oid) = @_;
148 $_ = `$snmpget $host $community $oid`;
149 if (/^.*(\s|\")([0-9A-Za-z]{8})(\s|\"|$).*$/) {
152 } elsif (/^.*=.*"(.*)"/) {
153 # oid = "...." junk format.
155 } elsif (/^.*=\s*(\S+)/) {
156 # oid = string format
160 # Strip trailing junk if any.
161 $ret =~ s/\s*Hex:.*$//;
166 # Do snmpget by using SNMP_Session.
167 # Coded by Jerry Workman <jerry@newwave.net>
169 sub snmpget_session {
170 my ($host, $community, $OID) = @_;
173 my (@enoid, $var,$response, $bindings, $binding, $value);
174 my ($inoid, $outoid, $upoid, $oid, @retvals);
176 $OID =~ s/^.iso.org.dod.internet.private.enterprises/.1.3.6.1.4.1/;
178 push @enoid, encode_oid((split /\./, $OID));
181 my $session = SNMP_Session->open($host, $community, 161);
182 if (!$session->get_request_response(@enoid)) {
183 $e = "No SNMP answer from $ARGV[0].";
184 print LOG "$e\n" if ($debug);
185 print STDERR "checkrad: $e\n";
188 $response = $session->pdu_buffer;
189 ($bindings) = $session->decode_get_response ($response);
192 ($binding,$bindings) = decode_sequence ($bindings);
193 ($oid,$value) = decode_by_template ($binding, "%O%@");
194 my $tempo = pretty_print($value);
200 push @retvals, $tempo;
211 if ($::HAVE_SNMP_SESSION) {
212 $ret = snmpget_session(@_);
213 } elsif (-x $snmpget) {
214 $ret = snmpget_prog(@_);
216 $e = "Neither SNMP_Session module or $snmpget found!";
217 print LOG "$e\n" if ($debug);
218 print STDERR "checkrad: $e\n";
225 # Strip domains, prefixes and suffixes from username
227 # Known prefixes: (P)PP, (S)LIP e (C)SLIP
228 # Known suffixes: .ppp, .slip e .cslip
230 # Author: Antonio Dias of SST Internet <accdias@sst.com.br>
237 $user =~ s/^\s*(.*?)\s*$/$1/;
239 # Strip out domains, prefix and suffixes
241 $user =~ s/\@(.)*$//;
243 $user =~ s/\.(ppp|slip|cslip)$//;
248 # See if the user is logged in using the Livingston MIB.
249 # We don't check the username but the session ID.
251 $lvm = '.iso.org.dod.internet.private.enterprises.307';
252 sub livingston_snmp {
255 # First find out the offset (ugly!!). Also, if the portno
256 # is greater than 29, substract 2 (S30 and S31 don't exist).
257 # You might need to change this to 23 and 1 for the USA.
259 $_ = snmpget($ARGV[1], "public", "$lvm.3.2.1.1.1.2.5");
262 $portidx = $ARGV[2] + (5 - $xport);
263 $portidx -= $lv_hole if ($ARGV[2] > $lv_offs);
265 print LOG " using $xport offset for port / SNMPno translation\n"
269 # Now get the session id from the terminal server.
271 $sessid = snmpget($ARGV[1], "public", "$lvm.3.2.1.1.1.5.$portidx");
273 print LOG " session id at port S$ARGV[2]: $sessid\n" if ($debug);
275 ($sessid eq $ARGV[4]) ? 1 : 0;
279 # See if the user is logged in using the Aptis MIB.
280 # We don't check the username but the session ID.
282 # sessionStatusActiveName
283 $apm1 = '.iso.org.dod.internet.private.enterprises.2637.2.2.102.1.12';
284 # sessionStatusActiveStopTime
285 $apm2 = '.iso.org.dod.internet.private.enterprises.2637.2.2.102.1.20';
288 # Remove unique identifier, then take remainder of the
289 # session-id as a hex number, convert that to decimal.
290 my $sessid = $ARGV[4];
293 $sessid = "0" if ($sessid eq '');
296 # Now get the login from the terminal server.
297 # Blech - the SNMP table is called 'sessionStatusActiveTable,
298 # but it sometimes lists inactive sessions too.
299 # However an active session doesn't have a Stop time,
300 # so we can differentiate that way.
302 my $login = snmpget($ARGV[1], "public", "$apm1." . hex($sessid));
303 my $stopt = snmpget($ARGV[1], "public", "$apm2." . hex($sessid));
304 $login = "--" if ($stopt > 0);
306 print LOG " login with session-id $ARGV[4]: $login\n" if ($debug);
308 (strip_username($login) eq strip_username($ARGV[3])) ? 1 : 0;
312 # See if the user is logged in using the Cisco MIB
314 $csm = '.iso.org.dod.internet.private.enterprises.9';
317 # Look up community string in naspasswd file.
318 my ($login, $password) = naspasswd($ARGV[1], 1);
319 if ($login && $login ne 'SNMP') {
322 " Error: Need SNMP community string for $ARGV[1]\n";
326 $password = "public";
329 $login = snmpget($ARGV[1], $password, "$csm.2.9.2.1.18.$ARGV[2]");
331 print LOG " user at port S$ARGV[2]: $login\n" if ($debug);
333 ($login eq $ARGV[3]) ? 1 : 0;
337 # Check a MultiTech CommPlete Server ( CC9600 & CC2400 )
339 # Author: Eric Honzay of Bennett Office Products <ehonzay@willmar.com>
341 $msm = '.iso.org.dod.internet.private.enterprises.995';
343 my $temp = $ARGV[2] + 1;
345 $login = snmpget($ARGV[1], "public", "$msm.2.31.1.1.1.$temp");
346 print LOG " user at port S$ARGV[2]: $login\n" if ($debug);
348 ($login eq $ARGV[3]) ? 1 : 0;
352 # Check a Computone Powerrack via finger
354 # Old Author: Shiloh Costa of MDI Internet Inc. <costa@mdi.ca>
355 # New Author: Alan Curry <pacman@world.std.com>
357 # The finger response format is version-dependent. To do this *right*, you
358 # need to know exactly where the port number and username are. I know that
359 # for 1.7.2, and 3.0.4 but for others I just guess.
360 # Oh yeah and on top of it all, the thing truncates usernames. --Pac.
362 # 1.7.2 and 3.0.4 both look like this:
364 # 0 0 000 00:56 luser pppfsm Incoming PPP, ppp00, 10.0.0.1
366 # and the truncated ones look like this:
368 # 25 0 000 00:15 longnameluse..pppfsm Incoming PPP, ppp25, 10.0.0.26
370 # Yes, the fields run together. Long Usernames Considered Harmful.
372 sub computone_finger {
375 open(FD, "finger \@$ARGV[1]|") or return 2;
376 <FD>; # the [hostname] line is definitely uninteresting
377 $trunc = substr($ARGV[3], 0, 12);
380 if(/cnx kernel release ([^ ,]+)[, ]/) {
384 # Check for known versions
385 if ($ver eq '1.7.2' || $ver eq '3.0.4') {
386 if (/^\Q$ARGV[2]\E\s+\S+\s+\S+\s+\S+\s+\Q$trunc\E(\s+|\.\.)/) {
393 if (/^\s*\Q$ARGV[2]\E\s+.*\s+\Q$trunc\E\s+/) {
404 # Check an Ascend Max4000 or similar model via finger
406 # Note: Not all software revisions support finger
407 # You may also need to enable the finger option.
409 # Author: Shiloh Costa of MDI Internet Inc. <costa@mdi.ca>
412 open(FD, "finger $ARGV[3]\@$ARGV[1]|");
415 if( $line =~ /Session/ ){
416 return 1; # user is online
418 return 0; # user is offline
426 # Check an Ascend Max4000 or similar model via SNMP
428 # Author: Blaz Zupan of Medinet <blaz@amis.net>
430 $asm = '.iso.org.dod.internet.private.enterprises.529';
439 # If it looks like hex, only try it as hex,
440 # otherwise try it as both decimal and hex.
443 if ($sess_id !~ /^0/ && $sess_id !~ /[a-f]/i) {
444 $l1 = snmpget($ARGV[1], "public", "$asm.12.3.1.4.$sess_id");
446 $sess_id = hex $ARGV[4];
447 $l2 = snmpget($ARGV[1], "public", "$asm.12.3.1.4.$sess_id");
449 print LOG " user at port S$ARGV[2]: $l1 (dec)\n" if ($debug && $l1);
450 print LOG " user at port S$ARGV[2]: $l2 (hex)\n" if ($debug && $l2);
452 (($l1 && $l1 eq $ARGV[3]) || ($l2 && $l2 eq $ARGV[3])) ? 1 : 0;
457 # See if the user is logged in using the portslave finger.
459 sub portslave_finger {
464 open(FD, "finger \@$ARGV[1]|");
467 # Check for ^Port. If we don't see it we
468 # wont get confused by non-portslave-finger
475 next if (!$Port_seen);
478 ($port, $user) = /^.(...) (...............)/;
482 $ulen = length($user);
484 # HACK: strip [PSC] from the front of the username,
485 # and things like .ppp from the end.
488 $user =~ s/\.(ppp|slip|cslip)$//;
491 # HACK: because ut_user usually has max. 8 characters
492 # we only compare up the the length of $user if the
493 # unstripped name had 8 chars.
495 $argv_user = $ARGV[3];
497 $ulen = length($user);
498 $argv_user = substr($ARGV[3], 0, $ulen);
501 if ($port == $ARGV[2]) {
502 if ($user eq $argv_user) {
503 print LOG " $user matches $argv_user " .
504 "on port $port" if ($debug);
508 print LOG " $user doesn't match $argv_user " .
509 "on port $port" if ($debug);
520 # See if the user is already logged-in at the 3Com/USR Total Control.
521 # (this routine by Alexis C. Villalon <alexisv@compass.com.ph>).
522 # You must have the Net::Telnet module from CPAN for this to work.
523 # You must also have your /etc/raddb/naspasswd made up.
527 # Localize all variables first.
529 my ($Port_seen, $ts, $terminalserver, $log, $login, $pass, $password);
530 my ($telnet, $curprompt, $curline, $ok, $totlines, $ccntr);
531 my (@curlines, @cltok, $user, $port, $ulen);
533 return 2 unless (check_net_telnet());
535 $terminalserver = $ARGV[1];
538 # Get login name and password for a certain NAS from $naspass.
540 ($login, $password) = naspasswd($terminalserver, 1);
541 return 2 if ($password eq "");
544 # Communicate with NAS using Net::Telnet, then issue
545 # the command "show sessions" to see who are logged in.
546 # Thanks to Chris Jackson <chrisj@tidewater.net> for the
547 # for the "-- Press Return for More --" workaround.
549 $telnet = new Net::Telnet (Timeout => 10,
551 $telnet->open($terminalserver);
552 $telnet->login($login, $password);
553 $telnet->print("show sessions");
554 while ($curprompt ne "\>") {
555 ($curline, $curprompt) = $telnet->waitfor
556 (String => "-- Press Return for More --",
559 $ok = $telnet->print("");
560 push @curlines, split(/^/m, $curline);
564 # Telnet closed. We got the info. Let's examine it.
566 $totlines = @curlines;
568 while($ccntr < $totlines) {
572 if ($curlines[$ccntr] =~ /^Port/) {
578 # Ignore all unnecessary lines.
580 if (!$Port_seen || $curlines[$ccntr] =~ /^---/ ||
581 $curlines[$ccntr] =~ /^ .*$/) {
586 # Parse the current line for the port# and username.
588 @cltok = split(/\s+/, $curlines[$ccntr]);
592 $ulen = length($user);
594 # HACK: strip [PSC] from the front of the username,
595 # and things like .ppp from the end. Strip S from
596 # the front of the port number.
599 $user =~ s/\.(ppp|slip|cslip)$//;
602 # HACK: because "show sessions" shows max. 15 characters
603 # we only compare up to the length of $user if the
604 # unstripped name had 15 chars.
606 $argv_user = $ARGV[3];
608 $ulen = length($user);
609 $argv_user = substr($ARGV[3], 0, $ulen);
611 if ($port == $ARGV[2]) {
612 if ($user eq $argv_user) {
613 print LOG " $user matches $argv_user " .
614 "on port $port" if ($debug);
617 print LOG " $user doesn't match $argv_user " .
618 "on port $port" if ($debug);
627 # Check a Cyclades PathRAS via telnet
631 # Author: Antonio Dias of SST Internet <accdias@sst.com.br>
633 sub cyclades_telnet {
635 # Localize all variables first.
637 my ($pr, $pr_login, $pr_passwd, $pr_prompt, $endlist, @list, $port, $user);
639 # This variable must match PathRAS' command prompt
640 # string as entered in menu option 6.2.
641 # The value below matches the default command prompt.
643 $pr_prompt = '/Select option ==\>$/i';
646 # This variable match the end of userslist.
648 $endlist = '/Type \<enter\>/i';
651 # Do we have Net::Telnet installed?
653 return 2 unless (check_net_telnet());
656 # Get login name and password for NAS
657 # from $naspass file.
659 ($pr_login, $pr_passwd) = naspasswd($ARGV[1], 1);
662 # Communicate with PathRAS using Net::Telnet, then access
663 # menu option 6.8 to see who are logged in.
664 # Based on PathRAS firmware version 1.2.3
666 $pr = new Net::Telnet (
673 # Force PathRAS shows its banner.
680 if ($pr->waitfor(Match => '/login : $/i') == 1) {
681 $pr->print($pr_login);
683 print LOG " Error: sending login name to PathRAS\n" if ($debug);
688 if ($pr->waitfor(Match => '/password : $/i') == 1) {
689 $pr->print($pr_passwd);
691 print LOG " Error: sending password to PathRAS.\n" if ($debug);
699 # Access menu option 6 "PathRAS Management"
701 if ($pr->waitfor(Match => $pr_prompt) == 1) {
704 print LOG " Error: acessing menu option '6'.\n" if ($debug);
709 # Access menu option 8 "Show Active Ports"
711 if ($pr->waitfor(Match => $pr_prompt) == 1) {
712 @list = $pr->cmd(String => '8', Prompt => $endlist);
714 print LOG " Error: acessing menu option '8'.\n" if ($debug);
719 # Since we got the info we want, let's close
725 # Lets examine the userlist stored in @list
729 # We are interested in active sessions only
732 ($port, $user) = split;
734 # Strip out any prefix, suffix and
735 # realm from $user check to see if
738 if($ARGV[3] eq strip_username($user)) {
739 print LOG " User '$ARGV[3]' found on '$ARGV[1]:$port'.\n" if ($debug);
744 print LOG " User '$ARGV[3]' not found on '$ARGV[1]'.\n" if ($debug);
749 # Check a Patton 2800 via SNMP
753 # Author: Antonio Dias of SST Internet <accdias@sst.com.br>
758 #$oid = '.1.3.6.1.4.1.1768.5.100.1.40.' . hex $ARGV[4];
759 # Reported by "Andria Legon" <andria@patton.com>
760 # The OID below should be the correct one instead of the one above.
761 $oid = '.1.3.6.1.4.1.1768.5.100.1.56.' . hex $ARGV[4];
763 # Check if the session still active
765 if (snmpget($ARGV[1], "monitor", "$oid") == 0) {
766 print LOG " Session $ARGV[4] still active on NAS " .
767 "$ARGV[1], port $ARGV[2], for user $ARGV[3].\n" if ($debug);
774 # Check a Digitro BXS via rusers
778 # Author: Antonio Dias of SST Internet <accdias@sst.com.br>
784 if (-e $rusers && -x $rusers) {
786 # Get a list of users logged in via rusers
788 $_ = `$rusers $ARGV[1]`;
789 $ret = ((/$ARGV[3]/) ? 1 : 0);
791 print LOG " Error: can't execute $rusers\n" if $debug;
798 # Check Cyclades PR3000 and PR4000 via SNMP
802 # Author: Antonio Dias of SST Internet <accdias@sst.com.br>
808 $oid = ".1.3.6.1.4.1.2925.3.3.6.1.1.2";
810 if (-e $snmpwalk && -x $snmpwalk) {
812 # Get a list of logged in users via snmpwalk
814 # I'm looking for a way to do this using SNMP_Session
815 # module. Any help would be great.
817 $_ = `$snmpwalk $ARGV[1] public $oid`;
818 $ret = ((/$ARGV[3]/) ? 1 : 0);
820 print LOG " Error: can't execute $snmpwalk\n" if $debug;
827 # 3Com/USR HiPer Arc Total Control.
828 # This works with HiPer Arc 4.0.30
829 # (this routine by Igor Brezac <igor@ipass.net>)
831 $usrm = '.iso.org.dod.internet.private.enterprises.429';
833 my ($login,$password,$oidext);
835 # Look up community string in naspasswd file.
836 ($login, $password) = naspasswd($ARGV[1], 1);
837 if ($login && $login ne 'SNMP') {
840 " Error: Need SNMP community string for $ARGV[1]\n";
844 $password = "public";
847 $oidext = 1257 + 256*int(($ARGV[2]-1) / $hiper_density) +
848 (($ARGV[2]-1) % $hiper_density);
851 $login = snmpget($ARGV[1], $password, "$usrm.4.10.1.1.18.$oidext");
852 if ($login =~ /\"/) {
853 $login =~ /^.*\"([^"]+)\"/;
857 print LOG " user at port S$ARGV[2]: $login\n" if ($debug);
859 ($login eq $ARGV[3]) ? 1 : 0;
864 # Check USR Netserver with Telnet - based on tc_tccheck.
865 # By "Marti" <mts@interplanet.es>
869 # Localize all variables first.
871 my ($ts, $terminalserver, $login, $password);
872 my ($telnet, $curprompt, $curline, $ok);
873 my (@curlines, $user, $port);
875 return 2 unless (check_net_telnet());
877 $terminalserver = $ARGV[1];
880 # Get login name and password for a certain NAS from $naspass.
882 ($login, $password) = naspasswd($terminalserver, 1);
883 return 2 if ($password eq "");
886 # Communicate with Netserver using Net::Telnet, then access
887 # list connectionsto see who are logged in.
889 $telnet = new Net::Telnet (Timeout => 10,
891 $telnet->open($terminalserver);
896 $telnet->login($login, $password);
899 # Launch list connections command
901 $telnet->print("list connections");
903 while ($curprompt ne "\>") {
904 ($curline, $curprompt) = $telnet->waitfor
907 $ok = $telnet->print("");
908 push @curlines, split(/^/m, $curline);
913 # Telnet closed. We got the info. Let's examine it.
917 ($port, $user, $dummy) = split;
919 # Strip out any prefixes and suffixes
922 # uncomment this if you use the standard
924 #$user =~ s/^[PSC]//;
925 #$user =~ s/\.(ppp|slip|cslip)$//;
927 # Check to see if $user is already connected
929 if ($user eq $ARGV[3]) {
930 print LOG " $user matches $ARGV[3] " .
931 "on port $port" if ($debug);
937 " $ARGV[3] not found on Netserver logged users list " if ($debug);
942 # Versanet's Perl Script Support:
944 # ___ versanet_snmp 1.0 by support@versanetcomm.com ___ July 1999
945 # Versanet Enterprise MIB Base: 1.3.6.1.4.1.2180
947 # VN2001/2002 use slot/port number to locate modems. To use snmp get we
948 # have to translate the original port number into a slot/port pair.
950 $vsm = '.iso.org.dod.internet.private.enterprises.2180';
953 print LOG "argv[2] = $ARGV[2] " if ($debug);
955 $port = 8 if ($port eq 0);
956 print LOG "port = $port " if ($debug);
957 $slot = (($ARGV[2]-$port)/8)+1;
958 print LOG "slot = $slot" if ($debug);
959 $loginname = snmpget($ARGV[1], "public", "$vsm.27.1.1.3.$slot.$port");
961 # Note: the "public" string above could be replaced by the public
962 # community string defined in Versanet VN2001/VN2002.
964 print LOG " user at slot $slot port $port: $loginname\n" if ($debug); ($loginname eq $ARGV[3]) ? 1 : 0;
968 # 1999/08/24 Chris Shenton <chris@shenton.org>
969 # Check Bay8000 NAS (aka: Annex) using finger.
970 # Returns from "finger @bay" like:
971 # Port What User Location When Idle Address
972 # asy2 PPP bill --- 9:33am :08 192.168.1.194
973 # asy4 PPP hillary --- 9:36am :04 192.168.1.195
975 # But also returns partial-match users if you say like "finger g@bay":
976 # Port What User Location When Idle Address
977 # asy2 PPP gore --- 9:33am :09 192.168.1.194
978 # asy22 PPP gwbush --- Mon 9:19am :07 192.168.1.80
979 # So check exact match of username!
981 sub bay_finger { # ARGV: 1=nas_ip, 2=nas_port, 3=login, 4=sessid
982 open(FINGER, "finger $ARGV[3]\@$ARGV[1]|") || return 2; # error
984 my ($Asy, $PPP, $User) = split;
985 if( $User =~ /^$ARGV[3]$/ ){
987 print LOG "checkrad:bay_finger: ONLINE $ARGV[3]\@$ARGV[1]"
993 print LOG "checkrad:bay_finger: offline $ARGV[3]\@$ARGV[1]" if ($debug);
997 ###############################################################################
1000 open(LOG, ">>$debug");
1002 print LOG "$now checkrad @ARGV\n";
1006 print LOG "Usage: checkrad nas_type nas_ip " .
1007 "nas_port login session_id\n" if ($debug);
1008 print STDERR "Usage: checkrad nas_type nas_ip " .
1009 "nas_port login session_id\n";
1010 close LOG if ($debug);
1014 if ($ARGV[0] eq 'livingston') {
1015 $ret = &livingston_snmp;
1016 } elsif ($ARGV[0] eq 'cisco') {
1018 } elsif ($ARGV[0] eq 'cvx') {
1020 } elsif ($ARGV[0] eq 'multitech') {
1021 $ret = &multitech_snmp;
1022 } elsif ($ARGV[0] eq 'computone') {
1023 $ret = &computone_finger;
1024 } elsif ($ARGV[0] eq 'max40xx') {
1025 $ret = &max40xx_finger;
1026 } elsif ($ARGV[0] eq 'ascend' || $ARGV[0] eq 'max40xx_snmp') {
1027 $ret = &ascend_snmp;
1028 } elsif ($ARGV[0] eq 'portslave') {
1029 $ret = &portslave_finger;
1030 } elsif ($ARGV[0] eq 'tc') {
1032 } elsif ($ARGV[0] eq 'pathras') {
1033 $ret = &cyclades_telnet;
1034 } elsif ($ARGV[0] eq 'pr3000') {
1035 $ret = &cyclades_snmp;
1036 } elsif ($ARGV[0] eq 'pr4000') {
1037 $ret = &cyclades_snmp;
1038 } elsif ($ARGV[0] eq 'patton') {
1039 $ret = &patton_snmp;
1040 } elsif ($ARGV[0] eq 'digitro') {
1041 $ret = &digitro_rusers;
1042 } elsif ($ARGV[0] eq 'usrhiper') {
1043 $ret = &usrhiper_snmp;
1044 } elsif ($ARGV[0] eq 'netserver') {
1045 $ret = &usrnet_telnet;
1046 } elsif ($ARGV[0] eq 'versanet') {
1047 $ret = &versanet_snmp;
1048 } elsif ($ARGV[0] eq 'bay') {
1050 } elsif ($ARGV[0] eq 'other') {
1053 print LOG " checkrad: unknown NAS type $ARGV[0]\n" if ($debug);
1054 print STDERR "checkrad: unknown NAS type $ARGV[0]\n";
1060 $mn = "double detected" if ($ret == 1);
1061 $mn = "error detected" if ($ret == 2);
1062 print LOG " Returning $ret ($mn)\n";