Help on passing parameter to exec
nghiapt
nghia.pham at exe.com.vn
Wed Nov 3 10:19:15 CET 2010
Hi all,
At first, to the people who is working on FreeRADIUS, you're doing an
awesome, awesome job!
Ok, so I'm having this configuration:
in sites-available/default:
[...]
preacct {
# Echo here yields WARNING and doesn't catch Session-Timeout
# echo
if (Acct-Status-Type == "Start"){
acctstart
}
if (Acct-Status-Type == "Stop"){
acctstop
}
[...]
where acctstart and acctstop is 2 exec modules, defined like this:
exec acctstart {
wait = yes
program = "/accounting_start_sh.sh %{User-Name} %{reply:Session-Timeout}"
input_pairs = reply
output_pairs = reply
shell_escape = yes
}
exec acctstop {
wait = yes
program = "/accounting_stop_sh.sh %{User-Name}
input_pairs = reply
output_pairs = reply
shell_escape = yes
}
Basically, the shell script is to ssh and terminate stuff in NAS after
Session-Timeout seconds have passed (Don't ask, but NAS doesn't support
Session-Timeout so we need to do it this way). The problem is, when we have
a run, the debug yield:
[...]
Sending Access-Accept of id 121 to 127.0.0.1 port 45280
Reply-Message = "Hello, test"
Session-Timeout = 94
Finished request 0.
Going to the next request
Waking up in 4.7 seconds.
rad_recv: Accounting-Request packet from host 127.0.0.1 port 45280, id=123,
length=155
NAS-Identifier = "OpenVPN.localhost.localdomain"
User-Name = "test"
NAS-Port = 27
Service-Type = Dialout-Framed-User
Framed-Protocol = PPP
Acct-Status-Type = Start
Framed-IP-Netmask = 255.255.248.0
Acct-Session-Id =
"OpenVPN.localhost.localdomain.as0t1.1288162180.5521.27"
Framed-IP-Address = 5.5.8.25
NAS-Port-Type = Virtual
+- entering group preacct {...}
++? if (Acct-Status-Type == "Start")
? Evaluating (Acct-Status-Type == "Start") -> TRUE
++? if (Acct-Status-Type == "Start") -> TRUE
++- entering if (Acct-Status-Type == "Start") {...}
[acctstart] WARNING! Input pairs are empty. No attributes will be passed to
the script
[acctstart] expand: %{User-Name} -> test
[acctstart] expand: %{reply:Session-Timeout} ->
expr: syntax error
Exec-Program output: test is scheduled to be terminated after min(s)
Exec-Program-Wait: plaintext: test is scheduled to be terminated after
min(s)
Exec-Program: returned: 0
[...]
Note the 2 bold lines, the Session-Timeout isn't passed to the acctstart
exec, leading to shellscript doesn't run correctly.
My question is can I somehow pass the Session-Timeout value from the
Access-Accept packet to this section of preaccounting?
FYI, I'm using sql counter (the default noresetcounter) to calculate the
Session-Timeout.
Thanks a lot in advance,
N.
--
View this message in context: http://freeradius.1045715.n5.nabble.com/Help-on-passing-parameter-to-exec-tp3248136p3248136.html
Sent from the FreeRadius - User mailing list archive at Nabble.com.
More information about the Freeradius-Users
mailing list