FreeRADIUS是来自开放源码社区的一种强大的Linux上的RADIUS服务器,可用于如今的分布式和异构计算环境。FreeRADIUS 1.0.2 支持LDAP、MySQL、PostgreSQL和Oracle数据库,并与诸如EAP和Cisco LEAP之类的网络协议兼容。FreeRADIUS目前被部署在很多大型生产网络系统中。
下面的步骤演示如何在Red Hat Enterprise Linux Advanced Server 3.0上安装和测试FreeRADIUS 1.0.2:
清单1 安装和测试FreeRADIUS
tar -zxvf freeradius-1.0.2.tar.gz - extract it with gunzip and tar
./configure
make
make install - run this command as root
radiusd or - start RADIUS server
radiusd -X - start RADIUS server in debug mode
radtest test test localhost 0 testing123 - test RADIUS server
如果radtest收到一个响应,则表明FreeRADIUS服务器工作正常。
同时我还推荐另一种免费工具,那就是NTRadPing,它可用于测试来自Windows客户机的验证和授权请求。它可以显示从RADIUS服务器发回的详细的响应,例如属性值。
现在让我们来配置FreeRADIUS。
配置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 上配置的一样。
