配置FreeRADIUS
RADIUS服务器的配置包括对服务器、客户机和用户的配置(都是用于验证和授权)。出于不同的需要,对RADIUS服务器可以有不同的配置。幸运的是,大多数配置都是类似的。
* 配置服务器
FreeRADIUS配置文件通常位于/etc/raddb文件夹下。首先,我们需要像下面这样修改radiusd.conf文件。
清单2 修改radiusd.conf
1) Global settings:
log_auth = yes - log authentication requests to the log file
log_auth_badpass = no - don't log passwords if request rejected
log_auth_goodpass = no - don't log passwords if request accepted
2) LDAP Settings:
modules {
ldap {
server = "bluepages.ibm.com" - the hostname or IP address of the LDAP server
port = 636 - encrypted communications
basedn = "ou=bluepages,o=ibm.com" - define the base Distinguished Names (DN),
- under the Organization (O) "ibm.com",
- in the Organization Unit (OU) "bluepages"
filter = "(mail=%u)" - specify search criteria
base_filter = "(objectclass=person)" - specify base search criteria
}
authenticate { - enable authentication against LDAP
Auth-Type LDAP {
ldap
}
参数被设为使用 IBM BluePages,这是LDAP服务的一个实例。对于其他LDAP服务器,参数可能有所不同。
* 配置客户机
客户机是在/etc/raddb/clients.conf 文件中配置的。有两种方式可用于配置RADIUS客户机。您可以按IP subnet将NAS分组(清单 3),或者可以按主机名或 IP 地址列出NAS(清单4)。如果按照第二种方法,可以定义shortname和nastype。
清单3 按IP subnet将NAS分组
client 192.168.0.0/24 {
secret = mysecret1 - the "secret" should be the same as configured on NAS
shortname = mylan - the "shortname" can be used for logging
nastype = cisco - the "nastype" is used for checkrad and is optional
}
清单4 按主机名或 IP 地址列出 NAS
client 192.168.0.1 {
secret = mysecret1
shortname = myserver
nastype = other
}
* 为验证而配置用户
文件 /etc/raddb/user 包含每个用户的验证和配置信息。
清单5 /etc/raddb/user 文件
1) Authentication type:
Auth-Type := LDAP - authenticate against LDAP
Auth-Type := Local, User-Password == "mypasswd"
- authenticate against the
- password set in /etc/raddb/user
Auth-Type := System - authenticate against the system password file
- /etc/passwd or /etc/shadow
2) Service type:
Service-Type = Login, - for administrative login
* 为授权而配置用户
下面的验证服务器属性-值对(AV)应该为用户授权而进行配置。在验证被接受后,这个属性-值对被返回给NAS,作为对管理员登录请求的响应。
对于Cisco路由器,有不同的权限级别:
级别1是无特权(non-privileged)。提示符是 router>,这是用于登录的默认级别。
级别15是特权(privileged)。 提示符是 router#,这是进入 enable 模式后的级别。
级别2到14 在默认配置中不使用。
下面的命令可以使一个用户从网络访问服务器登录,并获得对EXEC命令的立即访问:
cisco-avpair ="shell:priv-lvl=15"
下面的代码处理相同的任务,这一次是对于Cisco无线访问点:
Cisco:Avpair= "aironet:admin-capability=write+snmp+ident+firmware+admin"
任何功能组合都和这个属性一起返回:
Cisco:Avpair = "aironet:admin-capability=ident+admin"
Cisco:Avpair = "aironet:admin-capability=admin"
请与 Cisco 联系,以获得关于这些命令的更多信息。
配置网络访问服务器
接下来我们将配置NAS,首先是配置一个Cisco路由器,然后轮到一个Cisco WAP。
对于Cisco IOS 12.1路由器,我们将启用AAA,然后配置验证、授权和记帐。
清单6 启用AAA
aaa new-model
radius-server host 192.168.0.100
radius-server key mysecret1
AAA 在路由器上应该被启用。然后,指定能为 NAS 提供 AAA 服务的 RADIUS 服务器的列表。加密密钥用于加密 NAS 和 RADIUS 服务器之间的数据传输。它必须与 FreeRADIUS 上配置的一样。
清单7 配置验证
aaa authentication login default group radius local
line vty 0 4
login authentication default
在这个例子中,网络管理员使用 RADIUS 验证。如果 RADIUS 服务器不可用,则使用 NAS 的本地用户数据库密码。
清单8 配置授权
aaa authorization exec default group radius if-authenticated
允许用户在登录到 NAS 中时运行 EXEC shell。
清单9 配置记帐
aaa accounting system default start-stop group radius
aaa accounting network default start-stop group radius
aaa accounting connection default start-stop group radius
aaa accounting exec default stop-only group radius
aaa accounting commands 1 default stop-only group radius
aaa accounting commands 15 default wait-start group radius
必须对路由器进行特别的配置,以使之发送记帐记录到RADIUS服务器。使用清单9中的命令记录关于NAS系统事件、网络连接、输出连接、EXEC操作以及级别1和级别15上的命令的记帐信息。
这样就好了。现在让我们看看为Cisco无线访问点而进行的配置。下面的配置适用于带有Firmware 12.01T1的Cisco 1200 Series AP。如图2中的屏幕快照所示,您:
* 输入服务器名或 IP 地址和共享的秘密。
* 选择“Radius”作为类型,并选中“User Authentication”。

图2 为WAP配置NAS
实际上,在这里您还可以配置EAP Authentication,使FreeRADIUS可用于验证无线LAN的一般用户。