diff --git a/log/run b/log/run index 5a4d84b..c25d679 100755 --- a/log/run +++ b/log/run @@ -1,5 +1,5 @@ #! /bin/sh export LOGDIR=./main mkdir -p $LOGDIR -exec multilog t s1000000 n20 $LOGDIR +exec multilog t s10000000 n40 $LOGDIR diff --git a/plugins/spamassassin b/plugins/spamassassin index 468b84a..fcad2be 100644 --- a/plugins/spamassassin +++ b/plugins/spamassassin @@ -67,6 +67,10 @@ The username to pass to spamd, if different from the user qpsmtpd runs as. =back +=item timeout [seconds] + +How long to wait for spamd? Default 60 seconds. + With both of the first options the configuration line will look like the following spamasssasin reject_threshold 18 munge_subject_threshold 8 @@ -96,6 +100,7 @@ sub register { $self->register_hook("data_post", "check_spam_munge_subject") if $self->{_args}->{munge_subject_threshold}; + $self->{timeout} = $self->{_args}->{timeout} || 60; } sub hook_data_post { # check_spam @@ -137,6 +142,14 @@ sub hook_data_post { # check_spam $self->log(LOGDEBUG, "check_spam: connected to spamd"); SPAMD->autoflush(1); + + local $SIG{ALRM} = sub { + $self->qp->respond(451, "An error occured while processing your mail. (#SA)"); + $self->log(LOGERROR, "spamassassin timeout"); + exit(1); + }; + + alarm $self->{timeout}; $transaction->body_resetpos; my $username = $self->{_args}->{spamd_user} || getpwuid($>); @@ -186,6 +199,7 @@ sub hook_data_post { # check_spam } my $tests = ; + alarm 0; $tests =~ s/\015//; # hack for outlook $flag = $flag eq 'True' ? 'Yes' : 'No'; $self->log(LOGDEBUG, "check_spam: finished reading from spamd"); diff --git a/plugins/uribl b/plugins/uribl index ac45966..a9454ed 100644 --- a/plugins/uribl +++ b/plugins/uribl @@ -323,11 +323,11 @@ sub data_handler { } } while ($l =~ m{ - ([Ww]{3,3}\.[\w\-.]+\.[a-zA-Z]{2,8}| # www.hostname + ([Ww]{3,3}\.[\w\-.]+\.[a-zA-Z]{2,32}| # www.hostname [a-zA-Z0-9][a-zA-Z0-9\-.]+\. # hostname. ... (?:com|net|org|biz|info|[a-zA-Z]{2,2}))(?!\w) # (cc)TLD - }gx) { - my $host = $1; + }gix) { + my $host = lc $1; my @host_domains = split /\./, $host; $self->log(LOGDEBUG, "uribl: matched 'www.' hostname $host"); @@ -352,9 +352,9 @@ sub data_handler { while ($l =~ m{ \w{3,16}:/+ # protocol (?:\S+@)? # user/pass - ([\w\-.]+\.[a-zA-Z]{2,8}) # hostname + ([\w\-.]+\.[a-zA-Z]{2,32}) # hostname }gx) { - my $host = $1; + my $host = lc $1; my @host_domains = split /\./, $host; $self->log(LOGDEBUG, "uribl: matched full URI hostname $host"); diff --git a/qpsmtpd b/qpsmtpd index b11a489..4cfafd2 100755 --- a/qpsmtpd +++ b/qpsmtpd @@ -1,4 +1,4 @@ -#!/usr/bin/perl -Tw +#!/pkg/bin/perl -Tw # Copyright (c) 2001 Ask Bjoern Hansen. See the LICENSE file for details. # The "command dispatch" system is taken from colobus - http://trainedmonkey.com/colobus/ # diff --git a/run b/run index aa23428..542b360 100755 --- a/run +++ b/run @@ -1,8 +1,42 @@ #!/bin/sh QMAILDUID=`id -u smtpd` NOFILESGID=`id -g smtpd` + +export SLOWROOT=/home/smtpd/slowforward + +method=forkserver + +# robert bumped up max-from-ip to 5 to make postfix on x6 happier. dropped connections to 40 from 90 + +if [ ${method} = "forkserver" ]; then + +exec /usr/local/bin/softlimit -m 25000000 \ + /pkg/bin/perl -T ./qpsmtpd-forkserver \ + --port 25 \ + --limit-connections 40 \ + --user smtpd \ + --listen-address `head -1 config/IP` \ + --max-from-ip 5 \ + 2>&1 + +elif [ ${method} = "prefork" ]; then + +exec /usr/local/bin/softlimit -m 25000000 \ + /pkg/bin/perl -T ./qpsmtpd-prefork \ + --port 25 \ + --user smtpd \ + --interface `head -1 config/IP` \ + --max-from-ip 3 \ + --children 90 \ + --idle-children 10 \ + --pretty-child \ + 2>&1 + +else + exec /usr/local/bin/softlimit -m 25000000 \ /usr/local/bin/tcpserver -c 10 -v -R -p \ -u $QMAILDUID -g $NOFILESGID `head -1 config/IP` smtp \ ./qpsmtpd 2>&1 +fi