Freeradius and php script
Khaldon manIP
manvoip at gmail.com
Tue Sep 4 18:12:29 CEST 2007
Hi all,
I finally found out how to launch a script after authentication:
I have first created a module
exec modatt {
wait = yes
program = "/home/raduser/test.php %{User-Name} "
input_pairs = request
output_pairs = reply
}
and then I have added it in instantiate and authorize section
here is the php script (test.php):
#!/usr/bin/php
<?php
$argv = $_SERVER['argv'];
if ( $argv[1] == "toto")
echo "Session-Timeout:=100";
else
echo "Session-Timeout:=50";
?>
But I still have a problem: the session-timeout attribute is not sent to the
NAS.
The debug output is hereunder:
Tue Sep 4 17:26:57 2007 : Debug: Exec-Program output: Session-Timeout:=100
Tue Sep 4 17:26:57 2007 : Debug: Exec-Program-Wait: value-pairs:
,Session-Timeout:=100
Tue Sep 4 17:26:57 2007 : Error: Exec-Program-Wait: /home/raduser/test.php
%{User-Name} : unparsable reply
Tue Sep 4 17:26:57 2007 : Debug: Exec-Program: returned: 0
But I really don't know why because I execute a sh script (instead of a php
script), it works very well!!
here is my sh script (test.sh):
#!/bin/sh
if [ $1 == "toto" ]; then
echo "Session-Timeout:=100"
else
echo "Session-Timeout:=53"
fi
debug trace:
Tue Sep 4 17:58:00 2007 : Debug: Exec-Program output: Session-Timeout:=100
Tue Sep 4 17:58:00 2007 : Debug: Exec-Program-Wait: value-pairs:
Session-Timeout:=100
Tue Sep 4 17:58:00 2007 : Debug: Exec-Program: returned: 0
I don't see any difference between the scripts (except one is working and
the other one not)....
Please, advise me...
Many Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20070904/d987fab3/attachment.html>
More information about the Freeradius-Users
mailing list