当前位置:网站首页>Centos7部署radius服务-freeradius-3.0.13-15.el7集成mysql
Centos7部署radius服务-freeradius-3.0.13-15.el7集成mysql
2022-06-23 04:19:00 【CaptainCats】
Centos7信息

安装freeradius
freeradius、freeradius-utils、freeradius-mysql
yum -y install freeradius freeradius-utils freeradius-mysql
配置freeradius
安装完成会创建一个"radiusd"用户,
我们即将操作的目录:"/etc/raddb/",
需要有和它相同权限。
授权
sudo chown dev.radiusd /etc/raddb/*
clients.conf配置
/etc/raddb/clients.conf
添加客户端:private-network,
0.0.0.0/0:表示可以从任意IP发起访问,
testing123:当前实例的秘钥。
default配置
/etc/raddb/sites-available/default
修改
accounting {}中
“-sql"改为"sql”
authorize {}中
“-sql"改为"sql”
session {}中
“# sql"改为” sql"
inner-tunnel配置
/etc/raddb/sites-available/inner-tunnel
修改
authorize {}中
“-sql"改为"sql”
post-auth {}中
“-sql"改为"sql”
session {}中
“# sql"改为” sql"
数据库配置
(我用的是mysql数据源)
/etc/raddb/mods-available/sql
创建硬连接
(radius启动时会去访问)
cd /etc/raddb/mods-enabled/
ln ../mods-available/sql ./
驱动
将driver = "rlm_sql_null"这一行注释,
添加:driver = “rlm_sql_mysql”;
方言
将dialect = "sqlite"注释,
添加:dialect = “mysql”;
数据源
在"# Connection info:"下边另起一行,添加数据源配置:
server = “192.168.1.123”
port = 3306
login = “x”
password = “y”
创建mysql数据库
CREATE DATABASE radius;
创建表
在数据库执行文件:
/etc/raddb/mods-config/sql/main/mysql/schema.sql
初始化数据
-- 用户组
insert into radgroupreply (groupname,attribute,op,value) values ('user','Auth-Type',':=','Local');
insert into radgroupreply (groupname,attribute,op,value) values ('user','Service-Type',':=','Framed-User');
insert into radgroupreply (groupname,attribute,op,value) values ('user','Framed-IP-Address',':=','255.255.255.255');
insert into radgroupreply (groupname,attribute,op,value) values ('user','Framed-IP-Netmask',':=','255.255.255.0');
-- 用户
insert into radcheck (username,attribute,op,value) values ('test','Cleartext-Password',':=','testpwd');
-- 将用户添加进用户组
insert into radusergroup (username,groupname) values ('test','user');
radiusd -X,debug模式启动

测试
另起一个窗口,radtest命令测试,
test:用户名,
testpwd:用户密码,
localhost 1812:radius地址,1812为默认端口号,
testing123:当前实例的秘钥。
pap模式(默认)
radtest test testpwd localhost 1812 testing123
收到Access-Accept响应算成功
在radpostauth表会添加记录
让我们测试个错误的,把密码写错:testpwdhhh
radtest test testpwdhhh localhost 1812 testing123
变成了Access-Reject
把数据库中的密码修改为:testpwdhhh
刚才测试的记录也都保存了
chap模式
radtest -t chap -x test testpwd 192.168.1.123 1812 testing123
-t chap:
指定chap模式,
-x:
输出debug信息。
systemctl启动
先退出radiusd -X,再执行
systemctl start radiusd
设置开机自启动
systemctl enable radiusd
不当之处,请予指正。
参考文章:
cluniquecui:FreeRADIUS 3.0安装配置
h11345p:Freeradius+mysql+daloradius简单安装配置
gocgocgo:CentOS6.5搭建freeradius服务器
松晨:Linux搭建Radius服务器
hiwill:Centos 7上编译安装freeradius3.0
边栏推荐
- A bit of knowledge - folding forging and Damascus steel
- [graduation season u; advanced technology Er] farewell to the confused self in the past two years. Regroup, junior I'm coming
- Huawei's software and hardware ecosystem has taken shape, fundamentally changing the leading position of the United States in the software and hardware system
- fastjson中的@JSONField注解
- Real MySQL interview questions (25) -- common group comparison scenarios
- mysql字符集
- PAT 乙等 1013 C语言
- C primer plus學習筆記 —— 2、常量與格式化IO(輸入/輸出)
- C prime plus notes d'apprentissage - 2, constantes et formatage io (I / o)
- opencv显示图像
猜你喜欢

How to move the software downloaded from win11 app store to the desktop

Dolphin scheduler dolphin scheduling upgrade code transformation -upgradedolphin scheduler

Real MySQL interview questions (XXVII) -- Classification of users by RFM analysis method

新课上线 | 每次 5 分钟,轻松玩转阿里云容器服务!

云原生数据库是未来

True question of MySQL interview (29) -- case - finding favorite movies

编址和编址单位

runc 符号链接挂载与容器逃逸漏洞预警(CVE-2021-30465)

Wechat applet: wechat can also send flash photos to create wechat applet source code download and customize flash time

Software design and Development Notes 2: serial port debugging tool based on QT design
随机推荐
Ansible 使用普通用户管理被控端
MySQL character set
PAT 乙等 1015 C语言
Fs2119a Synchronous Boost IC output 3.3V and fs2119b Synchronous Boost IC output 5V
PAT 乙等 1011 C语言
PAT 乙等 1016 C语言
Wechat applet: an artifact for calculating the full amount of orders
ssm项目搭建
Arctime makes Chinese and English subtitle video
【数据库备份】通过定时任务完成MySQL数据库的备份
PAT 乙等 1021 个位数统计
What is the reason for the black screen of the computer monitor when the computer is turned on? What should I do about the black screen of the computer monitor
Software design and Development Notes 2: serial port debugging tool based on QT design
JS面试题----防抖函数
MySQL面试真题(二十一)——金融-贷款逾期
android Handler内存泄露 kotlin内存泄露处理
MySQL面试真题(三十)——贝壳-房产订单分析
HierarchyViewer工具找不到 HierarchyViewer位置
数字藏品市场才刚刚开始
The author believes that the so-called industrial Internet is a process of deep integration of industry and the Internet