Help on passing parameter to exec

nghiapt nghia.pham at
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"){

	if (Acct-Status-Type == "Stop"){

where acctstart and acctstop is 2 exec modules, defined like this:

exec acctstart {
	wait = yes
	program = "/ %{User-Name} %{reply:Session-Timeout}"
	input_pairs = reply
	output_pairs = reply
	shell_escape = yes

exec acctstop {
	wait = yes
	program = "/ %{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 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 port 45280, id=123,
        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 =
        Acct-Session-Id =
        Framed-IP-Address =
        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 
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

Thanks a lot in advance,

View this message in context:
Sent from the FreeRadius - User mailing list archive at

More information about the Freeradius-Users mailing list