Launch external script after login and logout

Alan DeKok aland at deployingradius.com
Fri May 8 13:03:04 CEST 2009


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.



More information about the Freeradius-Users mailing list