Mail-Milter-Authentication

 view release on metacpan or  search on metacpan

bin/authentication_milter  view on Meta::CPAN

            "timeout_in"  : "10",
            "timeout_out" : "10"
        }

    },

                                                        | Timeouts for callbacks, should be slightly lower
                                                        | than the corresponding timeouts in Postfix
                                                        | Timeouts are ignored if missing.
    "connect_timeout"       : 30,                       | Timeout for Connect callbacks
    "command_timeout"       : 30,                       | Timeout for Helo,Mail,Rcpt,Data and Unknown callbacks
    "content_timeout"       : 300,                      | Timeout for Header,Eoh, Body and Eom callbacksa

    "dns_resolvers"         : [                         | Explicit list of DNS resolvers to use
        "8.8.8.8",
        "127.0.0.1"
    ],
    "dns_timeout"           : 10,                       | Timeout for DNS lookups
    "dns_retry"             : 2,                        | Number of times a lookup will retry per call

    "tempfail_on_error"               : "1",            | Tempfail on errors

lib/Mail/Milter/Authentication/Config.pm  view on Meta::CPAN

        'runas'                           => 'nobody',
        'rungroup'                        => 'nogroup',
        'listen_backlog'                  => 20,
        'min_children'                    => 20,
        'max_children'                    => 200,
        'min_spare_children'              => 10,
        'max_spare_children'              => 20,
        'max_requests_per_child'          => 200,
        'protocol'                        => 'milter',
        'connect_timeout'                 => 30,
        'command_timeout'                 => 30,
        'content_timeout'                 => 300,
        'addheader_timeout'               => 30,
        'dns_timeout'                     => 10,
        'dns_retry'                       => 2,
        'tempfail_on_error'               => '1',
        'tempfail_on_error_authenticated' => '0',
        'tempfail_on_error_local'         => '0',
        'tempfail_on_error_trusted'       => '0',
        'handlers'                        => {}
    };

lib/Mail/Milter/Authentication/Handler.pm  view on Meta::CPAN


    # On HELO
    my ( $self, $helo_host ) = @_;
    $self->status('helo');
    $self->dbgout( 'CALLBACK', 'Helo', LOG_DEBUG );
    $self->set_return( $self->smfis_continue() );
    $helo_host = q{} if not $helo_host;
    my $config = $self->config();
    eval {
        local $SIG{'ALRM'} = sub{ die "Timeout\n" };
        if ( $config->{'command_timeout'} ) {
            alarm( $config->{'command_timeout'} );
        }

        # Take only the first HELO from a connection
        if ( !( $self->{'helo_name'} ) ) {
            $self->{'helo_name'} = $helo_host;
            my $callbacks = $self->get_callbacks( 'helo' );
            foreach my $handler ( @$callbacks ) {
                my $start_time = $self->get_microseconds();
                eval{ $self->get_handler($handler)->helo_callback($helo_host); };
                if ( my $error = $@ ) {

lib/Mail/Milter/Authentication/Handler.pm  view on Meta::CPAN

    # On MAILFROM
    #...
    my ( $self, $env_from ) = @_;
    $self->status('envfrom');
    $self->dbgout( 'CALLBACK', 'EnvFrom', LOG_DEBUG );
    $self->set_return( $self->smfis_continue() );
    $env_from = q{} if not $env_from;
    my $config = $self->config();
    eval {
        local $SIG{'ALRM'} = sub{ die "Timeout\n" };
        if ( $config->{'command_timeout'} ) {
            alarm( $config->{'command_timeout'} );
        }

        # Reset private data for this MAIL transaction
        delete $self->{'auth_headers'};
        delete $self->{'pre_headers'};
        delete $self->{'add_headers'};

        my $callbacks = $self->get_callbacks( 'envfrom' );
        foreach my $handler ( @$callbacks ) {
            my $start_time = $self->get_microseconds();

lib/Mail/Milter/Authentication/Handler.pm  view on Meta::CPAN

    # On RCPTTO
    #...
    my ( $self, $env_to ) = @_;
    $self->status('envrcpt');
    $self->dbgout( 'CALLBACK', 'EnvRcpt', LOG_DEBUG );
    $self->set_return( $self->smfis_continue() );
    $env_to = q{} if not $env_to;
    my $config = $self->config();
    eval {
        local $SIG{'ALRM'} = sub{ die "Timeout\n" };
        if ( $config->{'command_timeout'} ) {
            alarm( $config->{'command_timeout'} );
        }
        my $callbacks = $self->get_callbacks( 'envrcpt' );
        foreach my $handler ( @$callbacks ) {
            my $start_time = $self->get_microseconds();
            eval{ $self->get_handler($handler)->envrcpt_callback($env_to); };
            if ( my $error = $@ ) {
                $self->log_error( 'Rcpt To callback error ' . $error );
                $self->exit_on_close();
                $self->tempfail_on_error();
                $self->metric_count( 'callback_error_total', { 'stage' => 'rcptto', 'handler' => $handler } );

lib/Mail/Milter/Authentication/Handler.pm  view on Meta::CPAN

sub top_abort_callback {

    # On any out of our control abort
    my ($self) = @_;
    $self->status('abort');
    $self->dbgout( 'CALLBACK', 'Abort', LOG_DEBUG );
    $self->set_return( $self->smfis_continue() );
    my $config = $self->config();
    eval {
        local $SIG{'ALRM'} = sub{ die "Timeout\n" };
        if ( $config->{'command_timeout'} ) {
            alarm( $config->{'command_timeout'} );
        }
        my $callbacks = $self->get_callbacks( 'abort' );
        foreach my $handler ( @$callbacks ) {
            my $start_time = $self->get_microseconds();
            eval{ $self->get_handler($handler)->abort_callback(); };
            if ( my $error = $@ ) {
                $self->log_error( 'Abort callback error ' . $error );
                $self->exit_on_close();
                $self->tempfail_on_error();
                $self->metric_count( 'callback_error_total', { 'stage' => 'abort', 'handler' => $handler } );

share/authentication_milter.json  view on Meta::CPAN

    "chroot"                 : "",

    "listen_backlog"         : 20,
    "min_children"           : 20,
    "max_children"           : 200,
    "min_spare_children"     : 10,
    "max_spare_children"     : 20,
    "max_requests_per_child" : 200,

    "connect_timeout"       : 30,
    "command_timeout"       : 30,
    "content_timeout"       : 300,
    "dns_timeout"           : 10,
    "dns_retry"             : 2,

    "tempfail_on_error"               : "1",
    "tempfail_on_error_authenticated" : "0",
    "tempfail_on_error_local"         : "0",
    "tempfail_on_error_trusted"       : "0",

    "handlers" : {

t/config/dmarc_reject.smtp/authentication_milter.json  view on Meta::CPAN

# Test configuration for auth milter smtp
{

    "debug"                           : 0,
    "dryrun"                          : 0,
    "logtoerr"                        : 0,
    "error_log"                       : "tmp/smtp.err",
    "connection"                      : "unix:tmp/authentication_milter_test.sock",
    "umask"                           : "0000",
    "connect_timeout"                 : 55,
    "command_timeout"                 : 55,
    "content_timeout"                 : 595,
    "tempfail_on_error"               : 1,
    "tempfail_on_error_authenticated" : 1,
    "tempfail_on_error_local"         : 1,
    "tempfail_on_error_trusted"       : 1,

    "metric_connection"               : "unix:tmp/authentication_milter_test_metrics.sock",
    "metric_umask"                    : "0000",

    "protocol" : "smtp",

t/config/dmarc_reject/authentication_milter.json  view on Meta::CPAN

# Test configuration for auth milter
{

    "debug"                           : 0,
    "dryrun"                          : 0,
    "logtoerr"                        : 0,
    "error_log"                       : "tmp/milter.err",
    "connection"                      : "unix:tmp/authentication_milter_test.sock",
    "umask"                           : "0000",
    "connect_timeout"                 : 55,
    "command_timeout"                 : 55,
    "content_timeout"                 : 595,
    "tempfail_on_error"               : 1,
    "tempfail_on_error_authenticated" : 1,
    "tempfail_on_error_local"         : 1,
    "tempfail_on_error_trusted"       : 1,

    "metric_connection"               : "unix:tmp/authentication_milter_test_metrics.sock",
    "metric_umask"                    : "0000",

    "listen_backlog"         : 1,

t/config/dmarc_reject_wl.smtp/authentication_milter.json  view on Meta::CPAN

# Test configuration for auth milter smtp
{

    "debug"                           : 0,
    "dryrun"                          : 0,
    "logtoerr"                        : 0,
    "error_log"                       : "tmp/smtp.err",
    "connection"                      : "unix:tmp/authentication_milter_test.sock",
    "umask"                           : "0000",
    "connect_timeout"                 : 55,
    "command_timeout"                 : 55,
    "content_timeout"                 : 595,
    "tempfail_on_error"               : 1,
    "tempfail_on_error_authenticated" : 1,
    "tempfail_on_error_local"         : 1,
    "tempfail_on_error_trusted"       : 1,

    "metric_connection"               : "unix:tmp/authentication_milter_test_metrics.sock",
    "metric_umask"                    : "0000",

    "protocol" : "smtp",

t/config/dmarc_reject_wl/authentication_milter.json  view on Meta::CPAN

# Test configuration for auth milter
{

    "debug"                           : 0,
    "dryrun"                          : 0,
    "logtoerr"                        : 0,
    "error_log"                       : "tmp/milter.err",
    "connection"                      : "unix:tmp/authentication_milter_test.sock",
    "umask"                           : "0000",
    "connect_timeout"                 : 55,
    "command_timeout"                 : 55,
    "content_timeout"                 : 595,
    "tempfail_on_error"               : 1,
    "tempfail_on_error_authenticated" : 1,
    "tempfail_on_error_local"         : 1,
    "tempfail_on_error_trusted"       : 1,

    "metric_connection"               : "unix:tmp/authentication_milter_test_metrics.sock",
    "metric_umask"                    : "0000",

    "listen_backlog"         : 1,

t/config/dryrun.smtp/authentication_milter.json  view on Meta::CPAN

# Test configuration for auth milter smtp dryrun
{

    "debug"                           : 0,
    "dryrun"                          : 1,
    "logtoerr"                        : 0,
    "error_log"                       : "tmp/smtp.dryrun.err",
    "connection"                      : "unix:tmp/authentication_milter_test.sock",
    "umask"                           : "0000",
    "connect_timeout"                 : 55,
    "command_timeout"                 : 55,
    "content_timeout"                 : 595,
    "tempfail_on_error"               : 1,
    "tempfail_on_error_authenticated" : 1,
    "tempfail_on_error_local"         : 1,
    "tempfail_on_error_trusted"       : 1,

    "metric_connection"               : "unix:tmp/authentication_milter_test_metrics.sock",
    "metric_umask"                    : "0000",

    "protocol" : "smtp",

t/config/dryrun/authentication_milter.json  view on Meta::CPAN

# Test configuration for auth milter dryrun
{

    "debug"                           : 0,
    "dryrun"                          : 1,
    "logtoerr"                        : 0,
    "error_log"                       : "tmp/milter.dryrun.err",
    "connection"                      : "unix:tmp/authentication_milter_test.sock",
    "umask"                           : "0000",
    "connect_timeout"                 : 55,
    "command_timeout"                 : 55,
    "content_timeout"                 : 595,
    "tempfail_on_error"               : 1,
    "tempfail_on_error_authenticated" : 1,
    "tempfail_on_error_local"         : 1,
    "tempfail_on_error_trusted"       : 1,

    "metric_connection"               : "unix:tmp/authentication_milter_test_metrics.sock",
    "metric_umask"                    : "0000",

    "listen_backlog"         : 1,

t/config/normal.smtp/authentication_milter.json  view on Meta::CPAN

# Test configuration for auth milter smtp
{

    "debug"                           : 0,
    "dryrun"                          : 0,
    "logtoerr"                        : 0,
    "error_log"                       : "tmp/smtp.err",
    "connection"                      : "unix:tmp/authentication_milter_test.sock",
    "umask"                           : "0000",
    "connect_timeout"                 : 55,
    "command_timeout"                 : 55,
    "content_timeout"                 : 595,
    "tempfail_on_error"               : 1,
    "tempfail_on_error_authenticated" : 1,
    "tempfail_on_error_local"         : 1,
    "tempfail_on_error_trusted"       : 1,

    "metric_connection"               : "unix:tmp/authentication_milter_test_metrics.sock",
    "metric_umask"                    : "0000",

    "protocol" : "smtp",

t/config/normal/authentication_milter.json  view on Meta::CPAN

# Test configuration for auth milter
{

    "debug"                           : 0,
    "dryrun"                          : 0,
    "logtoerr"                        : 0,
    "error_log"                       : "tmp/milter.err",
    "connection"                      : "unix:tmp/authentication_milter_test.sock",
    "umask"                           : "0000",
    "connect_timeout"                 : 55,
    "command_timeout"                 : 55,
    "content_timeout"                 : 595,
    "tempfail_on_error"               : 1,
    "tempfail_on_error_authenticated" : 1,
    "tempfail_on_error_local"         : 1,
    "tempfail_on_error_trusted"       : 1,

    "metric_connection"               : "unix:tmp/authentication_milter_test_metrics.sock",
    "metric_umask"                    : "0000",

    "listen_backlog"         : 1,

t/config/timeout/authentication_milter.json  view on Meta::CPAN

# Test configuration for auth milter dryrun
{

    "debug"                           : 0,
    "dryrun"                          : 1,
    "logtoerr"                        : 0,
    "error_log"                       : "tmp/milter.dryrun.err",
    "connection"                      : "unix:tmp/authentication_milter_test.sock",
    "umask"                           : "0000",
    "connect_timeout"                 : 1,
    "command_timeout"                 : 1,
    "content_timeout"                 : 1,
    "tempfail_on_error"               : 1,
    "tempfail_on_error_authenticated" : 1,
    "tempfail_on_error_local"         : 1,
    "tempfail_on_error_trusted"       : 1,

    "metric_connection"               : "unix:tmp/authentication_milter_test_metrics.sock",
    "metric_umask"                    : "0000",

    "listen_backlog"         : 1,



( run in 0.648 second using v1.01-cache-2.11-cpan-a5abf4f5562 )