bashshellscriptingfreeradius

bash script invoked in freeradius


Can you please help me insert my bash script into freeradius. I would like to start my script each time a user is allowed access via freeradius to my network.

I tried to insert my script into queries (/etc/freeradius/3.0/mods-config/sql/main/mysql/queries.conf), but the script is not invoked.

If you have any idea on how to do this please let me know.

Thank you in advance!


Solution

  • Adding random things to the SQL configuration isn't going to help here.

    You need to configure the exec module, the best example is in mods-enabled/echo (though also see mods-enabled/exec). There are examples in that file on how to point to the script that you want to run, and what it should return.

    Then to ensure that it is run after a successful authentication, make sure that echo (or whatever instance name you gave to the module configuration) is listed in the post-auth{} section of the correct virtual server, most likely sites-enabled/default.

    Note that calling out to external scripts is nearly always a bad idea, it will cause performance to drop significantly. There is usually a better way to solve the problem.