キビタキ(戸隠森林公園)


Date/Time: 2014:05:18 09:04:13
Camera: PENTAX
Model: PENTAX K-5 II s
Exporsure Time: 1/400
FNumber: 0.0
Aperture Value: 0.0
Focal Length: 0.0

Close

y2blog » LeopardサーバのRADIUS #7 : WindowsXP標準サプリカントへの対応

12

15

2007

LeopardサーバのRADIUS #7 : WindowsXP標準サプリカントへの対応

Windows XP のサプリカント


前回の記事で、Windows XP 用のサプリカントとして、BUFFALO (メルコ)の”クライアントマネージャー3”を用いた例を紹介しましたが、Windows XP のデフォルトのサプリカントでは何故か上手く接続することができませんでした.この問題を解決するため、設定を変更したりパケットキャプチャーをしたり色々と調べてみたところ、おおよその原因と解決方法が判りました.そこで今回の記事では、Windows XPの標準的な無線LAN接続ソフトウェア(サプリカント)で Free RADIUSの802.1X認証に対応させる方法を紹介します.


エラーの原因を探る


まず、何故Windows XP の標準的なサプリカント機能では上手く認証できないのか探ってみました.サードパーティー製では問題が生じないということは、Microsoftが特別な事をやっているかあるいはきちんとEAPを実装していないという事が考えられます.このような事はMicrosoftの常套手段なので、とりあえずRADIUSサーバのログとパケットキャプチャ(Wireshark)ツールを使って、EAP認証の様子を探ってみました.


OS X Server の標準的なログ出力は殆ど役に立たないので、RADIUSサーバを手動で立ち上げ、デバッグ用の詳細ログモードにします.

#/usr/sbin/radiusd -X   (オプションのXは大文字)
RADIUSサーバのセッションが事細かに表示されますので、上手くつながらない際の原因究明にはとても役に立ちます.


EAP-PEAP で接続しようとしたときのログを示します.実際のログは膨大な量なので、エラーが起きている部分だけを抜き出しました.セッションの流れを追っていくと、どうやら RADIUSサーバとの間で認証を行う際に、認証データをやりとりする通信路をTLSによって暗号化するのですが、その部分でネゴシエーションが上手く行かないようです.

rlm_eap_tls: <<< TLS 1.0 Alert [length 0002], fatal access_denied
このため、RADIUSサーバが認証エラーとなってサプリカント側がまた最初からEAP 認証を繰り返すようです.


rad_recv: Access-Request packet from host 192.168.100.241:1030, id=27, length=224
	Framed-MTU = 1466
	NAS-IP-Address = 192.168.100.241
	NAS-Identifier = "AirPort Extream"
	User-Name = "yoko"
	Service-Type = Framed-User
	NAS-Port = 256
	NAS-Port-Type = Ethernet
	NAS-Port-Id = "wl0"
	Called-Station-Id = "00-03-93-ec-eb-ee"
	Calling-Station-Id = "00-07-40-91-de-22"
	Connect-Info = "CONNECT Ethernet 54Mbps Half duplex"
	State = 0x0d2fe4f63cdea4bbaa54a7f875906c8a
	EAP-Message = 0x0207002119800000001715030100129d038296ad1ff5796f8696a9df28c26e865c
	Message-Authenticator = 0x7cd68fcd54d00101cc8b616bd2ab2e94
  Processing the authorize section of radiusd.conf
modcall: entering group authorize for request 5
  modcall[authorize]: module "preprocess" returns ok for request 5
  modcall[authorize]: module "chap" returns noop for request 5
  modcall[authorize]: module "mschap" returns noop for request 5
    rlm_realm: No '@' in User-Name = "yoko", looking up realm NULL
    rlm_realm: No such realm "NULL"
  modcall[authorize]: module "suffix" returns noop for request 5
  rlm_eap: EAP packet type response id 7 length 33
  rlm_eap: No EAP Start, assuming it's an on-going EAP conversation
  modcall[authorize]: module "eap" returns updated for request 5
    users: Matched entry DEFAULT at line 153
    users: Matched entry DEFAULT at line 172
  modcall[authorize]: module "files" returns ok for request 5
rlm_opendirectory: The SACL group "com.apple.access_radius" does not exist on this system.
rlm_opendirectory: The host 192.168.100.241 does not have an access group.
rlm_opendirectory: no access control groups, all users allowed.
  modcall[authorize]: module "opendirectory" returns ok for request 5
modcall: leaving group authorize (returns updated) for request 5
  rad_check_password:  Found Auth-Type EAP
auth: type "EAP"
  Processing the authenticate section of radiusd.conf
modcall: entering group authenticate for request 5
  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
  eaptls_process returned 7
  rlm_eap_peap: EAPTLS_OK
  rlm_eap_peap: Session established.  Decoding tunneled attributes.
  rlm_eap_tls: <<< TLS 1.0 Alert [length 0002], fatal access_denied
TLS Alert read:fatal:access denied
rlm_eap_peap: No data inside of the tunnel.
 rlm_eap: Handler failed in EAP/peap
  rlm_eap: Failed in EAP select
  modcall[authenticate]: module "eap" returns invalid for request 5
modcall: leaving group authenticate (returns invalid) for request 5
auth: Failed to validate the user.
Login incorrect: [yoko/] (from client AirPort Extream Base Station port 256 cli 00-07-40-91-de-22)
Delaying request 5 for 1 seconds
Finished request 5
Going to the next request
Waking up in 6 seconds...
rad_recv: Access-Request packet from host 192.168.100.241:1030, id=27, length=224
Sending Access-Reject of id 27 to 192.168.100.241 port 1030
	EAP-Message = 0x04070004
	Message-Authenticator = 0x00000000000000000000000000000000
--- Walking the entire request list ---
Waking up in 5 seconds...


RADIUSサーバのログだけでは全体的なセッションの流れを追いにくいため、クライアント側の通信の様子をパケットキャプチャしてみました.この手のパケットキャプチャソフトツールとしてはフリーソフトの “Wireshark” がお薦めです.
セッション #16 で クライアント(Windows XP)側からRADIUSサーバへ “Encrypted Alert” というエラーメッセージを送っています.恐らくWindows側でEAP認証手続きを却下しているのでしょう.


EAP-PEAPだけではなくて、EAP-TLSの場合にも同じようなエラーで EAPセッションが打ち切られています.どうやらWindows XP のサプリカント側に問題がありそうです.


Wireshark Screen Shot


原因発見


Windows XPのサプリカントでEAPセッションが打ち切られてしまう原因を色々と調べて見たのですが、なかなか上手く行きません.無線LANのアクセスポイント固有の問題かと思いましたが、Apple以外のアクセスポイントの持ち合わせがありませんので、他のメーカーのアクセスポイントで試すわけにも行きません.だいいち家庭などの一般用として出まわっているアクセスポイントで802.1X認証に対応している物は数えるほどしかありません.そのような訳で解決策を見いだせないでいたところ、実に簡単な所に答えが転がっていました.


何と、Free RADIUSの設定ファイル “eap.conf” の中に、Windows XP に関する注意書きが書かれていたのです.設定ファイルにはきちんと隅々まで目を通して置くべきでした....反省


                ##################################################
                #
                #  !!!!! WARNINGS for Windows compatibility  !!!!!
                #
                ##################################################
                #
                #  If you see the server send an Access-Challenge,
                #  and the client never sends another Access-Request,
                #  then
                #
                #               STOP!
                #
                #  The server certificate has to have special OID's
                #  in it, or else the Microsoft clients will silently
                #  fail.  See the "scripts/xpextensions" file for
                #  details, and the following page:
                #
                #       http://support.microsoft.com/kb/814394/en-us
                #
                #  For additional Windows XP SP2 issues, see:
                #
                #       http://support.microsoft.com/kb/885453/en-us
                #
                #  Note that we do not necessarily agree with their
                #  explanation... but the fix does appear to work.
                #
                ##################################################


上記の MS のサイト (http://support.microsoft.com/kb/814394/en-us) “Certificate requirements when you use EAP-TLS or PEAP with EAP-TLS” を見たところ、どうやらWindows XP ではTLSとPEAPで必要となる証明書に特別な extension が含まれている必要があり、これがないとWindows XP は正常に認証を行わないようです.

この辺の事はFree RADIUSのFAQにも書かれていました.Free RADIUS の スクリプトディレクトリにこの特別な extension の定義ファイル “scripts/xpextensions” が用意されています.但し、Leopardサーバには含まれていませんので、Free RADIUS からオリジナルソースをダウンロードしてくる必要があります.


Windows XP用の特別な extension を証明書に組み込む方法


サーバの署名要求 (CSR) とクライアントの署名要求を作成する所までは今までと同じです.異なるのはCAによる署名手続きです.サーバの場合とクライアントの場合で組み込む extension が異なります.extensionの定義ファイル “xpextension” の内容は次のようになっています.



#
#  For use with the 'CA.all' script.
#
[ xpclient_ext]
extendedKeyUsage = 1.3.6.1.5.5.7.3.2

[ xpserver_ext]
extendedKeyUsage = 1.3.6.1.5.5.7.3.1


サーバ用のコマンド例 (画面の都合で2行にしてありますが、実際は1行です)


#openssl ca -policy policy_anything -out newcert.pem -extensions xpserver_ext -extfile xpextensions -infiles newreq.pem


クライアント用のコマンド例


#openssl ca -policy policy_anything -out newcert.pem -extensions xpclient_ext -extfile xpextensions -infiles newreq.pem


opensslコマンドを直接入力せずに、スクリプトファイル(CA.pl or CA.sh)を使っている場合には、スクリプトファイルそのものに手を加えた方が簡単です. CA.pl スクリプトの場合の例を載せておきます. サーバー用の署名をするには #./CA.pl -sign-server-xp のように指定します.



#========================================================================================
        } elsif (/^(-sign-server-xp)$/) {
            system ("$CA -policy policy_anything -out newcert.pem " .
                        "-extensions xpserver_ext -extfile xpextensions " .
                                                        "-infiles newreq.pem");
            $RET=$?;
            print "Signed certificate is in newcert.pem [ with Windows XP extension : server ]\n";

        } elsif (/^(-sign-client-xp)$/) {
            system ("$CA -policy policy_anything -out newcert.pem " .
                        "-extensions xpclient_ext -extfile xpextensions " .
                                                        "-infiles newreq.pem");
            $RET=$?;
            print "Signed certificate is in newcert.pem [ with Windows XP extension : client ]\n";
#=======================================================================================


このようにサーバ証明書とクライアント証明書(EAP-TLSの場合)に特別な extension を加えることで、Windows XP のサプリカントでもFree RADIUS の802.1X認証に対応可能となります.

Calendar

March 2024
S M T W T F S
 12
3456789
10111213141516
17181920212223
24252627282930
31  
  • Blogroll

  • Meta