radius服务器创建方法

/***********************************/

依赖:ubuntu18.04 + freeradius-3.0

/**********************************/

1、安装freeradius

sudo apt-get install freeradius

#安装的时候会提示有依赖关系的及建议安装的其它工具,一起全部安装

sudo apt-get install freeradius-ldap freeradius-postgresql freeradius-mysql freeradius-krb5 snmp libmldbm-perl libnet-daemon-perl libsql-statement-perl make-doc

2、停止服务

sudo service freeradius stop

3、建立freeradius的软链接

cd /usr/sbin

sudo ln -s freeradius radiusd

4、修改防火墙允许freeradius端口

sudo ufw allow 1812/udp

sudo ufw allow 1813/udp

5、开启radius服务

radiusd -X

6、测试服务是否正常开启

gedit或vim /etc/freeradius/3.0/mods-config/files/authorize

插入以下内容:

testing Cleartext-Password := "password"

保存退出

停止服务再重新开启服务(执行2、5)

输入测试命令:

radtest testing password 127.0.0.1 0 testing123

如果接收到"Access-Accept"则说明正常

7、增加EAP相关的用户

gedit或vim /etc/freeradius/3.0/mods-config/files/authorize

插入以下内容:

test Cleartext-Password := "testpwd"

Auth-Type := Local,

Service-Type = Framed-User,

Framed-IP-Address = 255.255.255.255,

Framed-IP-Netmask = 255.255.255.0

8、增加路由器的相关配置

gedit或vim /etc/freeradius/3.0/clients.conf

插入以下内容:

client wifi_ap {

ipaddr = 192.168.1.0/24

secret = testing123

require_message_authenticator = no

}

这里的ip对路由器的lan口ip有要求,必须为同一网段

9、生成EAP相关的证书

注意:

CA的common name和server、client的common name不能一样,否则验证配套性的时候会提示自签名

以下命令中需要输入用于解密的密码,千万要记住,我一般都固定为123456

openssl req -newkey rsa:2048 -nodes -keyout ca.key -x509 -days 3650 -out ca.crt

openssl pkcs12 -export -in ca.crt -inkey ca.key -out ca.p12

openssl genrsa -out server.key 2048

openssl req -new -key server.key -out server.csr

openssl x509 -req -days 3650 -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt

openssl pkcs12 -export -in server.crt -inkey server.key -out server.p12

openssl genrsa -out client.key 2048

openssl req -new -key client.key -out client.csr

openssl x509 -req -days 3650 -in client.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out client.crt

openssl pkcs12 -export -in client.crt -inkey client.key -out client.p12

生成文件说明

ca.crt:ca根证书,用于验证server/client子证书

ca.key:ca私钥,用于签名server/client子证书,wifi连接过程中不需要

ca.p12:ca根证书+加密私钥,wifi连接过程中不需要

client.crt:客户端证书

client.csr:客户端未签名的证书摘要,wifi连接过程中不需要

client.key:客户端私钥,因未签名,出于安全考虑,客户端可能不能使用,可使用client.p12

client.p12:客户端证书+加密私钥

server.crt:服务器端证书

server.csr:服务器端未签名的证书摘要,wifi连接过程中不需要

server.key:服务器端私钥,因未签名,出于安全考虑,服务器端可能不能使用,可使用client.p12

server.p12:服务器端证书+加密私钥

windows下tls连接默认使用client.p12内的用户连接,可勾选"为此连接使用一个不同的用户名"

openssl pkcs12 -in client.p12 -out client.pem

openssl pkcs12 -in server.p12 -out server.pem

openssl x509 -in ca.crt -out ca.pem

验证证书是否配套:

openssl verify -CAfile ca.pem client.pem server.pem

10、将生成的证书拷贝到freeradius路径下

/etc/freeradius/3.0/certs/

11、修改EAP相关配置

gedit或vim /etc/freeradius/3.0/mods-enabled/eap

涉及到的修改如下:tls-config tls-common

private_key_password = 123456 #这里是前面生成证书时输入的密码

private_key_file = /etc/freeradius/3.0/certs/server.pem

certificate_file = /etc/freeradius/3.0/certs/server.pem

ca_file = /etc/freeradius/3.0/certs/ca.pem

12、路由器页面上的相关设置

radius服务器ip:跟client.conf中网段一样的ip,也就是ubuntu服务器ip,我这里手动设置静态ip为192.168.1.5

radius端口:1812(默认)

radius密码:testing123

13、客户端连接wifi时的配置

method:TLS

身份:test

CA证书:ca.pem

用户证书:client.pem

用户私钥:client.pem

私钥密码:123456

相关推荐
信安IT租赁17 分钟前
小公司服务器用户与权限管理:chmod/chown/用户组从零理清
linux·运维·服务器
redsea_HR1 小时前
全球化HR系统选型:本地服务网络和远程支持怎么选?
大数据·服务器·网络
yyuuuzz2 小时前
跨境电商云服务器,五个店铺挤一台机器
运维·服务器·人工智能·云服务器
CoderYanger3 小时前
Java EE 进阶:15. Linux基本使用和程序部署(第二弹):部署 Web 项目到 Linux
linux·服务器·数据库·spring boot·spring·阿里云·java-ee
飞花漫卷,情随岁迁3 小时前
Linux 排障与性能监控
linux·运维·服务器·网络·数据库·mysql·oracle
福大大架构师每日一题4 小时前
agno v3.2.1发布:会话压缩、公司文件 API、工具稳定性与模型兼容性全面升级
服务器·网络·数据库
JoyCong19985 小时前
从一张空白设备列表开始,ToDesk新版本增添无设备引导,远程管理更友好
linux·运维·服务器·网络·远程工作
Matt Feng5 小时前
在线PDF加密码水印怎么用?水印与权限设置步骤
运维·服务器·pdf·word·wps
llilian_165 小时前
海外进口授时服务器与国产授时服务器横向对比
服务器·功能测试·嵌入式硬件·51单片机·软件工程
跨境猫小妹5 小时前
亚马逊后台登录频繁触发验证码:先查会话Cookie还是IP环境
服务器·tcp/ip·php·跨境电商·营销策略