實驗三 無線網路與 802.1x 與 RADIUS

36
實實實 實實實實實 802.1x 實 RAD IUS 實實 802.1x 實實實實實 Supplicant 使使 peap 使使 Authenticator 使使 Host AP Authentication Server 使使 Free RADIUS 使使使使2006/11/16

description

實驗三 無線網路與 802.1x 與 RADIUS. 瞭解 802.1x 的認證機制 Supplicant → 使用 peap 方案 Authenticator → 使用 Host AP Authentication Server → 使用 Free RADIUS 繳交時間: 2006/11/16. 實驗目的. Station Join 到 AP 之後,對於認證方式傳統上都是透過一台 AP 本身去執行的。 - PowerPoint PPT Presentation

Transcript of 實驗三 無線網路與 802.1x 與 RADIUS

Page 1: 實驗三 無線網路與 802.1x 與 RADIUS

實驗三無線網路與 802.1x 與RADIUS

瞭解 802.1x 的認證機制Supplicant → 使用 peap 方案Authenticator → 使用 Host APAuthentication Server → 使用 Free RADIU

S繳交時間: 2006/11/16

Page 2: 實驗三 無線網路與 802.1x 與 RADIUS

實驗目的 Station Join 到 AP 之後,對於認證方式傳統上都是透過一台 AP本身去執行的。

在 802.1x 機制上,提供 Authentication Server( 即 AS) , AS 可以同時服務許多台 AP,並且提供認證與記帳等機制 (AAA) 。

利用架設 802.1x 相關環境來瞭解 802.1x 運作的方式,以及透過 Ethereal 抓取 EAP 與 Radius 封包來瞭解運作流程。 EAP 有多種身分認證方式,其中包括 EAP-MD5 、 EAP-TLS 、 EAP-PEAP……(參見課本第五章介紹 )

Page 3: 實驗三 無線網路與 802.1x 與 RADIUS

知識背景Authenticator使用 Host AP Daemon140.113.167.205SSID : netlab

Authentication Server使用 Free RADIUS140.113.167.206

Supplicant使用 peap140.113.167.219

Internet

Station 連結上AP,並且輸入在AS中登記好的帳號密碼後才可以上網

AP要與 Radius 建立連線,負責傳送相關的 message 到 AS 與 Supplicant 之間,一開始僅允許 Station 的 traffic流向 AS ,經由認證之後才可連接到 Internet

負責使用者的認證與計費機制

需設定 AP到 AS 加密的 key ,即 Shared Secret

Page 4: 實驗三 無線網路與 802.1x 與 RADIUS

基礎概念802.1x 運作流程

Page 5: 實驗三 無線網路與 802.1x 與 RADIUS

基礎概念HOSTAP 三部分 HOSTAP driver for prism (2/2.5/3)

此為特別的 driver ,會將無線網路卡以 AP的模式驅動 本 driver 可設定無線網卡成為 AP模式

HOSTAPD 主要負責 802.1x 的部分,可以利用 hostapd.conf 簡單設定 AP的認證機制

HOSTAP utility 主要是一些公用程式可以把參數傳給 hostap-driver ,以方便作一些測試或者其他用途

Page 6: 實驗三 無線網路與 802.1x 與 RADIUS

實驗設備與環境 硬體

電腦兩台 (Linux FC5) : 一台接上有線網路當作 RADIUS Server 使用 一台架設 hostap ,需有兩張網卡用作 bridge

筆記型電腦:需有無線網卡 軟體

Authentication Server :採用 Free RADIUS Authenticator :採用 Host AP Daemon Supplicant :採用 windows 內建的 802.1X verification function 方案

Ethereal :抓 EAP 與 RADIUS 封包

Page 7: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Authentication Server (1/10) 抓取 Free RADIUS 版本。

到 http://www.freeradius.org/網址上抓取download 目前的版本。

wget ftp://ftp.freeradius.org/pub/radius/freeradius-1.1.3.tar.gz

解壓縮 FREERADIUS 抓回來的版本。 tar zxvf freeradius-1.1.3.tar.gz

Page 8: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Authentication Server (2/10) 切換到 FREERADIUS 解壓縮後的目錄,並且執行 .

/configure 設定編譯時所需用到的相關參數。 cd freeradius-1.1.3 ./configure

對程式作編譯。 make

安裝編譯好的執行檔與相關設定檔。 make install

Page 9: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Authentication Server (3/10) 切換到設定檔預設安裝的目錄,並且對 RA

DIUS Server 進行設定,首先修改允許連線到此台 RADIUS Server 的 AP ,即 802.1x 中的 Authenticator 相關資訊。

cd /usr/local/etc/raddb vi clients.conf

Page 10: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Authentication Server (4/10) 設定將要連線進來的 AP相關資訊。包括對 AP之

間 traffic 所使用加密的 key,以及 AP的名稱。 在第 99行中新增四行資訊:

client 140.113.167.205/24{ IP address and mask of AP

secret = secret encryption key between AP and A

S

shortname = netlab15 Name of AP

}

Page 11: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Authentication Server (5/10)

修改使用者登入時所需要的設定檔。 cd /usr/local/etc/raddb vi users

增加使用者帳號,並且設定使用者密碼與認證的方式。

在第 96行新增兩行資訊:“netlab” Auth-Type := EAP, User-Password == “hello”

Reply-Message = “Hello, %u”

Page 12: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Authentication Server (6/10) Open the main configuration file radiusd.conf

a. Make sure mschap contains:

mschap {

authtype = MS-CHAP 認證方法 use_mppe = yes assign key

require_encryption = yes 要加密require_strong = yes 128 bit

}

Page 13: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Authentication Server (7/10) Make sure the authorize and authenticate contai

ns: authorize{ 設定 mschap 作的動作

preprocess 事前處理的動作mschap 認證機制suffix parser user name 的準則eap 採用 eapfiles 開 user 檔看 user 是否合法

}authenticate {

Auth-Type MS-CHAP {mschap

}eap

}

Page 14: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Authentication Server (8/10) Open eap.conf

Set default_eap_type to peap station 認證方式 default_eap_type = peap

Since PEAP is using TLS, the TLS section must contain:tls {

private_key_password = whateverprivate_key_file = ${raddbdir}/certs/cert-srv.pemcertificate_file = ${raddbdir}/certs/cert-srv.pem# Trusted Root CA listCA_file = ${raddbdir}/certs/root.pemdh_file = ${raddbdir}/certs/dhrandom_file = ${raddbdir}/certs/random

}

Page 15: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Authentication Server (9/10)

Find the peap section, and make sure it contain the following peap {

# The tunneled EAP session needs a default# EAP type which is separate from the one for# the non-tunneled EAP module. Inside of the# PEAP tunnel, we recommend using MS-CHA

Pv2,# as that is the default type supported by# Windows clients.default_eap_type = mschapv2

}

Page 16: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Authentication Server (10/10) execute the RADIUS server

radiusd –f –X

Page 17: 實驗三 無線網路與 802.1x 與 RADIUS
Page 18: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Authenticator (1/7) 首先架設 hostap 。 FC5 已預設安裝 HostAP driver, 只要搭配 Intersil Prism2 (2/2.5/3) 晶片的無線網卡 , 就能將 Linux 電腦變成 AP(若使用 RH9 ,請參考課程網頁所提供文件來安裝hostap) vi /etc/sysconfig/network-scripts/ifcfg-wlan0

DEVICE=wlan0 BOOTPROTO=none HWADDR=00:60:B3:8D:D0:BF ONBOOT=no TYPE=Wireless MODE=Master ESSID=netlab Disable=no

Page 19: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Authenticator (2/7) 設定 bridge

Install yum utility yum install yum-utils

Set bridge yum install bridge-utils brctl addbr br0 brctl addif br0 eth0 brctl addif br0 wlan0

Page 20: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Authenticator (3/7)

ifconfig eth0 down ifconfig wlan0 down ifconfig eth0 0.0.0.0 up ifconfig wlan0 0.0.0.0 up ifconfig br0 140.113.167.205 netmask 255.255.255.

0 up echo "1" > /proc/sys/net/ipv4/ip_forward route add default gw 140.113.167.254請man brctl , eth0 與 wlan0請依你的 device名稱而定

Page 21: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Authenticator (4/7) HOSTAP (hostapd) 需另外下載

cd hostapd-0.4.9make

Page 22: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Authenticator (5/7) 修改內部跑的 Host AP Daemon 的設定檔來啟用 802.1x 的功能。vi hostapd.conf

新增或修改部份資訊:# Require IEEE 802.1X authorization ieee8021x=1# The own IP address of the access point (us

ed as NAS-IP-Address)own_ip_addr=127.0.0.1

Page 23: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Authenticator (6/7)

# RADIUS authentication serverauth_server_addr=140.113.167.206auth_server_port=1812auth_server_shared_secret=secret# RADIUS accounting serveracct_server_addr=140.113.167.206acct_server_port=1813acct_server_shared_secret=secret

Page 24: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Authenticator (7/7)

執行 ./hostapd 可以得知各參數啟動 hostap

執行 ./hostapd ./hostapd.conf請另外開啟終端機下指令 iwconfig wlan0 ,檢查 e

ncryption key 是否 off ,若為 on請下指令 : Iwconfig wlan0 enc off

encryption key 是對傳輸連線加密,使用者端亦須擁有解密金鑰,本次實驗著重身分認證流程,不考慮這方面。

Page 25: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Supplicant 設定 (1/3)

Page 26: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Supplicant 設定 (2/3)

Page 27: 實驗三 無線網路與 802.1x 與 RADIUS

實驗方法與步驟Supplicant 設定 (3/3)

Page 28: 實驗三 無線網路與 802.1x 與 RADIUS
Page 29: 實驗三 無線網路與 802.1x 與 RADIUS
Page 30: 實驗三 無線網路與 802.1x 與 RADIUS
Page 31: 實驗三 無線網路與 802.1x 與 RADIUS
Page 32: 實驗三 無線網路與 802.1x 與 RADIUS

實驗記錄 (請詳細說明 ) Free RADIUS 架設過程中更改了哪些設定,遇到哪些困難?

架設 hostap 過程中,遇到了哪些困難? hostapd更改了哪些設定,遇到哪些困難? station 採用哪種方法,遇到哪些困難? 請抓取 station 與 AP 之間的 EAP 無線封包。 ( 用

Ethereal 抓取之後可用 EAP 或 EAPOL 來秀出此類封包 )

請抓取 AP 與 RADIUS Server 的 RADIUS 有線封包。 ( 用 Ethereal 抓取之後可用 RADIUS 來秀出此類封包 )

Page 33: 實驗三 無線網路與 802.1x 與 RADIUS

問題討論 分析 EAP 的封包結構。 (請貼圖證明 ) 分析 RADIUS 的封包結構。 (請貼圖證明 ) 故意打錯密碼,再抓一次封包,分析其運作方式與封包內容有何不同。

請分析認證成功與失敗的流程。

Page 34: 實驗三 無線網路與 802.1x 與 RADIUS

注意事項 繳交時間: 2006/11/16(週四課堂上繳交 ) 報告撰寫請以投影片所列項目 ( 實驗紀錄與問題討論 ) 為準,並請詳細說明。

報告以組別為單位繳交,請雙面列印。 需借網卡之組別至工三 446B 登記,期限一週。 因為需要三台電腦,所以設備不足之組別請於星期五 (10/27)下午四點前寄信給助教 [email protected] 登記,日後安排至系計中做實驗,逾期不予受理。

Page 35: 實驗三 無線網路與 802.1x 與 RADIUS

加分題根據原始設定大約十秒斷線,請同學去研究 AP 的 hostapd.conf ,找出讓 station保持連線的解決方法。

同學亦可嘗試 MD5 認證方式,參照課本附錄

請多做其他嘗試,請問可以對 hostap 與 RADIUS server做哪些設定方面的更動?

Page 36: 實驗三 無線網路與 802.1x 與 RADIUS

參考資料 802.1X Port-Based Authentication HOWTO

http://tldp.org/HOWTO/8021X-HOWTO/index.html

Free RADIUS 網站: http://www.freeradius.org READE, INSTALL, doc/README, doc/*

Host AP http://hostap.epitest.fi/ hostapd.conf 內的說明