Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Jun 2023 15:38:53 GMT
From:      Chris Rees <crees@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 62e8b9119097 - main - mail/dmarcts-report-parser: New port
Message-ID:  <202306251538.35PFcrDJ042464@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by crees:

URL: https://cgit.FreeBSD.org/ports/commit/?id=62e8b9119097a852ae34082eb65111449714051a

commit 62e8b9119097a852ae34082eb65111449714051a
Author:     Chris Rees <crees@FreeBSD.org>
AuthorDate: 2023-06-25 15:08:49 +0000
Commit:     Chris Rees <crees@FreeBSD.org>
CommitDate: 2023-06-25 15:38:46 +0000

    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.
---
 mail/Makefile                                      |  1 +
 mail/dmarcts-report-parser/Makefile                | 44 ++++++++++++++++++++++
 mail/dmarcts-report-parser/distinfo                |  3 ++
 .../files/667.dmarcts-report-parser.in             | 23 +++++++++++
 .../files/patch-dmarcts-report-parser.pl           | 29 ++++++++++++++
 mail/dmarcts-report-parser/pkg-descr               | 18 +++++++++
 mail/dmarcts-report-parser/pkg-plist               |  5 +++
 7 files changed, 123 insertions(+)

diff --git a/mail/Makefile b/mail/Makefile
index 32b5ef3550d0..19e518a9ffd7 100644
--- a/mail/Makefile
+++ b/mail/Makefile
@@ -97,6 +97,7 @@
     SUBDIR += dkfilter
     SUBDIR += dkimproxy
     SUBDIR += dma
+    SUBDIR += dmarcts-report-parser
     SUBDIR += dot-forward
     SUBDIR += dovecot
     SUBDIR += dovecot-coi
diff --git a/mail/dmarcts-report-parser/Makefile b/mail/dmarcts-report-parser/Makefile
new file mode 100644
index 000000000000..f47be84a54cc
--- /dev/null
+++ b/mail/dmarcts-report-parser/Makefile
@@ -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>
diff --git a/mail/dmarcts-report-parser/distinfo b/mail/dmarcts-report-parser/distinfo
new file mode 100644
index 000000000000..7a8d00193ec3
--- /dev/null
+++ b/mail/dmarcts-report-parser/distinfo
@@ -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
diff --git a/mail/dmarcts-report-parser/files/667.dmarcts-report-parser.in b/mail/dmarcts-report-parser/files/667.dmarcts-report-parser.in
new file mode 100755
index 000000000000..b8232da2013d
--- /dev/null
+++ b/mail/dmarcts-report-parser/files/667.dmarcts-report-parser.in
@@ -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
diff --git a/mail/dmarcts-report-parser/files/patch-dmarcts-report-parser.pl b/mail/dmarcts-report-parser/files/patch-dmarcts-report-parser.pl
new file mode 100644
index 000000000000..754685fa00d4
--- /dev/null
+++ b/mail/dmarcts-report-parser/files/patch-dmarcts-report-parser.pl
@@ -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;
diff --git a/mail/dmarcts-report-parser/pkg-descr b/mail/dmarcts-report-parser/pkg-descr
new file mode 100644
index 000000000000..abfd57edba27
--- /dev/null
+++ b/mail/dmarcts-report-parser/pkg-descr
@@ -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.
diff --git a/mail/dmarcts-report-parser/pkg-plist b/mail/dmarcts-report-parser/pkg-plist
new file mode 100644
index 000000000000..4a24c4f5248f
--- /dev/null
+++ b/mail/dmarcts-report-parser/pkg-plist
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202306251538.35PFcrDJ042464>