Why Freeradius and Mysql dont work?

yao guoxian yaoguoxian at gmail.com
Mon Jan 29 02:15:00 CET 2007


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 at 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 at 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 at biochem.mpg.de>:
>
> Zitat von yao guoxian <yaoguoxian at 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 at 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 at 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 at biochem.mpg.de
>
>
>
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20070129/c4e32e56/attachment.html>


More information about the Freeradius-Users mailing list