Launch external script after login and logout
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? 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 -----------------------------------------------
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.
http://wiki.freeradius.org/FAQ#It_still_doesn.27t_work.21 You have sent thing one, but not thing two (thing three is irrelevant). Ivan Kalik Kalik Informatika ISP
Ivan Kalik ha scritto:
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.
ok, thanks for this link. I've already read this page but I'ven't find the solution.
You have sent thing one, but not thing two (thing three is irrelevant).
??? sorry but I don't understand this. Can anyone explain me where set the call to an external program when a user do a login or a logout? 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 -----------------------------------------------
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}" } } } Alan DeKok.
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 -----------------------------------------------
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)"
Read man unlang to see how to use variables (in your case User-Name). Ivan Kalik Kalik Informatika ISP
Gianni Olivieri wrote:
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)"
That isn't what you were told to use. Could you cut & paste from my email, rather than re-typing it, with mistakes?
DEFAULT Acct-Status-Type == "Stop" Tmp-String-0 = "%(exec:/etc/freeradius/SCRIPT/userlogout.py User-Name)"
This one, too.
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....
You need to define TMP-String-0. It's defined in later versions of the server by default. Just add it to "raddb/dictionary" in your version, and it will work. As for passing User-Name, it will be passed as the environment variable USER_NAME. Alan DeKok.
participants (3)
-
Alan DeKok -
Gianni Olivieri -
Ivan Kalik