Captive-Portal

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

        'parent'      => 0,
        'Role::Basic' => 0,
        'Template'    => 0,
        'JSON'        => 0,
        'CGI::Fast'   => 0,
        'CGI::Cookie' => 0,

        'Authen::Simple' => 0,
        'Scalar::Util'   => 0,
        'Time::HiRes'    => 0,
        'Try::Tiny'      => 0,
        'Spawn::Safe'    => 0,

        'Log::Log4perl'         => 0,
        'Log::Dispatch::Syslog' => 0,

    },

    recommends => {
        'Authen::Simple::RADIUS' => 0,

META.json  view on Meta::CPAN

            "CGI::Cookie" : 0,
            "CGI::Fast" : 0,
            "JSON" : 0,
            "Log::Dispatch::Syslog" : 0,
            "Log::Log4perl" : 0,
            "Role::Basic" : 0,
            "Scalar::Util" : 0,
            "Spawn::Safe" : 0,
            "Template" : 0,
            "Time::HiRes" : 0,
            "Try::Tiny" : 0,
            "parent" : 0
         }
      }
   },
   "provides" : {
      "Captive::Portal" : {
         "file" : "lib/Captive/Portal.pm",
         "version" : "4.10"
      },
      "Captive::Portal::LockHandle" : {

META.yml  view on Meta::CPAN

  CGI::Cookie: 0
  CGI::Fast: 0
  JSON: 0
  Log::Dispatch::Syslog: 0
  Log::Log4perl: 0
  Role::Basic: 0
  Scalar::Util: 0
  Spawn::Safe: 0
  Template: 0
  Time::HiRes: 0
  Try::Tiny: 0
  parent: 0
resources:
  license: http://dev.perl.org/licenses/
version: 4.10

bin/capo-ctl.pl  view on Meta::CPAN

=cut

use sigtrap qw(die untrapped normal-signals);

use Pod::Usage qw(pod2usage);
use FindBin qw($Bin $Script);
use lib "$Bin/../lib";

use Log::Log4perl qw(:easy);
use Getopt::Long qw(GetOptions);
use Try::Tiny;
use Captive::Portal;
use Captive::Portal::LockHandle;

$ENV{PATH} = '/sbin:/bin:/usr/sbin:/usr/bin';

select(STDERR) and $| = 1;
select(STDOUT) and $| = 1;

#####################################################################
# put scriptname in process table instead of plain 'perl'

lib/Captive/Portal.pm  view on Meta::CPAN

The firewall rules and commands are also generated from template files. Normally there is no need to change the firewall rules but it would be possible to add some local needed additional rules without changing the perl code. Be careful, you must und...

=head1 I18N

There exists a template tree for each supported language. Some system/error messages used by the program must also be translated for the message catalog in the config file.

=cut

use POSIX qw(strftime);
use Log::Log4perl qw(:easy);
use Try::Tiny;
use Template;

# consume CaPo roles
use Role::Basic qw(with);
with qw(
  Captive::Portal::Role::Config
  Captive::Portal::Role::Utils
  Captive::Portal::Role::I18N
  Captive::Portal::Role::AuthenSimple
  Captive::Portal::Role::Session

lib/Captive/Portal/LockHandle.pm  view on Meta::CPAN


=head1 NAME

Captive::Portal::LockHandle - lock handling for Captive::Portal

=cut

our $VERSION = '4.10';

use Log::Log4perl qw(:easy);
use Try::Tiny;
use Time::HiRes qw(usleep ualarm);
use Fcntl qw(:flock O_CREAT O_RDWR);

use parent qw(FileHandle);

=head1 DESCRIPTION

Inherit from FileHandle, add locking and DESTROY().

=head1 CONSTRUCTION and DESTROY

lib/Captive/Portal/Role/AuthenSimple.pm  view on Meta::CPAN

=head1 NAME

Captive::Portal::Role::AuthenSimple - Authen::Simple adapter for Captive::Portal

=cut

our $VERSION = '4.10';

use Log::Log4perl qw(:easy);
use Authen::Simple qw();
use Try::Tiny;

use Role::Basic;
requires qw(cfg);

my $authen_singleton;

=head1 DESCRIPTION

CaPo authentication is based on the pluggable Authen::Simple framework.

lib/Captive/Portal/Role/Firewall.pm  view on Meta::CPAN


=head1 DESCRIPTION

Does all stuff needed to dynamically update iptables and ipset.

=cut

our $VERSION = '4.10';

use Log::Log4perl qw(:easy);
use Try::Tiny;

use Role::Basic;
requires qw(
  cfg
  spawn_cmd
  list_sessions_from_disk
  get_session_lock_handle
  read_session_handle
  delete_session_from_disk
);

lib/Captive/Portal/Role/Session.pm  view on Meta::CPAN

=head1 NAME

Captive::Portal::Role::Session - session methods for Captive::Portal

=cut

our $VERSION = '4.10';

use Log::Log4perl qw(:easy);
use JSON qw();
use Try::Tiny;
use Digest::MD5 qw(md5_hex);
use Captive::Portal::LockHandle;

use Role::Basic;
requires qw(
  cfg
  spawn_cmd
  normalize_ip
  find_mac
);

lib/Captive/Portal/Role/Utils.pm  view on Meta::CPAN

=head1 NAME

Captive::Portal::Role::Utils - common utils for Captive::Portal

=cut

our $VERSION = '4.10';

use Log::Log4perl qw(:easy);
use Spawn::Safe qw(spawn_safe);
use Try::Tiny;
use Socket qw(inet_ntoa);
use Net::hostent;
use Template::Exception;

use Role::Basic;
requires qw(cfg);

=head1 DESCRIPTION

Utility roles needed by other modules. All roles die on error.

t/002_utils.t  view on Meta::CPAN

use strict;
use warnings;

use Test::More;
use Try::Tiny;

use_ok('Captive::Portal::Role::Utils');

# enable this code fragment to get DEBUG logging for this tests

=pod

my $log4perl_conf = <<EO_CONF;
log4perl.logger                 = DEBUG, screen
log4perl.appender.screen   = Log::Log4perl::Appender::Screen

t/004_config.t  view on Meta::CPAN

use strict;
use warnings;

use Test::More;
use Try::Tiny;

use_ok('Captive::Portal');
my $capo;

my $error;
try { $capo = Captive::Portal->new( cfg_file => 't/etc/fail.pl' ) }
catch { $error = $_ };
like( $error, qr/syntax error/i, 'syntax error in t/etc/fail.pl' );

undef $error;

t/005_locking.t  view on Meta::CPAN

use strict;
use warnings;

use Test::More;
use Try::Tiny;

use_ok('Captive::Portal');
use_ok('Captive::Portal::LockHandle');

my ( $capo, $ip, $mac, $error );

ok( $capo = Captive::Portal->new( cfg_file => 't/etc/ok.pl' ),
    'successfull parse t/etc/ok.pl' );

undef $error;



( run in 1.102 second using v1.01-cache-2.11-cpan-05444aca049 )