From 60a7e01bd0d20d0873e253b018ec19f260eeceab Mon Sep 17 00:00:00 2001 From: Durand Fabrice Date: Tue, 6 May 2014 08:14:32 -0400 Subject: [PATCH] Fixed ExtractSsid in Cisco Aironet and Change the Vendor in radius dictionary --- NEWS.asciidoc | 2 ++ lib/pf/Switch/Cisco/Aironet.pm | 15 +++++++++------ lib/pf/Switch/Cisco/Aironet_WDS.pm | 21 ++++++++++++--------- raddb/dictionary.packetfence | 8 ++++---- 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/NEWS.asciidoc b/NEWS.asciidoc index 3c132ede0495..1530a210b268 100644 --- a/NEWS.asciidoc +++ b/NEWS.asciidoc @@ -68,6 +68,7 @@ Enhancements * Added a file backing for the cache to decrease cache misses * Allow advanced search of nodes by OS type (#1790) * The PF RPC client can be configured in the conf/radiusd/radiusd.conf +* Added PacketFence radius dictionary Bug Fixes +++++++++ @@ -85,6 +86,7 @@ Bug Fixes * Fixed conversion of wildcards to regular expressions in domains passthroughs * Fixed display of last IP address of nodes when end_time is in the future * Fixed XSS issues in Web admin +* Fixed extractSsid for Cisco Aironet and Cisco Aironet WDS Version 4.1.0 released on 2013-12-11 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/lib/pf/Switch/Cisco/Aironet.pm b/lib/pf/Switch/Cisco/Aironet.pm index 8056a710b8f8..6188fb0ed7d5 100644 --- a/lib/pf/Switch/Cisco/Aironet.pm +++ b/lib/pf/Switch/Cisco/Aironet.pm @@ -203,13 +203,16 @@ sub extractSsid { my $logger = Log::Log4perl::get_logger(ref($this)); if (defined($radius_request->{'Cisco-AVPair'})) { - - if ($radius_request->{'Cisco-AVPair'} =~ /^ssid=(.*)$/) { # ex: Cisco-AVPair = "ssid=PacketFence-Secure" - return $1; - } else { - $logger->info("Unable to extract SSID of Cisco-AVPair: ".$radius_request->{'Cisco-AVPair'}); + foreach my $ciscoAVPair (@{$radius_request->{'Cisco-AVPair'}}) { + $logger->trace("Cisco-AVPair: ".$ciscoAVPair); + + if ($ciscoAVPair =~ /^ssid=(.*)$/) { # ex: Cisco-AVPair = "ssid=PacketFence-Secure" + return $1; + } else { + $logger->info("Unable to extract SSID of Cisco-AVPair: ".$ciscoAVPair); + } } - } + } $logger->warn( "Unable to extract SSID for module " . ref($this) . ". SSID-based VLAN assignments won't work. " diff --git a/lib/pf/Switch/Cisco/Aironet_WDS.pm b/lib/pf/Switch/Cisco/Aironet_WDS.pm index a577cb328cba..ae029b8fee9b 100644 --- a/lib/pf/Switch/Cisco/Aironet_WDS.pm +++ b/lib/pf/Switch/Cisco/Aironet_WDS.pm @@ -199,20 +199,23 @@ Overriding default extractSsid because on Aironet AP SSID is in the Cisco-AVPair # Same as in pf::Switch::Cisco::Aironet. Please keep both in sync. Once Moose push in a role. sub extractSsid { - my ($self, $radius_request) = @_; - my $logger = Log::Log4perl::get_logger(__PACKAGE__); + my ($this, $radius_request) = @_; + my $logger = Log::Log4perl::get_logger(ref($this)); if (defined($radius_request->{'Cisco-AVPair'})) { - - if ($radius_request->{'Cisco-AVPair'} =~ /^ssid=(.*)$/) { # ex: Cisco-AVPair = "ssid=PacketFence-Secure" - return $1; - } else { - $logger->info("Unable to extract SSID of Cisco-AVPair: ".$radius_request->{'Cisco-AVPair'}); + foreach my $ciscoAVPair (@{$radius_request->{'Cisco-AVPair'}}) { + $logger->trace("Cisco-AVPair: ".$ciscoAVPair); + + if ($ciscoAVPair =~ /^ssid=(.*)$/) { # ex: Cisco-AVPair = "ssid=PacketFence-Secure" + return $1; + } else { + $logger->info("Unable to extract SSID of Cisco-AVPair: ".$ciscoAVPair); + } } - } + } $logger->warn( - "Unable to extract SSID for module " . ref($self) . ". SSID-based VLAN assignments won't work. " + "Unable to extract SSID for module " . ref($this) . ". SSID-based VLAN assignments won't work. " . "Make sure you enable Vendor Specific Attributes (VSA) on the AP if you want them to work." ); return; diff --git a/raddb/dictionary.packetfence b/raddb/dictionary.packetfence index 417ce498e63e..cff453c9b588 100644 --- a/raddb/dictionary.packetfence +++ b/raddb/dictionary.packetfence @@ -1,14 +1,14 @@ # -*- text -*- -# Copyright (C) 2012 The FreeRADIUS Server project and contributors +# Copyright (C) 2014 The FreeRADIUS Server project and contributors ############################################################################## # # Inverse Inc. # ############################################################################## -VENDOR PacketFence 29464 +VENDOR Inverse 29464 -BEGIN-VENDOR PacketFence +BEGIN-VENDOR Inverse ATTRIBUTE PacketFence-RPC-Server 1 string ATTRIBUTE PacketFence-RPC-Port 2 string @@ -16,5 +16,5 @@ ATTRIBUTE PacketFence-RPC-User 3 string ATTRIBUTE PacketFence-RPC-Pass 4 string ATTRIBUTE PacketFence-RPC-Proto 5 string -END-VENDOR PacketFence +END-VENDOR Inverse