virtual server and clients from sql
With the actual git/cvs I wanted to setup client based virtual Servers, where the clients are stored in a mysql database. I added a column "server" to the nas table and set it to the name of a virtual server. ... rlm_sql (sql) in generate_sql_clients: query is SELECT id, nasname, shortname, type, secret FROM nas^M rlm_sql (sql): Reserving sql socket id: 4^M rlm_sql (sql): Read entry nasname=149.246.222.54,shortname=149.246.222.541,secret=testing123^M rlm_sql (sql): Adding client 149.246.222.54 (149.246.222.541, server=<none>) to clients list^M ... It seems, the value for server is ignored. Maybe the SELECT statement in rlm_sql.c has to be modified? Or do I have to configure anything else? Thanks Norbert Wegener
Hi,
With the actual git/cvs I wanted to setup client based virtual Servers, where the clients are stored in a mysql database. I added a column "server" to the nas table and set it to the name of a virtual server.
the logic is in rlm_sql.c alrady, all you need to do is update your nas_query so that it looks like eg SELECT id,nasname,shortname,type,secret,virtual_server FROM nas then it'll pull in the details from the DB alan
A.L.M.Buxey@lboro.ac.uk schrieb:
Hi,
With the actual git/cvs I wanted to setup client based virtual Servers, where the clients are stored in a mysql database. I added a column "server" to the nas table and set it to the name of a virtual server.
the logic is in rlm_sql.c alrady, all you need to do is update your nas_query so that it looks like eg
SELECT id,nasname,shortname,type,secret,virtual_server FROM nas
then it'll pull in the details from the DB
Thanks, will this be in 2.0.6 by default? Norbert Wegener
alan - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Should it be "SELECT id, nasname, shortname, type, secret, virtual_server FROM nas" or "SELECT id, nasname, shortname, type, secret, server FROM nas" Seg, 2008-07-07 às 20:54 +0200, Norbert Wegener escreveu:
A.L.M.Buxey@lboro.ac.uk schrieb:
Hi,
With the actual git/cvs I wanted to setup client based virtual Servers, where the clients are stored in a mysql database. I added a column "server" to the nas table and set it to the name of a virtual server.
the logic is in rlm_sql.c alrady, all you need to do is update your nas_query so that it looks like eg
SELECT id,nasname,shortname,type,secret,virtual_server FROM nas
then it'll pull in the details from the DB
Thanks, will this be in 2.0.6 by default?
Norbert Wegener
alan - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Alan DeKok wrote:
Norbert Wegener wrote:
will this be in 2.0.6 by default?
Yes.
It's also in 2.0.5, if you're willing to try it out in a testing environment.
I will try it, but what about the comment from A.L.M.Buxey@lboro.ac.uk:
the logic is in rlm_sql.c alrady, all you need to do is update your nas_query so that it looks like eg
SELECT id,nasname,shortname,type,secret,virtual_server FROM nas
then it'll pull in the details from the DB
alan
where those changes alone did not seem to help... So in 2.0.5 something seems to be missing..... Norbert Wegener
Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Norbert Wegener wrote:
where those changes alone did not seem to help...
See raddb/sql/mysql/nas.sql The field name is "server", not "virtual_server". And it's commented out by default.
So in 2.0.5 something seems to be missing.....
The SQL tables have to be updated to contain the right information, too. Once that's done, and the queries updated, it should work. Alan DeKok.
Alan DeKok wrote:
Norbert Wegener wrote:
where those changes alone did not seem to help...
See raddb/sql/mysql/nas.sql
The field name is "server", not "virtual_server". And it's commented out by default.
So in 2.0.5 something seems to be missing.....
The SQL tables have to be updated to contain the right information, too. Once that's done, and the queries updated, it should work.
I took today's cvs/git, modified the nas table: mysql> select * from nas; +----+-----------------+-----------+-------+-------+------------+--------+-----------+----------------+ | id | nasname | shortname | type | ports | secret | server | community | description | +----+-----------------+-----------+-------+-------+------------+--------+-----------+----------------+ | 1 | 149.246.185.169 | testbox | linux | 123 | testing123 | cisco | none | no description | +----+-----------------+-----------+-------+-------+------------+--------+-----------+----------------+ 1 row in set (0.00 sec) Modified nas_query: {"nas_query", PW_TYPE_STRING_PTR, offsetof(SQL_CONFIG,nas_query), NULL, "SELECT id,nasname,shortname,type,secret,server FROM nas"}, rebuild the server. ... rlm_sql (sql) in generate_sql_clients: query is SELECT id, nasname, shortname, type, secret FROM nas^M rlm_sql (sql): Reserving sql socket id: 4^M rlm_sql (sql): Read entry nasname=149.246.185.169,shortname=testbox,secret=testing123^M rlm_sql (sql): Adding client 149.246.185.169 (testbox, server=<none>) to clients list^M so the server does not seem to arrive. So I changed in rlm_sql.c: /* NAS query isn't xlat'ed */ /*strlcpy(querystr, inst->config->nas_query, sizeof(querystr));*/ strlcpy(querystr, "SELECT id,nasname,shortname,type,secret,server FROM nas", sizeof(querystr)); Which is probably not how it is expected to be done, but it works: .... rlm_sql (sql) in generate_sql_clients: query is SELECT id,nasname,shortname,type,secret,server FROM nas rlm_sql (sql): Reserving sql socket id: 4 rlm_sql (sql): Read entry nasname=149.246.185.169,shortname=testbox,secret=testing123 rlm_sql (sql): Adding client 149.246.185.169 (testbox, server=cisco) to clients list rlm_sql (sql): Released sql socket id: 4 Norbert Wegener
Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Hi,
Modified nas_query: {"nas_query", PW_TYPE_STRING_PTR, offsetof(SQL_CONFIG,nas_query), NULL, "SELECT id,nasname,shortname,type,secret,server FROM nas"}, rebuild the server.
huh? thats the default query in the code - if you edit sql.conf and modify nas_query in the config it will do the required task. alan
A.L.M.Buxey@lboro.ac.uk wrote:
Hi,
Modified nas_query: {"nas_query", PW_TYPE_STRING_PTR, offsetof(SQL_CONFIG,nas_query), NULL, "SELECT id,nasname,shortname,type,secret,server FROM nas"}, rebuild the server.
huh? thats the default query in the code - if you edit sql.conf and modify nas_query in the config it will do the required task.
Correct, thanks. I have been confused by the nas_query in rlm_sql.c Norbert Wegener
alan - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
participants (4)
-
A.L.M.Buxey@lboro.ac.uk -
Alan DeKok -
nf-vale -
Norbert Wegener