Unless the ISP is _really_ cheap or _really_ low on IP space, static is
they way to go for many reasons, of which simultaneous logins is the least.
> about this until Windows 97 and NT 40 which both support
> load balancing. When these ISP start seeing multiple logins getting extra
> bandwidth, let's see who cries the loadest then.
ComOS 3.3.1 includes support for limiting the number of load-balanced ports in
use by a single user. Since load-balancing will only work on a single PM
(as well it should), controlling the number of ports is done in the ComOS.
***FREE SOURCE CODE***
I've written a simple variation on 'pmwho' that "flags" users who are on
more than once, or who have been on for a long time. Adding code to warn,
disconnect, or delete the accounts of these users is left as an exercise for
the reader, or you can hire me at my usual rates.
No this solution doesn't scale well, but running it every 5/15/45 minutes
is enough to catch chronic violaters. After that it's up to you to enforce
your policies.
I'm more interested in seeing Livingston implement OSPF/classless than
devoting time to enforcing ISP policies.
#!/usr/local/bin/perl5
#
# By Kevin Kadow (kadow@msg.net), loosely based on Internet Direct's 'pmwho'
# Part of the unpublished 'pmweb' web-based portmaster control software
#
# This program needs 'pm.pl' in the current or a @INC directory in order
# to run. Get it in ftp.rellim.com:/pub/admin/bpmtools2.0.tar.gz
#
# To use as a CGI script, invoke with '-html' (e.g. in ServerSide Include)
# or force $html to 1.
require 'pm.pl';
require 'flush.pl';
#
# Put your portmaster password, domain, and hostnames here, you can instead
# put the password in pm.pl and comment out the $Pass= line here.
#
$Pass="MYSecret";
$domain=".mydomain.com";
@All = ( "pm1","pm2" );
$count= $#All +1;
$LongCall=4; #Flag people who've been on for more than four hours
$| = 1;
#
# Handle command line arguments
#
while($_=shift) {
$Verbose++ if(m/^-v/);
$html++ if(m/^-html/);
}
#
# Print the appropriate header
#
if($html) {
$date=`date`; chop $date;
print <<"EOF";
Content-type: text/html
Refresh: 120
<HEAD><TITLE>User List $date</TITLE></HEAD>
<BODY>
<H1>User list for $date</H1>
<PRE>
EOF
}
else {
print <<"EOF";
Server ## Username Hostname Status Idle Time Flags
EOF
}
#
#Cycle through the list of portmasters
#
foreach $Host (@All) {
portmaster::Connect($Host,$Pass);
for ($Cnt = 0; $Cnt <= 29; $Cnt++) {
local($Flag,$Status,$address,$Machine);
&portmaster::Who("$Cnt");
$Ports++;
next if("IDLE" eq $PortValue{$Cnt,STATUS});
$Used++;
#if($PortValue{$Cnt, PORT_TYPE} ne "Login/Netwrk" ) {
#warn "Port $Cnt on $Host is not configured for Login/Netwrk!!\n";
#};
$User=$PortValue{$Cnt, USERNAME};
if(($Users{$User}++) >1) {
#
#Logged on more than once!
#
$Flag="x".$Users{$User};
}
$Status=$PortValue{$Cnt, STATUS},
$address=$PortValue{$Cnt,FRAMED_ADDR};
if($address eq "0.0.0.0") {
#
# Addr9 is just a guess.
#
$address=$PortValue{$Cnt,Addr9};
}
else {
$Status="SLIP/PPP";
$SLIP++;
}
#
# Convert their time online to human readable, flag long calls
#
$time=$PortValue{$Cnt, STARTTIME};
$hours=int($time / 60);
$Flag.="!" if($hours >$LongCall);
$minutes= $time % 60;
unless($Machine=$lookup{$address}) {
$Machine=$address unless($Machine=&address2name($address));
$Machine=~ s/$domain//;
$lookup{$address}=$Machine;
}
$Total{$Machine}++ unless($Status eq "SLIP/PPP");
printf "$Host-S%2.2d %-10s %-15s %15s %4d %2d:%2.2d %s\n",
$Cnt,
$User, $Machine,
$Status,
$PortValue{$Cnt, IDLETIME},$hours,$minutes,$Flag;
}
close(portmaster'DS);
}
#
# Print the trailer
#
print "\n";
print "<HR>" if($html);
foreach $Machine (keys(%Total)) {
if($html) {
print "<B>${Machine}</B>: $Total{$Machine}<BR>\n";
}
else {
print "$Machine:$Total{$Machine} "
}
}
if($html) {
print "<B>SLIP</B>: ${SLIP}<BR>\n";
print "Total $Used of $Ports\n";
}
else {
print "SLIP/PPP: $SLIP = $Used/$Ports\n";
}
exit;
sub address2name {
local($addr,@bytes)=@_;
local($name,$aliases,$addrtype,$length,@addrs);
($name,$aliases,$addrtype,$length,@addrs) = gethostbyname($addr);
($name,$aliases,$addrtype,$length,@addrs) = gethostbyaddr($addrs[0],$addrtype);
return($name);
}