Captive::Portal::Role::Firewall - firewall methods for Captive::Portal
Does all stuff needed to dynamically update iptables and ipset.
Add tuple IP/MAC to the ipset named capo_sessions_ipset. Members of this ipset have Internet access and are no longer redirected to the login/splash page crossing the gateway.
Also insert this IP into capo_activity_ipset, needed for stateful restarts.
Delete tuple IP/MAC from the ipset named capo_sessions_ipset.
This method is called during startup of the Captive::Portal when the old state of the clients must be preserved. Reads the sessions from disc cache and calls fw_start_session for all ACTIVE clients.
Counts the members of the ipset 'capo_sessions_ipset'. Returns the number of members in this set on success (maybe 0) or undef on error (e.g. ipset undefined).
Parses the output of: ipset list capo_sessions_ipset
and returns a hashref for the tuples { ip => mac, ... }
Reads and flushes the ipset 'capo_activity_ipset' and returns a hashref for the tuples { ip => timeout, ... }
Captive::Portal doesn't rely on JavaScript or any other client technology to test for idle clients. A cronjob must call periodically:
capo-ctl.pl [-f capo.cfg] [-l log4perl.cfg] purge
in order to detect idle clients. The firewall rules add active clients to the ipset 'capo_activity_ipset' and the purger reads this set for activity checks.
Flushes the ipset 'capo_sessions_ipset', normally used in start/stop scripts, see capo-ctl.pl.
Calls the firewall templates in the order flush, init, mangle, nat and filter, see the corresponding firewall templates under templates/orig/firewall/. After the init step the ipsets are filled via fw_reload_sessions from disc cache.
Calls the firewall template flush, see the corresponding firewall template under templates/orig/firewall/.
Detect idle sessions, mark them as IDLE in disk cache and remove entry in ipset.
Karl Gaissmaier, <gaissmai at cpan.org>
<gaissmai at cpan.org>
Copyright 2010-2013 Karl Gaissmaier, all rights reserved.
This distribution is free software; you can redistribute it and/or modify it under the terms of either:
a) the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version, or
b) the Artistic License version 2.0.
To install Captive::Portal, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Captive::Portal
CPAN shell
perl -MCPAN -e shell install Captive::Portal
For more information on module installation, please visit the detailed CPAN module installation guide.