/usr/share/doc/radiusclient1/examples/ip-down is in radiusclient1 0.3.2-14.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | #!/usr/bin/perl
#
# ip-down
#
# Script started when the PPP daemon disconnects.
#
use strict;
use GDBM_File;
#### RADIUS Begins
my ($sessionid, $username, $port, $portid, $timeout) = split (/:/, $ARGV[5]);
if ($sessionid)
{
# Code to inform the server that we're getting out.
# Port information database.
my $path_portinfo = "/var/ipoint/acct/portinfo";
# Radius accounting record generator.
my $prog_radacct = "/usr/local/lib/radiusclient/radacct";
# The session ID, username, raw port and ID are given to this script
# through the ipparam parameter of pppd 2.2.0e and above.
# Generate the accounting entry, and hand it over to RADIUS.
# Delete the port info entry since the user has logged off, but make use
# of the starting time.
my (%s, @e, $sessiontime);
tie (%s, "GDBM_File", $path_portinfo, GDBM_WRCREAT, 0600);
@e = split (':', $s{$portid});
if ($e[4])
{
$sessiontime = time() - $e[4];
}
delete $s{$portid};
untie (%s);
# Generate the accounting entry, and hand it over to RADIUS.
open (H, "| $prog_radacct -i $port");
my $cmd =
"Acct-Session-ID = \"$sessionid\"\n" .
"User-Name = \"$username\"\n" .
"Acct-Status-Type = Stop\n" .
"Acct-Authentic = RADIUS\n" .
"Service-Type = Framed\n" .
"Framed-Protocol = PPP\n" .
"Framed-IP-Address = $ARGV[4]\n";
if ($sessiontime)
{
$cmd .= "Acct-Session-Time = $sessiontime\n";
}
print H $cmd;
close (H);
}
#### RADIUS Ends
|