ubuntu freeradius 3.0 + mariadb

安装数据库及Radius

sudo apt update
sudo apt install -y freeradius freeradius-mysql freeradius-utils mariadb-server mariadb-client
# sudo mysql_secure_installationNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDBSERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.Enter current password for root (enter for none): 
OK, successfully used password, moving on...Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..... Success!By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.Remove anonymous users? [Y/n] y... Success!Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] n... skipping.By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.Remove test database and access to it? [Y/n] y- Dropping test database...... Success!- Removing privileges on test database...... Success!Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.Reload privilege tables now? [Y/n] y... Success!Cleaning up...All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.Thanks for using MariaDB!
# systemctl start mariadb
# systemctl enable mariadb

为FreeRADIUS创建数据库和用户

设置mysql root用户信息

# 初始化数据库
sudo mysql_secure_installation## Enter current password for root (enter for none): 输入管理员原始密码,默认为空值,直接回车即可## Switch to unix_socket authentication [Y/n]: 切换到 unix_socket 身份验证,输入N## Set root password? [Y/n] y(设置管理员密码)
输入两次要设置的数据库root密码## Remove anonymous users? [Y/n] y(是否删除匿名账户)## Disallow root login remotely? [Y/n] n(是否禁止管理员从远程登录)## Remove test database and access to it? [Y/n] y(删除测试数据库及其访问权限)## Reload privilege tables now? [Y/n] y(刷新授权表,让初始化后的设定立即生效)# 设置开机自启且现在启动
systemctl enable --now mariadb
systemctl enable mariadb

利用root用户添加radius用户及其密码

# 登录数据库
mysql -u root -p# 检查数据库版本
MariaDB [(none)]> SELECT VERSION();# 创建数据库和用户
## 创建数据库radius
CREATE database radius;# 创建数据库用户:radius/radius123
## 先用root登陆数据库
mysql -u root -p## 创建数据库用户radius,设置密码为radius123
MariaDB [(none)]> CREATE USER radius@localhost IDENTIFIED BY 'radius123';# 查看用户radius是否创建成功
## 进入mysql库
MariaDB [(none)]> use mysql;## 查看radius用户
SELECT HOST,USER,PASSWORD FROM user WHERE USER="radius";## radius用户已经创建完成了,但是没有任何的数据库权限# 为radius用户授权
# 登陆root
mysql -u root -p# 进入mysql库
use mysql;# 对数据库进行授权
## 授予radius用户权限 create创建,select查询,update修改,delete删除,insert插入,@localhost 仅允许从本地登陆
GRANT CREATE,SELECT,UPDATE,DELETE,INSERT ON radius.* TO radius@localhost identified by 'radius123';## 刷新权限
flush privileges;# 查看radius的权限
show GRANTS FOR 'radius'@'localhost';

为radius

# 使用radius账户登陆:
mysql -uradius -pradius123 radius
# 导入数据表结构:
MariaDB [radius]> source /etc/freeradius/3.0/mods-config/sql/main/mysql/schema.sql
# 检查倒入的表格
show tables;
MariaDB [radius]> show tables;
+------------------+
| Tables_in_radius |
+------------------+
| nas              |
| radacct          |
| radcheck         |
| radgroupcheck    |
| radgroupreply    |
| radpostauth      |
| radreply         |
| radusergroup     |
+------------------+
8 rows in set (0.00 sec)

在/etc/freeradius/3.0/mods-enabled/下为sql模块创建一个软链接:

ln -s /etc/freeradius/3.0/mods-available/sql /etc/freeradius/3.0/mods-enabled/vim /etc/freeradius/3.0/mods-enabled/sql# 配置SQL模块并更改数据库连接参数以适合你的环境:
## 清空原文件,写入新配置
vi /etc/freeradius/3.0/mods-enabled/sql# 你的sql部分应该类似于下面的部分:
sql {
driver = "rlm_sql_mysql"
dialect = "mysql"
server = "localhost"
port = 3306
login = "radius"
password = “radius123”
radius_db = "radius"
}
read_clients = yes
client_table = "nas"# 然后更改/etc/freeradius/3.0/mods-enabled/sql的组权限:
chgrp -h freerad /etc/freeradius/3.0/mods-available/sql
chown -R freerad:freerad /etc/freeradius/3.0/mods-enabled/sql# 重启freeradius服务:
systemctl restart freeradius.service 或 sudo freeradius -X(带调试信息)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/260.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Springboot启用HTTP响应压缩

官方文档:https://docs.spring.io/spring-boot/docs/2.3.12.RELEASE/reference/htmlsingle/#how-to-enable-http-response-compression

mmc记录

1、获取csd,也就是DSR寄存器 说是应该可以获取块长度、卡存储容量等,但是在8953上,没看到这个日志 参考: 一、有6个主要的和寄存器 1、OCR寄存器 描述了存储卡的Vdd电压描述 ,总共32Bit Bit31 --- 卡上电状态位&…

赋能智能智造-RK3568智能主板助力机器人产业高速发展

机器人作为现代制造业的重要一环,正在以惊人的速度推动着生产效率和智能化水平的提升,它们在生产线上的准确操作和高效工作,为企业带来了巨大的竞争优势。关于工业机器人的编程和控制技术,在过去几年中已经有了很多发展和新的应用…

计算机网络——物理层

物理层 物理层是计算机网络体系结构中的底层层级,负责处理计算机与物理传输媒介之间的接口和通信细节。它主要关注如何在物理媒介上传输原始比特流,并确保数据能够可靠地从发送方传输到接收方。 物理层的主要任务包括: 传输介质&#xff1a…

谷歌Bard入门指南

文章目录 谷歌Bard入门指南一、简介二、使用指南三、中文化3.1 中文提问3.2 中文回答 四、Hello Game五、亮点 谷歌Bard入门指南 一、简介 Bard 是一个大型语言模型,也称为对话式 AI 或聊天机器人,经过训练,内容丰富且全面。Bard 接受过大量…

无线基站与无线频谱资源

文章目录 基站的主要组成天线馈线(电缆线)RRU(射频拉远单元,Remote Radio Unit)BBU(室内基带处理单元,Building Base band Unit)AAU(有源天线单元,Active Ant…

计算机网络 day3 广播风暴 - VLAN - Trunk

目录 广播风暴: 1.什么是广播风暴? 2.危害: 3.防范 STP生成树协议:(72条消息) 生成树协议 — STP_生成树协议步骤_一下子就醒了的博客-CSDN博客 VLAN: VLAN是什么? VLAN起到的作用: 广…

Redis 主从配置、哨兵、集群模式

目录 Redis 主从复制 主从复制的作用: 主从复制流程: 搭建Redis 主从复制 安装 Redis 环境准备 修改内核参数 安装redis 创建redis工作目录 环境变量 定义systemd服务管理脚本 修改 Redis 配置文件(Master节点操作) …

【C++/嵌入式笔试面试八股】bootloader

bootloader 01.什么是bootloader? 嵌入式芯片启动过程全解析,彻底理解bootloader_哔哩哔哩_bilibili Bootloader(引导加载程序)是一段位于计算机系统启动区的特殊程序,主要负责加载操作系统的内核(kernel)并将控制权交给它,从而启动计算机系统。Bootloader 是计算机…

Linux下载安装opencv时报错:CMake Error

1、CMake Error at 3rdparty/ippicv/downloader.cmake:73 (file): file DOWNLOAD HAS 解决办法:解压后的opencv文件里的/home/kevin/opencv-3.2.0/3rdparty/ippicv/downloads/linux-808b791a6eac9ed78d32a7666804320e/ippicv_linux_20151201.tgz这个文件有问题&…

Python Flask构建微信小程序订餐系统 (六)

🔥 账号管理 🔥 展示账户列表 默认情况下的账户列表布局 查询用户信息 查询 所有用户信息 按照 倒序 的方式查询出来 User.query.order_by( User.uid.desc() ).all() ......@route_account.route("/index") def index():#模版文件夹取名叫 "account/login…

如何安装 Eigen

1.离线包安装(推荐) 1.1 安装包下载 安装包下载网址: http://eigen.tuxfamily.org/index.php?titleMain_Page 在该网站中,可以下载任意版本对应的文件,本例下载了 eigen-3.4.0.tar.gz 格式压缩文件(eige…

【Python爬虫与数据分析】Jupyter的安装与快捷键

目录 一、jupyter notebook安装与配置 二、命令模式快捷键 三、编辑模式快捷键 四、文件操作 一、jupyter notebook安装与配置 安装:Jupyter Notebook是以网页的形式打开的一个程序,集成在Anaconda包里面,也可以直接安装python3解释器&a…

C#基础学习_泛型集合List<T>

C#基础学习_泛型集合List 为什么要使用集合? 数组元素个数是固定的,数组一旦定义,就无法改变元素总数。如果需求变化,则必须修改源码。 如果初始化元素总数非常大,则会造成浪费。 集合的特点: 根据需要动态增加元素个数,没有限制 List泛型集合的存储结构,与数组类似,…

数据库基本操作-----数据库用户管理和授权

目录 一、数据库用户管理 1.新建用户 2.查看用户信息 3.重命名用户 4.删除用户 ​编辑5.修改当前登录用户密码 6.修改其他用户密码 7.忘记 root 密码的解决办法 (1)修…

window环境下安装Node并修改保存缓存的位置

0, 卸载Node 打开cmd命令行窗口 输入: npm cache clean --force然后在控制面版中卸载node 1,官网下载Node.js 点击官网下载 如一台电脑需要多个node环境 可使用nvm命令进行操作安装并且可以切换 2, 配置环境变量 安装成功之后&#x…

一、Dell服务器的iDRAC管理卡连接

Dell服务器的iDRAC管理卡图文教程 1、网线连接idrac口2、查看idrac地址3、匹配IP地址4、web登录idrac页面5、登录成功页面 带有集成戴尔远程访问控制器 (idrac)的系统具有默认用户名和密码,但您也可以使用安全密码对其进行配置。默认使用web浏…

Hive(26):Select高级查询之Common Table Expressions(CTE)

1 CTE介绍 公用表表达式(CTE)是一个临时结果集,该结果集是从WITH子句中指定的简单查询派生而来的,该查询紧接在SELECT或INSERT关键字之前。 CTE仅在单个语句的执行范围内定义。一个或多个CTE可以在Hive SELECT,INSER…

OpenCV 入门教程:SIFT和SURF特征描述

OpenCV 入门教程: SIFT 和 SURF 特征描述 导语一、SIFT特征描述原理二、SURF特征描述原理三、SIFT特征描述步骤四、SURF特征描述步骤总结 导语 SIFT (尺度不变特征变换)和 SURF (加速稳健特征)是图像处理中常用的特征描…

Linux(centos 7)将 ens33 改为 eth0

背景: 先说明一下 eth0 与 ens33 的关系,目前的主流网卡为使用以太网络协定所开发出来的以太网卡(Ethernet),因此我们 Linux 就称呼这种网络接口为 ethN (N为数字)。 举个例子:就是说主机上面有一张以太网卡&#xff0…