搭建freeradius服务# yum install freeradius freeradius-mysql freeradius-utils mysql-server -y启动mysql # service mysqld start 设置mysql密码和安全设置 /usr/bin/mysql_secure_installation(执行脚本) 创建数据库并授权 # mysql -uroot -p mysql-> CREATE DATABASE radius; mysql-> GRANT ALL PRIVILEGES ON radius.* TO radius@localhost IDENTIFIED BY "radpass"; mysql-> flush privileges; 导入数据表 mysql> use radius; mysql> SOURCE /etc/raddb/sql/mysql/schema.sql; mysql> exit; 编辑freeradius配置文件,开启sql认证 文件1:/etc/raddb/sql.conf # Connection info: server = "localhost" #port = 3306 login = "radius" #mysql登录用户名 password = "radpass" #上述登录用户名的密码 # Database table configuration for everything except Oracle radius_db = "radius" 文件2:/etc/raddb/radiusd.conf $INCLUDE sql.conf #去掉前面的注释 文件3: /etc/raddb/sites-available/default authorize{} accounting {} session {} 去掉里面sql前面的注释 /etc/raddb/sites-available/inner-tunnel authorize {} session {} 去掉里面sql前面的注释 文件4: /etc/raddb/clients.conf secret = testing123 这个key太简单,可以为一个随机字符串。例如: secret = 3c23498n349c3yt290y93b4t3 修改freeradius client的ip地址。 启动freeradius服务: service radiusd restart 本地测试添加用户信息:mysql -uroot -p use radius; insert into radcheck (username,attribute,op,value) values ('test','User-Password',':=','test'); exit; radtest test test 127.0.0.1 0 testing123
(责任编辑:IT) |