added new t/config directory, with developer tests
run when $ENV{QPSMTPD_DEVELOPER} is set plugins file is same as in config.sample, but with more stuff enabled
This commit is contained in:
parent
980c2a28bb
commit
9c1e62371b
@ -1,2 +1,3 @@
|
|||||||
|
# example entries
|
||||||
good@example.com:good_pass
|
good@example.com:good_pass
|
||||||
bad@example.com:bad_pass
|
bad@example.com:bad_pass
|
||||||
|
@ -69,6 +69,7 @@ sub input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub config_dir {
|
sub config_dir {
|
||||||
|
return './t/config' if $ENV{QPSMTPD_DEVELOPER};
|
||||||
'./config.sample';
|
'./config.sample';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
t/config.t
15
t/config.t
@ -5,12 +5,17 @@ use strict;
|
|||||||
use lib 't';
|
use lib 't';
|
||||||
use_ok('Test::Qpsmtpd');
|
use_ok('Test::Qpsmtpd');
|
||||||
|
|
||||||
|
my @mes;
|
||||||
|
|
||||||
BEGIN { # need this to happen before anything else
|
BEGIN { # need this to happen before anything else
|
||||||
my $cwd = `pwd`;
|
my $cwd = `pwd`;
|
||||||
chomp($cwd);
|
chomp($cwd);
|
||||||
open my $me_config, '>', "./config.sample/me";
|
@mes = qw{ ./config.sample/me ./t/config/me };
|
||||||
print $me_config "some.host.example.org";
|
foreach my $f ( @mes ) {
|
||||||
close $me_config;
|
open my $me_config, '>', $f;
|
||||||
|
print $me_config "some.host.example.org";
|
||||||
|
close $me_config;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
ok(my ($smtpd, $conn) = Test::Qpsmtpd->new_conn(), "get new connection");
|
ok(my ($smtpd, $conn) = Test::Qpsmtpd->new_conn(), "get new connection");
|
||||||
@ -22,6 +27,8 @@ is($smtpd->config('me'), 'some.host.example.org', 'config("me")');
|
|||||||
my $relayclients = join ",", sort $smtpd->config('relayclients');
|
my $relayclients = join ",", sort $smtpd->config('relayclients');
|
||||||
is($relayclients, '127.0.0.1,192.0.', 'config("relayclients") are trimmed');
|
is($relayclients, '127.0.0.1,192.0.', 'config("relayclients") are trimmed');
|
||||||
|
|
||||||
unlink "./config.sample/me";
|
foreach my $f ( @mes ) {
|
||||||
|
unlink $f if -f $f;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
4
t/config/badhelo
Normal file
4
t/config/badhelo
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# these domains never uses their domain when greeting us, so reject transactions
|
||||||
|
aol.com
|
||||||
|
yahoo.com
|
||||||
|
|
9
t/config/badrcptto
Normal file
9
t/config/badrcptto
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
######## entries used for testing ###
|
||||||
|
bad@example.com
|
||||||
|
@bad.example.com
|
||||||
|
######## Example patterns #######
|
||||||
|
# Format is pattern\s+Response
|
||||||
|
# Don't forget to anchor the pattern if required
|
||||||
|
! Sorry, bang paths not accepted here
|
||||||
|
@.*@ Sorry, multiple at signs not accepted here
|
||||||
|
% Sorry, percent hack not accepted here
|
1
t/config/dnsbl_zones
Normal file
1
t/config/dnsbl_zones
Normal file
@ -0,0 +1 @@
|
|||||||
|
zen.spamhaus.org
|
2
t/config/flat_auth_pw
Normal file
2
t/config/flat_auth_pw
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
good@example.com:good_pass
|
||||||
|
bad@example.com:bad_pass
|
94
t/config/plugins
Normal file
94
t/config/plugins
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
#
|
||||||
|
# Example configuration file for plugins
|
||||||
|
#
|
||||||
|
|
||||||
|
# enable this to get configuration via http; see perldoc
|
||||||
|
# plugins/http_config for details.
|
||||||
|
# http_config http://localhost/~smtpd/config/ http://www.example.com/smtp.pl?config=
|
||||||
|
|
||||||
|
# hosts_allow does not work with the tcpserver deployment model!
|
||||||
|
# perldoc plugins/hosts_allow for an alternative.
|
||||||
|
#
|
||||||
|
# The hosts_allow module must be loaded if you want the -m / --max-from-ip /
|
||||||
|
# my $MAXCONNIP = 5; # max simultaneous connections from one IP
|
||||||
|
# settings... without this it will NOT refuse more than $MAXCONNIP connections
|
||||||
|
# from one IP!
|
||||||
|
hosts_allow
|
||||||
|
|
||||||
|
# information plugins
|
||||||
|
ident/geoip
|
||||||
|
#ident/p0f /tmp/.p0f_socket version 3
|
||||||
|
connection_time
|
||||||
|
|
||||||
|
# enable to accept MAIL FROM:/RCPT TO: addresses without surrounding <>
|
||||||
|
dont_require_anglebrackets
|
||||||
|
|
||||||
|
# enable to reject MAIL FROM:/RCPT TO: parameters if client helo was HELO
|
||||||
|
# (strict RFC 821)... this is not used in EHLO ...
|
||||||
|
parse_addr_withhelo
|
||||||
|
|
||||||
|
quit_fortune
|
||||||
|
# tls should load before count_unrecognized_commands
|
||||||
|
#tls
|
||||||
|
check_earlytalker
|
||||||
|
count_unrecognized_commands 4
|
||||||
|
check_relay
|
||||||
|
|
||||||
|
require_resolvable_fromhost
|
||||||
|
|
||||||
|
rhsbl
|
||||||
|
dnsbl
|
||||||
|
check_badmailfrom
|
||||||
|
check_badrcptto
|
||||||
|
check_spamhelo
|
||||||
|
|
||||||
|
sender_permitted_from
|
||||||
|
greylisting p0f genre,windows
|
||||||
|
|
||||||
|
auth/auth_checkpassword checkpw /usr/local/vpopmail/bin/vchkpw true /usr/bin/true
|
||||||
|
auth/auth_vpopmail
|
||||||
|
auth/auth_vpopmaild
|
||||||
|
auth/auth_vpopmail_sql
|
||||||
|
auth/auth_flat_file
|
||||||
|
auth/authdeny
|
||||||
|
|
||||||
|
# this plugin needs to run after all other "rcpt" plugins
|
||||||
|
rcpt_ok
|
||||||
|
|
||||||
|
check_basicheaders days 5 reject_type temp
|
||||||
|
domainkeys
|
||||||
|
|
||||||
|
# content filters
|
||||||
|
virus/klez_filter
|
||||||
|
|
||||||
|
|
||||||
|
# You can run the spamassassin plugin with options. See perldoc
|
||||||
|
# plugins/spamassassin for details.
|
||||||
|
#
|
||||||
|
spamassassin
|
||||||
|
|
||||||
|
# rejects mails with a SA score higher than 20 and munges the subject
|
||||||
|
# of the score is higher than 10.
|
||||||
|
#
|
||||||
|
# spamassassin reject_threshold 20 munge_subject_threshold 10
|
||||||
|
|
||||||
|
# dspam must run after spamassassin for the learn_from_sa feature to work
|
||||||
|
dspam learn_from_sa 7 reject 1
|
||||||
|
|
||||||
|
# run the clamav virus checking plugin
|
||||||
|
virus/clamav
|
||||||
|
|
||||||
|
# You must enable a queue plugin - see the options in plugins/queue/ - for example:
|
||||||
|
|
||||||
|
# queue to a maildir
|
||||||
|
# queue/maildir /home/spamtrap/mail
|
||||||
|
|
||||||
|
# queue the mail with qmail-queue
|
||||||
|
queue/qmail-queue
|
||||||
|
|
||||||
|
|
||||||
|
# If you need to run the same plugin multiple times, you can do
|
||||||
|
# something like the following
|
||||||
|
# check_relay
|
||||||
|
# check_relay:0 somearg
|
||||||
|
# check_relay:1 someotherarg
|
1
t/config/rcpthosts
Normal file
1
t/config/rcpthosts
Normal file
@ -0,0 +1 @@
|
|||||||
|
localhost
|
5
t/config/relayclients
Normal file
5
t/config/relayclients
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Format is IP, or IP part with trailing dot
|
||||||
|
# e.g. "127.0.0.1", or "192.168."
|
||||||
|
127.0.0.1
|
||||||
|
# leading/trailing whitespace is ignored
|
||||||
|
192.168.
|
@ -7,3 +7,11 @@ my $qp = Test::Qpsmtpd->new();
|
|||||||
|
|
||||||
$qp->run_plugin_tests();
|
$qp->run_plugin_tests();
|
||||||
|
|
||||||
|
foreach my $file (
|
||||||
|
"./t/config/greylist.dbm",
|
||||||
|
"./t/config/greylist.dbm.lock"
|
||||||
|
) {
|
||||||
|
next if ! -f $file;
|
||||||
|
unlink $file;
|
||||||
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user