FreeRADIUSでWPAの認証を行う方法 EAP-PEAP (Microsoft PEAP)

Last update: 2004/01/25

使用機器

アクセスポイント: Sony PCWA-A320 (ファームウエア ver 1.7.2)
PCカード: Sony PCWA-C800S
サプリカント: Windows XP Wireless Protected Access サポート修正プログラム (Q815485)
FreeRADIUS : FreeRADIUS snap 20040121+ OpenSSL 0.9.7c + OpenLDAP 2.2.4

証明書のインストール

FreeRADIUSのサーバ側で使用する秘密鍵と、証明書、CAの証明書、DSAパラメータファイルが必要です。

OpenSSLのCAを使って証明書を作成します。基本的にapacheやopenldap等で使用するサーバ証明書と同じです。FreeRADIUSを動かすサーバで、すでにapacheやopenldap等でサーバ証明書を作成してある場合は、それを使うことが出来ます。

秘密鍵の生成と、証明書発行要求の作成
  % openssl req -new -newkey rsa:2048 -keyout rad-privkey.pem -out rad-req.pem

証明書発行要求の処理
  # openssl ca -out rad-cert.pem -infiles rad-req.pem

秘密鍵のパスワードの解除
  # openssl rsa -in rad-privkey.pem -out rad-priv.pem

DSAパラメータファイルの作成
  # openssl dsaparam -out dh2048.pem 2048

CAの証明書 (OpenSSLでCAを設定した時に出来る)
WindowsXPに読み込ませる為に、DER形式の証明書を作成。
  % openssl x509 -in cacert.pem -out cacert.der -outform DER

作成したファイル
  rad-priv.pem    : パスワードなしの秘密鍵ファイル
  rad-cert.pem    : サーバ証明書
  dh2048.pem      : DSAパラメータファイル
  cacert.der      : WindowsXPにインストールするCAの証明書(DER形式)

FreeRADIUSの設定

FreeRADIUS 0.9.3ではEAP-PEAPに対応していないので、最新のsnapを使います。

radiusd.conf (の一部)
modules {
	eap {
		default_eap_type = peap
		timer_expire     = 60
		ignore_unknown_eap_types = yes
	
		tls {
			private_key_file = ${confdir}/rad-priv.pem
			certificate_file = ${confdir}/rad-cert.pem
			CA_file = ${confdir}/cacert.pem
			dh_file = ${confdir}/dh2048.pem
			random_file = /dev/urandom
		}

		peap {
			default_eap_type = mschapv2
		}

		mschapv2 {
		}
	}

	mschap {
		authtype = MS-CHAP
		use_mppe = yes
		require_encryption = yes (noでいいかも?)
		require_strong = yes
	}
}

authorize {
	files
	ldap
}

authentication {
	eap
}

WindowsXPの設定

1.CAの証明書のインストール

1-1. 作成したDER形式のCAの証明書ファイル(cacert.der)をWindowsXPに転送し、ダブルクリックしてルートストアにインストールします。

1-2. 証明書。「証明書のインストール」ボタンをクリック。

1-3. 証明書インポートウィザード。「次へ」をクリック。

1-4.「証明書の種類に基づいて、自動的に証明書ストアを選択する」を選んで「次へ」をクリック。

1-5.証明書インポートウィザードの完了。「完了」をクリック。

1-6.ルート証明書ストア。「はい」をクリック。

1-7.正しくインポートされました。「OK」をクリック。

2.ワイヤレスネットワーク接続の設定

コントロールパネルのネットワーク接続にある、ワイヤレスネットワークのアダプタのプロパティを表示して、 「ワイヤレスネットワーク」のタブをクリック。

2-1.利用できるネットワークにSSIDが表示されていたら、そのSSIDを選択して「構成」をクリック。表示されていない場合は「追加」をクリック。

2-2.ワイヤレスネットワークの「アソシエーション」プロパティ。SSIDを入力。「ネットワーク認証」は「WPA」。データの暗号化はアクセスポイントの設定と同じ。「AES」か「TKIP」。

2-3.「認証」タブをクリック。「EAPの種類」の「保護されたEAP (PEAP)」を選択して、「プロパティ」をクリック。

2-4.保護されたEAPのプロパティ。 「サーバーの証明書を有効化する」をチェックし、「信頼されたルート証明機関」から、 インストールしたCAの証明書を選択してチェックを入れる。

「認証方法を選択する」の「セキュリティで保護されたパスワード (EAP-MSCHAP v2)」を選択して、「構成」をクリック。

2-5.EAP MSCHAPv2のプロパティ。「Windowsのログオン名と・・・・」はチェックをはずしておく。「OK」をクリック。

2-6.設定完了。開いたウインドウの「OK」をクリックして、ウインドウを閉じる。

3.接続

3-1.設定が正しければ、数秒〜数十秒でWPAでの認証のバルーンメッセージが表示されます。

バルーンメッセージが消えないうちにクリック。

3-2.資格情報の入力。ユーザ名とパスワードを入力。ログオンドメインは空のまま。

3-3.接続完了。特に何もメッセージは出てきません。通信できればOK。

4.番外

手順2-4で、インストールしたCAのルート証明書を選択しなかった場合、次のようなバルーンメッセージが表示されます。

バルーンメッセージをクリックすると、CAのルート証明書を有効にするかどうか聞いてきます。「OK」をクリックすると、自動的に手順2-4のCAの証明書の選択が行われます。

FreeRADIUS側でのデバッグメッセージ

radiusdを「-X」オプション付きで起動すると、デバッグメッセージが表示されます。 うまくつながらない場合は、メッセージを見ると、設定の間違い等がわかります。

WPAで認証した時のメッセージ (長いので一部のみ)
# /usr/local/sbin/radiusd -X

(省略)

Ready to process requests.
rad_recv: Access-Request packet from host 192.168.0.3:65341, id=0, length=188
        Message-Authenticator = 0x00000000000000000000000000000000
        Service-Type = Framed-User
        User-Name = "waga"
        Framed-MTU = 1488
        Called-Station-Id = "XX-XX-XX-XX-XX-XX:wagahome"
        Calling-Station-Id = "XX-XX-XX-XX-XX-XX"
        NAS-Identifier = "PCWA-A320 xxxxxx"
        NAS-Port-Type = Wireless-802.11
        Connect-Info = "CONNECT 54Mbps 802.11g"
        EAP-Message = 0x020000090177616761
        NAS-IP-Address = 192.168.0.3
        NAS-Port = 1
        NAS-Port-Id = "STA port # 1"

(省略)

rlm_ldap: - authorize
rlm_ldap: performing user authorization for waga
radius_xlat:  '(uid=waga)'
radius_xlat:  'ou=Users,dc=waga,dc=homeip,dc=net'
ldap_get_conn: Got Id: 0
rlm_ldap: attempting LDAP reconnection
rlm_ldap: (re)connect to localhost:389, authentication 0
rlm_ldap: bind as cn=Manager,dc=waga,dc=homeip,dc=net/xxxxxxxxxx to localhost:389
rlm_ldap: waiting for bind result ...
rlm_ldap: Bind was successful
rlm_ldap: performing search in ou=Users,dc=waga,dc=homeip,dc=net, with filter (uid=waga)
rlm_ldap: Added password {crypt}xxxxxxxxxxxx in check items
rlm_ldap: looking for check items in directory...
rlm_ldap: Adding sambaNTPassword as NT-Password, value xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx & op=21
rlm_ldap: Adding sambaLMPassword as LM-Password, value xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx & op=21
rlm_ldap: looking for reply items in directory...
rlm_ldap: user waga authorized to use remote access
ldap_release_conn: Release Id: 0
  modcall[authorize]: module "ldap" returns ok for request 0
modcall: group authorize returns ok for request 0
  rad_check_password:  Found Auth-Type EAP
auth: type "EAP"
modcall: entering group authenticate for request 0
  rlm_eap: EAP Identity
  rlm_eap: processing type tls
  rlm_eap_tls: Initiate
  rlm_eap_tls: Start returned 1
  modcall[authenticate]: module "eap" returns handled for request 0
modcall: group authenticate returns handled for request 0
Sending Access-Challenge of id 0 to 192.168.0.3:65341
        Framed-IP-Address = 255.255.255.254
        Framed-MTU = 576
        Service-Type = Framed-User
        EAP-Message = 0x010100061920
        Message-Authenticator = 0x00000000000000000000000000000000
        State = 0x21c67c2972c2174c9ea6dfd2b11e195b
Finished request 0
Going to the next request
--- Walking the entire request list ---

(省略)

auth: type "EAP"
modcall: entering group authenticate for request 1
  rlm_eap: Request found, released from the list
  rlm_eap: EAP/peap
  rlm_eap: processing type peap
  rlm_eap_peap: Authenticate
  rlm_eap_tls: processing TLS
rlm_eap_tls:  Length Included
  eaptls_verify returned 11
undefined: before/accept initialization
TLS_accept: before/accept initialization
  rlm_eap_tls: <<< TLS 1.0 Handshake [length 0041], ClientHello
TLS_accept: SSLv3 read client hello A
  rlm_eap_tls: >>> TLS 1.0 Handshake [length 004a], ServerHello
TLS_accept: SSLv3 write server hello A
  rlm_eap_tls: >>> TLS 1.0 Handshake [length 0867], Certificate
TLS_accept: SSLv3 write certificate A
  rlm_eap_tls: >>> TLS 1.0 Handshake [length 0004], ServerHelloDone
TLS_accept: SSLv3 write server done A
TLS_accept: SSLv3 flush data
TLS_accept:error in SSLv3 read client certificate A
In SSL Handshake Phase
In SSL Accept mode
  eaptls_process returned 13
  rlm_eap_peap: EAPTLS_HANDLED
  modcall[authenticate]: module "eap" returns handled for request 1
modcall: group authenticate returns handled for request 1
Sending Access-Challenge of id 1 to 192.168.0.3:65341
        Framed-IP-Address = 255.255.255.254
        Framed-MTU = 576
        Service-Type = Framed-User
        EAP-Message = 0x0102040a19c0000008c416030 (省略)
        EAP-Message = 0x303631313136323135385a170 (省略)
        EAP-Message = 0xd62bef144dc36756b60d3336c (省略)
        EAP-Message = 0x2106092a864886f70d0109011 (省略)
        EAP-Message = 0xc11b7e1a2aab98603e31f6cb3 (省略)
        Message-Authenticator = 0x00000000000000000000000000000000
        State = 0x9f6f03f23950345fc7189cc0d7a3be62
Finished request 1
Going to the next request
--- Walking the entire request list ---

(省略)

modcall: entering group authenticate for request 9
  rlm_eap: Request found, released from the list
  rlm_eap: EAP/peap
  rlm_eap: processing type peap
  rlm_eap_peap: Authenticate
  rlm_eap_tls: processing TLS
  eaptls_verify returned 7
  rlm_eap_tls: Done initial handshake
  eaptls_process returned 7
  rlm_eap_peap: EAPTLS_OK
  rlm_eap_peap: Session established.  Proceeding to decode tunneled attributes.

  rlm_eap_peap: Received EAP-TLV response.
  rlm_eap_peap: Tunneled data is valid.
  rlm_eap_peap: Success
  rlm_eap: Freeing handler
  modcall[authenticate]: module "eap" returns ok for request 9
modcall: group authenticate returns ok for request 9
Sending Access-Accept of id 9 to 192.168.0.3:65341
        Framed-IP-Address = 255.255.255.254
        Framed-MTU = 576
        Service-Type = Framed-User
        MS-MPPE-Recv-Key = 0xad74509 (省略)
        MS-MPPE-Send-Key = 0xd49e323 (省略)
        EAP-Message = 0x03090004
        Message-Authenticator = 0x00000000000000000000000000000000
        User-Name = "waga"
Finished request 9
Going to the next request
Waking up in 5 seconds...