Don't ask me why or get me started on the short sightedness of this BUT......
I need to offer "Guest" on our campuses the ability to get short term access to
our Guest/Public wireless SSID without asking them to register their device.
So there will be a link/button on our Captive Portal pages that says "I accept
AUP and give me xxx hours of access".
When they click on this link their MAC Address/device will be added to the
"NODE" database table with an "unregdate" for xxx hours from the time they
click.
Using code from
guest-selfregistration.cgi
email_activation.cgi
mobile-confirmation.cgi
by Olivier Bilodeau <[email protected]>
I am almost there,
* The device/mac gets added to the "node" table with an unregdate 2
hours in the future.
o I am not adding a "person" record since they are only temporary users
* I get the "your registered" web page showing my unregdate 2 hours in
the future
But, the device never get switched from the Registration VLAN to the Guest VLAN
or gets a Guest VLAN IP address.
What did I miss? CGI code follows below.
mlh
Node table Entries
MAC<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=mac&direction=ASC&per_page=&>
Computer
Name<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=computername&direction=ASC&per_page=&>
Identifier<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=pid&direction=ASC&per_page=&>
Category<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=category&direction=ASC&per_page=&>
Status<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=status&direction=ASC&per_page=&>
Bypass
VLAN<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=bypass_vlan&direction=ASC&per_page=&>
#
Viol.<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=nbopenviolations&direction=ASC&per_page=&>
VoIP<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=voip&direction=ASC&per_page=&>
Detect
Date<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=detect_date&direction=ASC&per_page=&>
Reg
Date<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=regdate&direction=ASC&per_page=&>
Unregdate<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=unregdate&direction=ASC&per_page=&>
Last
connection<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=last_connection_type&direction=ASC&per_page=&>
Last
Switch<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=last_switch&direction=ASC&per_page=&>
Last
Port<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=last_port&direction=ASC&per_page=&>
Last
VLAN<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=last_vlan&direction=ASC&per_page=&>
Last
SSID<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=last_ssid&direction=ASC&per_page=&>
Last 802.1X
Username<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=last_dot1x_username&direction=ASC&per_page=&>
User-Agent<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=user_agent&direction=ASC&per_page=&>
OS
(dhcp)<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=dhcp_fingerprint&direction=ASC&per_page=&>
Last Arp
Time<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=last_arp&direction=ASC&per_page=&>
Last DHCP
Time<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=last_dhcp&direction=ASC&per_page=&>
Lastskip<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=lastskip&direction=ASC&per_page=&>
Notes<https://10.0.91.250:1443/node/view.php?filter=Guest13&sort=notes&direction=ASC&per_page=&>
38:e7:d8:1b:cc:b3<https://10.0.91.250:1443/node/lookup.php?view_item=38:e7:d8:1b:cc:b3>
android_22cee73dca89c6a9
Guest1319148713<https://10.0.91.250:1443/person/lookup.php?view_item=Guest1319148713>
Guest
reg
100
0
no
2010-10-21 11:54:27
2011-10-20 14:11:54
2011-10-20 16:11:53
WiFi MAC Auth
10.xxx.yyy.zzz
259
50
pfSMCCCD_Public
38e7d81bccb3
Mozilla/5.0 (Linux; U; Android ...
HTC
Android<https://10.0.91.250:1443/configuration/fingerprint.php?view_item=1,121,33,3,6,28,51,58,59>
2010-10-21 11:54:27
2011-10-20 14:55:16
SMCCCD_Public
00:17:f2:45:da:8b<https://10.0.91.250:1443/node/lookup.php?view_item=00:17:f2:45:da:8b>
hart-maclt
Guest1319148523<https://10.0.91.250:1443/person/lookup.php?view_item=Guest1319148523>
Guest
reg
50
0
no
2010-10-25 13:12:31
2011-10-20 14:08:43
2011-10-20 16:08:43
WiFi MAC Auth
10.xxx.yyy.zzz
257
50
pfSMCCCD_Public
0017f245da8b
Mozilla/5.0 (Macintosh; U; Int ...
Mac OS
X<https://10.0.91.250:1443/configuration/fingerprint.php?view_item=1,3,6,15,119,95,252,44,46,47>
2010-10-25 13:12:31
2011-10-20 14:56:09
SMCCCD_Public
Code:
#!/usr/bin/perl
=head1 NAME
guest-2hour-registration.cgi - shortterm guest self registration portal
=cut
use strict;
use warnings;
use CGI;
use CGI::Carp qw( fatalsToBrowser );
use CGI::Session;
use Log::Log4perl;
use Readonly;
use POSIX;
use pf::class;
use pf::config;
use pf::iplog;
use pf::node;
use pf::util;
use pf::violation;
use pf::web;
use pf::web::guest 1.10;
# called last to allow redefinitions
use pf::web::custom;
# constants
Readonly::Scalar my $GUEST_REGISTRATION => "guest-register";
Log::Log4perl->init("$conf_dir/log.conf");
my $logger = Log::Log4perl->get_logger('guest-2hour-registration.cgi');
Log::Log4perl::MDC->put('proc', 'guest-2hour-registration.cgi');
Log::Log4perl::MDC->put('tid', 0);
my $cgi = new CGI;
my $session = new CGI::Session(undef, $cgi, {Directory=>'/tmp'});
my $result;
my $ip = $cgi->remote_addr();
my $destination_url = $cgi->param("destination_url") ||
$Config{'trapping'}{'redirecturl'};
my $enable_menu = $cgi->param("enable_menu");
my $mac = ip2mac($ip);
my %params;
my %info;
#my ($auth_return, $err) = pf::web::guest::validate_selfregistration($cgi,
$session);
#if ($auth_return) {
my $smcunregdate = 0;
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$smcunregdate = POSIX::mktime($sec, $min, $hour, $mday, $mon, $year);
$logger->info("Registering short term guest");
# grab additional info about the node
$info{'pid'} = "Guest". $smcunregdate;
$info{'category'} = "guest";
# unreg in 2 hours
my $expiration = POSIX::strftime("%Y-%m-%d %H:%M:%S", localtime( time +
2*60*60 ));
$info{'unregdate'} = $expiration;
# register the node
pf::web::web_node_register($cgi, $session, $mac, $info{'pid'}, %info);
# send to success page
pf::web::guest::generate_activation_confirmation_page($cgi, $session,
$expiration);
#}
---------------------------------------------------------------------
Michael L Hart
Network Manager
San Mateo County Community College District
Information Technology Services
voice:650.358.6709
mailto:[email protected]
http://www.smccd.edu<http://www.smccd.edu/>
1700 W Hillsdale Blvd,
Building 25 ITS
San Mateo CA 94402
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Packetfence-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/packetfence-users