我使用Ubuntu 10.04.4上的FreeRADIUS 2.1.8进行WPA2 802.11x EAP身份validation设置,并使用PEAP / MSCHAPv2,TTLS / MSCHAPv2和TTLS / PAP(均通过AP和eapol_test )进行身份validation 。 我现在试图根据用户所属的LDAP组来限制对特定SSID的访问。
我在/etc/freeradius/modules/ldapconfiguration了组成员身份检查,如下所示:
groupname_attribute = cn groupmembership_filter = "(|(&(objectClass=posixGroup)(memberUid=%{User-Name}))(&(objectClass=posixGroup)(uniquemember=%{User-Name})))"
并且我已经根据Mac Auth wiki页面将从被叫台ID中提取的SSIDconfiguration为被叫台SSID。 在/etc/freeradius/eap.conf我已经启用了将外层隧道的属性复制到内层隧道中,以及在外层隧道(对于PEAP和TTLS)中使用内层隧道响应。 然而,在更改这些选项之前,我有相同的行为。
copy_request_to_tunnel = yes use_tunneled_reply = yes
我正在运行eapol_test来testing设置:
eapol_test -c peap-mschapv2.conf -a 172.16.0.16 -s testing123 -N 30:s:01-23-45-67-89-01:Example-EAP
使用以下peap-mschapv2.conf文件:
network={ ssid="Example-EAP" key_mgmt=WPA-EAP eap=PEAP identity="mgorven" anonymous_identity="anonymous" password="foobar" phase2="autheap=MSCHAPV2" }
在/etc/freeradius/users :
DEFAULT Ldap-Group == "employees"
并运行freeradius-Xx ,我可以看到LDAP组检索工作,SSID被提取。
Debug: [ldap] performing search in dc=example,dc=com, with filter (&(cn=employees)(|(&(objectClass=posixGroup)(memberUid=mgorven))(&(objectClass=posixGroup)(uniquemember=mgorven)))) Debug: rlm_ldap::ldap_groupcmp: User found in group employees ... Info: expand: %{7} -> Example-EAP
接下来,我尝试只允许访问employees组中的用户(不pipeSSID),所以我把以下内容放在/etc/freeradius/users :
DEFAULT Ldap-Group == "employees" DEFAULT Auth-Type := Reject
但是这会立即拒绝外部隧道中的访问请求,因为anonymous用户不在employees组中。 所以我修改它只匹配内部隧道请求,如下所示:
DEFAULT Ldap-Group == "employees" DEFAULT FreeRADIUS-Proxied-To == "127.0.0.1" Auth-Type := Reject, Reply-Message = "User does not belong to any groups which may access this SSID."
现在, employees组中的用户进行了身份validation,但不属于employees组的用户也进行了身份validation。 我看到拒绝条目被匹配,并设置回复消息,但客户端收到访问接受。
Debug: rlm_ldap::ldap_groupcmp: Group employees not found or user is not a member. Info: [files] users: Matched entry DEFAULT at line 209 Info: ++[files] returns ok ... Auth: Login OK: [mgorven] (from client test port 0 cli 02-00-00-00-00-01 via TLS tunnel) Info: WARNING: Empty section. Using default return values. ... Info: [peap] Got tunneled reply code 2 Auth-Type := Reject Reply-Message = "User does not belong to any groups which may access this SSID." ... Info: [peap] Got tunneled reply RADIUS code 2 Auth-Type := Reject Reply-Message = "User does not belong to any groups which may access this SSID." ... Info: [peap] Tunneled authentication was successful. Info: [peap] SUCCESS Info: [peap] Saving tunneled attributes for later ... Sending Access-Accept of id 11 to 172.16.2.44 port 60746 Reply-Message = "User does not belong to any groups which may access this SSID." User-Name = "mgorven"
和eapol_test报告:
RADIUS message: code=2 (Access-Accept) identifier=11 length=233 Attribute 18 (Reply-Message) length=64 Value: 'User does not belong to any groups which may access this SSID.' Attribute 1 (User-Name) length=9 Value: 'mgorven' ... SUCCESS
为什么拒绝这个请求,这是实现这个的正确方法吗?
出于一些奇怪的原因,设置Auth-Type是一个检查项目,而不是回复项目,因此必须在规则的第一行完成。 以下工作正确:
DEFAULT FreeRADIUS-Proxied-To == "127.0.0.1", Auth-Type := Reject Reply-Message = "User does not belong to any groups which may access this SSID."