# HG changeset patch # User Heiko Schlittermann # Date 1279293142 -7200 # Node ID 2407e371ec7a7764e1b96868d460472a125311af # Parent 90735b404da2bc10a019c8ebd7a37d6ffa06cd12 [savepoint] diff -r 90735b404da2 -r 2407e371ec7a README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Fri Jul 16 17:12:22 2010 +0200 @@ -0,0 +1,17 @@ +The checks should ensure that configuration changes to exim didn't break +anything. + +Several types of checks should be performed: + +* ROUTING +* ACCESS +* AUTHENTICATION + + +Which parameters do we need to set for checking? +Which parameters influence Routing, Access Control and Authentication? + +First we could focus on simple -bt or -bv checks. But this does not +suffice, since even routing could depend on source IP, sender address +and so on. + diff -r 90735b404da2 -r 2407e371ec7a lib/.perltidyrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/.perltidyrc Fri Jul 16 17:12:22 2010 +0200 @@ -0,0 +1,2 @@ +--paren-tightness=2 +--square-bracket-tightness=2 diff -r 90735b404da2 -r 2407e371ec7a lib/Exim.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/Exim.pm Fri Jul 16 17:12:22 2010 +0200 @@ -0,0 +1,58 @@ +package Exim; + +use strict; +use warnings; +use Carp; + +my %basename; +my %binary; +my %config; + +sub new { + my $class = ref $_[0] ? ref shift : shift; + + bless my $self = \my $anonymous => $class; + my %arg = @_; + + $basename{$self} = $arg{basename} ? $arg{basename} : "exim4"; + $config{$self} = $arg{config} ? $arg{config} : "$arg{basename}.conf"; + $binary{$self} = $self->_find_exim; + + return $self; +} + +sub binary { + my $self = shift; + return $binary{$self}; +} + +sub run { + my $self = shift; + return qx/$binary{$self} -C $config{$self} @_/; +} + +sub get { + my $self = shift; + chomp(local $_ = $self->run(-bP => shift)); + croak $_ unless /=/; + return /=\s*(.*)/; +} + +sub DESTROY { + my $self = shift; + delete $basename{$self}; + delete $binary{$self}; + delete $config{$self}; +} + +sub _find_exim { + my $self = shift; + my %seen; + foreach (split /:/, "$ENV{PATH}:/usr/local/sbin:/usr/sbin:/sbin") { + next if $seen{$_}; + return "$_/$basename{$self}" if -x "$_/$basename{$self}"; + } + croak "Can't find the exim binary ($basename{$self})\n"; +} + +1; diff -r 90735b404da2 -r 2407e371ec7a run --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run Fri Jul 16 17:12:22 2010 +0200 @@ -0,0 +1,11 @@ +#! /usr/bin/perl + +use strict; +use warnings; + +use lib "lib"; +use Exim; + +my $exim = new Exim(basename => "exim4", config => "/etc/exim4/exim4.conf"); + +print $exim->get("spool_directory");