how to run sql query on radius startup
Hi All. I'm currently setting up freeeradius 1.0.4 with pgsql (8.0.3) backend, and I need to run an SQL query on radius server startup. Id like to know is it possible at all ? I've read the docs and *.sql config files but haven't found anything like this. Any suggestions ? I know I can run a query via psql from radius startup script, but I'd prefer another solution if such exists. Thanks in advance, Sergey Pariev.
Sergey Pariev wrote:
Hi All. I'm currently setting up freeeradius 1.0.4 with pgsql (8.0.3) backend, and I need to run an SQL query on radius server startup. Id like to know is it possible at all ? I've read the docs and *.sql config files but haven't found anything like this. Any suggestions ? I know I can run a query via psql from radius startup script, but I'd prefer another solution if such exists.
What exactly would you want to do? Maybe it serves a general purpose :) -- Groeten, Regards, Salutations, Thor Spruyt M: +32 (0)475 67 22 65 E: thor.spruyt@telenet.be W: www.thor-spruyt.com www.salesguide.be www.telenethotspot.be
Hello. I'm implementing my own db-based auth setup, and I want to check stale sessions, which can be caused by power outage, improper NAS shutdown, etc, on radius server startup. Basically I'd just like to have some sql query hook which would be executed on startup - to check the DB state . I've looked over config files for different sql modules but haven't found anything similar. So I'd like to clarify if such a query hook exists at all, and if not, how it can be done. Also I would appreciate any freeradius-related suggestions or best practices for dealing with things like stale sessions, handling improper shutdown etc - I suppose it's a common and known problem and there is currently no time to reinvent the wheel :) . Any pointers or advices would be highly appreciated. Thanks, Sergey. Thor Spruyt пишет:
Sergey Pariev wrote:
Hi All. I'm currently setting up freeeradius 1.0.4 with pgsql (8.0.3) backend, and I need to run an SQL query on radius server startup. Id like to know is it possible at all ? I've read the docs and *.sql config files but haven't found anything like this. Any suggestions ? I know I can run a query via psql from radius startup script, but I'd prefer another solution if such exists.
What exactly would you want to do? Maybe it serves a general purpose :)
Sergey Pariev <spariev@tnet.dp.ua> wrote:
So I'd like to clarify if such a query hook exists at all, and if not, how it can be done.
No query hook. As for how it could be done, edit src/modules/rlm_sql/rlm_sql.c.
Also I would appreciate any freeradius-related suggestions or best practices for dealing with things like stale sessions, handling improper shutdown etc
stale sessions can be handled via radzap. I'm not sure what you mean bu "improper shutdown". You should be able to kill the RADIUS server at any time & restart it. The only effect will be a few seconds where people can't log in. Alan DeKok.
Hello. Thanks for quick reply, Alan. Alan DeKok пишет:
Sergey Pariev <spariev@tnet.dp.ua> wrote:
So I'd like to clarify if such a query hook exists at all, and if not, how it can be done.
No query hook. As for how it could be done, edit src/modules/rlm_sql/rlm_sql.c.
Ok, I'll look into it, thanks.
Also I would appreciate any freeradius-related suggestions or best practices for dealing with things like stale sessions, handling improper shutdown etc
stale sessions can be handled via radzap.
I'm not sure what you mean bu "improper shutdown". You should be able to kill the RADIUS server at any time & restart it. The only effect will be a few seconds where people can't log in.
I probably haven't phrased my question clear enough. I wanted to ask about preferred strategies of dealing with data consistency at the db-level of the radius-based setup - is it better to run some procedure on the startup, as I'm going to do, or one can just setup some periodical checks, or to use radzap as you're suggested, or may be there are some other methods/strategies experienced guys use I'm not aware of ? Thanks, Sergey.
Alan DeKok.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Sergey Pariev <spariev@tnet.dp.ua> wrote:
I probably haven't phrased my question clear enough. I wanted to ask about preferred strategies of dealing with data consistency at the db-level of the radius-based setup
What DB consistency problems are you worried about? I can't think of any.
is it better to run some procedure on the startup, as I'm going to do, or one can just setup some periodical checks, or to use radzap as you're suggested, or may be there are some other methods/strategies experienced guys use I'm not aware of ?
If you mean "having the DB hold exactly which users are logged in" correctly, give up now. It's impossible. That's why the server includes "checkrad". Alan DeKok.
Alan DeKok пишет:
Sergey Pariev <spariev@tnet.dp.ua> wrote:
I probably haven't phrased my question clear enough. I wanted to ask about preferred strategies of dealing with data consistency at the db-level of the radius-based setup
What DB consistency problems are you worried about? I can't think of any.
is it better to run some procedure on the startup, as I'm going to do, or one can just setup some periodical checks, or to use radzap as you're suggested, or may be there are some other methods/strategies experienced guys use I'm not aware of ?
If you mean "having the DB hold exactly which users are logged in" correctly,
Yes, that's what I mean. Thanks again and sorry for unclear explanations - nothing is perfect and so is my English :). Thanks, Sergey. give up now. It's impossible. That's why the server
includes "checkrad".
Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
participants (3)
-
Alan DeKok -
Sergey Pariev -
Thor Spruyt