Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mail/dmarcts-report-parser: New port
A Perl based tool to parse DMARC reports, based on John Levine's rddmarc, but extended by the following features: Allow to read messages from an IMAP server and not only from the local filesystem. Store much more XML values into the database (for example the missing SPF and DKIM results from the policy_evaluated section) and also the entire XML for later reference. Supports MySQL and PostgreSQL. Needed database tables and columns are created automatically, database by themselves.
- Loading branch information
Showing
7 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
PORTNAME= dmarcts-report-parser | ||
PORTVERSION= 2.0 | ||
DISTVERSIONPREFIX= v | ||
CATEGORIES= mail | ||
|
||
MAINTAINER= crees@FreeBSD.org | ||
COMMENT= Perl based tool to parse DMARC reports | ||
|
||
LICENSE= GPLv3 | ||
|
||
RUN_DEPENDS= \ | ||
p5-File-MimeInfo>=0:devel/p5-File-MimeInfo \ | ||
p5-Mail-IMAPClient>=0:mail/p5-Mail-IMAPClient \ | ||
p5-MIME-Tools>=0:mail/p5-MIME-Tools \ | ||
p5-XML-Simple>=0:textproc/p5-XML-Simple \ | ||
p5-DBI>=0:databases/p5-DBI \ | ||
p5-Socket6>=0:net/p5-Socket6 \ | ||
p5-PerlIO-gzip>=0:archivers/p5-PerlIO-gzip \ | ||
p5-Mail-Mbox-MessageParser>=0:mail/p5-Mail-Mbox-MessageParser | ||
|
||
USES= perl5 shebangfix | ||
SHEBANG_FILES= *.pl | ||
SUB_FILES= 667.dmarcts-report-parser | ||
USE_GITHUB= yes | ||
GH_ACCOUNT= techsneeze | ||
NO_BUILD= yes | ||
|
||
post-patch: | ||
${REINPLACE_CMD} \ | ||
's,%%PREFIX%%,${PREFIX},g;s,%%DATADIR%%,${DATADIR},g' \ | ||
${WRKSRC}/dmarcts-report-parser.pl | ||
|
||
do-install: | ||
${INSTALL_SCRIPT} ${WRKSRC}/dmarcts-report-parser.pl \ | ||
${STAGEDIR}${PREFIX}/bin/dmarcts-report-parser.pl | ||
${INSTALL_DATA} ${WRKSRC}/dmarcts-report-parser.conf.sample \ | ||
${STAGEDIR}${PREFIX}/etc/ | ||
${MKDIR} ${STAGEDIR}${DATADIR} | ||
${INSTALL_DATA} ${WRKSRC}/dbx_*.pl ${STAGEDIR}${DATADIR}/ | ||
${MKDIR} ${STAGEDIR}${PREFIX}/etc/periodic/daily | ||
${INSTALL_SCRIPT} ${WRKDIR}/667.dmarcts-report-parser \ | ||
${STAGEDIR}${PREFIX}/etc/periodic/daily/ | ||
|
||
.include <bsd.port.mk> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
TIMESTAMP = 1687701602 | ||
SHA256 (techsneeze-dmarcts-report-parser-v2.0_GH0.tar.gz) = 06b3f9db47b5cb8a487d7ddd8a5bf8d3ae419e2a3a58abfcbbe1f66f45363696 | ||
SIZE (techsneeze-dmarcts-report-parser-v2.0_GH0.tar.gz) = 26425 |
23 changes: 23 additions & 0 deletions
23
mail/dmarcts-report-parser/files/667.dmarcts-report-parser.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/sh - | ||
|
||
if [ -r /etc/defaults/periodic.conf ]; then | ||
. /etc/defaults/periodic.conf | ||
source_periodic_confs | ||
fi | ||
|
||
rc=0 | ||
|
||
case "${daily_dmarcts_report_parser_enable:-no}" in | ||
[Nn][Oo]) | ||
;; | ||
*) | ||
if ! %%PREFIX%%/bin/dmarcts-report-parser.pl -i >/dev/null 2>&1 ; then | ||
echo 'dmarcts-report-parser failed- try running it manually' | ||
echo '# dmarcts-report-parser.pl -i' | ||
rc=2 | ||
fi | ||
|
||
;; | ||
esac | ||
|
||
exit $rc |
29 changes: 29 additions & 0 deletions
29
mail/dmarcts-report-parser/files/patch-dmarcts-report-parser.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- dmarcts-report-parser.pl.orig 2023-06-25 14:23:56 UTC | ||
+++ dmarcts-report-parser.pl | ||
@@ -88,7 +88,7 @@ sub show_usage { | ||
print " ./dmarcts-report-parser.pl [OPTIONS] [PATH] \n"; | ||
print "\n"; | ||
print " This script needs a configuration file called <dmarcts-report-parser.conf> in \n"; | ||
- print " the current working directory, which defines a database server with credentials \n"; | ||
+ print " %%PREFIX%%/etc, which defines a database server with credentials \n"; | ||
print " and (if used) an IMAP server with credentials. \n"; | ||
print "\n"; | ||
print " Additionaly, one of the following source options must be provided: \n"; | ||
@@ -171,7 +171,7 @@ use constant ALLOWED_SPFRESULT => qw( | ||
# Load script configuration options from local config file. The file is expected | ||
# to be in the current working directory. | ||
-my $conf_file = 'dmarcts-report-parser.conf'; | ||
+my $conf_file = '%%PREFIX%%/etc/dmarcts-report-parser.conf'; | ||
# Get command line options. | ||
my %options = (); | ||
@@ -265,7 +265,7 @@ if (exists $options{info}) {$processInfo = 1;} | ||
# Setup connection to database server. | ||
our %dbx; | ||
-my $dbx_file = File::Basename::dirname($0) . "/dbx_$dbtype.pl"; | ||
+my $dbx_file = "%%DATADIR%%/dbx_$dbtype.pl"; | ||
my $dbx_return = do $dbx_file; | ||
die "$scriptname: couldn't load DB definition for type $dbtype: $@" if $@; | ||
die "$scriptname: couldn't load DB definition for type $dbtype: $!" unless defined $dbx_return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
A Perl based tool to parse DMARC reports, based on John Levine's rddmarc, | ||
but extended by the following features: | ||
|
||
Allow to read messages from an IMAP server and not only from | ||
the local filesystem. | ||
|
||
Store much more XML values into the database (for example the | ||
missing SPF and DKIM results from the policy_evaluated section) | ||
and also the entire XML for later reference. | ||
|
||
Supports MySQL and PostgreSQL. | ||
|
||
Needed database tables and columns are created automatically, | ||
user only needs to provide a database. The database schema is | ||
compatible to the one used by rddmarc, but extends it by | ||
additional fields. Users can switch from rddmarc to | ||
dmarcts-report-parser without having to do any changes to the | ||
database by themselves. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
bin/dmarcts-report-parser.pl | ||
@sample etc/dmarcts-report-parser.conf.sample | ||
etc/periodic/daily/667.dmarcts-report-parser | ||
%%DATADIR%%/dbx_Pg.pl | ||
%%DATADIR%%/dbx_mysql.pl |