3
4

More than 3 years have passed since last update.

hostapdでIEEE 802.1X/EAP認証対応Wi-Fi AP

Last updated at Posted at 2020-08-25

TL;DR

IEEE 802.1X認証をテストするために hostapd を使ってのアクセスポイントの設定方法。
802.1X認証には通常、認証サーバとして RADIUS を立てる必要があるが、テスト目的なので hostapd の integrated EAP server 機能を使って簡単にRaspbian stretch上に立ち上げてみる。

ネットワーク設定

ブリッジ設定

有線インタフェース eth0 と無線インタフェース wlan0 をブリッジ br0 に接続する。

/etc/network/interfaces
auto br0
iface br0 inet manual
bridge_ports eth0 wlan0

ネットワークインタフェース設定

wlan0インタフェースをwpa_supplicantが握ってしまわないようにwpa_supplicantは停止させる。
eth0, wlan0にDCHPでアドレスが振られないよう hdcpcd.conf に設定。

/etc/dhcpcd.conf
# bridge
denyinterfaces eth0 wlan0

アクセスポイント設定

hostapd設定

EAP認証は外部の RADIUS server を使わず hostapd の機能を使う (eap_server=1)。
WPA-EAPを有効にし、EAP-TLS/PEAP/TTLSに対応するためCA証明書、サーバ証明書とサーバ秘密鍵を設定。プライベートCAの各証明書の作成は https://server-setting.info/centos/private-ca-cert.html を参考にするとよい。

hostapd.conf
# wlan
interface=wlan0
bridge=br0
ssid=test8021x

# for WPA-EAP
ieee8021x=1
wpa=2
wpa_key_mgmt=WPA-EAP

# for EAP-TLS/PEAP/TTLS
eap_server=1
eap_user_file=/etc/hostapd/hostapd.eap_user
ca_cert=/etc/hostapd/capem.pem
server_cert=/etc/hostapd/server.crt
private_key=/etc/hostapd/server.key
private_key_passwd=server1234


ユーザ認証設定

PEAP認証するユーザ名/パスワードの組、TTLS認証するユーザ名/パスワードの組を設定しておく。

hostapd.eap_user
* TLS,TTLS,PEAP

"user" MSCHAPV2,GTC "password" [2]
"ttls-user" TTLS-PAP,TTLS-CHAP,TTLS-MSCHAP,TTLS-MSCHAPV2 "password" [2]

動作確認

PEAPで認証したときに hostapd から以下のような log が出力される。method=25がPEAP。

wlan0: STA xx:xx:xx:xx:xx:xx IEEE 802.11: authenticated
wlan0: STA xx:xx:xx:xx:xx:xx IEEE 802.11: associated (aid 1)
wlan0: CTRL-EVENT-EAP-STARTED xx:xx:xx:xx:xx:xx
wlan0: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=1
wlan0: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=13
wlan0: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=25
wlan0: CTRL-EVENT-EAP-SUCCESS xx:xx:xx:xx:xx:xx
wlan0: STA xx:xx:xx:xx:xx:xx WPA: pairwise key handshake completed (RSN)
wlan0: AP-STA-CONNECTED xx:xx:xx:xx:xx:xx
wlan0: STA xx:xx:xx:xx:xx:xx RADIUS: starting accounting session 1D1D8F4EAC6C9405
wlan0: STA xx:xx:xx:xx:xx:xx IEEE 802.1X: authenticated - EAP type: 0 (unknown)
3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4