Home >> 心情与随笔 >> 安装配置 Free Radius 2 on CentOS 6.x

安装配置 Free Radius 2 on CentOS 6.x

  1. 简介
  2. 安装
    如果系统没有安装mysql-server,下面的yum命令行中,再加入一项mysql-server。本文假设mysql-server已经安装并配置可以使用了。

    [~]# yum install freeradius freeradius-mysql freeradius-utils
    Loaded plugins: fastestmirror, security
    Loading mirror speeds from cached hostfile
    epel/metalink | 5.6 kB 00:00
    * base: mirrors.163.com
    * epel: mirrors.neusoft.edu.cn
    * extras: mirrors.163.com
    * updates: mirrors.163.com
    … …
    … …
    Dependencies Resolved
    … …
    … …
    Installing:
    … …
    … …
    Running Transaction
    … …
    … …
    Installed:
    freeradius.x86_64 0:2.1.12-4.el6_3 freeradius-mysql.x86_64 0:2.1.12-4.el6_3
    freeradius-utils.x86_64 0:2.1.12-4.el6_3

    Complete!

  3. 创建radius数据库

    [root@cardjn-db3a ~]# mysql -uroot -p
    Enter password:
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 2
    Server version: 5.5.36 MySQL Community Server (GPL) by Remi
    … …
    … …
    mysql> create database radius default character set utf8;
    Query OK, 1 row affected (0.00 sec)

    mysql> grant all privileges on radius.* to radius@localhost identified by ‘pass’;
    Query OK, 0 rows affected (0.00 sec)

    mysql> flush privileges;
    Query OK, 0 rows affected (0.01 sec)

  4. 初始化数据库,并配置radius使用数据库:
    在CentOS中,Free Radius默认安装在 /etc/raddb 目录,下面数据库的操作,将默认切换到此目录执行:

    mysql> \. sql/mysql/schema.sql
    Query OK, 0 rows affected (0.11 sec)
    … …
    Query OK, 0 rows affected (0.08 sec)

    设置Radius使用刚刚初始化好的数据库, 配置文件在安装目录的sql.conf

    vi sql.conf
    sql {
    #
    # Set the database to one of:
    #
    # mysql, mssql, oracle, postgresql
    #
    database = “mysql”

    #
    # Which FreeRADIUS driver to use.
    #
    driver = “rlm_sql_${database}”

    # Connection info:
    server = “localhost”
    #port = 3306
    login = “radius”
    password = “pass”

    # Database table configuration for everything except Oracle
    radius_db = “radius”

    修改radius主配置文件以启用数据库(取消$INCLUDE sql.conf一行的注释符)

    vi radiusd.conf
    $INCLUDE sql.conf

    修改 sites-available/default 站点配置文件启用数据库(取消 sql 行前的注释符)

    authorize {
    #
    # Security settings. Take a User-Name, and do some simple
    # checks on it, for spaces and other invalid characters. If
    # it looks like the user is trying to play games, reject it.
    #
    … …
    #
    # Look in an SQL database. The schema of the database
    # is meant to mirror the “users” file.
    #
    # See “Authorization Queries” in sql.conf
    sql

    #
    # Accounting. Log the accounting data.
    #
    accounting {
    #
    # Create a ‘detail’ed log of the packets.
    # Note that accounting requests which are proxied
    # are also logged in the detail file.
    detail
    # daily
    … …
    #
    # Log traffic to an SQL database.
    #
    # See “Accounting queries” in sql.conf
    sql

    # Session database, used for checking Simultaneous-Use. Either the radutmp
    # or rlm_sql module can handle this.
    # The rlm_sql module is *much* faster
    session {
    radutmp

    #
    # See “Simultaneous Use Checking Queries” in sql.conf
    sql
    }

    同样修改sites-available/inner-tunnel配置文件,取消authorize{}和session{}配置节中 sql 行的注释,此配置中还有 post-auth {} 以及其下的 Post-Auth-Type REJECT {}配置节,也可以取消 sql 行的注释


(原文链接 http://ddbiz.com/?p=1392)

留言/有话要说

Copyright © 2012 Dimensions Data Business. All rights reserved.
server process 8.091 seconds.
WP-Backgrounds Lite by InoPlugs Web Design and Juwelier Schönmann 1010 Wien