認証サーバであるFreeRadiusをインストールします。
Radiusを使用する場面はIEEE802.1Xを使った認証設定やISPの接続認証などでしょうか。実案件の中ではFreeRadiusを使うことはまずなく、Cisco ACSやNetAttestなどのアプライアンス製品を導入することが多いのですがFreeRadiusも実用レベルに十分達しているソフトウェアなので検証などにおいては大いに効果を発揮します。
FreeRadiusはyumからインストール可能です。
# yum search freeradius freeradius-utils # rpm -qa | grep freeradius freeradius-2.1.12-4.el6_3.i686 freeradius-utils-2.1.12-4.el6_3.i686 |
設定ファイル関連は/etc/raddb以下にごっそりインストールされています。radiusの動作全般は/etc/raddb/radiusd.confを編集しログ周りの一部の設定を修正します。下記はその抜粋です。
# vi /etc/raddb/radiusd.conf
log {
# Log authentication requests to the log file.
#
# allowed values: {no, yes}
#
auth = yes
# Log passwords with the authentication requests.
# auth_badpass - logs password if it's rejected
# auth_goodpass - logs password if it's correct
#
# allowed values: {no, yes}
#
auth_badpass = yes
auth_goodpass = no
}
|
次にRADIUSクライアントを設定します。これは例えば無線LANコントローラやRouter/Switchなどが該当します。/etc/raddb/clients.confの最後尾に以下を追記します。secretで指定する文字列はRADIUSクライアントでも同一のものを設定する必要があります。
# vi /etc/raddb/clients.conf
client 192.168.12.30 {
secret = cisco
shortname = C1812J
}
|
さらに実際に認証を行うユーザ名を登録します。これは/etc/raddb/usersファイルを編集し、最後尾に以下を追記します。
# vi /etc/raddb/users unixpower Auth-Type:=Local, Cleartext-Password:="password" |
上記ではユーザ名「unixpower」でパスワードは「password」に設定しています。ここまでできたらFreeRadiusを起動します。
# /etc/rc.d/init.d/radiusd start radiusd を起動中: [ OK ] |
次に認証が成功するか実機を用いてではなく、ローカルで確認することが可能です。/etc/raddb/clients.confにlocalhostがデフォルトで登録されているので、これを使用することになります。書式はradtest -4 [ユーザ名] [パスワード] localhost [Port] [SecretKey]となります。SecretKeyはtesting123と設定されています。
# radtest -4 unixpower password localhost 1812 testing123
Sending Access-Request of id 58 to 127.0.0.1 port 1812
User-Name = "unixpower"
User-Password = "password"
NAS-IP-Address = 127.0.0.1
NAS-Port = 1812
Message-Authenticator = 0x00000000000000000000000000000000
rad_recv: Access-Accept packet from host 127.0.0.1 port 1812, id=58, length=40
|
上記のようになればOKです。/var/log/radius/radius.logに以下のようなログが出力されます。
Sun Dec 30 11:47:02 2012 : Auth: Login OK: [unixpower] (from client localhost port 1812) |
あとは実際のRADIUSクライアント(192.168.12.20)から設定をしてこのRADIUSサーバで認証できるか確認を行います。