hostnames come in lower case, and might even be longer than 8 characters
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@909 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
parent
b3eacea14f
commit
6563dcc4f8
2
log/run
2
log/run
@ -1,5 +1,5 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
export LOGDIR=./main
|
export LOGDIR=./main
|
||||||
mkdir -p $LOGDIR
|
mkdir -p $LOGDIR
|
||||||
exec multilog t s1000000 n20 $LOGDIR
|
exec multilog t s10000000 n40 $LOGDIR
|
||||||
|
|
||||||
|
@ -67,6 +67,10 @@ The username to pass to spamd, if different from the user qpsmtpd runs as.
|
|||||||
|
|
||||||
=back
|
=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
|
With both of the first options the configuration line will look like the following
|
||||||
|
|
||||||
spamasssasin reject_threshold 18 munge_subject_threshold 8
|
spamasssasin reject_threshold 18 munge_subject_threshold 8
|
||||||
@ -96,6 +100,7 @@ sub register {
|
|||||||
$self->register_hook("data_post", "check_spam_munge_subject")
|
$self->register_hook("data_post", "check_spam_munge_subject")
|
||||||
if $self->{_args}->{munge_subject_threshold};
|
if $self->{_args}->{munge_subject_threshold};
|
||||||
|
|
||||||
|
$self->{timeout} = $self->{_args}->{timeout} || 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub hook_data_post { # check_spam
|
sub hook_data_post { # check_spam
|
||||||
@ -138,6 +143,14 @@ sub hook_data_post { # check_spam
|
|||||||
|
|
||||||
SPAMD->autoflush(1);
|
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;
|
$transaction->body_resetpos;
|
||||||
my $username = $self->{_args}->{spamd_user} || getpwuid($>);
|
my $username = $self->{_args}->{spamd_user} || getpwuid($>);
|
||||||
|
|
||||||
@ -186,6 +199,7 @@ sub hook_data_post { # check_spam
|
|||||||
|
|
||||||
}
|
}
|
||||||
my $tests = <SPAMD>;
|
my $tests = <SPAMD>;
|
||||||
|
alarm 0;
|
||||||
$tests =~ s/\015//; # hack for outlook
|
$tests =~ s/\015//; # hack for outlook
|
||||||
$flag = $flag eq 'True' ? 'Yes' : 'No';
|
$flag = $flag eq 'True' ? 'Yes' : 'No';
|
||||||
$self->log(LOGDEBUG, "check_spam: finished reading from spamd");
|
$self->log(LOGDEBUG, "check_spam: finished reading from spamd");
|
||||||
|
@ -323,11 +323,11 @@ sub data_handler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ($l =~ m{
|
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. ...
|
[a-zA-Z0-9][a-zA-Z0-9\-.]+\. # hostname. ...
|
||||||
(?:com|net|org|biz|info|[a-zA-Z]{2,2}))(?!\w) # (cc)TLD
|
(?:com|net|org|biz|info|[a-zA-Z]{2,2}))(?!\w) # (cc)TLD
|
||||||
}gx) {
|
}gix) {
|
||||||
my $host = $1;
|
my $host = lc $1;
|
||||||
my @host_domains = split /\./, $host;
|
my @host_domains = split /\./, $host;
|
||||||
$self->log(LOGDEBUG, "uribl: matched 'www.' hostname $host");
|
$self->log(LOGDEBUG, "uribl: matched 'www.' hostname $host");
|
||||||
|
|
||||||
@ -352,9 +352,9 @@ sub data_handler {
|
|||||||
while ($l =~ m{
|
while ($l =~ m{
|
||||||
\w{3,16}:/+ # protocol
|
\w{3,16}:/+ # protocol
|
||||||
(?:\S+@)? # user/pass
|
(?:\S+@)? # user/pass
|
||||||
([\w\-.]+\.[a-zA-Z]{2,8}) # hostname
|
([\w\-.]+\.[a-zA-Z]{2,32}) # hostname
|
||||||
}gx) {
|
}gx) {
|
||||||
my $host = $1;
|
my $host = lc $1;
|
||||||
my @host_domains = split /\./, $host;
|
my @host_domains = split /\./, $host;
|
||||||
$self->log(LOGDEBUG, "uribl: matched full URI hostname $host");
|
$self->log(LOGDEBUG, "uribl: matched full URI hostname $host");
|
||||||
|
|
||||||
|
2
qpsmtpd
2
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.
|
# Copyright (c) 2001 Ask Bjoern Hansen. See the LICENSE file for details.
|
||||||
# The "command dispatch" system is taken from colobus - http://trainedmonkey.com/colobus/
|
# The "command dispatch" system is taken from colobus - http://trainedmonkey.com/colobus/
|
||||||
#
|
#
|
||||||
|
34
run
34
run
@ -1,8 +1,42 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
QMAILDUID=`id -u smtpd`
|
QMAILDUID=`id -u smtpd`
|
||||||
NOFILESGID=`id -g 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 \
|
exec /usr/local/bin/softlimit -m 25000000 \
|
||||||
/usr/local/bin/tcpserver -c 10 -v -R -p \
|
/usr/local/bin/tcpserver -c 10 -v -R -p \
|
||||||
-u $QMAILDUID -g $NOFILESGID `head -1 config/IP` smtp \
|
-u $QMAILDUID -g $NOFILESGID `head -1 config/IP` smtp \
|
||||||
./qpsmtpd 2>&1
|
./qpsmtpd 2>&1
|
||||||
|
|
||||||
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user