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

相关推荐
佳児素花痴╮19 分钟前
C语言链接库
linux·运维·服务器
雷电小将军30 分钟前
诡秘之主手游占卜家序列加点 诡秘之主手游占卜家怎么加点
服务器·网络·游戏·电脑·玩游戏
云飞云共享云桌面34 分钟前
苏州昆山精密机械加工厂研发部门10个SolidWorks可以部署云飞云共享云桌面吗?
大数据·运维·服务器·自动化·汽车·制造
聚美智数35 分钟前
图片水印-图片剪裁-图片缩放API接口介绍
java·服务器·数据库
云飞云共享云桌面1 小时前
自动化设备厂 10 人研发团队,如何共用一台服务器做 SolidWorks 建模?
运维·服务器·网络·3d·自动化·制造
筝筝ba2 小时前
Configure IP Address Via Different User Roles And Verify(1)
服务器
QH139292318802 小时前
NVIDIA H200 H300服务器
运维·服务器·开发语言·网络·信息与通信
xixiaoyunya2 小时前
中小微企业轻量组网方案的技术选型与实践:从传统专线到软定义隧道的成本与效能分析
服务器·php·apache
Hello-FPGA2 小时前
嵌入式LINUX 设备 ip配置后怎么保存才能掉电不消失?
linux·运维·服务器
奥莱维2 小时前
KNX酒店方案_KNX专用线与高端酒店技术逻辑
java·服务器·前端·数据库