作为一名网络管理员,您需要为您所需管理的每个网络设备存放用于管理的用户信息。但是网络设备通常只支持有限的用户管理功能。学习如何使用Linux上的一个外部RADIUS服务器来验证用户,具体来说是通过一个LDAP服务器 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服务器能够有不同的配置。幸运的是,大多数配置都 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"

文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!