Alan DeKok ha scritto:
Gianni Olivieri wrote:
Hi to all,
in a previous verison of freeradius I use the acct_users file to launch a python script after login/logout of a user.
the acct_users was so:
DEFAULT Acct-Status-Type == "Start" Exec-Program = "/etc/freeradius/SCRIPT/userlogin.py %{User-Name}" DEFAULT Acct-Status-Type == "Stop" Exec-Program = "/etc/freeradius/SCRIPT/userlogout.py %{User-Name}
Now with freeradius 2.0.4 this acct_users doesn't work. How can launch a script after a login and a logout?
You will need to use the "exec" module:
DEFAULT Acct-Status-Type == "Start" Tmp-String-0 = "%{exec:/etc/freeradius/SCRIPT/userlogin.py}"
That will also cause the script to execute immediately. Or, you can use "unlang":
accounting { ...
if (Acct-Status-Type == Start) { update reply { Tmp-String-0 = "%{exec:/etc/freeradius/SCRIPT/userlogin.py}" }
} }
thanks for the reply... but there is some error in my conf... now my acct_users is: radius:/etc/freeradius/sites-enabled# cat ../acct_users DEFAULT Acct-Status-Type == "Start" Tmp-String-0 = "%(exec:/etc/freeradius/SCRIPT/userlogin.py User-Name)" DEFAULT Acct-Status-Type == "Stop" Tmp-String-0 = "%(exec:/etc/freeradius/SCRIPT/userlogout.py User-Name)" and when I launch freeradius: /etc/freeradius/acct_users[2]: Parse error (reply) for entry DEFAULT: Invalid octet string "%(exec:/etc/freeradius/SCRIPT/userlogin.py User-Name)" for attribute name "Tmp-String-0" Errors reading /etc/freeradius/acct_users I must initialize Tmp-String-0? I must also pass the UserName to my script.... Best regards. -- Gianni Olivieri SICE Telecomunicazioni ------------------------------------ Via Tazio Nuvolari, 53 55061 - Carraia (LU) - ITALY ------------------------------------------------ Tel. +39 0583 980787 Fax +39 0583 981495 www.sicetelecom.it gianni.olivieri@sicetelecom.it -----------------------------------------------