> . I just need an example for the vlan/custom.pm of how to assign the
> category based on what auth method they choose.
In your module that is doing the authentication there is a subroutine that is
called getNodeAttributes, make it look something like this:
sub getNodeAttributes {
my ($this) = @_;
my $portalSession = pf::Portal::Session->new();
my $session = $portalSession->getSession();
return ( category => '*your category here*' );
}
This will set the category for any user that uses that auth method. Then in
your vlan custom.pm you can return the vlan based on that category. REMEMBER!
All of this is case sensitive, so either use an "lc" perl statement or make
sure your cases are perfect.
Jake Sallee
Godfather of Bandwidth
System Engineer
University of Mary Hardin-Baylor
900 College St.
Belton TX. 76513
Fone: 254-295-4658
Phax: 254-295-4221
HTTP://WWW.UMHB.EDU
-----Original Message-----
From: Dan Nelson [mailto:[email protected]]
Sent: Tuesday, October 23, 2012 11:23 AM
To: [email protected]
Subject: Re: [PacketFence-users] captive Portal radius login add to Guest Vlan
Sallee, Stephen (Jake <Jake.Sallee@...> writes:
>
Thanks for your help. I think I am getting close. I am going to use radius for
my corporate auth and the ldap for my internet only auth. I have this portion
done and working. I just need an example for the vlan/custom.pm of how to
assign the category based on what auth method they choose.
Here is what I currently have in my custom.pm
sub getNormalVlan {
# #$switch is the switch object (pf::SNMP)
# #$ifIndex is the ifIndex of the computer connected to
# #$mac is the mac connected
# #$node_info is the node info hashref (result of pf::node's node_attributes
on $mac)
# #$conn_type is set to the connnection type expressed as the constant in
pf::config
# #$user_name is set to the RADIUS User-Name attribute (802.1X Username or
MAC address under MAC Authentication)
# #$ssid is the name of the SSID (Be careful: will be empty string if radius
non-wireless and undef if not radius)
my ($this, $switch, $ifIndex, $mac, $node_info, $connection_type,
$user_name, $ssid) = @_;
my $logger = Log::Log4perl->get_logger(); #
# # custom example: admin category
# # return customVlan5 to nodes in the admin category
if (defined($node_info->{'category'}) && lc($node_info->{'category'}) eq
"guest") {
return $switch->getVlanByName('guestVlan');
}
#
# # custom example: simple guest user
# # return guestVlan for pid=nutraguest
if (defined($node_info->{pid}) && $node_info->{pid} =~ /^nutraguest$/i) {
return $switch->getVlanByName('guestVlan');
}
#
# # custom example: enforce a node's bypass VLAN
# # If node record has a bypass_vlan prefer it over normalVlan
# # Note: It might be made the default behavior one day
if (defined($node_info->{'bypass_vlan'}) && $node_info->{'bypass_vlan'} ne
'') {
return $node_info->{'bypass_vlan'};
}
#
# # custom example: VLAN by SSID
# # return customVlan1 if SSID is 'PacketFenceRocks'
# if (defined($ssid) && $ssid eq 'PacketFenceRocks') {
# return $switch->getVlanByName('customVlan1');
# }
#
return $switch->getVlanByName('normalVlan');
}
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics Download AppDynamics Lite for free
today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
PacketFence-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/packetfence-users
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
PacketFence-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/packetfence-users