本指南旨在帮助您在 Ubuntu 22.04/20.04/18.04 LTS 服务器上安装 FreeRADIUS 和 Daloradius。我们最近关于 FreeRADIUS 的指南是关于如何在 CentOS 7 和 RHEL 7 上安装 FreeRADIUS 和 Daloradius。FreeRADIUS 是一款开源、高性能、模块化、可扩展且功能丰富的 RADIUS 服务器。它附带服务器和 Radius 客户端、开发库以及许多其他 RADIUS 相关实用程序。 FreeRADIUS 支持请求代理、故障转移和负载平衡,以及访问多种类型后端数据库的能力。 RADIUS 的全称是“远程身份验证拨入用户服务”,是一种用于远程用户身份验证和计费的网络协议。提供AAA级服务;即授权、身份验证和记账。 FreeRADIUS 的特点- 灵活的配置可以通过多种方法来选择用户配置。
- 完全支持 RFC 2865 和 RFC 2866 属性。
- 具有 EAP-MD5、EAP-SIM、EAP-TLS、EAP-TTLS、EAP-PEAP 和 Cisco LEAP EAP 子类型的 EAP
- 近百家供应商的供应商特定属性,包括 BinTec、Foundry、Cisco、Juniper、Lucent/Ascend、HP ProCurve、Microsoft、USR/3Com、Acc/Newbridge 等。
daloRADIUS 是什么?另一方面,daloRADIUS 是一个用 PHP 和 JavaScript 编写的高级 RADIUS Web 管理平台。它主要旨在管理由 FreeRADIUS 服务器支持的热点和通用 ISP 部署。 daloRADIUS 的一些优秀功能包括: - 拥有数据库抽象层,支持多种数据库系统 – MySQL、SQLite、PostgreSQL、MsSQL 和 Oracle
- 高级用户管理
- 强大的图形报告和会计
- 与 GoogleMaps 集成以实现地理位置
- 有计费引擎
在 Ubuntu 22.04/20.04/18.04 上安装 FreeRADIUS 和 Daloradius首先将系统软件包更新到最新版本: sudo apt update
sudo apt -y upgrade
升级后重新启动系统 sudo reboot
系统启动后,开始在 Ubuntu 上安装 FreeRADIUS 和 Daloradius 第 1 步:安装 Apache Web 服务器和 PHPDaloradius 需要在主机系统上安装 php 和 Apache Web 服务器。 通过运行以下命令安装 Apache Web 服务器: sudo apt -y install apache2
用于在 Ubuntu 上安装 PHP sudo apt -y install php libapache2-mod-php php-{gd,common,mail,mail-mime,mysql,pear,db,mbstring,xml,curl}
检查安装的php版本: # Ubuntu 22.04
$ php -v
PHP 8.0.8 (cli) (built: Sep 11 2021 04:17:39) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.8, Copyright (c) Zend Technologies
with Zend OPcache v8.0.8, Copyright (c), by Zend Technologies
# Ubuntu 20.04
$ php -v
PHP 7.2.19-0ubuntu0.18.04.2 (cli) (built: Aug 12 2019 19:34:28) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.19-0ubuntu0.18.04.2, Copyright (c) 1999-2018, by Zend Technologies
第2步:安装MariaDB并创建数据库
接下来是安装 MariaDB 服务器并为daloRADIUS 创建数据库:
sudo apt update
sudo apt install mariadb-server
sudo mysql_secure_installation
安装并运行后,为 FreeRADIUS 创建一个数据库,这将在稍后阶段使用。
database name: radius
database user: radius
database user password: Str0ngR@diusPass
如果您有专用的数据库服务器,请将 localhost 替换为源 FreeRADIUS 服务器的 IP。
$ sudo mysql -u root -p
CREATE DATABASE radius;
GRANT ALL ON radius.* TO radius@localhost IDENTIFIED BY "Str0ngR@diusPass";
FLUSH PRIVILEGES;
QUIT
步骤 3:安装和配置 FreeRADIUS
您可以查看 Ubuntu 中可用的 freeradius 版本:
$ sudo apt policy freeradius
freeradius:
Installed: 3.0.21+dfsg-3
Candidate: 3.0.21+dfsg-3
Version table:
*** 3.0.21+dfsg-3 500
500 http://ke.archive./ubuntu jammy/main amd64 Packages
100 /var/lib/dpkg/status
使用以下命令从官方 Ubuntu APT 存储库安装 FreeRadius 软件包: sudo apt -y install freeradius freeradius-mysql freeradius-utils
安装的软件包包括 mysql 模块和 utils 软件包。 导入freeradius MySQL数据库方案:sudo su -
mysql -u root -p radius < /etc/freeradius/3.0/mods-config/sql/main/mysql/schema.sql
检查创建的表: $ sudo mysql -u root -p -e "use radius;show tables;"
Enter password:
+------------------+
| Tables_in_radius |
+------------------+
| nas |
| radacct |
| radcheck |
| radgroupcheck |
| radgroupreply |
| radpostauth |
| radreply |
| radusergroup |
+------------------+
在/etc/freeradius/3.0/mods-enabled/下创建sql模块的软链接 sudo ln -s /etc/freeradius/3.0/mods-available/sql /etc/freeradius/3.0/mods-enabled/
配置 SQL 模块并更改数据库连接参数以适合您的环境。 sudo vim /etc/freeradius/3.0/mods-enabled/sql
您的 sql 部分应如下所示。 sql {
driver = "rlm_sql_mysql"
dialect = "mysql"
# Connection info:
server = "localhost"
port = 3306
login = "radius"
password = "Str0ngR@diusPass"
# Database table configuration for everything except Oracle
radius_db = "radius"
}
# Set to 'yes’ to read radius clients from the database ('nas’ table)
# Clients will ONLY be read on server startup.
read_clients = yes
# Table to keep radius client info
client_table = "nas"
注释 mysql 中的 SSL 部分 mysql {
# If any of the files below are set, TLS encryption is enabled
# tls {
# ca_file = "/etc/ssl/certs/my_ca.crt"
# ca_path = "/etc/ssl/certs/"
# certificate_file = "/etc/ssl/certs/private/client.crt"
# private_key_file = "/etc/ssl/certs/private/client.key"
# cipher = "DHE-RSA-AES256-SHA:AES128-SHA"
#
# tls_required = yes
# tls_check_cert = no
# tls_check_cert_cn = no
# }
# If yes, (or auto and libmysqlclient reports warnings are
# available), will retrieve and log additional warnings from
# the server if an error has occured. Defaults to 'auto'
warnings = auto
}
然后更改 /etc/freeradius/3.0/mods-enabled/sql 的组右侧 sudo chgrp -h freerad /etc/freeradius/3.0/mods-available/sql
sudo chown -R freerad:freerad /etc/freeradius/3.0/mods-enabled/sql
重新启动 freeradius 服务: sudo systemctl restart freeradius.service
第 5 步:安装并配置 Daloradius我们需要安装 Daloradius 才能获得 FreeRADIUS Web 管理界面。 sudo apt -y install wget unzip
wget https://github.com/lirantal/daloradius/archive/master.zip
unzip master.zip
mv daloradius-master daloradius
更改配置目录: cd daloradius
配置daloradiussudo mysql -u root -p radius < contrib/db/fr2-mysql-daloradius-and-freeradius.sql
sudo mysql -u root -p radius < contrib/db/mysql-daloradius.sql
cd ..
sudo mv daloradius /var/www/html/
然后更改 http 文件夹的权限并为daloradius 配置文件设置正确的权限。 sudo mv /var/www/html/daloradius/library/daloradius.conf.php.sample /var/www/html/daloradius/library/daloradius.conf.php
sudo chown -R www-data:www-data /var/www/html/daloradius/
sudo chmod 664 /var/www/html/daloradius/library/daloradius.conf.php
您现在应该修改文件 daloradius.conf.php 以调整 MySQL 数据库信息。打开daloradius.conf.php并添加数据库用户名、密码和数据库名称。 sudo vim /var/www/html/daloradius/library/daloradius.conf.php
要配置的特别相关的变量是: $configValues['CONFIG_DB_HOST'] = 'localhost';
$configValues['CONFIG_DB_PORT'] = '3306';
$configValues['CONFIG_DB_USER'] = 'radius';
$configValues['CONFIG_DB_PASS'] = 'Str0ngR@diusPass';
$configValues['CONFIG_DB_NAME'] = 'radius';
为确保一切正常,请重新启动freeradius和apache2 sudo systemctl restart freeradius.service apache2
使用您的系统 IP 地址或域名打开管理链接: http://ip-address/daloradius/login.php
将会出现这样的页面: 默认登录详细信息为: Username: administrator
Password: radius
首次登录后更改密码。 了解有关 daloRADIUS 配置的更多信息 标签: - 在 Ubuntu 22.04/20.04/18.04 上安装 FreeRADIUS
- 在 Ubuntu 22.04/20.04/18.04 上安装 FreeRADIUS 和 Daloradius
- Ubuntu 20.04/18.04 FreeRADIUS 和 Daloradius 安装
在其他操作系统上安装。 - 在 CentOS 8/RHEL 8 上安装 FreeRADIUS 和 Daloradius
- 在 CentOS 7 上安装 FreeRADIUS 和 daloRADIUS
|