Why Freeradius and Mysql dont work?
Platform and Environment: Freeradius:1.0.5 on Redhat 9 MySQL:MySQL-standard-5.0.20-linux-i686 Step: 1. create database radius; 2.mysql -uroot -prootpass radius < db_mysql.sql ; 3.Edit radiusd.conf and sql.conf; Debug Result: Nothing to do. Sleeping until we see a request. rad_recv: Access-Request packet from host 202.117.7.223:1490, id=6, length=47 User-Name = "barney" CHAP-Password = 0xad35a90d409c25b78b6d148a531358d9ac Processing the authorize section of radiusd.conf modcall: entering group authorize for request 2 modcall[authorize]: module "preprocess" returns ok for request 2 rlm_chap: Setting 'Auth-Type := CHAP' modcall[authorize]: module "chap" returns ok for request 2 modcall[authorize]: module "mschap" returns noop for request 2 rlm_realm: No '@' in User-Name = "barney", looking up realm NULL rlm_realm: No such realm "NULL" modcall[authorize]: module "suffix" returns noop for request 2 radius_xlat: 'barney' rlm_sql (sql): sql_set_user escaped user --> 'barney' radius_xlat: 'SELECT id, UserName, Attribute, Value, op FROM radcheck WHERE Username = 'barney' ORDER BY id' rlm_sql (sql): Ignoring unconnected handle 4.. rlm_sql (sql): Ignoring unconnected handle 3.. rlm_sql (sql): Ignoring unconnected handle 2.. rlm_sql (sql): Ignoring unconnected handle 1.. rlm_sql (sql): Ignoring unconnected handle 0.. rlm_sql (sql): There are no DB handles to use! skipped 5, tried to connect 0 modcall[authorize]: module "sql" returns fail for request 2 modcall: group authorize returns fail for request 2 Finished request 2 Going to the next request --- Walking the entire request list --- Waking up in 6 seconds... rad_recv: Access-Request packet from host 202.117.7.223:1490, id=6, length=47 Discarding duplicate request from client liv1:1490 - ID: 6 --- Walking the entire request list --- Waking up in 2 seconds... --- Walking the entire request list --- Cleaning up request 2 ID 6 with timestamp 45bca7cb Nothing to do. Sleeping until we see a request. From the above results, I guess mysql doesnt work. But I can access databases from the command line .The Freeradius Server worked well when I use the "user", not using MySQL. Any suggestion?
Zitat von yao guoxian <yaoguoxian@gmail.com>:
Platform and Environment: Freeradius:1.0.5 on Redhat 9 MySQL:MySQL-standard-5.0.20-linux-i686 Step: 1. create database radius; 2.mysql -uroot -prootpass radius < db_mysql.sql ; 3.Edit radiusd.conf and sql.conf; Debug Result: Nothing to do. Sleeping until we see a request. rad_recv: Access-Request packet from host 202.117.7.223:1490, id=6, length=47 User-Name = "barney" CHAP-Password = 0xad35a90d409c25b78b6d148a531358d9ac Processing the authorize section of radiusd.conf modcall: entering group authorize for request 2 modcall[authorize]: module "preprocess" returns ok for request 2 rlm_chap: Setting 'Auth-Type := CHAP' modcall[authorize]: module "chap" returns ok for request 2 modcall[authorize]: module "mschap" returns noop for request 2 rlm_realm: No '@' in User-Name = "barney", looking up realm NULL rlm_realm: No such realm "NULL" modcall[authorize]: module "suffix" returns noop for request 2 radius_xlat: 'barney' rlm_sql (sql): sql_set_user escaped user --> 'barney' radius_xlat: 'SELECT id, UserName, Attribute, Value, op FROM radcheck WHERE Username = 'barney' ORDER BY id' rlm_sql (sql): Ignoring unconnected handle 4.. rlm_sql (sql): Ignoring unconnected handle 3.. rlm_sql (sql): Ignoring unconnected handle 2.. rlm_sql (sql): Ignoring unconnected handle 1.. rlm_sql (sql): Ignoring unconnected handle 0.. rlm_sql (sql): There are no DB handles to use! skipped 5, tried to connect 0 modcall[authorize]: module "sql" returns fail for request 2 modcall: group authorize returns fail for request 2 Finished request 2 Going to the next request --- Walking the entire request list --- Waking up in 6 seconds... rad_recv: Access-Request packet from host 202.117.7.223:1490, id=6, length=47 Discarding duplicate request from client liv1:1490 - ID: 6 --- Walking the entire request list --- Waking up in 2 seconds... --- Walking the entire request list --- Cleaning up request 2 ID 6 with timestamp 45bca7cb Nothing to do. Sleeping until we see a request.
From the above results, I guess mysql doesnt work. But I can access databases from the command line .The Freeradius Server worked well when I use the "user", not using MySQL. Any suggestion?
Did you double-check the settings in sql.conf? It seems that freeradius can not connect to the mysql server. The startup messages (in debug mode) at my installation has the lines: sql: safe-characters = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /" rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked rlm_sql (sql): Attempting to connect to radiusd@localhost:/radius rlm_sql (sql): starting 0 rlm_sql (sql): Attempting to connect rlm_sql_mysql #0 rlm_sql_mysql: Starting connect to MySQL server for #0 rlm_sql (sql): Connected new DB handle, #0 rlm_sql (sql): starting 1 rlm_sql (sql): Attempting to connect rlm_sql_mysql #1 rlm_sql_mysql: Starting connect to MySQL server for #1 rlm_sql (sql): Connected new DB handle, #1 rlm_sql (sql): starting 2 rlm_sql (sql): Attempting to connect rlm_sql_mysql #2 rlm_sql_mysql: Starting connect to MySQL server for #2 rlm_sql (sql): Connected new DB handle, #2 rlm_sql (sql): starting 3 rlm_sql (sql): Attempting to connect rlm_sql_mysql #3 rlm_sql_mysql: Starting connect to MySQL server for #3 rlm_sql (sql): Connected new DB handle, #3 rlm_sql (sql): starting 4 rlm_sql (sql): Attempting to connect rlm_sql_mysql #4 rlm_sql_mysql: Starting connect to MySQL server for #4 rlm_sql (sql): Connected new DB handle, #4 Module: Instantiated sql (sql) Do you see those? Regards markus -- Markus Krause email: krause@biochem.mpg.de Mogli-Soft: Support for Mac OS X, Webmail/Horde, LDAP, RADIUS by order of the Computing Center of the Max-Planck-Institute of Biochemistry Tel.: 089 - 89 40 85 99 Fax.: 089 - 89 40 85 98 ---------------------------------------------------------------------- This message was sent using https://webmail2.biochem.mpg.de If you encounter any problems please report to rz-linux@biochem.mpg.de
Thanks for reply. The startup message(in debug mode) on my machine: sql: safe-characters = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /" rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked rlm_sql (sql): Attempting to connect to root@localhost:/radius rlm_sql (sql): starting 0 rlm_sql (sql): Attempting to connect rlm_sql_mysql #0 rlm_sql_mysql: Starting connect to MySQL server for #0 rlm_sql_mysql: Couldn't connect socket to MySQL server root@localhost:radius rlm_sql_mysql: Mysql error 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' rlm_sql (sql): Failed to connect DB handle #0 rlm_sql (sql): starting 1 rlm_sql (sql): starting 2 rlm_sql (sql): starting 3 rlm_sql (sql): starting 4 rlm_sql (sql): Failed to connect to any SQL server. Module: Instantiated sql (sql) The settings of sql.conf is like followings: sql { driver = "rlm_sql_mysql" server = "localhost" login = "root" password = "123" # Database table configuration radius_db = "radius" acct_table1 = "radacct" acct_table2 = "radacct" # Allow for storing data after authentication postauth_table = "radpostauth" authcheck_table = "radcheck" authreply_table = "radreply" groupcheck_table = "radgroupcheck" groupreply_table = "radgroupreply" usergroup_table = "usergroup" # Table to keep radius client info nas_table = "nas" # Remove stale session if checkrad does not see a double login deletestalesessions = yes sqltrace = yes sqltracefile = ${logdir}/sqltrace.sql # number of sql connections to make to server num_sql_socks = 5 # number of seconds to dely retrying on a failed database # connection (per_socket) connect_failure_retry_delay = 60 sql_user_name = "%{Stripped-User-Name:-%{User-Name:-DEFAULT}}" sql_user_name = "%{User-Name}" authorize_check_query = "SELECT id, UserName, Attribute, Value, op \ FROM ${authcheck_table} \ WHERE Username = '%{SQL-User-Name}' \ ORDER BY id" authorize_reply_query = "SELECT id, UserName, Attribute, Value, op \ FROM ${authreply_table} \ WHERE Username = '%{SQL-User-Name}' \ ORDER BY id" ...... Is anything wrong with the settings? 2007/1/28, Markus Krause <krause@biochem.mpg.de>:
Zitat von yao guoxian <yaoguoxian@gmail.com>:
Platform and Environment: Freeradius:1.0.5 on Redhat 9 MySQL:MySQL-standard-5.0.20-linux-i686 Step: 1. create database radius; 2.mysql -uroot -prootpass radius < db_mysql.sql ; 3.Edit radiusd.conf and sql.conf; Debug Result: Nothing to do. Sleeping until we see a request. rad_recv: Access-Request packet from host 202.117.7.223:1490, id=6, length=47 User-Name = "barney" CHAP-Password = 0xad35a90d409c25b78b6d148a531358d9ac Processing the authorize section of radiusd.conf modcall: entering group authorize for request 2 modcall[authorize]: module "preprocess" returns ok for request 2 rlm_chap: Setting 'Auth-Type := CHAP' modcall[authorize]: module "chap" returns ok for request 2 modcall[authorize]: module "mschap" returns noop for request 2 rlm_realm: No '@' in User-Name = "barney", looking up realm NULL rlm_realm: No such realm "NULL" modcall[authorize]: module "suffix" returns noop for request 2 radius_xlat: 'barney' rlm_sql (sql): sql_set_user escaped user --> 'barney' radius_xlat: 'SELECT id, UserName, Attribute, Value, op FROM radcheck WHERE Username = 'barney' ORDER BY id' rlm_sql (sql): Ignoring unconnected handle 4.. rlm_sql (sql): Ignoring unconnected handle 3.. rlm_sql (sql): Ignoring unconnected handle 2.. rlm_sql (sql): Ignoring unconnected handle 1.. rlm_sql (sql): Ignoring unconnected handle 0.. rlm_sql (sql): There are no DB handles to use! skipped 5, tried to connect 0 modcall[authorize]: module "sql" returns fail for request 2 modcall: group authorize returns fail for request 2 Finished request 2 Going to the next request --- Walking the entire request list --- Waking up in 6 seconds... rad_recv: Access-Request packet from host 202.117.7.223:1490, id=6, length=47 Discarding duplicate request from client liv1:1490 - ID: 6 --- Walking the entire request list --- Waking up in 2 seconds... --- Walking the entire request list --- Cleaning up request 2 ID 6 with timestamp 45bca7cb Nothing to do. Sleeping until we see a request.
From the above results, I guess mysql doesnt work. But I can access databases from the command line .The Freeradius Server worked well when I use the "user", not using MySQL. Any suggestion?
Did you double-check the settings in sql.conf? It seems that freeradius can not connect to the mysql server. The startup messages (in debug mode) at my installation has the lines:
sql: safe-characters = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /" rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked rlm_sql (sql): Attempting to connect to radiusd@localhost:/radius rlm_sql (sql): starting 0 rlm_sql (sql): Attempting to connect rlm_sql_mysql #0 rlm_sql_mysql: Starting connect to MySQL server for #0 rlm_sql (sql): Connected new DB handle, #0 rlm_sql (sql): starting 1 rlm_sql (sql): Attempting to connect rlm_sql_mysql #1 rlm_sql_mysql: Starting connect to MySQL server for #1 rlm_sql (sql): Connected new DB handle, #1 rlm_sql (sql): starting 2 rlm_sql (sql): Attempting to connect rlm_sql_mysql #2 rlm_sql_mysql: Starting connect to MySQL server for #2 rlm_sql (sql): Connected new DB handle, #2 rlm_sql (sql): starting 3 rlm_sql (sql): Attempting to connect rlm_sql_mysql #3 rlm_sql_mysql: Starting connect to MySQL server for #3 rlm_sql (sql): Connected new DB handle, #3 rlm_sql (sql): starting 4 rlm_sql (sql): Attempting to connect rlm_sql_mysql #4 rlm_sql_mysql: Starting connect to MySQL server for #4 rlm_sql (sql): Connected new DB handle, #4 Module: Instantiated sql (sql)
Do you see those?
Regards markus
-- Markus Krause email: krause@biochem.mpg.de Mogli-Soft: Support for Mac OS X, Webmail/Horde, LDAP, RADIUS by order of the Computing Center of the Max-Planck-Institute of Biochemistry Tel.: 089 - 89 40 85 99 Fax.: 089 - 89 40 85 98
---------------------------------------------------------------------- This message was sent using https://webmail2.biochem.mpg.de If you encounter any problems please report to rz-linux@biochem.mpg.de
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
rlm_sql_mysql: Mysql error 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' rlm_sql (sql): Failed to connect DB handle #0 rlm_sql (sql): Failed to connect to any SQL server. your socket file is not in the place.. maybe you should use an IP in your sql.conf instead of the "localhost" ! Regards, E:S
Thanks again. The file "/var/lib/mysql/mysql.sock" does not exist.When I use an IP in sql.conf instead of the "localhost", I get the following result: rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked rlm_sql (sql): Attempting to connect to root@202.117.X.X:/radius rlm_sql (sql): starting 0 rlm_sql (sql): Attempting to connect rlm_sql_mysql #0 rlm_sql_mysql: Starting connect to MySQL server for #0 rlm_sql_mysql: Couldn't connect socket to MySQL server root@202.117.7.243 :radius rlm_sql_mysql: Mysql error 'Host '202.117.7.243' is not allowed to connect to this MySQL server' rlm_sql (sql): Failed to connect DB handle #0 rlm_sql (sql): starting 1 rlm_sql (sql): starting 2 rlm_sql (sql): starting 3 rlm_sql (sql): starting 4 rlm_sql (sql): Failed to connect to any SQL server. Module: Instantiated sql (sql) 2007/1/29, Edvin Seferovic <edvin.seferovic@kolp.at>:
rlm_sql_mysql: Mysql error 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' rlm_sql (sql): *Failed to connect DB handle #0 * rlm_sql (sql): Failed to connect to any SQL server.
your socket file is not in the place.. maybe you should use an IP in your sql.conf instead of the "localhost" !
Regards,
E:S
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Use the socket method. If you don't know where the socket file is try: find / -name mysql.sock It will probably be in /tmp if it isn't in /var/lib/mysql regards Frank Ranner ________________________________ From: freeradius-users-bounces+frank.ranner=defence.gov.au@lists.freeradius.or g [mailto:freeradius-users-bounces+frank.ranner=defence.gov.au@lists.freer adius.org] On Behalf Of yao guoxian Sent: Monday, 29 January 2007 15:14 To: edvin.seferovic@kolp.at; FreeRadius users mailing list Subject: Re: Why Freeradius and Mysql dont work? Thanks again. The file "/var/lib/mysql/mysql.sock" does not exist.When I use an IP in sql.conf instead of the "localhost", I get the following result: rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked rlm_sql (sql): Attempting to connect to root@202.117.X.X:/radius rlm_sql (sql): starting 0 rlm_sql (sql): Attempting to connect rlm_sql_mysql #0 rlm_sql_mysql: Starting connect to MySQL server for #0 rlm_sql_mysql: Couldn't connect socket to MySQL server root@202.117.7.243:radius rlm_sql_mysql: Mysql error 'Host '202.117.7.243' is not allowed to connect to this MySQL server' rlm_sql (sql): Failed to connect DB handle #0 rlm_sql (sql): starting 1 rlm_sql (sql): starting 2 rlm_sql (sql): starting 3 rlm_sql (sql): starting 4 rlm_sql (sql): Failed to connect to any SQL server. Module: Instantiated sql (sql) 2007/1/29, Edvin Seferovic <edvin.seferovic@kolp.at>: rlm_sql_mysql: Mysql error 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' rlm_sql (sql): Failed to connect DB handle #0 rlm_sql (sql): Failed to connect to any SQL server. your socket file is not in the place.. maybe you should use an IP in your sql.conf instead of the "localhost" ! Regards, E:S - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Thanks! The file "mysql.sock" is actually in /tmp/. regards Guoxian 2007/1/29, Ranner, Frank MR <Frank.Ranner@defence.gov.au>:
Use the socket method. If you don't know where the socket file is try:
find / -name mysql.sock
It will probably be in /tmp if it isn't in /var/lib/mysql
regards Frank Ranner
------------------------------ *From:* freeradius-users-bounces+frank.ranner= defence.gov.au@lists.freeradius.org [mailto: freeradius-users-bounces+frank.ranner=defence.gov.au@lists.freeradius.org] *On Behalf Of *yao guoxian *Sent:* Monday, 29 January 2007 15:14 *To:* edvin.seferovic@kolp.at; FreeRadius users mailing list *Subject:* Re: Why Freeradius and Mysql dont work?
Thanks again. The file "/var/lib/mysql/mysql.sock" does not exist.When I use an IP in sql.conf instead of the "localhost", I get the following result:
rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked rlm_sql (sql): Attempting to connect to root@202.117.X.X:/radius rlm_sql (sql): starting 0 rlm_sql (sql): Attempting to connect rlm_sql_mysql #0 rlm_sql_mysql: Starting connect to MySQL server for #0 rlm_sql_mysql: Couldn't connect socket to MySQL server root@202.117.7.243 :radius rlm_sql_mysql: Mysql error 'Host '202.117.7.243' is not allowed to connect to this MySQL server' rlm_sql (sql): Failed to connect DB handle #0 rlm_sql (sql): starting 1 rlm_sql (sql): starting 2 rlm_sql (sql): starting 3 rlm_sql (sql): starting 4 rlm_sql (sql): Failed to connect to any SQL server. Module: Instantiated sql (sql)
2007/1/29, Edvin Seferovic <edvin.seferovic@kolp.at>:
rlm_sql_mysql: Mysql error 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' rlm_sql (sql): *Failed to connect DB handle #0 * rlm_sql (sql): Failed to connect to any SQL server.
your socket file is not in the place.. maybe you should use an IP in your sql.conf instead of the "localhost" !
Regards,
E:S
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Install mysql again yao guoxian <yaoguoxian@gmail.com> wrote: Thanks again. The file "/var/lib/mysql/mysql.sock" does not exist.When I use an IP in sql.conf instead of the "localhost", I get the following result: rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked rlm_sql (sql): Attempting to connect to root@202.117.X.X:/radius rlm_sql (sql): starting 0 rlm_sql (sql): Attempting to connect rlm_sql_mysql #0 rlm_sql_mysql: Starting connect to MySQL server for #0 rlm_sql_mysql: Couldn't connect socket to MySQL server root@202.117.7.243:radius rlm_sql_mysql: Mysql error 'Host '202.117.7.243' is not allowed to connect to this MySQL server' rlm_sql (sql): Failed to connect DB handle #0 rlm_sql (sql): starting 1 rlm_sql (sql): starting 2 rlm_sql (sql): starting 3 rlm_sql (sql): starting 4 rlm_sql (sql): Failed to connect to any SQL server. Module: Instantiated sql (sql) 2007/1/29, Edvin Seferovic <edvin.seferovic@kolp.at>: rlm_sql_mysql: Mysql error 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' rlm_sql (sql): Failed to connect DB handle #0 rlm_sql (sql): Failed to connect to any SQL server. your socket file is not in the place.. maybe you should use an IP in your sql.conf instead of the "localhost" ! Regards, E:S - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html --------------------------------- Heres a new way to find what you're looking for - Yahoo! Answers --------------------------------- Heres a new way to find what you're looking for - Yahoo! Answers
Yes,I compiled FR myself. Originally I installed mysql with *.rpm packages(MySQL-*-5.0.20-0.i386.rpm, include MySQL-devel-5.0.20-0.i386.rpm),but it doent works. So I uninstall rpm packages and use mysql-standard-5.0.20-linux-i686.tar.gz to install Mysql. Thanks. 2007/1/29, YvesDM <ydmlog@gmail.com>:
On 1/29/07, satish patel <linuxtrap@yahoo.co.in> wrote:
Install mysql again
Did you compile FR yourself? Did you install the mysql-dev files?
Kind regards, Yves
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
yao guoxian wrote:
rlm_sql_mysql: Mysql error 'Host '202.117.7.243 <http://202.117.7.243>' is not allowed to connect to this MySQL server'
I assume this is a test server and is tightly controlled.... Login to MySQL as root on the command line. Type this: GRANT ALL ON *.* TO root@202.117.7.243 IDENTIFIED BY 'mysql-root-pass'; That will let you do what you are trying to do. Then go read the MySQL documentation on server security. You really should not be using the root account. Create a new user for radius queries and only give it the access it needs. Then REVOKE the rights I just had you GRANT above. -- Dennis Skinner Systems Administrator BlueFrog Internet http://www.bluefrog.com
Yes, 202.117.7.243 is the MySQL server's IP.The problem is that I can not login to MySQL on the command line. The following is the input commands and output responses to them: input command: ./bin/mysqld_safe --user=root output results: Starting mysqld daemon with databases from /home/ygx/mysql-standard-5.0.20-linux-i686/data input command:./bin/mysql -u root -p output results:Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) input command:./bin/mysql -u root output results:Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 to server version: 5.0.20-standard-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> Notice: the third input command is not with "-p". I have done the following steps to reset user "root"'s password: # killall -TERM mysqld #./bin/mysql_safe --skip-grant-tables& #./mysql -u root >use mysql; >update user set password=password('the-new-password') where user='root'; >flush priviliges; >quit; But it didn't work. At first I could use #./bin/mysql_safe --skip-grant-tables& and #./mysql -u root to enter into the command line environmeng of mysql , while the two commands doesn't take effect now. The response to #./bin/mysql_safe --skip-grant-tables& is like follows: [root@nic219 mysql-standard-5.0.20-linux-i686]# bin/mysqld_safe --skip-grant-tables & [1] 4542 [root@nic219 mysql-standard-5.0.20-linux-i686]# Starting mysqld daemon with databases from /home/ygx/mysql-standard-5.0.20-linux-i686 /data STOPPING server from pid file /home/ygx/mysql-standard-5.0.20-linux-i686 /data/nic219.pid 070129 15:40:21 mysqld ended 2007/1/30, Dennis Skinner <dskinner@bluefrog.com>:
yao guoxian wrote:
rlm_sql_mysql: Mysql error 'Host '202.117.7.243 <http://202.117.7.243>' is not allowed to connect to this MySQL server'
I assume this is a test server and is tightly controlled....
Login to MySQL as root on the command line. Type this:
GRANT ALL ON *.* TO root@202.117.7.243 IDENTIFIED BY 'mysql-root-pass';
That will let you do what you are trying to do. Then go read the MySQL documentation on server security. You really should not be using the root account. Create a new user for radius queries and only give it the access it needs. Then REVOKE the rights I just had you GRANT above.
-- Dennis Skinner Systems Administrator BlueFrog Internet http://www.bluefrog.com - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
yao guoxian wrote:
input command:./bin/mysql -u root output results:Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 to server version: 5.0.20-standard-log
*sigh* You installed MySQL but did none of the security things that it probably told you to do during the install (that it definitely tells you to do in the manual). Please go read the docs for MySQL. You are not having FreeRADIUS problems, you are having MySQL problems, the largest of which is that you haven't read the manual. Here's a hint, you didn't need to reset the root password, you never set one in the first place! Now, go read. -- Dennis Skinner Systems Administrator BlueFrog Internet http://www.bluefrog.com
this is problem of mysql configuration check /etc/my.cnf file for socket path and check your mysql working ??? or some mysql put mysql.sock file in /tmp/mysql.sock so plz check where your sock file in your env ? install mysql again and try it Edvin Seferovic <edvin.seferovic@kolp.at> wrote: rlm_sql_mysql: Mysql error 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' rlm_sql (sql): Failed to connect DB handle #0 rlm_sql (sql): Failed to connect to any SQL server. your socket file is not in the place.. maybe you should use an IP in your sql.conf instead of the localhost ! Regards, E:S - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html --------------------------------- Heres a new way to find what you're looking for - Yahoo! Answers
Thanks a lot! I dont know why Freeradius and MySQL suddenly works after I did the following step. 1 insert into radgroupreply (groupname,attribute,op,values) values ('user','Auth-Type',':=','Local'); insert into radgroupreply (groupname,attribute,op,values) values ('user','Service-Type',':=','Framed-User'); insert into radgroupreply (groupname,attribute,op,values) values ('user','Framed-IP-Address',':=','255.255.255.254'); insert into radgroupreply (groupname,attribute,op,values) values ('user','Framed-IP-Netmask',':=','255.255.255.0'); insert into radcheck (username,attribute,op,value) values ('test','User-Password',':=','test') ; insert into usergroup (username,groupname) values ('test','user'); 2 change the setting of sql.conf server = "localhost" => server = "202.117.X.X" 3 # cp /home/ygx/mysql-standard-5.0.20-linux-i686/support-files/my- medium.cnf /etc/my.cnf 4 # /home/ygx/mysql-standard-5.0.20-linux-i686/bin/safe_mysqld --user = root 5 # radiusd -X 6 #radtest test teset localhost 0 testing123 It seems Freeradius and MySQL works as follow: [root@nic219 freeradius-1.0.5]# radtest test test localhost 0 testing123 Sending Access-Request of id 211 to 127.0.0.1:1812 User-Name = "test" User-Password = "test" NAS-IP-Address = nic219 NAS-Port = 0 rad_recv: Access-Accept packet from host 127.0.0.1:1812, id=211, length=38 Service-Type = Framed-User Framed-IP-Address = 255.255.255.254 Framed-IP-Netmask = 255.255.255.0 And I use NTRadping on a XP machine , it returns correctly. But i couldn't use " mysql -u root -p rootpass" to enter the command line enviroment any longer. The output is :ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES). Seems strange,isnt? Anyway, I might better re-install Mysql. Thanks again! 2007/1/29, satish patel <linuxtrap@yahoo.co.in>:
this is problem of mysql configuration check /etc/my.cnf file for socket path and check your mysql working ??? or some mysql put mysql.sock file in /tmp/mysql.sock so plz check where your sock file in your env ?
install mysql again and try it
*Edvin Seferovic <edvin.seferovic@kolp.at>* wrote:
rlm_sql_mysql: Mysql error 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' rlm_sql (sql): *Failed to connect DB handle #0 * rlm_sql (sql): Failed to connect to any SQL server.
your socket file is not in the place.. maybe you should use an IP in your sql.conf instead of the "localhost" !
Regards,
E:S
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
------------------------------ Here's a new way to find what you're looking for - Yahoo! Answers<http://us.rd.yahoo.com/mail/in/yanswers/*http://in.answers.yahoo.com/>
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Hi,
But i couldn't use " mysql -u root -p rootpass" to enter the command line enviroment any longer. The output is :ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES). Seems strange,isnt? Anyway, I might better re-install Mysql.
not strange at all - does that default config file have a root exclude or a default password entry? have you installed or created the privileges table (check the mysql table for user/password/host entries) alan
Where is the default config file and how to config it? I copyed surpport-files/my-medium.cnf to /etc/my.medim.cnf and its content is as follow: [client] #password = your_password port = 3306 socket = /tmp/mysql.sock # Here follows entries for some specific programs # The MySQL server [mysqld] port = 3306 user =root socket = /tmp/mysql.sock skip-locking key_buffer = 16M max_allowed_packet = 1M table_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M Is anything wrong with it? I have done the following steps to reset user "root"'s password: # killall -TERM mysqld #./bin/mysql_safe --skip-grant-tables& #./mysql -u root >use mysql; >update user set password=password('the-new-password') where user='root'; >flush priviliges; >quit; But it didn't work. At first I could use #./bin/mysql_safe --skip-grant-tables& and #./mysql -u root to enter into the command line environmeng of mysql , while the two commands doesn't take effect now. The response to #./bin/mysql_safe --skip-grant-tables& is like follows: [root@nic219 mysql-standard-5.0.20-linux-i686]# bin/mysqld_safe --skip-grant-tables & [1] 4542 [root@nic219 mysql-standard-5.0.20-linux-i686]# Starting mysqld daemon with databases from /home/ygx/mysql-standard-5.0.20-linux-i686/data STOPPING server from pid file /home/ygx/mysql-standard-5.0.20-linux-i686 /data/nic219.pid 070129 15:40:21 mysqld ended 2007/1/29, A.L.M.Buxey@lboro.ac.uk <A.L.M.Buxey@lboro.ac.uk>:
Hi,
But i couldn't use " mysql -u root -p rootpass" to enter the command line enviroment any longer. The output is :ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES). Seems strange,isnt? Anyway, I might better re-install Mysql.
not strange at all - does that default config file have a root exclude or a default password entry? have you installed or created the privileges table (check the mysql table for user/password/host entries)
alan - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Sorry. The debug result I listed is only the response to access request. The original display of "radiusd -X" is as follows: Starting - reading configuration files ... reread_config: reading radiusd.conf Config: including file: /usr/local/etc/raddb/proxy.conf Config: including file: /usr/local/etc/raddb/clients.conf Config: including file: /usr/local/etc/raddb/snmp.conf Config: including file: /usr/local/etc/raddb/eap.conf Config: including file: /usr/local/etc/raddb/sql.conf main: prefix = "/usr/local" main: localstatedir = "/usr/local/var" main: logdir = "/usr/local/var/log/radius" main: libdir = "/usr/local/lib" main: radacctdir = "/usr/local/var/log/radius/radacct" main: hostname_lookups = no main: max_request_time = 30 main: cleanup_delay = 5 main: max_requests = 1024 main: delete_blocked_requests = 0 main: port = 0 main: allow_core_dumps = no main: log_stripped_names = no main: log_file = "/usr/local/var/log/radius/radius.log" main: log_auth = no main: log_auth_badpass = no main: log_auth_goodpass = no main: pidfile = "/usr/local/var/run/radiusd/radiusd.pid" main: user = "(null)" main: group = "(null)" main: usercollide = no main: lower_user = "no" main: lower_pass = "no" main: nospace_user = "no" main: nospace_pass = "no" main: checkrad = "/usr/local/sbin/checkrad" main: proxy_requests = yes proxy: retry_delay = 5 proxy: retry_count = 3 proxy: synchronous = no proxy: default_fallback = yes proxy: dead_time = 120 proxy: post_proxy_authorize = yes proxy: wake_all_if_all_dead = no security: max_attributes = 200 security: reject_delay = 1 security: status_server = no main: debug_level = 0 read_config_files: reading dictionary read_config_files: reading naslist Using deprecated naslist file. Support for this will go away soon. read_config_files: reading clients read_config_files: reading realms radiusd: entering modules setup Module: Library search path is /usr/local/lib Module: Loaded exec exec: wait = yes exec: program = "(null)" exec: input_pairs = "request" exec: output_pairs = "(null)" exec: packet_type = "(null)" rlm_exec: Wait=yes but no output defined. Did you mean output=none? Module: Instantiated exec (exec) Module: Loaded expr Module: Instantiated expr (expr) Module: Loaded PAP pap: encryption_scheme = "crypt" Module: Instantiated pap (pap) Module: Loaded CHAP Module: Instantiated chap (chap) Module: Loaded MS-CHAP mschap: use_mppe = yes mschap: require_encryption = no mschap: require_strong = no mschap: with_ntdomain_hack = no mschap: passwd = "(null)" mschap: authtype = "MS-CHAP" mschap: ntlm_auth = "(null)" Module: Instantiated mschap (mschap) Module: Loaded preprocess preprocess: huntgroups = "/usr/local/etc/raddb/huntgroups" preprocess: hints = "/usr/local/etc/raddb/hints" preprocess: with_ascend_hack = no preprocess: ascend_channels_per_line = 23 preprocess: with_ntdomain_hack = no preprocess: with_specialix_jetstream_hack = no preprocess: with_cisco_vsa_hack = no Module: Instantiated preprocess (preprocess) Module: Loaded realm realm: format = "suffix" realm: delimiter = "@" realm: ignore_default = no realm: ignore_null = no Module: Instantiated realm (suffix) Module: Loaded SQL sql: driver = "rlm_sql_mysql" sql: server = "localhost" sql: port = "" sql: login = "root" sql: password = "123" sql: radius_db = "radius" sql: acct_table = "radacct" sql: acct_table2 = "radacct" sql: authcheck_table = "radcheck" sql: authreply_table = "radreply" sql: groupcheck_table = "radgroupcheck" sql: groupreply_table = "radgroupreply" sql: usergroup_table = "usergroup" sql: nas_table = "nas" sql: dict_table = "dictionary" sql: sqltrace = yes sql: sqltracefile = "/usr/local/var/log/radius/sqltrace.sql" sql: readclients = no sql: deletestalesessions = yes sql: num_sql_socks = 5 sql: sql_user_name = "%{Stripped-User-Name:-%{User-Name:-DEFAULT}}" sql: default_user_profile = "" sql: query_on_not_found = no sql: authorize_check_query = "SELECT id, UserName, Attribute, Value, op FROM radcheck WHERE Username = '%{SQL-User-Name}' ORDER BY id" sql: authorize_reply_query = "SELECT id, UserName, Attribute, Value, op FROM radreply WHERE Username = '%{SQL-User-Name}' ORDER BY id" sql: authorize_group_check_query = "SELECT radgroupcheck.id, radgroupcheck.GroupName,radgroupcheck.Attribute,radgroupcheck.Value, radgroupcheck.op FROM radgroupcheck,usergroup WHERE usergroup.Username = '%{SQL-User-Name}' AND usergroup.GroupName = radgroupcheck.GroupName ORDER BY radgroupcheck.id" sql: authorize_group_reply_query = "SELECT radgroupreply.id, radgroupreply.GroupName,radgroupreply.Attribute,radgroupreply.Value, radgroupreply.op FROM radgroupreply,usergroup WHERE usergroup.Username = '%{SQL-User-Name}' AND usergroup.GroupName = radgroupreply.GroupName ORDER BY radgroupreply.id" sql: accounting_onoff_query = "UPDATE radacct SET AcctStopTime='%S', AcctSessionTime=unix_timestamp('%S') - unix_timestamp(AcctStartTime), AcctTerminateCause='%{Acct-Terminate-Cause}', AcctStopDelay = '%{Acct-Delay-Time}' WHERE AcctSessionTime=0 AND AcctStopTime=0 AND NASIPAddress= '%{NAS-IP-Address}' AND AcctStartTime <= '%S'" sql: accounting_update_query = "UPDATE radacct SET FramedIPAddress = '%{Framed-IP-Address}', AcctSessionTime = '%{Acct-Session-Time}', AcctInputOctets = '%{Acct-Input-Octets}', AcctOutputOctets = '%{Acct-Output-Octets}' WHERE AcctSessionId = '%{Acct-Session-Id}' AND UserName = '%{SQL-User-Name}' AND NASIPAddress= '%{NAS-IP-Address}'" sql: accounting_update_query_alt = "INSERT into radacct (AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType, AcctStartTime, AcctSessionTime, AcctAuthentic, ConnectInfo_start, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, ServiceType, FramedProtocol, FramedIPAddress, AcctStartDelay) values('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port}', '%{NAS-Port-Type}', DATE_SUB('%S',INTERVAL (%{Acct-Session-Time:-0} + %{Acct-Delay-Time:-0}) SECOND), '%{Acct-Session-Time}', '%{Acct-Authentic}', '', '%{Acct-Input-Octets}', '%{Acct-Output-Octets}', '%{Called-Station-Id}', '%{Calling-Station-Id}', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', '0')" sql: accounting_start_query = "INSERT into radacct (AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType, AcctStartTime, AcctStopTime, AcctSessionTime, AcctAuthentic, ConnectInfo_start, ConnectInfo_stop, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, AcctTerminateCause, ServiceType, FramedProtocol, FramedIPAddress, AcctStartDelay, AcctStopDelay) values('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port}', '%{NAS-Port-Type}', '%S', '0', '0', '%{Acct-Authentic}', '%{Connect-Info}', '', '0', '0', '%{Called-Station-Id}', '%{Calling-Station-Id}', '', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', '%{Acct-Delay-Time}', '0')" sql: accounting_start_query_alt = "UPDATE radacct SET AcctStartTime = '%S', AcctStartDelay = '%{Acct-Delay-Time}', ConnectInfo_start = '%{Connect-Info}' WHERE AcctSessionId = '%{Acct-Session-Id}' AND UserName = '%{SQL-User-Name}' AND NASIPAddress = '%{NAS-IP-Address}'" sql: accounting_stop_query = "UPDATE radacct SET AcctStopTime = '%S', AcctSessionTime = '%{Acct-Session-Time}', AcctInputOctets = '%{Acct-Input-Octets}', AcctOutputOctets = '%{Acct-Output-Octets}', AcctTerminateCause = '%{Acct-Terminate-Cause}', AcctStopDelay = '%{Acct-Delay-Time}', ConnectInfo_stop = '%{Connect-Info}' WHERE AcctSessionId = '%{Acct-Session-Id}' AND UserName = '%{SQL-User-Name}' AND NASIPAddress = '%{NAS-IP-Address}'" sql: accounting_stop_query_alt = "INSERT into radacct (AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType, AcctStartTime, AcctStopTime, AcctSessionTime, AcctAuthentic, ConnectInfo_start, ConnectInfo_stop, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, AcctTerminateCause, ServiceType, FramedProtocol, FramedIPAddress, AcctStartDelay, AcctStopDelay) values('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port}', '%{NAS-Port-Type}', DATE_SUB('%S', INTERVAL (%{Acct-Session-Time:-0} + %{Acct-Delay-Time:-0}) SECOND), '%S', '%{Acct-Session-Time}', '%{Acct-Authentic}', '', '%{Connect-Info}', '%{Acct-Input-Octets}', '%{Acct-Output-Octets}', '%{Called-Station-Id}', '%{Calling-Station-Id}', '%{Acct-Terminate-Cause}', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', '0', '%{Acct-Delay-Time}')" sql: group_membership_query = "SELECT GroupName FROM usergroup WHERE UserName='%{SQL-User-Name}'" sql: connect_failure_retry_delay = 60 sql: simul_count_query = "" sql: simul_verify_query = "SELECT RadAcctId, AcctSessionId, UserName, NASIPAddress, NASPortId, FramedIPAddress, CallingStationId, FramedProtocol FROM radacct WHERE UserName='%{SQL-User-Name}' AND AcctStopTime = 0" sql: postauth_table = "radpostauth" sql: postauth_query = "INSERT into radpostauth (id, user, pass, reply, date) values ('', '%{User-Name}', '%{User-Password:-Chap-Password}', '%{reply:Packet-Type}', NOW())" sql: safe-characters = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /" rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked rlm_sql (sql): Attempting to connect to root@localhost:/radius rlm_sql (sql): starting 0 rlm_sql (sql): Attempting to connect rlm_sql_mysql #0 rlm_sql_mysql: Starting connect to MySQL server for #0 rlm_sql_mysql: Couldn't connect socket to MySQL server root@localhost:radius rlm_sql_mysql: Mysql error 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' rlm_sql (sql): Failed to connect DB handle #0 rlm_sql (sql): starting 1 rlm_sql (sql): starting 2 rlm_sql (sql): starting 3 rlm_sql (sql): starting 4 rlm_sql (sql): Failed to connect to any SQL server. Module: Instantiated sql (sql) Module: Loaded Acct-Unique-Session-Id acct_unique: key = "User-Name, Acct-Session-Id, NAS-IP-Address, Client-IP-Address, NAS-Port" Module: Instantiated acct_unique (acct_unique) Module: Loaded detail detail: detailfile = "/usr/local/var/log/radius/radacct/%{Client-IP-Address}/detail-%Y%m%d" detail: detailperm = 384 detail: dirperm = 493 detail: locking = no Module: Instantiated detail (detail) Module: Loaded System unix: cache = no unix: passwd = "(null)" unix: shadow = "(null)" unix: group = "(null)" unix: radwtmp = "/usr/local/var/log/radius/radwtmp" unix: usegroup = no unix: cache_reload = 600 Module: Instantiated unix (unix) Module: Loaded radutmp radutmp: filename = "/usr/local/var/log/radius/radutmp" radutmp: username = "%{User-Name}" radutmp: case_sensitive = yes radutmp: check_with_nas = yes radutmp: perm = 384 radutmp: callerid = yes Module: Instantiated radutmp (radutmp) Module: Loaded eap eap: default_eap_type = "md5" eap: timer_expire = 60 eap: ignore_unknown_eap_types = no eap: cisco_accounting_username_bug = no rlm_eap: Loaded and initialized type md5 rlm_eap: Loaded and initialized type leap gtc: challenge = "Password: " gtc: auth_type = "PAP" rlm_eap: Loaded and initialized type gtc mschapv2: with_ntdomain_hack = no rlm_eap: Loaded and initialized type mschapv2 Module: Instantiated eap (eap) Listening on authentication *:1812 Listening on accounting *:1813 Ready to process requests. Is anything wrong? 2007/1/29, A.L.M.Buxey@lboro.ac.uk <A.L.M.Buxey@lboro.ac.uk>:
Hi,
3.Edit radiusd.conf and sql.conf; Debug Result: Nothing to do. Sleeping until we see a request.
no. thats not the debug result. you've edited all the lines before that output.
alan - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
hi, thanks, now that you supplied the full debug we can clearly see that freeradius is unable to connect to your SQL database. so, questions arise such as - is your database server running? is it configured for that 'root' account and password (check using command line tools etc), is it firewalled? alan
participants (8)
-
A.L.M.Buxey@lboro.ac.uk -
Dennis Skinner -
Edvin Seferovic -
Markus Krause -
Ranner, Frank MR -
satish patel -
yao guoxian -
YvesDM