由於工作需求,在此做個紀錄
實作環境
- Ubuntu 10.04
- freeradius-server-2.1.12
- hostapd-1.0
- wpa_supplicant-1.0
- openssl-1.0.0e
- libnl-1.1
下載位置
- freeradius-server-2.1.12 http://freeradius.org/download.html
- hostapd-1.0 http://hostap.epitest.fi/hostapd/
- wpa_supplicant-1.0 http://hostap.epitest.fi/wpa_supplicant/
- openssl-1.0.0e http://www.openssl.org/source/
- libnl-1.1 http://www.infradead.org/~tgr/libnl/
8021x diagram
安裝及設定
6. make; make install
7. cd /ur/local/etc/raddb
一、users
加入你 supplicant的user name
Example: wensheng Cleartext-Password :="1234"
二、eap.conf
default_eap_type = tls,我這裡預設是tls,看客官們自己的需求配置
8. cd certs; ※ 這裡是配製 tls, ttls , peap ... 等需要憑證的檔案
9. ./bootstrap;make client.pem ※ 會產生需要的 ca.pem client.key client.pem ,這些是我們用來驗證tls , ttls , peap用
10. radiusd -X
安裝hostapd-1.0
1. tar -zxvf hostapd-1.0
2. cd hostapd-1.0/hostapd
3. cp defconfig .config ※ .config 這個是hostapd-1.0 默認的configure檔名
4. vim .config
由於hostapd-1.0 只是當AP認證使用,我這邊稍作調整
CONFIG_DRIVER_NL80211=y → #CONFIG_DRIVER_NL80211=y
#CONFIG_DRIVER_WIRED=y → CONFIG_DRIVER_WIRED=y
加入 openssl 和 libnl
LIBNL=/opt/libnl-1.1 //移植的libnl库所在位置
CFLAGS += -I$(LIBNL)/include
LIBS += -L$(LIBNL)/lib
LIBSSL=/usr/local/openssl //移植的openssl库所在位置
CFLAGS += -I$(LIBSSL)/include
LIBS += -L$(LIBSSL)/lib
5. make; 如果有出現錯誤,大部分可能是找不到鏈結檔,就請客官們自己解決了
6. 修改hostapd.conf,我只列重點修改部分
一、
interface=eth0
driver=wired
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2
dump_file=/tmp/hostapd.dump
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
ieee8021x=1
eapol_version=1
own_ip_addr=127.0.0.1
二、
# RADIUS authentication server
auth_server_addr=127.0.0.1
auth_server_port=1812
auth_server_shared_secret=testing123
7. ./hostapd hostapd.conf
安裝wpa_supplicant-1.0
1. tar wpa_supplicant-1.0
2. cd wpa_supplicant-1.0/wpa_supplicant
3. cp defconfig .config
4. 配置.config,請依照個人需求設定
CFLAGS += -I/usr/local/openssl/include
LIBS += -L/usr/local/openssl/lib
上面兩行是需要加入的
5. make;
6. ./wpa_supplicant -Dwird -ieth0 -c xxxx.conf ※ 這邊就是自行設定 看是要驗證tls , peap 都可以在wpa_supplicant-1.0/wpa_supplicant/examples 有範例可以參考,下面是我自己本身的設定檔,僅共參考用
一、tls.conf
eapol_version=1
network={
eap=TLS
eapol_flags=0
key_mgmt=IEEE8021X
identity="wensheng"
ca_cert="/usr/local/etc/raddb/certs/ca.pem" ※這邊就是看你freeradiusd 所產生的憑證檔位置,一般默認都是/usr/local/etc/raddb/certs底下
client_cert="/usr/local/etc/raddb/certs/client.pem"
private_key="/usr/local/etc/raddb/certs/client.key"
private_key_passwd="whatever" ※比較奇怪的是這裡面passwd竟然不是1234,而是certs/底下 client.cnf 裡面的whatever ,此問題害我找了超久
}
二、ttls.conf
eapol_version=1
network={
eap=TTLS
eapol_flags=0
key_mgmt=IEEE8021X
identity="wensheng"
password="1234"
anonymous_identity="anonymous"
ca_cert="/usr/local/etc/raddb/certs/ca.pem"
phase2="auth=MD5"
}
三、peap.conf
eapol_version=1
network={
eap=PEAP
eapol_flags=0
key_mgmt=IEEE8021X
identity="wensheng"
password="1234"
ca_cert="/usr/local/etc/raddb/certs/ca.pem"
phase2="auth=MSCHAPV2"
anonymous_identity="anonymous"
}
如果網段相同,設定都有成功架起來的話,就會看得到認證成功問題
其餘的問題
一、大多數都是可能做cross complier ,porting to arm board 時候,遇到權限不足沒辦法修改或是讀取
二、配置的certs目錄底下找不到相對應的*.pem or *.key
三、憑證時間差距很遠
這幾天下來對於8021x有了更深的認識,在此做個紀錄
[Reference]
http://www.backtrack-linux.org/forums/showthread.php?t=40500
http://blog.csdn.net/xtx1990/article/details/6951429
http://blog.163.com/tianjunqiang666@126/blog/static/8725911920122219714381/
http://fedetft.wordpress.com/2009/11/21/openwrt-fonera-and-p12-certificates/
http://blog.xuite.net/jackie.xie/bluelove/33079474
http://blog.yam.com/weieer/article/24672276
http://www.cnblogs.com/zhuwenger/archive/2011/03/11/1980294.html
請先 登入 以發表留言。