For those who
concern,
I'm using a Linux RedHat
6.0 (running Portslave 1.2.0pre12 and a Moxa multiport) as an Access Server. It
works well with Radiator, but there is a problem with finger to Portslave. I
have to replace fingerd with ctlportslave, a finger
simulation deamon which you can finger to and see all online dialup
users.
Then I configure Nastype
in file radius.cfg => PortSlavelinux as described in documentation, but as I
looked into Radiator source code, I saw that the fingerd's format was different
to that in source code. The portslave linux output looks similar to format of
PortMaster. So if I configure Nastype=>PortSlaveLinux, it does not work.
Then I decided to write a new procedure to Handle PortslaveLinux like
that:
Nastype:
PortSlaveMoxa
Add new entry in
Nas table: 'PortslaveMoxa' =>
\&isOnlinePortslaveMoxa,
and write new
isOnlinePortslaveMoxa:
-------------------------------------------------------------
#####################################################################
# Check Portslave runing on Linux/Moxa by using finger
#Added by Le Anh Tuan, 27/05/2000
# The NAS-Port Number Format in network byte order is as follows:
#
# 0 1 2 3
# 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | Channel | Line | Slot | All zero |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#
# So channel 4 of line 1 in slot 2 is, for example,
# NAS-Port = 2084 (4 + 1 * 32 + 2 * 1024).
#
# This is from http://www.dataman.nl/ with search query:
# "portmaster 4 radius accounting"
#Port User Host/Inet/Dest Type Dir Status Start Idle
#----- --------------- ---------------- ------- --- ------------- ------ ------
#C0 - - Log/Net In USERNAME 0 0
#C1 - - Log/Net In USERNAME 0 0
#Port User Host/Inet/Dest Type Dir Status Start Idle
#----- --------------- ---------------- ------- --- ------------- ------ ------
#S0 jpampalone@syst ras13230.systec. Netwrk In ESTABLISHED 11:29 5
#S1 hugh ras13265.systec. Netwrk In ESTABLISHED 30 0
#S2 MANEMAN ras13284.systec. Netwrk In ESTABLISHED 2:08 0
#S3 hippydude ras13242.systec. Netwrk In ESTABLISHED 2 0
#S4 - - Log/Net In IDLE 0 0
#S5 gzaino ras13259.systec. Netwrk In ESTABLISHED 1:58 0
#S6 DSAMUELS ras13254.systec. Netwrk In ESTABLISHED 44 5
#S7 dazz ras13212.systec. Netwrk In ESTABLISHED 12 6
#S8 MAGRUNSEICH@sys ras13272.systec. Netwrk In ESTABLISHED 25 5
#S9 bushill ras13243.systec. Netwrk In ESTABLISHED 6:02 0
#
# Check Portslave runing on Linux/Moxa by using finger
#Added by Le Anh Tuan, 27/05/2000
# The NAS-Port Number Format in network byte order is as follows:
#
# 0 1 2 3
# 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | Channel | Line | Slot | All zero |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#
# So channel 4 of line 1 in slot 2 is, for example,
# NAS-Port = 2084 (4 + 1 * 32 + 2 * 1024).
#
# This is from http://www.dataman.nl/ with search query:
# "portmaster 4 radius accounting"
#Port User Host/Inet/Dest Type Dir Status Start Idle
#----- --------------- ---------------- ------- --- ------------- ------ ------
#C0 - - Log/Net In USERNAME 0 0
#C1 - - Log/Net In USERNAME 0 0
#Port User Host/Inet/Dest Type Dir Status Start Idle
#----- --------------- ---------------- ------- --- ------------- ------ ------
#S0 jpampalone@syst ras13230.systec. Netwrk In ESTABLISHED 11:29 5
#S1 hugh ras13265.systec. Netwrk In ESTABLISHED 30 0
#S2 MANEMAN ras13284.systec. Netwrk In ESTABLISHED 2:08 0
#S3 hippydude ras13242.systec. Netwrk In ESTABLISHED 2 0
#S4 - - Log/Net In IDLE 0 0
#S5 gzaino ras13259.systec. Netwrk In ESTABLISHED 1:58 0
#S6 DSAMUELS ras13254.systec. Netwrk In ESTABLISHED 44 5
#S7 dazz ras13212.systec. Netwrk In ESTABLISHED 12 6
#S8 MAGRUNSEICH@sys ras13272.systec. Netwrk In ESTABLISHED 25 5
#S9 bushill ras13243.systec. Netwrk In ESTABLISHED 6:02 0
#
sub
isOnlinePortslaveMoxa
{
my ($name, $nas_id, $nas_port, $session_id, $client) = @_;
{
my ($name, $nas_id, $nas_port, $session_id, $client) = @_;
my
$Login_seen = 0;
my ($result, @lines) = finger("\@$nas_id");
return 1 if !$result; # Could not finger. Assume still there
my $line;
my ($result, @lines) = finger("\@$nas_id");
return 1 if !$result; # Could not finger. Assume still there
my $line;
$name = substr($name, 0, 15);
foreach $line (@lines)
{
$_ = $line;
next if (/Port/);
next if (/---/);
next if !(/^S/);
my ($port, $user) = split;
$port =~ s/^S//;
if ($port == $nas_port )
{
return ($user eq $name);
}
}
{
$_ = $line;
next if (/Port/);
next if (/---/);
next if !(/^S/);
my ($port, $user) = split;
$port =~ s/^S//;
if ($port == $nas_port )
{
return ($user eq $name);
}
}
return 0; # Not there
}
-----------------------------------------------------------------------
Actually, this code is
mixed of PortslaveLinux and PortSalveMaster with some modification. But in my
case, I assume that our access server has only one channel, therefore I omit the
code to compute channel, slot and line from PortMaster.
So if any one interest in
PortslaveLinux like me, please review and correct this code for
me.
Thank you very
much.
Le Anh Tuan
Netnam Company
R&D group
email: [EMAIL PROTECTED]
www: http://www.netnam.vn