鳥海山 千蛇谷
Date/Time: 2013:06:24 09:37:27
Camera: RICOH
Model: GR DIGITAL 4
Exporsure Time: 1/2000 [s]
FNumber: 8.0
Aperture Value: 6.0
Focal Length: 6.0 [mm]

y2blog » ArubaのAPを用いて認証VLANを実装してみる#4(EAP-PEAPによる認証)

8

11

2025

ArubaのAPを用いて認証VLANを実装してみる#4(EAP-PEAPによる認証)

FreeRADIUSの各種設定


自己認証局によるサーバ証明書の発行ができたところで、RADIUSサーバにEAP-PEAP(MSCHAPV2)認証を行うための設定を加えて行くことにする.Free RADIUS関連の設定ファイルは “/etc/raddb/” 配下に置かれているが、各種設定ファイルの階層構造が解りにくいので、”/etc/raddb/”配下のディレクトリ、ファイル構成の一覧を載せておくことにする.




[root@nsauth6 raddb]# pwd
/etc/raddb
[root@nsauth6 raddb]# tree
.
├── README.rst
├── certs
│   ├── 01.pem
│   ├── 02.pem
│   ├── Makefile
│   ├── README
│   ├── bootstrap
│   ├── ca.cnf
│   ├── ca.key
│   ├── ca.pem
│   ├── client.cnf
│   ├── client.crt
│   ├── client.csr
│   ├── client.key
│   ├── client.p12
│   ├── client.pem
│   ├── index.txt
│   ├── index.txt.attr
│   ├── inner-server.cnf
│   ├── passwords.mk
│   ├── serial
│   ├── serial.old
│   ├── server.cnf
│   ├── server.crt
│   ├── server.csr
│   ├── server.key
│   ├── server.p12
│   ├── server.pem
│   ├── xpextensions
│   └── nanashi@y2tech.net.pem
├── clients.conf
├── dictionary
├── hints -> ./mods-config/preprocess/hints
├── huntgroups -> ./mods-config/preprocess/huntgroups
├── mods-available
│   ├── README.rst
│   ├── always
│   ├── attr_filter
│   ├── cache
│   ├── cache_eap
│   ├── chap
│   ├── counter
│   ├── cui
│   ├── date
│   ├── detail
│   ├── detail.example.com
│   ├── detail.log
│   ├── dhcp
│   ├── dhcp_sqlippool
│   ├── digest
│   ├── dynamic_clients
│   ├── eap
│   ├── echo
│   ├── etc_group
│   ├── exec
│   ├── expiration
│   ├── expr
│   ├── files
│   ├── idn
│   ├── inner-eap
│   ├── ippool
│   ├── krb5
│   ├── ldap
│   ├── linelog
│   ├── logintime
│   ├── mac2ip
│   ├── mac2vlan
│   ├── mschap
│   ├── ntlm_auth
│   ├── opendirectory
│   ├── otp
│   ├── pam
│   ├── pap
│   ├── passwd
│   ├── preprocess
│   ├── python
│   ├── python3
│   ├── radutmp
│   ├── realm
│   ├── redis
│   ├── rediswho
│   ├── replicate
│   ├── smbpasswd
│   ├── smsotp
│   ├── soh
│   ├── sometimes
│   ├── sql
│   ├── sqlcounter
│   ├── sqlippool
│   ├── sradutmp
│   ├── unix
│   ├── unpack
│   ├── utf8
│   ├── wimax
│   └── yubikey
├── mods-config
│   ├── README.rst
│   ├── attr_filter
│   │   ├── access_challenge
│   │   ├── access_reject
│   │   ├── accounting_response
│   │   ├── post-proxy
│   │   └── pre-proxy
│   ├── files
│   │   ├── accounting
│   │   ├── authorize
│   │   └── pre-proxy
│   ├── preprocess
│   │   ├── hints
│   │   └── huntgroups
│   └── sql
│       ├── counter
│       ├── cui
│       ├── ippool
│       ├── ippool-dhcp
│       └── main
├── mods-enabled
│   ├── always -> ../mods-available/always
│   ├── attr_filter -> ../mods-available/attr_filter
│   ├── cache_eap -> ../mods-available/cache_eap
│   ├── chap -> ../mods-available/chap
│   ├── date -> ../mods-available/date
│   ├── detail -> ../mods-available/detail
│   ├── detail.log -> ../mods-available/detail.log
│   ├── digest -> ../mods-available/digest
│   ├── dynamic_clients -> ../mods-available/dynamic_clients
│   ├── eap -> ../mods-available/eap
│   ├── echo -> ../mods-available/echo
│   ├── exec -> ../mods-available/exec
│   ├── expiration -> ../mods-available/expiration
│   ├── expr -> ../mods-available/expr
│   ├── files -> ../mods-available/files
│   ├── linelog -> ../mods-available/linelog
│   ├── logintime -> ../mods-available/logintime
│   ├── mschap -> ../mods-available/mschap
│   ├── ntlm_auth -> ../mods-available/ntlm_auth
│   ├── pap -> ../mods-available/pap
│   ├── passwd -> ../mods-available/passwd
│   ├── preprocess -> ../mods-available/preprocess
│   ├── radutmp -> ../mods-available/radutmp
│   ├── realm -> ../mods-available/realm
│   ├── replicate -> ../mods-available/replicate
│   ├── soh -> ../mods-available/soh
│   ├── sradutmp -> ../mods-available/sradutmp
│   ├── unix -> ../mods-available/unix
│   ├── unpack -> ../mods-available/unpack
│   └── utf8 -> ../mods-available/utf8
├── panic.gdb
├── policy.d
│   ├── accounting
│   ├── canonicalization
│   ├── control
│   ├── cui
│   ├── debug
│   ├── dhcp
│   ├── eap
│   ├── filter
│   ├── operator-name
│   └── rfc7542
├── proxy.conf
├── radiusd.conf
├── sites-available
│   ├── README
│   ├── buffered-sql
│   ├── challenge
│   ├── channel_bindings
│   ├── check-eap-tls
│   ├── coa
│   ├── coa-relay
│   ├── control-socket
│   ├── copy-acct-to-home-server
│   ├── decoupled-accounting
│   ├── default
│   ├── default.org
│   ├── dhcp
│   ├── dhcp.relay
│   ├── dynamic-clients
│   ├── example
│   ├── inner-tunnel
│   ├── originate-coa
│   ├── proxy-inner-tunnel
│   ├── robust-proxy-accounting
│   ├── soh
│   ├── status
│   ├── tls
│   ├── virtual.example.com
│   └── vmps
├── sites-enabled
│   ├── default -> ../sites-available/default
│   └── inner-tunnel -> ../sites-available/inner-tunnel
├── templates.conf
├── trigger.conf
└── users -> ./mods-config/files/authorize



FreeRADIUSサーバの構成ファイルの構造は複雑なのだが、とりあえず今回の用途で必要となる設定について概要を示す.先ずはベースとなる”/etc/raddb” ディレクトリにあるファイルを設定していく.




drwxr-xr-x.   9 root radiusd  4096 Aug 10 18:18 .
drwxr-xr-x. 113 root root     8192 Aug 10 08:26 ..
-rw-r-----    1 root radiusd 20807 Aug  7 21:00 README.rst
drwxrwx---.   2 root radiusd  4096 Aug 10 08:23 certs
-rw-r-----    1 root radiusd 10413 May  6 19:00 clients.conf
-rw-r--r--.   1 root radiusd  1440 Aug  7 21:00 dictionary
lrwxrwxrwx.   1 root radiusd    30 Aug  7 21:00 hints -> ./mods-config/preprocess/hints
lrwxrwxrwx.   1 root radiusd    35 Aug  7 21:00 huntgroups -> ./mods-config/preprocess/huntgroups
drwxr-x---.   2 root radiusd  4096 Aug 10 08:23 mods-available
drwxr-x---.   6 root radiusd    85 Aug 10 08:23 mods-config
drwxr-x---.   2 root radiusd  4096 Aug  7 21:00 mods-enabled
-rw-r-----.   1 root radiusd    52 Aug  7 21:00 panic.gdb
drwxr-x---.   2 root radiusd   160 Aug  7 21:00 policy.d
-rw-r-----.   1 root radiusd 29869 Aug  7 21:00 proxy.conf
-rw-r-----    1 root radiusd 40712 Aug  7 21:00 radiusd.conf
drwxr-x---.   2 root radiusd  4096 Aug 10 08:23 sites-available
drwxr-x---.   2 root radiusd    41 Aug  7 21:00 sites-enabled
-rw-r-----.   1 root radiusd  3470 Aug  7 21:00 templates.conf
-rw-r-----.   1 root radiusd  8536 Aug  7 21:00 trigger.conf
lrwxrwxrwx.   1 root radiusd    29 Aug  7 21:00 users -> ./mods-config/files/authorize


“clients.conf”ファイル


“clients.conf”ファイルはRADIUSサーバへアクセスを許可するクライアント(RADIUS認証を受ける各種NW機器など)を定義している.RADIUSクライアントとRADIUSサーバはこのファイルに定義されたクライアントの名前(IPアドレス)と共有鍵情報を用いてお互いが許可されたクライアントとサーバであることを確認する.


初期状態の”clients.conf”ファイルにはコメントと共に色々と設定内容の解説が記載されているが、localhost の設定(最初の動作確認テストで使う程度で、テスト終了後は無効化しておいた方が無難)と、実際に接続するRADIUSクライアントの情報を記載することになる.


localhostの定義に記載されている、共有鍵 (secret) は初期状態では誰でも知っている “testing123” となっているので、自分で別なキーワードに変更しておくこと.初期状態のまま放置して置かないように!!!


RADIUSクライアントによっては使えない文字や文字数制限などがある場合もあるので、印字可能な一般的な文字列(英数字、特殊記号など)で、適度な長さのキーワードを指定するのが無難だ.組織などではRADIUSクライアント(WiFiアクセスポイントやネットワーク機器など)を1台1台個別に登録することもできるが、通常はこれらのクライアントを管理しているネットワークセグメント単位で登録するのが一般的だろう.但し、この方式では共有鍵は一つなので、セキュリティー的には脆弱なので、可能な限り1つのクライアント毎に別々な共有鍵を設定するのが望ましい.




client localhost {
    ipaddr = 127.0.0.1
    secret = Hi32N0AkkoChan
    nas_type = other 
}
client localhost_ipv6 {
	ipv6addr	= ::1
	secret		= Hi32N0AkkoChan
}

client myAdminNetwork {
    ipaddr = 192.168.xxx.0/24
    secret = This#is@TopSecre10
    shortname = AdminNW    
}



“radiusd.conf”ファイルの設定


“radiusd.conf”ファイルはRADIUSサーバの全般の設定を行うファイルで、RADIUSサーバ関連の構成ファイルの場所やログの振る舞い、パフォーマンス関連のパラメータなどの設定を行っているが、今回の用途では初期設定のままでも特に問題となることはない.今回は、ログ関連の設定を一部変更している.


テスト期間中はなるべく詳細なログを出力し、通常運用モードに入ったら、認証エラーなどの情報以外はなるべく記録しないなどの配慮が必要だろう.




#
#  Logging section.  The various "log_*" configuration items
#  will eventually be moved here.
#
log {
        #
        #  Destination for log messages.  This can be one of:
        #

 ...

#========================================================================
#       auth = no
        auth = yes 
#       auth_reject = no
        auth_reject = yes
#       auth_badpass = no 
        auth_badpass = yes 
#========================================================================
 
 ...

#       suppress_secrets = no
}



EAP-PEAP関連の設定


ここまでの設定で、基本的なRADIUSプロトコルによるユーザ認証は行えるようになってはいるが、今回のRADIUSサーバ構築の主な目的は無線LANのAPに対して802.1x認証を行って、セキュリティーの強化を謀ることだ.802.1x認証は無線LANのAPだけではなく、一般的なネットワークスイッチでも殆どが802.1x認証に対応しているので、ネットワークのセキュリティー対策として必須の機能だ.


802.1x認証では、EAP(Extensible Authentication Protocol)と呼ばれているプロトコルを使用するが、このEAPには幾つかの代表的な方式がある.今回はEAPの方式として、EAP-PEAP(Protected EAP) という方式を採用することにする.EAP-PEAPを採用するのは、現時点ではこのEAP-PEAP方式がPCやスマートフォンなど幅広いデバイスやネットワーク機器が対応しているので、一番導入し易いEAPプロトコルと言えるだろう.


802.1x認証ではPCやスマートフォンなどのネットワークに接続して認証を受けるデバイス側の接続アプリケーションをサプリカント(Supplicant)、無線LANのAPやネットワークスイッチなどのネットワーク機器をオーセンティケータ(Authenticator)と読んでいる.


     Supplicant <==> Authenticator <==> Authentication Server (RADIUS)

PEAPでは、サーバ側の認証はサーバ証明書を用いて認証を行うが、クライアント側では証明書等による認証を行わない代わりに、ユーザIDとパスワードを用いてユーザ認証を行う簡易的な認証方式だ.EAP-TLS方式のようにクライアント側にもクライアント証明書を配置することなく認証が可能なので、比較的運用コストが低く導入し易い.


EAP-PEAPには幾つかのバリエーションがあり、Microsoftが提唱しているMS-PEAP(MSCHAPV2)やCiscoのCisco-PEAP( EAP-GTC)などの方言(癖)があり、必ずしも互換性が保証されて居るわけでは無いが、とりあえずMS-PEAP(MSCHAPV2)を用いて実装することにする.


EAP-PEAP方式はEAP方式の中では汎用性が高いと言えるが、Windows 11(22H2)、Windows Server 2025 以降では “Credential Guard” という新たなセキュリティーガード機能が導入されるようになり、EAP-PEAPによる認証に問題が生じる可能性がありそうだと言う.(参考:『ネットワーク認証にPEAPを使っているところは今後注意が必要かも?なWindowsのCredential Guardのお話』


EAP-PEAP方式に関連する設定ファイルは、”mods-available”, “mods-enabled” の2つのディレクトリ配下に置かれているが、”mods-available/mschap” と “mods-available/eap” の2つのファイルが設定ファイルの実体だ.”mods-enabled”ディレクトリ配下には、”mods-available”配下のファイルへのシンボリックリンクが置かれているだけだ.


“mods-available/eap” ファイルの設定


EAPに関する設定を行うファイルで、全部で1000行近くあるので設定を変更(追加)する箇所だけを示すことにする.





eap {
	#  Invoke the default supported EAP type when
	#  EAP-Identity response is received.

  ...

	#
#=========================================================================
#	default_eap_type = md5   [ default_eap_type をPEAPへ変更 ]            #line 27
	default_eap_type = PEAP 
#=========================================================================

  ...

	#
	tls-config tls-common {
		private_key_password = whatever
#=====================================================================  
		private_key_file = ${certdir}/server.pem                     #line 185 
#=====================================================================
    ...
#=====================================================================
		certificate_file = ${certdir}/server.pem                     #line 221 
#=====================================================================
    ...
#=====================================================================
		ca_file = ${cadir}/ca.pem                                     #line 234 
#=====================================================================

   ...

	#  The tunneled EAP session needs a default EAP type
	#  which is separate from the one for the non-tunneled
	#  EAP module.  Inside of the TLS/PEAP tunnel, we
	#  recommend using EAP-MS-CHAPv2.
	#
	peap {
		#  Which tls-config section the TLS negotiation parameters
		#  are in - see EAP-TLS above for an explanation.
		#

    ...
		#  This will cache attributes for the final Access-Accept.
		#
#==============================================================================		
#		use_tunneled_reply = no                                             #line 844
		use_tunneled_reply = yes        <===  認証VLANに対応させるための設定
#==============================================================================		

   ...



"mods-available/eap" ファイルでは、default_eap_typeをPEAPへ変更している.今回はデフォルトと同じ名前で証明書やプライベートキーファイルを配置しているので、証明書関連ファイルの設定は特に変更の必要はない.


844行目にある、"use_tunneled_reply" はデフォルトの "no" から "yes" に変更している."use_tunneled_reply"を"yes"に変更することで、認証VLANに対応可能となるように設定している.


"mods-available/mschap" ファイルでは、MSCHAPに関する設定を行う.次の3箇所を



#
#  Microsoft CHAP authentication
#
#  This module supports MS-CHAP and MS-CHAPv2 authentication.
#  It also enforces the SMB-Account-Ctrl attribute.
#
mschap {
        #
        #  If you are using /etc/smbpasswd, see the 'passwd'
        #  module for an example of how to use /etc/smbpasswd
        #

  ...

#================================================================
#       use_mppe = no        [  use_mppe = yes へ変更 ]             #line  22
        use_mppe = yes
#================================================================

  ...
        #
        #  If MPPE is enabled, require_encryption makes
        #  encryption moderate
        #
#================================================================
#       require_encryption = yes   [ require_encryption を有効化 ]    #line 28
        require_encryption = yes
#================================================================

        #
        #  require_strong always requires 128 bit key
        #  encryption
        #
#================================================================
#       require_strong = yes     [ require_strong を有効化 ]        #line 34
        require_strong = yes
#================================================================

  ...




RADIUSサーバの動作確認テスト


"radiusd.conf" と "clients.conf" 並びにEPA-PEAP関連の設定ファイルの記載が済んだところで、RADIUSサーバの基本的な動作テストを行っておくことにする.


先ずは、RADIUSサーバをターミナルコンソール上でコマンドラインからデバッグモードで起動させる.RADIUSサーバが無事起動すると、"-X"オプションの場合、800行近いデバッグメッセージが表示され、"Ready to process requests" というメッセージとともに、RADIUSリクエストを受け付ける待ちモードとなる.


デバッグオプションを"-XX" とすると、更に詳細なデバッグメッセージが出力されるので、何かトラブルが生じた際は、この方法でRADIUSサーバのデバッグを行うと良いだろう.





[root@nsauth6 raddb]# which radiusd
/usr/sbin/radiusd

[root@nsauth6 raddb]# /usr/sbin/radiusd -X
FreeRADIUS Version 3.2.7
Copyright (C) 1999-2023 The FreeRADIUS server project and contributors
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE
You may redistribute copies of FreeRADIUS under the terms of the
GNU General Public License
For more information about these matters, see the file named COPYRIGHT
Starting - reading configuration files ...
including dictionary file /usr/share/freeradius/dictionary
including dictionary file /usr/share/freeradius/dictionary.dhcp

 ...

listen {
  	type = "auth"
  	ipaddr = *
  	port = 18120
}
Listening on auth address * port 1812 bound to server default
Listening on acct address * port 1813 bound to server default
Listening on auth address :: port 1812 bound to server default
Listening on acct address :: port 1813 bound to server default
Listening on auth address * port 18120 bound to server inner-tunnel
Listening on proxy address * port 34296
Listening on proxy address :: port 59292
Ready to process requests



この状態で、RADIUSサーバ上でもう一つターミナルコンソールを立ち上げ、radtestコマンドを用いてローカルでのRADIUSサーバ接続テストを行う.radtestコマンドが見つからない場合は "freeradius-utils" パッケージを追加でインストールする必要がある. [ #dnf -y install freeradius-utils ]


radtest で用いるRADIUSアカウントとパスワードは、 "/etc/raddb/users" ファイルで定義したテスト用のローカルアカウントで定義してある.今回は、"radtest007" でテストする.




  ...

radtest007  Cleartext-Password := "Hi32da4"
	    Reply-Message := "Welcome, %{User-Name}"  

#=========================================================================#
#   Test user account for authenticated VLAN  
vl100user  Auth-Type:=EAP, Cleartext-Password := "ImVL100"
	Tunnel-Type = 13,
	Tunnel-Medium-Type = 6,
	Tunnel-Private-Group-Id = 100

vl200user Auth-Type:=EAP, Cleartext-Password := "ImVL200"
        Tunnel-Type = 13,
        Tunnel-Medium-Type =6,
        Tunnel-Private-Group-Id = 200
#=========================================================================#






[root@nsauth6 raddb]# radtest  radtest007 Hi32da4  localhost  0 testing123
Sent Access-Request Id 32 from 0.0.0.0:48955 to 127.0.0.1:1812 length 80
	User-Name = "radtest007"
	User-Password = "Hi32da4"
	NAS-IP-Address = 172.25.100.6
	NAS-Port = 0
	Message-Authenticator = 0x00
	Cleartext-Password = "Hi32da4"
Received Access-Accept Id 32 from 127.0.0.1:1812 to 127.0.0.1:48955 length 59
	Message-Authenticator = 0x64a0a5758eb3db98f7e3cbd8b43bccad
	Reply-Message = "Welcome, radtest007"
[root@nsauth6 raddb]# 

[root@nsauth6 raddb]# radtest  radtest007 badpass  localhost  0 testing123
Sent Access-Request Id 117 from 0.0.0.0:38494 to 127.0.0.1:1812 length 80
	User-Name = "radtest007"
	User-Password = "badpass"
	NAS-IP-Address = 172.25.100.6
	NAS-Port = 0
	Message-Authenticator = 0x00
	Cleartext-Password = "badpass"
Received Access-Reject Id 117 from 127.0.0.1:1812 to 127.0.0.1:38494 length 59
	Message-Authenticator = 0x437c3a4b16bf6eedb0505c037f3fb99e
	Reply-Message = "Welcome, radtest007"
(0) -: Expected Access-Accept got Access-Reject
[root@nsauth6 raddb]# 



radtestコマンドのパラメータは、 radtest の順で指定するが、で指定する値は、0 〜 2^31 の間の適当(ランダム)な整数値を指定する必要があるが、この接続テストではとりあえず "0" を指定している.


最初のradtestでは、無事認証が通り、"Received Access-Accept" となっているが、2回目のradtestでは間違ったパスワードを指定しているため、"Received Access-Reject" となり、認証に失敗している.


一方、RADIUSサーバ側のデバッグメッセージでは、RADIUS認証に関するかなり詳細なログが出力されているので、RADIUS認証が上手くいかない原因などを探る有力な手がかりとして活用できるだろう.




(0) Received Access-Request Id 238 from 127.0.0.1:58457 to 127.0.0.1:1812 length 80
(0)   Message-Authenticator = 0xec87379046735b3e793cd74e9d68746f
(0)   User-Name = "radtest007"
(0)   User-Password = "Hi32da4"
(0)   NAS-IP-Address = 172.25.100.6
(0)   NAS-Port = 0
(0) # Executing section authorize from file /etc/raddb/sites-enabled/default
(0)   authorize {
(0)     policy filter_username {
(0)       if (&User-Name) {
(0)       if (&User-Name)  -> TRUE
(0)       if (&User-Name)  {

 ...

(0) Found Auth-Type = PAP
(0) # Executing group from file /etc/raddb/sites-enabled/default
(0)   Auth-Type PAP {
(0) pap: Login attempt with password
(0) pap: Comparing with "known good" Cleartext-Password
(0) pap: User authenticated successfully
(0)     [pap] = ok
(0)   } # Auth-Type PAP = ok
(0) # Executing section post-auth from file /etc/raddb/sites-enabled/default
(0)   post-auth {
(0)     if (session-state:User-Name && reply:User-Name && request:User-Name && (reply:User-Name == request:User-Name)) {
(0)     if (session-state:User-Name && reply:User-Name && request:User-Name && (reply:User-Name == request:User-Name))  -> FALSE
(0)     update {
(0)       No attributes updated for RHS &session-state:
(0)     } # update = noop
(0)     [exec] = noop
(0)     policy remove_reply_message_if_eap {
(0)       if (&reply:EAP-Message && &reply:Reply-Message) {
(0)       if (&reply:EAP-Message && &reply:Reply-Message)  -> FALSE
(0)       else {
(0)         [noop] = noop
(0)       } # else = noop
(0)     } # policy remove_reply_message_if_eap = noop
(0)     if (EAP-Key-Name && &reply:EAP-Session-Id) {
(0)     if (EAP-Key-Name && &reply:EAP-Session-Id)  -> FALSE
(0)   } # post-auth = noop
(0) Login OK: [radtest007/Hi32da4] (from client localhost port 0)
(0) Sent Access-Accept Id 238 from 127.0.0.1:1812 to 127.0.0.1:58457 length 59
(0)   Reply-Message = "Welcome, radtest007"
(0) Finished request
Waking up in 4.9 seconds.
(0) Cleaning up request packet ID 238 with timestamp +5 due to cleanup_delay was reached
Ready to process requests

 ...

(1) Found Auth-Type = PAP
(1) # Executing group from file /etc/raddb/sites-enabled/default
(1)   Auth-Type PAP {
(1) pap: Login attempt with password
(1) pap: Comparing with "known good" Cleartext-Password
(1) pap: ERROR: Cleartext password does not match "known good" password
(1) pap: Passwords don't match
(1)     [pap] = reject
(1)   } # Auth-Type PAP = reject
(1) Failed to authenticate the user
(1) Using Post-Auth-Type Reject
(1) # Executing group from file /etc/raddb/sites-enabled/default
(1)   Post-Auth-Type REJECT {
(1) attr_filter.access_reject: EXPAND %{User-Name}
(1) attr_filter.access_reject:    --> radtest007
(1) attr_filter.access_reject: Matched entry DEFAULT at line 11
(1)     [attr_filter.access_reject] = updated
(1)     [eap] = noop
(1)     policy remove_reply_message_if_eap {
(1)       if (&reply:EAP-Message && &reply:Reply-Message) {
(1)       if (&reply:EAP-Message && &reply:Reply-Message)  -> FALSE
(1)       else {
(1)         [noop] = noop
(1)       } # else = noop
(1)     } # policy remove_reply_message_if_eap = noop
(1)   } # Post-Auth-Type REJECT = updated
(1) Login incorrect (pap: Cleartext password does not match "known good" password): [radtest007/badpass] (from client localhost port 0)
(1) Delaying response for 1.000000 seconds
Waking up in 0.3 seconds.
Waking up in 0.6 seconds.
(1) Sending delayed response
(1) Sent Access-Reject Id 117 from 127.0.0.1:1812 to 127.0.0.1:38494 length 59
(1)   Reply-Message = "Welcome, radtest007"
Waking up in 3.9 seconds.
(1) Cleaning up request packet ID 117 with timestamp +873 due to cleanup_delay was reached
Ready to process requests





EAP-PEAPの動作確認テスト


radtestコマンドを用いてRADIUSサーバへの簡単(単純)な接続テストを行うことができたが、EAP認証方式では通信路の暗号化などかなり複雑な手順を踏まなければRADIUSサーバとの間で通信を行うことができない.radtestコマンドではEAP認証方式に対応できないので、EAP認証方式の接続テストは別なツールを用いて行う必要がある.


今回EAP認証方式の接続テストツールとして "eapol_test" というツールを用いるが、RedHat Enterprise Linuxであれば、 "hostapd"パッケージをインストールすると、"eapol_test"ユーティリティーがインストールされる.(参考:『34.5. FreeRADIUS サーバーまたはオーセンティケーターに対する EAP-TTLS 認証のテスト』


AlmaLinux 9.6 では"hostapd"パッケージをインストールしても"eapol_test"ユーティリティーがインストールされなかったので、別途、wpa_supplicantパッケージをインストールすることで、"eapol_test"ユーティリティーがインストールされた.


ディストリビューションによってパッケージ構成に違いがあるようなので、wpa_supplicantパッケージをインストールするのが良いようだ.




[root@ns7 ~]# cat /etc/os-release
NAME="AlmaLinux"
VERSION="9.6 (Sage Margay)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.6"
PLATFORM_ID="platform:el9"
PRETTY_NAME="AlmaLinux 9.6 (Sage Margay)"
ANSI_COLOR="0;34"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:almalinux:almalinux:9::baseos"
HOME_URL="https://almalinux.org/"
DOCUMENTATION_URL="https://wiki.almalinux.org/"
BUG_REPORT_URL="https://bugs.almalinux.org/"

ALMALINUX_MANTISBT_PROJECT="AlmaLinux-9"
ALMALINUX_MANTISBT_PROJECT_VERSION="9.6"
REDHAT_SUPPORT_PRODUCT="AlmaLinux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.6"
SUPPORT_END=2032-06-01

[root@ns7 ~]# dnf install hostapd
Warning: failed loading '/etc/yum.repos.d/networkradius.repo', skipping.
Last metadata expiration check: 4:20:11 ago on Tue Aug 12 03:37:53 2025.
Package hostapd-2.11-2.el9.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

[root@ns7 ~]# which eapol_test
/usr/bin/which: no eapol_test in (/root/.local/bin:/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin)

[root@ns7 ~]# dnf install  wpa_supplicant
Warning: failed loading '/etc/yum.repos.d/networkradius.repo', skipping.
Last metadata expiration check: 4:21:24 ago on Tue Aug 12 03:37:53 2025.
Dependencies resolved.
========================================================================================================================
 Package                         Architecture            Version                          Repository               Size
========================================================================================================================
Installing:
 wpa_supplicant                  x86_64                  1:2.11-2.el9                     baseos                  1.7 M

Transaction Summary
========================================================================================================================
Install  1 Package

Total download size: 1.7 M
Installed size: 6.4 M
Is this ok [y/N]: y
Downloading Packages:
wpa_supplicant-2.11-2.el9.x86_64.rpm                                                    3.9 MB/s | 1.7 MB     00:00    
------------------------------------------------------------------------------------------------------------------------
Total                                                                                   1.7 MB/s | 1.7 MB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                1/1 
  Installing       : wpa_supplicant-1:2.11-2.el9.x86_64                                                             1/1 
  Running scriptlet: wpa_supplicant-1:2.11-2.el9.x86_64                                                             1/1 
  Verifying        : wpa_supplicant-1:2.11-2.el9.x86_64                                                             1/1 

Installed:
  wpa_supplicant-1:2.11-2.el9.x86_64                                                                                    

Complete!
[root@ns7 ~]# which eapol_test
/usr/sbin/eapol_test
[root@ns7 ~]# 



"eapol_test"ユーティリティーは wpa_supplicant ユーティリティー をインストールしてもwpa_supplicant関連のツールとしてインストールされる模様.Linuxディストリビューションによっては、ソースからコンパイルして導入する必要があるかもしれない.その際は、CentOS 9系であれば、下記のパッケージをインストールしておくと上手くコンパイルできる模様.(参考:『【解決】RADIUSのテスト(eapol_test)でハマった』





[root@nsauth6 raddb]# dnf install openssl-devel libnl3-devel dbus-devel 
Last metadata expiration check: 2:04:17 ago on Mon Aug 11 19:32:13 2025.
Package openssl-devel-1:3.2.2-6.el9_5.1.x86_64 is already installed.
Dependencies resolved.
====================================================================================================================================
 Package                         Architecture              Version                               Repository                    Size
====================================================================================================================================
Installing:
 dbus-devel                      x86_64                    1:1.12.20-8.el9                       appstream                     33 k
 libnl3-devel                    x86_64                    3.11.0-1.el9                          appstream                     77 k

Transaction Summary
====================================================================================================================================
Install  2 Packages

Total download size: 110 k
Installed size: 444 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): dbus-devel-1.12.20-8.el9.x86_64.rpm                                                          1.1 MB/s |  33 kB     00:00    
(2/2): libnl3-devel-3.11.0-1.el9.x86_64.rpm                                                         2.0 MB/s |  77 kB     00:00    
------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                               182 kB/s | 110 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                            1/1 
  Installing       : libnl3-devel-3.11.0-1.el9.x86_64                                                                           1/2 
  Installing       : dbus-devel-1:1.12.20-8.el9.x86_64                                                                          2/2 
  Running scriptlet: dbus-devel-1:1.12.20-8.el9.x86_64                                                                          2/2 
  Verifying        : dbus-devel-1:1.12.20-8.el9.x86_64                                                                          1/2 
  Verifying        : libnl3-devel-3.11.0-1.el9.x86_64                                                                           2/2 

Installed:
  dbus-devel-1:1.12.20-8.el9.x86_64                                 libnl3-devel-3.11.0-1.el9.x86_64                                

Complete!
[root@nsauth6 raddb]# 



eapol_testによるリモートテスト


先ず最初に、eapol_testを実行するための適当なディレクトリを用意し、そこに "peaptest.conf" のような名前で設定ファイルを作成する.ファイルの内容は、"/etc/raddb/users" に記載したテストアカウントの内容に沿って、


network={
    key_mgmt=WPA-EAP
    eap=PEAP
    identity="radtest007"
    password="Hi32da4"
    phase2="autheap=MSCHAPV2"
    ca_cert="/etc/raddb/certs/ca.pem"
}


のように記載する.


eapol_testのコマンドパラメータは eapol_test -a -c <設定ファイル> -s のように指定する.ルート証明書 "/etc/raddb/certs/ca.pem" のアクセス権の関係から、eapol_testをrootアカウントまたは sudo 権限で実施する.




[yasuaki@nsauth6 ~]$ sudo eapol_test -a 127.0.0.1 -c peaptest.conf -s testing123
Reading configuration file 'peaptest.conf'
Line: 1 - start of a new network block
key_mgmt: 0x1
eap methods - hexdump(len=16): 00 00 00 00 19 00 00 00 00 00 00 00 00 00 00 00
identity - hexdump_ascii(len=10):
     72 61 64 74 65 73 74 30 30 37                     radtest007      
password - hexdump_ascii(len=7):
     48 69 33 32 64 61 34                              Hi32da4         
phase2 - hexdump_ascii(len=16):
     61 75 74 68 65 61 70 3d 4d 53 43 48 41 50 56 32   autheap=MSCHAPV2
ca_cert - hexdump_ascii(len=23):
     2f 65 74 63 2f 72 61 64 64 62 2f 63 65 72 74 73   /etc/raddb/certs
     2f 63 61 2e 70 65 6d                              /ca.pem         
Priority group 0
   id=0 ssid=''
Authentication server 127.0.0.1:1812
RADIUS local address: 127.0.0.1:45888
ENGINE: Loading builtin engines
ENGINE: Loading builtin engines
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
EAPOL: External notification - portValid=0
EAPOL: External notification - portEnabled=1
EAPOL: SUPP_PAE entering state CONNECTING

  ...

Received RADIUS message
RADIUS message: code=2 (Access-Accept) identifier=9 length=178
   Attribute 80 (Message-Authenticator) length=18
      Value: 3b5750ebe0fdb06e402fc04d4bf4320f
   Attribute 1 (User-Name) length=12
      Value: 'radtest007'
   Attribute 26 (Vendor-Specific) length=58
      Value: 000001371134a472588d80d1f601b1165afeea5e7a0e680edffbcdc5c1ecbddc33c97ac402e81d7b70931f4caf207bab0ff1f9621340c7ac
   Attribute 26 (Vendor-Specific) length=58
      Value: 000001371034adc012c5f7fc7289c83c6379c1233a2990c8f2140e0742c3bd522a31268f72bb2a7bbf9ddc0f5e45c76e745e40915e2d8c4f
   Attribute 79 (EAP-Message) length=6
      Value: 03c50004
   Attribute 12 (Framed-MTU) length=6
      Value: 994
STA 02:00:00:00:00:01: Received RADIUS packet matched with a pending request, round trip time 0.00 sec

RADIUS packet matching with station
MS-MPPE-Send-Key (sign) - hexdump(len=32): ed cf 55 a5 3b 68 32 80 1b 5b 73 a9 e7 fd 78 eb 27 19 27 b2 c4 3b 5d a8 04 bb e6 43 87 82 4f cc
MS-MPPE-Recv-Key (crypt) - hexdump(len=32): 95 e9 25 61 ea 24 33 de 62 87 4a d4 f3 a1 e0 d0 88 73 e5 a4 c5 91 c8 19 50 4d bb a3 9b ad bf 85
decapsulated EAP packet (code=3 id=197 len=4) from RADIUS server: EAP Success
EAPOL: Received EAP-Packet frame
EAPOL: SUPP_BE entering state REQUEST
EAPOL: getSuppRsp
EAP: EAP entering state RECEIVED
EAP: Received EAP-Success
EAP: Status notification: completion (param=success)
EAP: EAP entering state SUCCESS
CTRL-EVENT-EAP-SUCCESS EAP authentication completed successfully
EAPOL: IEEE 802.1X for plaintext connection; no EAPOL-Key frames required
WPA: EAPOL processing complete
Cancelling authentication timeout
State: DISCONNECTED -> COMPLETED
EAPOL: SUPP_PAE entering state AUTHENTICATED
EAPOL: SUPP_BE entering state RECEIVE
EAPOL: SUPP_BE entering state SUCCESS
EAPOL: SUPP_BE entering state IDLE
eapol_sm_cb: result=1
EAPOL: Successfully fetched key (len=32)
PMK from EAPOL - hexdump(len=32): 95 e9 25 61 ea 24 33 de 62 87 4a d4 f3 a1 e0 d0 88 73 e5 a4 c5 91 c8 19 50 4d bb a3 9b ad bf 85
No EAP-Key-Name received from server
WPA: Clear old PMK and PTK
EAP: deinitialize previously used EAP method (25, PEAP) at EAP deinit
ENGINE: engine deinit
MPPE keys OK: 1  mismatch: 0
SUCCESS
[yasuaki@nsauth6 ~]$ 



1000行近い膨大なメッセージが出力されるが、最後の行に "SUCCESS" が表示されていれば、無事EPA-PEAPによる認証が成功したということになる.(認証失敗時は最後の行に "FAILURE" と表示される)


とりあえず、ここまでの設定でRADIUSサーバ側での EAP-PEAP(MSCHAPv2) による認証が可能となったので、802.1xに対応した無線LANのAPやネットワークスイッチと組み合わせて、802.1x認証を用いたネットワーク接続を試してみることにする.


Calendar

August 2025
S M T W T F S
 12
3456789
10111213141516
17181920212223
24252627282930
31  
  • Blogroll

  • Meta