Re: (PM) Radius (fwd)

Jeff Johnston (jjohnston@u-r-online.com)
Thu, 6 Nov 1997 22:39:26 -0500

This is a multi-part message in MIME format.

------=_NextPart_000_002A_01BCEB04.D77E81C0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

>Jeff,
>
>How about passing this script along to the rest of us......
>

Ok here goes. This works on a BSDI 3.0 system running a single pm3, however
it should be easily altered to run on multiple PM's.

Feel free to make any alterations to the script as you wish, however if you
could please email me any alterations you feel would benifit the script I
would be grateful. I doubt this is the best solution but it works, it is the
best free solution I know of.

Jeff

------=_NextPart_000_002A_01BCEB04.D77E81C0
Content-Type: text/plain;
name="mu.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="mu.txt"

#!/bin/bash

pmlist=3D"portmaster1"
=20
log=3D"/var/log/booted"
=20
umask 077
=20
if [ ! -x /usr/portmaster/pmwho -o ! -x /usr/portmaster/pmcom ]; then
echo portmaster utilities not found
exit 1
fi
=20
# checking and cleaning up workspace
if [ ! -d /tmp/.killer ]; then=20
rm -r /tmp/.killer=20
mkdir /tmp/.killer
fi
=20
cd /tmp/.killer
=20
rm -f killme duplicates
=20
# make a separate pmwho file for each portmaster; tail removes two =
header lines
for each in $pmlist; do
/usr/portmaster/pmwho $each | tail +3 > $each
done
=20
#combine all, cut down to login name, and check for duplicates. greps =
remove garbage
cut -c6-16 portmaster* | grep -v '\- ' | grep -v 'PPP' \
| sort | uniq -d > duplicates
=20
# get portmaster and port, put into a file. and kill the port
for abuser in `cat duplicates`; do

# /root/multimsg is a file containing the standard issue warning about
# misusing the system, this message is then mailed to the person who
# is logged on more than once
cat /root/multimsg | mail $abuser
for each in $pmlist; do
grep " $abuser " $each | tr ':' ' ' >> killme
if [ -s killme ]; then
echo ---`date`------------------------------------------- >> $log
while read port user junk;do
/usr/portmaster/pmcom -c $each "reset $port"=20
echo " $user disconected from $each port $port" >> $log
done < killme
echo >> $log
=09
# mails the log file containing the abuser to support email.
cat $log | mail support
fi
done
done
# final cleanup of /tmp/.killer
rm -r /tmp/.killer

------=_NextPart_000_002A_01BCEB04.D77E81C0--

-
To unsubscribe, email 'majordomo@livingston.com' with
'unsubscribe portmaster-users' in the body of the message.