ACL-Regex

 view release on metacpan or  search on metacpan

examples/postifx-policy-server.pl  view on Meta::CPAN

#!/usr/bin/perl
#
use IO::Socket;
use threads;
use Proc::Daemon;
use Sys::Syslog qw( :DEFAULT setlogsock);

use Data::Dumper;
use lib( "./" );
use ACL;

# Global config settings
my $TC = 1;
my $debug = 1;
my $port = 12345;
our $pidfile = "/var/run/postfix-policy-server.pid";

examples/postifx-policy-server.pl  view on Meta::CPAN

		print $client "action=dunno\n\n";
	}
}

sub handle_sig_int
{
	unlink( $pidfile );
	exit(0);
}

#openlog('missed-spam-policy', '', 'mail');
#syslog('info', 'launching in daemon mode') if $ARGV[0] eq 'quiet-quick-start';
#Proc::Daemon::Init if $ARGV[0] eq 'quiet-quick-start';

# Attempt to parse in the redirect config

$SIG{INT} = \&handle_sig_int;

# Ignore client disconnects
$SIG{PIPE} = "IGNORE";

open PID, "+>", "$pidfile" or die("Cannot open $pidfile: $!\n");

examples/postifx-policy-server.pl  view on Meta::CPAN

for( 1 .. $TC ){
	my $thread = threads->create( \&process_client, $server );
	push( @threads, $thread );
}

foreach my $thread ( @threads ){
	$thread->join();
}

unlink( $pidfile );
closelog;
exit( 0 );

lib/ACL/Regex.pm  view on Meta::CPAN

=head3 REQUIRED FILE

The required file is supplied to the object during instantiation and will seed
the object with a list of I<required> keys in the hash.  This way, if a key regex
isn't present in the B<ACL REGEX FILE> then the object will fill the hash with
a regex that I<matches all> possibilities.  This is designed to satisfy the regex
string should a key be absent from the action line.

  # This file contains a list of actions, and required attributes
  send-mail=account,ip,group,dow,time
  rwi_login=account,ip,auth_method,dow,time
  create_user=account,ip

=head3 ACTION FILE

A line of B<key>=[B<val>] pairs to be consumed by the ACL object.  These get
massaged so that any action key that doesn't satisfy the B<REQUIRED> fields are
added and the entire string is sorted by key name.

=head1 AUTHOR

t/acl.permit.txt  view on Meta::CPAN

/action=[create-user] group=[(admin|superadmin)]/	Allow admins and superadmins to create users
/action=[delete-user] group=[(super)?admin]/		Allow admins and superadmins to delete users
/action=[login] group=[user]/				Allow users to login
/action=[send-mail] group=[user] dow=[(mon|tue|wed|thu|fri)]/	Allow users to send mail during the work week
/action=[login-app] group=[(super-)?admin] ip=[1.2.3.\d{1,3}] dow=[.*]/	Allow superadmins to login to the app from 1.2.3.0/24
/account=[.*?@.*.adm] action=[login-mac] group=[(super-)?admin]/	Allow mac access to superadmins

t/action.txt  view on Meta::CPAN

action=[send-mail] account=[uwonnotice@example.net] ip=[200.1.2.3] group=[user] dow=[wed]
account=[pblair@example.adm] action=[login_mac] group=[super-admin] dow=[mon] time=[09:00]

t/required.txt  view on Meta::CPAN

# This file contains a list of actions, and required attributes
send-mail=account,ip,group,dow,time
rwi_login=account,ip,auth_method,dow,time
create_user=account,ip



( run in 0.880 second using v1.01-cache-2.11-cpan-49f99fa48dc )