FreeRADIUS 为AAA Radius Linux下开源解决方案,DaloRadius为图形化web管理工具。

freeradius一般用来进行账户认证管理,记账管理,常见的电信运营商的宽带账户,上网账户管理,记账,都是使用的radius服务器进行鉴权记账的。

常见的radius服务器种类不多,比较强大的当属开源的freeradius,世界上大部分的radius服务器都是基于freeradius开发而来的。

Freeradius包含一个radius服务器和radius-client,可以对支持radius协议的网络设备进行鉴权记账,常见的开源路由器操作系统:如Openwrt,DD-wrt等,都支持radius协议,对PPPOE,热点,VPN等服务器进行账户管理认证,记账。

freeradius功能十分强大,支持众多的数据库。

Freeradius操作稍显麻烦,内置diaup_admin简单web管理,需要更简单易用的管理功能可以使用第三方的管理程序对Freeradius进行账户管理,系统配置等。

很多刚入门的朋友,在搭建环境的时候都会遇到各种问题,本文详细介绍在Ubuntu 16.04 LTS服务器上安装FreeRADIUS和Daloradius的方法,为初学者省去很多麻烦。

一、在安装之前建议将系统升级到最新版本,运行以下命令:

1 sudo apt‐get update
2 sudo apt‐get upgrade

升级后重新启动系统:

1 sudo reboot

系统启动后,在Ubuntu 16.04系统上开始安装FreeRADIUS和Daloradius。

二、安装Apache Web Server和PHP

Daloradius将要求在主机系统上安装php和Apache Web服务器。

1、在Ubuntu上安装Apache,运行以下命令安装Apache Web服务器:

1 sudo apt‐get install apache2

2、要在Ubuntu 16.04上安装PHP,请运行以下命令:

若要安装PHP 7.3版本请参考在Ubuntu 18.04或CentOS 7系统上安装PHP7.3:点击下面的链接进入:

https://ywnz.com/linuxjc/3782.html

1 sudo apt‐get install php libapache2‐mod‐php php‐gd php‐common php‐mail \
2 php‐mail‐mime php‐mysql php‐pear php‐db php‐mbstring php‐xml php‐curl

3、检查PHP版本以确保安装成功

1 php ‐v

会输出这样的类似版本信息

1 PHP 7.0.33‐0ubuntu0.16.04.16 (cli) ( NTS )
2 Copyright (c) 1997‐2017 The PHP Group
3 Zend Engine v3.0.0, Copyright (c) 1998‐2017 Zend Technologies
4 with Zend OPcache v7.0.33‐0ubuntu0.16.04.16, Copyright (c) 1999‐2017, by Zend Technologies

三、安装MySQL并创建数据库

1、接下来是安装mysql服务器或者MariaDB并为daloRADIUS创建一个数据库。

1 安装MYSQL命令:
2 sudo apt ‐y install mysql‐server

若安装过程中提示你要输入root的密码,请按要求输入密码,然后"确定"即可。我这里暂设是:123456

若没有提示输入密码的话请运行以下命令:

1 sudo mysql_secure_installation
2 如果您还没有设置密码,您将被要求设置密码,然后如果您想删除匿名用户,则禁止远程root
3 登录,删除测试数据库并重新加载表。除非你有其他的计划,并且知道你在做什么,否则我
4 建议你一直按Enter键。

2、安装并运行后,为FreeRADIUS创建一个数据库,这将在稍后阶段使用:

数据库名称:radius

数据库用户:radius

数据库用户密码:123456

1 $ mysql ‐u root ‐p //进入mysql
2 MariaDB [(none)]> CREATE DATABASE radius; //创建一个数据库用户
3 Query OK, 1 row affected (0.000 sec)
4 // 设置数据库用户密码
5 MariaDB [(none)]> GRANT ALL ON radius.* TO radius@localhost IDENTIFIED BY "123456";
6 Query OK, 0 rows affected (0.000 sec)
7 MariaDB [(none)]> FLUSH PRIVILEGES; //刷新MySQL的系统权限相关表
8 Query OK, 0 rows affected (0.001 sec)9 MariaDB [(none)]> EXIT; //退出
10 Bye

四、安装和配置FreeRADIUS

1、由于Ubuntu 16.04系统,版本2.x是官方存储库中提供的软件包,要安装3.0版,请为FreeRADIUS版本3添加PPA:

1 sudo add‐apt‐repository ppa:freeradius/stable‐3.0
2 sudo apt‐get update

安装以下FreeRADIUS软件包:

1 sudo apt‐get install freeradius freeradius‐mysql freeradius‐utils
2 sudo ufw allow to any port 1812 proto udp
3 sudo ufw allow to any port 1813 proto udp

并在调试模式下运行它

1 sudo freeradius ‐X

输出应该很长,并以这样的内容结尾

1 Listening on auth address * port 1812 bound to server default
2 Listening on acct address * port 1813 bound to server default
3 Listening on auth address :: port 1812 bound to server default
4 Listening on acct address :: port 1813 bound to server default
5 Listening on auth address 127.0.0.1 port 18120 bound to server inner‐tunnel
6 Listening on proxy address * port 42463
7 Listening on proxy address :: port 55492
8 Ready to process requests

按Ctrl+C退出调试模式。

2、检查目录下是否有schema.sql文件

1 cd /etc/freeradius/mods‐config/sql/main/mysql
2 find schema.sql

3 若提示没有找到该文件,可能是安装出错没有生成也可能是目录层次不同,可尝试下:find ‐name "schema.sql"

若提示在目录下能找到这个文件则导入freeradius MySQL数据库方案:

1 sudo mysql ‐u root ‐p radius < /etc/freeradius/mods‐config/sql/main/mysql/schema.sql

3、检查创建的表:

1 mysql ‐u root ‐p ‐e "use radius;show tables;"

会显示这样图形输出例子

1 +‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐+
2 | Tables_in_radius |
3 +‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐+
4 | nas |
5 | radacct |
6 | radcheck |
7 | radgroupcheck |
8 | radgroupreply |
9 | radpostauth |
10 | radreply |
11 | radusergroup |
12 +‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐+

4、创建一个从SQL模块到/etc/freeradius/3.0/mods启用目录的符号链接:

1 sudo ln ‐s /etc/freeradius/mods‐available/sql /etc/freeradius/mods‐enabled/

5、配置SQL模块并更改数据库连接参数以适合你的环境:

1 sudo vim /etc/freeradius/mods‐enabled/sql

你的sql部分应该类似于下面的部分:

如果你有专用数据库服务器,请将localhost替换为源FreeRadius服务器的IP:

1 sql {
2 driver = "rlm_sql_mysql"
3 dialect = "mysql"
4 # Connection info:
5 server = "localhost"
6 port = 33067 login = "radius"
8 password = "123456"
9 # Database table configuration for everything except Oracle
10 radius_db = "radius"
11 }
12 # Set to ‘yes’ to read radius clients from the database (‘nas’ table)
13 # Clients will ONLY be read on server startup.
14 read_clients = yes
15
16 # Table to keep radius client info
17 client_table = "nas"

6、然后更改/etc/freeradius/mods-enabled/sql的组权限:

1 sudo chgrp ‐h freerad /etc/freeradius/mods‐available/sql
2 sudo chown ‐R freerad:freerad /etc/freeradius/mods‐enabled/sql

重启freeradius服务:

1 sudo systemctl restart freeradius.service

最后,我们将在调试模式下运行FreeRADIUS以确保一切正常工作。

7、首先停止当前运行的服务

1 sudo systemctl stop freeradius.service

在调试模式下运行FreeRADIUS

1 sudo freeradius ‐X

输出的末尾应该是这样的

1 Listening on auth address * port 1812 bound to server default
2 Listening on acct address * port 1813 bound to server default
3 Listening on auth address :: port 1812 bound to server default
4 Listening on acct address :: port 1813 bound to server default
5 Listening on auth address 127.0.0.1 port 18120 bound to server inner‐tunnel
6 Listening on proxy address * port 55873
7 Listening on proxy address :: port 46059
8 Ready to process requests

按Ctrl+C退出调试模式。

8、重新启动FreeRADIUS服务。

1 sudo systemctl start freeradius.service

五、在Ubuntu 16.04上安装和配置Daloradius

1、如果没有安装wget和unzip,则安装wget和unzip

1 sudo apt ‐y install wget unzip

下载并解压daloRADIUS和cd到目标文件夹中,这个文件夹是daloRADIUS-master

1 wget https://github.com/lirantal/daloradius/archive/master.zip
2 unzip daloradius‐master.zip
3 mv daloradius‐master/ daloradius
4 cd daloradius
5 若无法下载,可用浏览器打开https://github.com/lirantal/daloradius/archive/master.zip下载

2、我们将用daloRADIUS模式填充FreeRADIUS使用的数据库。它是我们在前面的案例中创建的数据库radius。

1 sudo mysql ‐u root ‐p radius < contrib/db/fr2‐mysql‐daloradius‐and‐freeradius.sql
2 sudo mysql ‐u root ‐p radius < contrib/db/mysql‐daloradius.sql

从“daloradius”目录中退出,并将该文件夹移动到文档根目录中,并将其重命名为“daloradius”

1 cd ..
2 sudo mv daloradius /var/www/html/

3、将daloradius文件夹的所有者和组更改为www-data:www-data,这是运行Apache Web Server的所有者和组。

1 sudo chown ‐R www‐data:www‐data /var/www/html/daloradius/

4、接下来,我们需要创建daloRADIUS配置文件。daloRADIUS提供了一个配置文件模板,名

为/var/www/html/daloradius/library/daloradius.conf.php。我们只复制样本。

1 sudo cp /var/www/html/daloradius/library/daloradius.conf.php.sample

/var/www/html/daloradius/library/daloradius.conf.php将配置文件的权限更改为664

1 sudo chmod 664 /var/www/html/daloradius/library/daloradius.conf.php

5、接下来,我们将编辑daloRADIUS配置文件中的一些值,以便它连接到我们之前为FreeRADIUS创建的数据库。

1 sudo vim /var/www/html/daloradius/library/daloradius.conf.php

我们将更改以下值

1 $configValues['CONFIG_DB_USER'] = 'root';
2 $configValues['CONFIG_DB_PASS'] = '';
3 $configValues['CONFIG_DB_NAME'] = 'radius';

下面是我如何根据前面创建的数据库名、用户和密码修改它们的。

1 $configValues['CONFIG_DB_USER'] = 'radius';
2 $configValues['CONFIG_DB_PASS'] = '123456';
3 $configValues['CONFIG_DB_NAME'] = 'radius'

6、最后重启daloRADIUS和Apache

1 sudo systemctl restart freeradius.service apache2

六、访问daloRADIUS

1、要访问daloRADIUS,请在浏览器中访问本机的IP或域名,然后是/daloRADIUS,例如https://your_server_ip/daloradius

除非您配置了SSL,否则请确保它是http://,并且浏览器不会将其更改为https://,,因为有时可能会发生这种情况。

这就是daloRADIUS的样子

默认的登录凭据是:

username: administrator

password: radius

七、测试 FreeRADIUS和daloRADIUS

1、NAS (Network Access Server)客户端表充当了到受保护资源的网关。为了让另一个设备连接到我们的FreeRADIUS服务器,需

要将它添加到NAS客户端表中。

我们通过登录到daloRADIUS仪表板来添加NAS客户端表。然后导航到Management > NAS(在蓝色的子菜单中)> New

NAS(在左边,深灰色的边栏)。

我们需要填写的最小选项如下所示

1 NAS IP/Host:你将连接的计算机的IP。
2 NAS Secret:密钥。
3 NAS Type:你可以在这里任意填写
4 NAS Shortname:方便您使用的短名称

我将填写以下内容

2、创建daloRADIUS用户

为了测试我们的服务器,我们还需要一个用户。

通过在顶部菜单导航到Management > Users(在蓝色子菜单中)> New User(在左边,深灰色的边栏)。

对于我们的示例,我将使用以下凭证创建用户

在创建用户时,除了Username,Password外,还有其他字段可用,但对于我们的目的,这些就足够了。

3、在调试模式下运行FreeRADIUS

接下来,我们将在调试模式下运行FreeRADIUS,这样我们就可以看到当我们向它发送认证请求时会发生什么。

首先停止正在运行的进程。

1 sudo systemctl stop freeradius.service

在调试模式下运行FreeRADIUS

1 sudo freeradius ‐X

注意:每次添加新的NAS表时,都需要重新启动FreeRADIUS服务器,以便它获取更新后的表。

4、使用NTRadPing测试FreeRADIUS服务器

测试服务器的一个方便方法是使用一种叫做NTRadPing的免费Windows软件。

你可以在这里下载https://community.microfocus.com/t5/OES-Tips-Information/NTRadPing-1-5-RADIUS-TestUtility/ta-p/1777768

这是到档案的直接链接

https://community.microfocus.com/dcvta86296/attachments/dcvta86296/OES_Tips/148/1/ntradping.zip

这是VirusTotal的报告,所以你知道它是安全的

https://www.virustotal.com/gui/file/e1b3318b884e4643a043ec5e3104638016c343c447424c244fc1da4f6e7165ec/detection

只需解压归档文件并运行可执行文件以运行NTRadPing即可。

5、我们将使用NTRadPing向在调试模式下运行FreeRADIUS的服务器发送身份验证请求。

我们将按如下方式填写

1 RADIUS Server/port:FreeRADIUS服务器的IP /端口1812
2 Reply timeout (sec.):1
3 Retries: 1
4 RADIUS Secret Key:testing1235 User‐Name:test_1
6 Password:A123456
7 选中CHAP复选框,这样请求使用CHAP密码,而不是PAP密码。
8 现在单击Send按钮发送身份验证请求。
9 如果您接收到Access‐Accept响应,那么我们可以假定它可以工作。

NTRadPing的输出应该像这样

在调试模式下运行FreeRADIUS的终端中,输出应该以这样的内容结束

希望您也已经成功地在ubuntu16.0.4上安装了FreeRADIUS,并安装和配置了daloRADIUS,然后成功地测试了FreeRADIUS服

务器。

八、常见错误

Failed binding with auth address [ ] when running in debug mode

1 Failed binding to auth address * port 1812 bound to server default: Address already in use
2 /etc/freeradius/3.0/sites‐enabled/default[59]: Error binding to port for 0.0.0.0 port 1812

这个错误发生在你试图运行FreeRADIUS,但有另一个FreeRADIUS实例已经在运行,所以你需要运行下面的命令来停止它

1 sudo systemctl stop freeradius.service

快抓紧来操作吧!

在Ubuntu 16.04 LTS服务器上安装FreeRADIUS和Daloradius的方法的更多相关文章

  1. 在Ubuntu 16.04 LTS下编译安装OpenCV 4.1.1

    目录 一 安装前的准备 二 编译并安装OpenCV 4.1.1 注:原创不易,转载请务必注明原作者和出处,感谢支持! OpenCV目前(2019-8-1)的最新版本为4.1.1.本文将介绍如何在Ubu ...

  2. Ubuntu 16.04 LTS U盘安装要点

    一.UltraISO UltraISO是一款功能强大而又方便实用的光盘映像文件制作/编辑/转换工具,它可以直接编辑ISO文件和从ISO中提取文件和目录,也可以从CD-ROM制作光盘映像或者将硬盘上的文 ...

  3. 在阿里云Ubuntu 14.04 Linux服务器上安装docker

    参考 How To Install and Use Docker: Getting Started 这篇最靠谱的文档在阿里云 Ubuntu  14.04 服务器上成功安装 docker . ---- ...

  4. Ubuntu 16.04 LTS下matplotlib安装出错

    使用命令sudo pip3 install matplotlib已知报错,用同样的命令安装numpy和opencv却没有,因此重装linux系统两次都没有解决(我是在Vmware中创建的).报错如下: ...

  5. Ubuntu 16.04 LTS运行robo3t报错

    系统环境:Ubuntu 16.04 LTS. 安装robomongo Robo 3T,运行时报以下错误: jaxu@jaxu-ubuntu:/usr/local/share/robo3t--linux ...

  6. Ubuntu 16.04 LTS 搭建ftp服务器

    其实我之前搭建好了,但是最近我上来看好像跟没搭建一样呢,于是我从新搭建一遍? 我的ubuntu版本: cat /etc/issue Ubuntu 16.04 LTS \n \l 1.安装vsftpd( ...

  7. EJBCA的安装(基于Ubuntu 16.04 LTS + wildfly8 + ejbca6.3.11 + jdk7)

    前一段时间折腾了一下PKI,用EJBCA在研究院内网搭建了一个CA,目前是提供给手机端(安卓和IOS)来和服务器端(nginx + Java应用)做安全连接的(客户端和服务器端双向认证) 由于EJBC ...

  8. Ubuntu 16.04 LTS 降级安装GCC 4.8

    转载自https://www.linuxidc.com/Linux/2017-03/142299.htm Ubuntu 16.04 LTS 降级安装GCC 4.8 [日期:2017-03-28] 来源 ...

  9. Ubuntu 16.04 LTS安装Docker并使用加速器

    参考优酷:http://v.youku.com/v_show/id_XMTkxOTYwODcxNg==.html?spm=a2h0k.8191407.0.0&from=s1.8-1-1.2 首 ...

  10. Ubuntu 16.04 LTS上git提交出现警告Warning: Permanently added 'github.com,52.74.223.119' (RSA) to the list of known hosts. 的解决方法

    问题: Ubuntu 16.04 LTS执行 git pull时总会出现以下警告: Warning: Permanently added 'github.com,52.74.223.119' (RSA ...

随机推荐

  1. Mac Eclipse 常用快捷键汇总

    寻找类:shift+command+t 删除当前行:command+d 上移当前行代码:option+↑ 下移当前行代码:option+↓ 复制当前行至下一行:option+command+↓ 复制当 ...

  2. CF372C

    思路 根据题意可以得到dp转移方程是 \(f_{i,j}=\max\{f_{i-1,k}+b_i-|a_i-j|\}\) 而且 \(j-(t_{i}-t_{i-1})\times d\le k\le ...

  3. Jingle Bio:产品出海的最重要一课是「重营销轻技术」?

    名字: Jingle Bio 开发者 / 团队: Luo Baishun 平台: Web 请简要介绍下这款产品 Jingle Bio 是一款不需要任何编程基础就可以轻松驾驭的个人网站制作工具,你可以使 ...

  4. CGI,FastCGI和PHP-FPM之间的关系和区别

    什么是CGI?早期的web server只可以处理简单的静态web文件,但是随着技术的发展出现动态语言如PHP,Python.PHP语言交给PHP解析器进行处理,但是处理之后如何和web server ...

  5. oeasy教您玩转vim - 4 - # 深入帮助

    深入帮助 回忆上节课内容 上次制作了 oeasy.txt 用 vim oeasy.txt 打开了文件 :f[ile] 查询了当前文件 的信息 从 正常模式或命令模式(Normal mode) 切换到 ...

  6. 第一节 线性数据结构 STL

    vector 容器 迭代器 vector<int> v{1, 0, 0, 8, 6}; for(vector<int>::interator it = v.begin(); i ...

  7. [rCore学习笔记 010]基于 SBI 服务完成输出和关机

    RustSBI的两个职责 它会在计算机启动时进行它所负责的环境初始化工作,并将计算机控制权移交给内核 在内核运行时响应内核的请求为内核提供服务 这里用不太确切的话表述一下,RustSBI作为介于内核和 ...

  8. JavaScript 常用 Web APIs

    Web APIs Web APIs DOM 页面文档对象模型 DOM 树 获取元素 事件 监听事件 事件解绑 操作元素 样式属性操作 结点操作 结点关系 创建节点 DOM 事件流 事件对象 常用鼠标事 ...

  9. odoo 开发入门教程系列-基本视图

    在上一章中已经看到,odoo能够为给定模型生成默认视图.实际上,默认视图对于业务应用程序来说是不可接受的.相反,我们至少应该以逻辑的方式组织各个字段. 视图是在带有操作和菜单的XML文件中定义的.它们 ...

  10. python none类型

    一.python中的数据类型:数值类型.序列类型.散列类型. 1.数值类型:整数型(int).浮点数(float).布尔值(bool) 2.序列类型(有序的):序列类型数据的内部元素是有顺序的,可以通 ...