freeradius on FreeBSD
[ Nob's Home |
FreeBSD ]
freeradius を install してみます。
Information
What you need
- freeradiusのsource
- freeradius.tar.gz
は2002.4.2現在 version 0.5です。
最新のsourceは cvsで
$ cvs -d :pserver:anoncvs@cvs.freeradius.org:/source login
CVS password: anoncvs
$ cvs -d :pserver:anoncvs@cvs.freeradius.org:/source checkout radiusd
とすると得られますが、makeが通らないようです。
install
$ tar zxvf freeradius.tar.gz
$ cd freeradius-0.5
$ ./configure
いろいろ warning 出ますが無視します。
$ make
$ su
# make install
設定
# vi /usr/local/raddb/radiusd.conf
group = root
を
group = wheel
に
modules > unix で
cache = no
として
# passwd = /etc/passwd
# shadow = /etc/shadow
と comment out します。
|
# vi /usr/local/etc/raddb/clients
localhost testing123
のコメントを外します。
211.**.***.** hogehoge1
自分自身のIPを登録しておきます。
この他の接続を許可するhostのIPとpasswordを登録します。
211.**.***.*** hogehoge2
|
このペアは radius serverのクライアントの
/etc/radiusclient/servers のものと一致している必要があります。
ユーザーの登録
試験的にbobというユーザーを登録してみます。
# vi /usr/local/etc/raddb/users
bob Auth-Type := Local, User-Password == "bob"
Reply-Message = "Hello, bob"
|
を "DEFAULT Auth-Type := System" の前に追加します。
debug
# radiusd -X
で起動します。
別の window で radtest を実行してみます。
$ radtest bob bob localhost 0 testing123
Sending Access-Request of id 58 to 127.0.0.1:1812
User-Name = "bob"
User-Password = "\205*y}1\242\026J\326\372u\2772\314\343\243"
NAS-IP-Address = makioka.y-min.or.jp
NAS-Port-Id = "0"
rad_recv: Access-Accept packet from host 127.0.0.1:1812, id=58, length=32
Reply-Message = "Hello, bob"
と表示されればOK
|
/etc/passwdを使う
defaultの設定で /etc/passwd のユーザーは認証されます。
/etc/passwdに登録してあるユーザーで radtestしてみてください。
MS-CHAPv2 & MPPE
pptpdなどでMS-CHAPv2とMPPEを使用する場合、authenticationにはMS-CHAPを使用します。
# vi /usr/local/etc/raddb/dictionary
# Cistron extensions
#
VALUE Auth-Type EAP 6
VALUE Auth-Type ARAP 7
VALUE Auth-Type MS-CHAP 8
VALUE Auth-Type Ldap 252
|
# vi users
DEFAULT Auth-Type := System
Fall-Through = 1
を
DEFAULT Auth-Type := MS-CHAP
Fall-Through = 1
に
|
RADIUSの動作
いろいろやってみて「こうであろうと」理解したことを書いておきます。
- RADIUS serverはNASからUser-Nameを受け取る
- raddb/radiusd.confの authorize の指定に従い、どのauthorize方法を使用するか決定
- まず preprocess
- 次に counter, attr_filter,eap, suffix, ldap, sql, mschapなどの module
- 最後に files で raddb/users を指定
- moduleの場合、authenticateの方法を自動的に決定させることもできる(raddb/radiusd.confで指定)
- authenticateに使用する moduleは raddb/radiusd.conf の authenticate に記載しておく
- filesの場合、raddb/usersに従い、そのUser-Nameに対し、どのauthenticate 方法を使うか決定する
現状
frod Auth-Type := MS-CHAP, User-Password == "lordoftherings"
Service-Type = Framed-User,
Framed-Protocol = PPP
と登録したuserは
authorize {
files
mschap
}
authenticate {
mschap
}
だと
modcall: entering group authorize
users: Matched frod at 7
modcall[authorize]: module "files" returns ok
modcall[authorize]: module "mschap" returns ok
modcall: group authorize returns ok
rad_check_password: Found Auth-Type MS-CHAP
auth: type "MS-CHAP"
modcall: entering group authenticate
modcall[authenticate]: module "mschap" returns ok
modcall: group authenticate returns ok
と無事認証ができました。しかし、
authorize {
mschap
files
}
authenticate {
mschap
}
だと
modcall: entering group authorize
modcall[authorize]: module "mschap" returns notfound
users: Matched frod at 7
modcall[authorize]: module "files" returns ok
modcall: group authorize returns ok
rad_check_password: Found Auth-Type MS-CHAP
auth: type "MS-CHAP"
modcall: entering group authenticate
modcall[authenticate]: module "mschap" returns reject
modcall: group authenticate returns reject
auth: Failed to validate the user.
と失敗するのは何故?
[ Nob's Home |
FreeBSD ]
nob@makioka.y-min.or.jp