From nobody Sun Jun 25 15:38:53 2023 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QpwB55Klqz4hBHF; Sun, 25 Jun 2023 15:38:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QpwB54brLz3CcK; Sun, 25 Jun 2023 15:38:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687707533; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eAPcr/08mnqWhFm7tFl8MhSANwwgheLFhB8MBUlp/iE=; b=CZw1K/gfk/EhsmMjY81tU0m8wTqK8qxZNb01IxzDngLWQuoiHneKUa7jhvEY0wkUR6Evfu zhMch6ohmWIXnr0NHiECcyiLZwYIbZAoA8ENLl01KJznrGoymxlLy7Y8I9DtzqMOHxERsA QYrr7++k0ZYPS9nh9KHcnoS/pzGpgQh8+mhmFqzIi2LMh3+NtSuL/GPAdBgZJdgkmde6Hb IjAdqHhcLGgzEn7cZup+vzaZIpdFL+ckFyft1TDrf2SQ605tDgEh2rumkqVo19c5p2/Qf0 R4e12YTHgPmvMe+Aha5eDrOFf6Cj77R/V+J27unueBfH9DfgOYj7Azo0wOtpXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687707533; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eAPcr/08mnqWhFm7tFl8MhSANwwgheLFhB8MBUlp/iE=; b=eNx9oll6mmE7oyoNe5UAXHOfoYXjlHEoNl2ljQ4Js5Td5ICio2U4dqGiBp4LX1L8KPsB2u p6JwalCbBuJirD5IrDdQpdbe5hvQ+vtLAAIOhXcmoWgTN4GtFN/ga+QmeJFioIM0JMNs8K YZI5kWEdzASodNiUHW4G5pNtOHeX/ScOaILFY2KnTpjMowAbKlQg6E00v9QM6Rsw8sLWwc K3P5Lcf96ymwfC7ue+W3PSce6kh1rGAHq6tCZK5bQCH5Cw8krmZz10oo880DXlGZxCyHQn GvphsMvVMkoAkTDGS2ujgMJmCZFlR0MmBPW8FDX70xaD0iBbyFxbHgbrgCmKMQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687707533; a=rsa-sha256; cv=none; b=b8nHYtGelxfKnpNRI2qmum+UxhBri/FXDTMyXmyUc/AE4Xo8NfW6lX30V59oX3Fuwt/Aqk 4TmM21L8zm2Ef6+j5/clUDmxKN6ziHIEU/h/uSfThZnv4EuMZI9NfbTtvQghJtvBcGU0uD ACiYu9q1CsNRrcrwiYeTGVaCKwASQsMVrlgIRdirNuIpTvDykp2Z0MRreZtr7ipdJt3E4X 9HGbFxPDuTG/Kl614nesqWq0rT1WUmRZHyeVLSlqUwsT0v23OVBFGI1ZtUFuyMKn+fI6fC Aml2nvKsumGm2NCJu5Kgq86Wht6w4RrSRJmzdkA8AYBd4Tw3C5cQ/bWhqTIVsQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QpwB53hN3zXsC; Sun, 25 Jun 2023 15:38:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35PFcrKU042465; Sun, 25 Jun 2023 15:38:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35PFcrDJ042464; Sun, 25 Jun 2023 15:38:53 GMT (envelope-from git) Date: Sun, 25 Jun 2023 15:38:53 GMT Message-Id: <202306251538.35PFcrDJ042464@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Chris Rees Subject: git: 62e8b9119097 - main - mail/dmarcts-report-parser: New port List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: crees X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 62e8b9119097a852ae34082eb65111449714051a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by crees: URL: https://cgit.FreeBSD.org/ports/commit/?id=62e8b9119097a852ae34082eb65111449714051a commit 62e8b9119097a852ae34082eb65111449714051a Author: Chris Rees AuthorDate: 2023-06-25 15:08:49 +0000 Commit: Chris Rees 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 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 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