Skip to content

Commit

Permalink
ci: working with Github Actions (#324)
Browse files Browse the repository at this point in the history
- chore: update package metadata
- tests: delete dspam, disable DMARC, earlytalker, geoip, SPF
  • Loading branch information
msimerson authored Jan 16, 2025
1 parent d1043d0 commit da5f60b
Show file tree
Hide file tree
Showing 15 changed files with 86 additions and 162 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI Tests

on:
push:
pull_request:

jobs:
test:
strategy:
matrix:
os: ["ubuntu-latest"]
perl: ["5.16", "5.32"]
fail-fast: false
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 10
fetch-tags: true
- uses: shogo82148/actions-setup-perl@v1
with:
perl-version: ${{ matrix.perl }}
- run: cpanm --installdeps -n -f .
- run: cpanm --installdeps -n -f Mail::SPF Mail::DMARC GeoIP2 ClamAV::Client Redis
- run: prove -lv t
2 changes: 1 addition & 1 deletion .perltidyrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

-i=4 # 4 space indentation (we used to use 2; in the future we'll use 4)
-i=4 # 4 space indentation
-ci=2 # continuation indention

-bbt=0 # open code block curly braces
Expand Down
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

17 changes: 15 additions & 2 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.gitignore
.travis.yml
bin/geolite-mirror-simple.pl
bin/install_deps.pl
Changes
config.sample/add_geoip_headers
config.sample/badhelo
config.sample/badmailfrom
config.sample/badrcptto
Expand All @@ -12,6 +12,7 @@ config.sample/dnsbl_zones
config.sample/flat_auth_pw
config.sample/invalid_resolvable_fromhost
config.sample/IP
config.sample/karma_tlds
config.sample/log2sql
config.sample/logging
config.sample/loglevel
Expand Down Expand Up @@ -43,6 +44,9 @@ lib/Qpsmtpd/Config.pm
lib/Qpsmtpd/ConfigServer.pm
lib/Qpsmtpd/Connection.pm
lib/Qpsmtpd/Constants.pm
lib/Qpsmtpd/DB.pm
lib/Qpsmtpd/DB/File/DBM.pm
lib/Qpsmtpd/DB/Redis.pm
lib/Qpsmtpd/DSN.pm
lib/Qpsmtpd/Plugin.pm
lib/Qpsmtpd/Postfix.pm
Expand All @@ -67,6 +71,7 @@ META.yml Module meta-data (added by MakeMaker)
plugins/auth/auth_checkpassword
plugins/auth/auth_cvm_unix_local
plugins/auth/auth_flat_file
plugins/auth/auth_imap
plugins/auth/auth_ldap_bind
plugins/auth/auth_vpopmail
plugins/auth/auth_vpopmail_sql
Expand Down Expand Up @@ -154,8 +159,10 @@ run.tcpserver
STATUS
t/addresses.t
t/auth.t
t/config/add_geoip_headers
t/config/badhelo
t/config/badrcptto
t/config/content_log_enabled
t/config/dnsbl_allow
t/config/dnsbl_zones
t/config/flat_auth_pw
Expand All @@ -174,6 +181,7 @@ t/misc.t
t/plugin_tests.t
t/plugin_tests/auth/auth_checkpassword
t/plugin_tests/auth/auth_flat_file
t/plugin_tests/auth/auth_imap
t/plugin_tests/auth/auth_vpopmail
t/plugin_tests/auth/auth_vpopmail_sql
t/plugin_tests/auth/auth_vpopmaild
Expand All @@ -182,11 +190,12 @@ t/plugin_tests/auth/authnull
t/plugin_tests/badmailfrom
t/plugin_tests/badmailfromto
t/plugin_tests/badrcptto
t/plugin_tests/content_log
t/plugin_tests/count_unrecognized_commands
t/plugin_tests/dmarc
t/plugin_tests/dnsbl
t/plugin_tests/dspam
t/plugin_tests/earlytalker
t/plugin_tests/fcrdns
t/plugin_tests/greylisting
t/plugin_tests/headers
t/plugin_tests/helo
Expand All @@ -202,6 +211,10 @@ t/plugin_tests/virus/clamdscan
t/qpsmtpd-address.t
t/qpsmtpd-base.t
t/qpsmtpd-config.t
t/qpsmtpd-db-file-dbm.t
t/qpsmtpd-db-redis.t
t/qpsmtpd-db.t
t/qpsmtpd-plugin.t
t/qpsmtpd-smtp.t
t/qpsmtpd.t
t/rset.t
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.SKIP
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ output/.*
^sqlite/
^output/
^tmp/
^t/tmp/
^blib/
^blibdirs$
^Makefile$
Expand All @@ -36,3 +37,4 @@ packaging
^supervise/
^ssl/
^t/config/greylist
^.github
27 changes: 14 additions & 13 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,20 @@ WriteMakefile(
'Test::More' => 0,
'Test::Output' => 0,
# modules for specific features
'Mail::DKIM' => 0.40,
'File::Tail' => 0, # log/summarize, log/watch
'Time::TAI64' => 0, # log2sql
# 'DBI' => 0, # auth_vpopmail_sql and
# 'DBD::mysql' => 0, # log2sql
# 'DBIx::Simple' => 0, # log2sql
# modules that cause Travis build tests to fail
# 'Mail::SpamAssassin' => 0,
# 'GeoIP2' => 2,
# 'Geo::IP' => 1,
# 'Math::Complex' => 0, # geodesic distance in Geo::IP
# 'PerlIO::gzip' => 0, # gunzip GeoIP databases
# 'Mail::SPF' => 0,
'Mail::SPF' => 1,
'Mail::DKIM' => 0.40,
'Mail::DMARC' => 0,
'File::Tail' => 0, # log/summarize, log/watch
'Time::TAI64' => 0, # log2sql
'Redis' => 0,
# 'DBI' => 0, # auth_vpopmail_sql and
# 'DBD::mysql' => 0, # log2sql
# 'DBIx::Simple' => 0, # log2sql
'Geo::IP' => 1,
'Mail::SpamAssassin' => 0,
'Math::Complex' => 0, # geodesic distance in Geo::IP
'PerlIO::gzip' => 0, # gunzip GeoIP databases
'File::NFSLock' => 0,
},
ABSTRACT => 'Flexible smtpd daemon written in Perl',
AUTHOR => 'Ask Bjoern Hansen <[email protected]>',
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ run the following command in the /home/smtpd/ directory.

git clone git://github.com/smtpd/qpsmtpd.git

Beware that the master branch might be unstable and unsuitable for anything
Beware that the master branch might be unsuitable for anything
but development, so you might want to get a specific release, for
example (after running git clone):

git checkout -b local_branch v0.93
git checkout -b local_branch v1.00

chmod o+t ~smtpd/qpsmtpd/ (or whatever directory you installed qpsmtpd
in) to make supervise start the log process.
Expand Down Expand Up @@ -91,9 +91,8 @@ information about what's missing) to the mailinglist or a PR to github.

# Better Performance

For better performance we recommend using "qpsmtpd-forkserver" or
running qpsmtpd under Apache 2.x. If you need extremely high
concurrency use [Haraka](http://haraka.github.io/).
For better performance we recommend using "qpsmtpd-forkserver". If
you need extremely high concurrency use [Haraka](http://haraka.github.io/).

# Plugins

Expand Down
3 changes: 0 additions & 3 deletions bin/install_deps.pl
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
my $apps = [
{ app => 'daemontools', info => { } },
{ app => 'ucspi-tcp', info => { } },
# { app => 'dspam', info => { } },
# { app => 'mysql-server-55', info => { port => 'mysql55-server', dport=>'mysql5', yum =>'mysql-server'} },
# { app => 'apache22' , info => { port => 'apache22', dport=>'', yum => 'httpd' } },
];

$EUID == 0 or die "You will have better luck if you run me as root.\n";
Expand Down
2 changes: 1 addition & 1 deletion lib/Qpsmtpd/DB/File/DBM.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use warnings;

use parent 'Qpsmtpd::DB';

BEGIN { @AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File) }
BEGIN { @AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File SDBM_File ODBM_File) }
use AnyDBM_File;
use Fcntl qw(:DEFAULT :flock LOCK_EX LOCK_NB);

Expand Down
4 changes: 1 addition & 3 deletions lib/Qpsmtpd/SMTP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ sub new {

my $self = bless({args => \%args}, $class);

# this list of valid commands should probably be a method or a set of methods
# this list of valid commands should probably be a method or a set of methods
$self->{_commands} =
{map { $_ => '' } qw(ehlo helo rset mail rcpt data help vrfy noop quit)};

Expand Down Expand Up @@ -712,8 +712,6 @@ sub data_respond {

$header->extract(\@headers);

#$header->add("X-SMTPD", "qpsmtpd/".$self->version.", http://smtpd.github.io/qpsmtpd/");

$buffer = '';

$self->transaction->header($header);
Expand Down
2 changes: 1 addition & 1 deletion plugins/dmarc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ sub check_dmarc {
return $self->get_reject( $@ );
};

#$self->log(LOGINFO, "result: " . Dumper( $dmarc ) );
#$self->log(LOGINFO, "result: " . Dumper( $dmarc ) );

my $pol;
eval { $pol = $dmarc->result->published; };
Expand Down
8 changes: 4 additions & 4 deletions plugins/ident/geoip
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ sub load_geoip1 {

$self->open_geoip_db();

# Note that opening the GeoIP DB only in register has caused problems before:
# https://github.com/smtpd/qpsmtpd/commit/29ea9516806e9a8ca6519fcf987dbd684793ebdd#plugins/ident/geoip
# Opening the DB anew for every connection is horribly inefficient.
# Instead, attempt to reopen upon connect if the DB connection fails.
# Note that opening the GeoIP DB only in register has caused problems before:
# https://github.com/smtpd/qpsmtpd/commit/29ea9516806e9a8ca6519fcf987dbd684793ebdd#plugins/ident/geoip
# Opening the DB anew for every connection is horribly inefficient.
# Instead, attempt to reopen upon connect if the DB connection fails.
$self->init_my_country_code();

$self->register_hook('connect', 'geoip_lookup');
Expand Down
25 changes: 8 additions & 17 deletions t/addresses.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,17 @@ use_ok('Test::Qpsmtpd');
ok(my ($smtpd, $conn) = Test::Qpsmtpd->new_conn(), "get new connection");
is(($smtpd->command('EHLO localhost'))[0], 250, 'EHLO localhost');

is(($smtpd->command('MAIL FROM:<[email protected]>'))[0],
250, 'MAIL FROM:<[email protected]>');
is($smtpd->transaction->sender->address, '[email protected]',
'got the right sender');
is(($smtpd->command('MAIL FROM:<[email protected]>'))[0], 250, 'MAIL FROM:<[email protected]>');
is($smtpd->transaction->sender->address, '[email protected]', 'got the right sender');

is(($smtpd->command('MAIL FROM:<ask @perl.org>'))[0],
250, 'MAIL FROM:<ask @perl.org>');
is($smtpd->transaction->sender->address,
'ask @perl.org',
'got the right sender');
is(($smtpd->command('MAIL FROM:<ask @perl.org>'))[0], 250, 'MAIL FROM:<ask @perl.org>');
is($smtpd->transaction->sender->address, 'ask @perl.org', 'got the right sender');

is(($smtpd->command('MAIL FROM:[email protected]'))[0],
250, 'MAIL FROM:[email protected]');
is($smtpd->transaction->sender->format,
'<[email protected]>', 'got the right sender');
is(($smtpd->command('MAIL FROM:[email protected]'))[0], 250, 'MAIL FROM:[email protected]');
is($smtpd->transaction->sender->format, '<[email protected]>', 'got the right sender');

is(($smtpd->command('MAIL FROM:ask@[1.2.3.4]'))[0],
250, 'MAIL FROM:ask@[1.2.3.4]');
is($smtpd->transaction->sender->format,
'<ask@[1.2.3.4]>', 'got the right sender');
is(($smtpd->command('MAIL FROM:ask@[1.2.3.4]'))[0], 250, 'MAIL FROM:ask@[1.2.3.4]');
is($smtpd->transaction->sender->format, '<ask@[1.2.3.4]>', 'got the right sender');

my $command = 'MAIL FROM:<[email protected]> SIZE=1230';
is(($smtpd->command($command))[0], 250, $command);
Expand Down
10 changes: 5 additions & 5 deletions t/config/plugins
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ content_log
hosts_allow

# information plugins
ident/geoip
# ident/geoip
ident/p0f /tmp/.p0f_socket version 3
connection_time
fcrdns
Expand All @@ -37,7 +37,7 @@ parse_addr_withhelo
quit_fortune
# tls should load before count_unrecognized_commands
#tls
earlytalker
# earlytalker
count_unrecognized_commands 4
relay

Expand Down Expand Up @@ -66,7 +66,7 @@ rcpt_ok
headers days 5 reject_type temp require From,Date
#domainkeys
dkim
dmarc
# dmarc

# content filters
virus/klez_filter
Expand All @@ -83,11 +83,11 @@ spamassassin
# 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
# dspam learn_from_sa 7 reject 1

# run the clamav virus checking plugin
virus/clamav
virus/clamdscan
# virus/clamdscan

# You must enable a queue plugin - see the options in plugins/queue/ - for example:

Expand Down
Loading

0 comments on commit da5f60b

Please sign in to comment.