Bookmark and Share Subscribe
Raspberry Pi 真的是很好用的居家必備小工具

再升級家裡Wi-Fi AP的 WPA2 Person 為 企業級認證上 
Raspberry Pi 只要安裝 FreeRadius 服務
馬上家裡每個人設備都能享受個人化的 Wi-Fi 密碼認證
不再擔心家裡的 WiFi密碼外洩或者有家人裝了什麼 WiFi萬能鑰匙等APP 把密碼外洩到公眾資料庫上

馬上來Raspberry上安裝

Install FreeRADIUS 3.0

$ sudo apt update
$ sudo apt install freeradius

產生Openssl DH Parameters

$ sudo openssl dhparam -out /etc/freeradius/3.0/certs/dh 2048

你也可以在PC上用 openssl for windows 小工具來製作,速度會比在樹梅派上快很多

Generate產生憑證 Certificates

編輯 ca.cnf 

$ sudo nano /etc/freeradius/3.0/certs/ca.cnf

有兩個重要參數要改掉 input_password 與 output_password 

然後把一些你的個人或組織資訊編輯修正 如國家 省分 公司 等等

Make 產生 CA certificate:

$ sudo /etc/freeradius/3.0/certs/make ca.pem

編輯 server.cnf 

$ sudo nano /etc/freeradius/3.0/certs/server.cnf

有兩個重要參數要改掉 input_password 與 output_password 

然後把一些你的個人或組織資訊編輯修正 如國家 省分 公司 等等

產生認證Server certificates

$ sudo /etc/freeradius/3.0/certs/make server.pem

修正 EAP Configuration

開啟config

$ sudo vim /etc/freeradius/3.0/mods-enabled/eap

在 “eap” 區塊, 把 “default_eap_type” 從 md5 改成 tls.

default_eap_type = tls

繼續修改在 tls-config 區段中的參數 private_key_password 

tls-config tls-common {
    private_key_password    = output_password from server.cnf
    private_key_file        = ${certdir}/server.key
    certificate_file        = ${certdir}/server.crt
    ca_file                 = ${certdir}/ca.pem
    dh_file                 = ${certdir}/dh
    ecdh_curve              = "secp384r1"
}

增加Wi-Fi AP 端

The clients can be found in the following file:

$ sudo nano /etc/freeradius/3.0/clients.conf

Feel free to remove the localhost entry after our first test at the end of this guide.

Add your client to the file. This example is for a Wi-Fi AP

client arubaAP01 {
    secret    = your_unique_client_secret
    ipaddr    = 10.0.0.5
    shortname = arubaAP01 
}

增加使用者

Open up the users file

$ sudo nano /etc/freeradius/3.0/users

Add your users to the file, e.g:

david    Cleartext-Password := "passwordPPP" 

啟動 Start and Test the Server

Start the server

$ sudo /etc/init.d/freeradius start

Test the connection

$ radtest david passwordPPP localhost 0 testing123

重新產生憑證  

/etc/freeradius/3.0/certs 這資料夾中執行以下指令即可清除舊憑證

 rm -f *.pem *.der *.csr *.crt *.key *.p12 serial* index.txt*


開啟LOG
/etc/freeradius/3.0/radiusd.conf
把[auth = no] 改成 yes



0 意見:

張貼留言

LinkWithin

Related Posts with Thumbnails
top