diff --git a/.gitignore b/.gitignore index 2736664c..4cf63eef 100644 --- a/.gitignore +++ b/.gitignore @@ -10,10 +10,11 @@ Build.bat Makefile Makefile.old MANIFEST.bak -META.yml +MYMETA.json MYMETA.yml nytprof.out pm_to_blib Mail-DMARC-* t/reports-test.sqlite dmarc_reports.sqlite +*.bak diff --git a/.mailmap b/.mailmap deleted file mode 100644 index e43622b7..00000000 --- a/.mailmap +++ /dev/null @@ -1,5 +0,0 @@ -Matt Simerson -Jean Paul Galea -Priyadi Iman Nurcahyo -Ricardo Signes -Marisa Clardy diff --git a/.release/bump_version.sh b/.release/bump_version.sh new file mode 100755 index 00000000..290b9cb3 --- /dev/null +++ b/.release/bump_version.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +NEWVER="1.$(date '+%Y%m%d')" +echo "$NEWVER" + +sed -i '' \ + -e "/VERSION =/ s/= .*$/= '$NEWVER';/" \ + -e "/^version / s/.*/version $NEWVER/" \ + $(find lib -type f -name '*.pm') diff --git a/.release/copyright_year.sh b/.release/copyright_year.sh new file mode 100755 index 00000000..36221da6 --- /dev/null +++ b/.release/copyright_year.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +YEAR=$(date "+%Y") + +sed -i '' \ + -e "/copyright/ s/20[[:digit:]][[:digit:]]/$YEAR/" \ + LICENSE $(find lib -type f -name '*.pm') diff --git a/.release/readme.sh b/.release/readme.sh new file mode 100755 index 00000000..0bec625b --- /dev/null +++ b/.release/readme.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +pod2markdown lib/Mail/DMARC.pm > README.md diff --git a/.release/tag.sh b/.release/tag.sh new file mode 100755 index 00000000..388fb6fd --- /dev/null +++ b/.release/tag.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +TAGNAME="v1.$(date '+%Y%M%d')" +echo "tag $TAGNAME" + +git tag "$TAGNAME" \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index d43d8fa7..0695ff60 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: perl perl: + - "5.28" - "5.22" # perlbrew (used by Travis to install perl versions) no longer supports these # lower versions @@ -15,18 +16,21 @@ before_install: - psql -U postgres dmarc_report < share/mail_dmarc_schema.pgsql - mysql -e 'CREATE DATABASE IF NOT EXISTS dmarc_report;' - mysql -u root --password="" dmarc_report < share/mail_dmarc_schema.mysql - + install: - cpanm --quiet --notest Regexp::Common Config::Tiny File::ShareDir Net::DNS::Resolver - cpanm --quiet --notest DBD::SQLite DBD::Pg DBD::mysql - cpanm --quiet --notest Net::IP Socket6 Email::MIME Net::SMTPS XML::LibXML - cpanm --quiet --notest DBIx::Simple HTTP::Tiny Test::File::ShareDir Test::Output - cpanm --quiet --notest Net::IDN::Encode CGI + - cpanm --quiet --notest XML::Validator::Schema script: - HARNESS_IS_VERBOSE=1 prove -v -Ilib t after_success: + - rm dmarc_reports.sqlite || echo "ok" + - rm t/reports-test.sqlite || echo "ok" - cpanm -n Devel::Cover::Report::Coveralls - cover -test -make 'prove -Ilib t' -report coveralls diff --git a/Build.PL b/Build.PL new file mode 100644 index 00000000..4a2e8087 --- /dev/null +++ b/Build.PL @@ -0,0 +1,130 @@ + +use strict; +use warnings; + +use Module::Build 0.3601; + + +my %module_build_args = ( + "build_requires" => { + "Module::Build" => "0.3601" + }, + "configure_requires" => { + "ExtUtils::MakeMaker" => 0, + "File::ShareDir::Install" => "0.06", + "Module::Build" => "0.3601" + }, + "dist_abstract" => "Perl implementation of DMARC", + "dist_author" => [ + "Matt Simerson ", + "Davide Migliavacca ", + "Marc Bradshaw " + ], + "dist_name" => "Mail-DMARC", + "dist_version" => "1.20191024", + "license" => "perl", + "module_name" => "Mail::DMARC", + "recommends" => { + "CGI" => 0, + "Email::Simple" => 0, + "IO::Compress::Gzip" => 0, + "IO::Compress::Zip" => 0, + "IO::Uncompress::Gunzip" => 0, + "IO::Uncompress::Unzip" => 0, + "Mail::DKIM" => 0, + # "MIME::Lite" => 0, + "Net::HTTP" => 0, + "Net::IMAP::Simple" => 0, + "Net::Server" => 2, + "XML::SAX::ParserFactory" => 0, + "XML::Validator::Schema" => 0, + }, + "recursive_test_files" => 1, + "requires" => { + "CGI" => 0, + "CPAN" => 0, + "Carp" => 0, + "Config::Tiny" => 0, + "DBD::SQLite" => "1.31", + "DBIx::Simple" => "1.35", + "Data::Dumper" => 0, + "Email::MIME" => 0, + "Email::Simple" => 0, + "Encode" => 0, + "English" => 0, + "File::ShareDir" => 0, + "Getopt::Long" => 0, + "HTTP::Request" => 0, + "HTTP::Tiny" => 0, + "IO::Compress::Gzip" => 0, + "IO::Compress::Zip" => 0, + "IO::File" => 0, + "IO::Socket::SSL" => 0, + "IO::Uncompress::Gunzip" => 0, + "IO::Uncompress::Unzip" => 0, + "JSON" => 0, + "LWP::UserAgent" => 0, + "Mail::DKIM::PrivateKey" => 0, + "Mail::DKIM::Signer" => 0, + "Mail::DKIM::TextWrap" => 0, + "Net::DNS::Resolver" => 0, + "Net::HTTP" => 0, + "Net::IDN::Encode" => 0, + "Net::IP" => 0, + "Net::SMTPS" => 0, + "Net::SSLeay" => 0, + "Net::Server::HTTP" => 0, + "POSIX" => 0, + "Pod::Usage" => 0, + "Regexp::Common" => "2013031301", + "Socket" => 0, + "Socket6" => "0.23", + "Sys::Hostname" => 0, + "Sys::Syslog" => 0, + "Test::File::ShareDir" => 0, + "URI" => 0, + "XML::LibXML" => 0, + "lib" => 0, + "parent" => 0, + "perl" => "5.008", + "strict" => 0, + "warnings" => 0 + }, + "script_files" => [ + "bin/dmarc_update_public_suffix_list", + "bin/dmarc_send_reports", + "bin/dmarc_httpd", + "bin/dmarc_lookup", + "bin/dmarc_receive", + "bin/dmarc_http_client", + "bin/dmarc_view_reports" + ], + "share_dir" => { + "dist" => "share" + }, + "test_requires" => { + "Test::Exception" => 0, + "Test::File::ShareDir" => 0, + "Test::More" => 0, + "Test::Output" => 0 + } +); + + +my %fallback_build_requires = ( + "Module::Build" => "0.3601", + "Test::Exception" => 0, + "Test::File::ShareDir" => 0, + "Test::More" => 0, + "Test::Output" => 0 +); + + +unless ( eval { Module::Build->VERSION(0.4004) } ) { + delete $module_build_args{test_requires}; + $module_build_args{build_requires} = \%fallback_build_requires; +} + +my $build = Module::Build->new(%module_build_args); + +$build->create_build_script; diff --git a/Changes b/Changes deleted file mode 100644 index 4383ad66..00000000 --- a/Changes +++ /dev/null @@ -1,317 +0,0 @@ - -{{$NEXT}} - -1.20191004 2019-10-04 America/Los_Angeles - - updated PSL - - update jQuery, jQuery grid - - empty ENV FROM when missing #144 - -1.20190831 2019-08-31 America/Los_Angeles - - improve aggregate report docs #142 - - added dmarc_whitelist hosts #119 - -1.20190308 2019-03-08 Australia/Melbourne - - Lower memory usage when sending reports - -1.20181001 2018-10-01 Australia/Melbourne - - Check author when saving a new report record - - Fix bug in RUA filtering when recipient had a size filter - - Fix TLS fails for report sending to certain domains - - Fix report sending loop problem - -1.20180125 2018-01-25 Australia/Melbourne - - - Allow domains listed in the public suffix list to align. - -1.20170911 2017009011 Australia/Melbourne - - STARTTLS workaround for Net::SMTPS issue. - -1.20170906 2017-09-06 Australia/Melbourne - - Ignore the case of tag keys when parsing DMARC records - -1.20170222 2017-02-21 America/Los_Angeles - - - Ensure entities in XML agg reports are properly escaped #104 - - geoip v6 support and field selection #103 - - use a larger integer type for report_record.count #102 - - improved apt package lookups in install_deps.pl #98 - -1.20160612 2016-06-11 America/Los_Angeles - - - fix aggregrate schema test #96 - - Do not reject NXDOMAIN as per rfc #94 - - added none result for no policy #93 - - avoid deadlock with some invalid rua data #92 - - avoid loop when sending reports via http #92 - -1.20150908 2015-09-08 America/Los_Angeles - - - Optionally log sending of reports to syslog - -1.20150527 2015-05-26 America/Los_Angeles - - - check for an updated PSL file and load if necessary - - handle domains with missing rua/ruf - - add timeout to sending script - -1.20150317 2015-03-17 America/Los_Angeles - - - squash subdomains w/o DMARC records into parent report (#59) - - add batch reporting (suppress throttling until...) - - align reports with hour/UTC day - - swap git contributors plugin - -1.20150310 2015-03-10 America/Los_Angeles - - lower case domain names at entry points (resolves #53) - - tolerate substitution of = with : in DMARC DNS rec - -1.20150228 2015-02-27 America/Los_Angeles - - - fix the policy_evaluated fields in outbound reports - - accommodate a common DMARC error substiting = with : - - initialized config file first (was non-deterministic) - - tolerate missing SPF auth type scope - -1.20150222 2015-02-22 America/Los_Angeles - - - remove ./mail-dmarc.ini (sample in share/mail-dmarc.ini) - - load PSL before dmarc_httpd forks, so we only load it once - - quieter report sending output unless --verbose - -1.20150211 2015-02-10 America/Los_Angeles - - - optionally DKIM sign sent reports - - warn when DMARC record format is invalid - - accept callbacks (lazy eval) for SPF & DKIM results - - make the report record building consistent for eval and reporting - - rewrite DKIM result invalid -> temperror - - capture test warnings, so 'make test' is prettier - -1.20150123 2015-01-22 America/Los_Angeles - - - enable lazy evaluation of SPF & DKIM (Ricardo Signes) - - check ShareDir for mail-dmarc.ini, if not in a standard location - - map DKIM status=invalid to status->temperror - - add config arg to dmarc_update_public_suffix_list (Ricardo Signes) - - Send only a single cc email (Marc Bradshaw) - - DMARC: update docs to show SPF one-shot syntax - - PurePerl: one shot accepts a Mail::DKIM::Verifier - - trap errors thrown by is_dkim_aligned - - INSTALL: added 'install mail-dmarc.ini' step - - Show "new record" output only in verbose mode. (Marc Bradshaw) - - require DBIx::Simple 1.35 (was any) - -1.20141230 2014-12-29 America/Los_Angeles - - - Add script to update the public suffix list file (Marc Bradshaw) - -1.20141206 2014-12-05 America/Los_Angeles - - - Delete reports with no valid rua (Marc Bradshaw) - - Ignore DomainKeys signatures (Marc Bradshaw) - - allow configurable delay between sending emails (Marc Bradshaw) - - permit absolute paths for public suffix list file location (Marc Bradshaw) - - fix lookup for *.foo entries (Marc Bradshaw) - -1.20141119 2014-11-18 America/Los_Angeles - - - added auto_save option for validation reports - - updated bin/install_deps.pl - -1.20141030 2014-10-30 America/Los_Angeles - - - percent policy logic wasn't being applied correctly - - fix for reasons not stored in SQL - -1.20140711 2014-07-10 America/Los_Angeles - - - Store/SQL: use full sql name in WHERE clause - - DMARC/HTTP: added error handling and tests - - removed excess comma in mail_dmarc_schema.mysql - - added quotes around ($commit || ''), just in case - - try IMAP fetch without SORT if no results, for IMAP servers like Gmail that don't support SORT - - warn but still pass test if DNS query fails - -1.20140623 2014-06-23 America/Los_Angeles - - - updated tests to accomodate the cached PSL - -1.20140622 2014-06-22 America/Los_Angeles - - - load PSL into hash to speed subsequent lookups (esp for daemon) - - uncommented Net::Server in Prereqs/Recommended section - - added INSTALL - - updated dmarc_httpd description to note validation feature - - updated public_suffix_list - -1.20140210 2014-02-09 America/Los_Angeles - - - NEW FEATURE: added HTTP validation service (see dmarc_httpd) - - install_deps: install optional prereqs by default - - added Best Current Practices link on main page - - minor tweaks to Pod (Ricardo Signes) - - PurePerl: added comments about Sender header - when message has multiple-address format used in the From header - - updated public_suffix_list - -1.20130906 2013-09-06 America/Los_Angeles - - - handle errors encountered when reporting address is illegal - - delete reports that return a SMTP 5XX code for the recipient - - delete reports after encountering 12 errors - - added 'too big' notices when report size exceeds limit - - updated install_deps.pl - -1.20130625 2013-06-24 America/Los_Angeles - - - added a bunch of tests from http://dmarc-qa.com - - URI: supress undef error if URI scheme not defined - - policy->parse: properly parse records with unnecessary trailing ; - - reporting is 'external' based on Org Domain (was email domain) - -1.20130616 2013-06-16 America/Los_Angeles - - - combined update/replace SQL methods - - dmarc_view_reports: fix duplicated variable name - -1.20130615 2013-06-15 America/Los_Angeles - - - bug fixes and purge unused classes - -1.20130614 2013-06-13 America/Los_Angeles - - - Added whitelist feature - - SMTP: remove Subject: Report-ID - - SMTP: more types of SMTP errors are stored and reported - - dmarc_send_reports: added verbose option - - dmarc_view_reports: fix for searches with MySQL backend - -1.20130612 2013-06-11 - - - dmarc_view_reports: improve gentoo support by adding /usr - to search path for GeoIP DBs on gentoo - Benny Pedersen - -1.20130610 2013-06-10 - - - tolerate receiving reports with no records (ahem, hotmail.com) - - simplify SMTP flow-of-control, additional SMTP tests - - avoid the join/split of binip in SQL::populate_agg_records - - replace carp with warn in several places (more legible warning) - - added RUA validity checks to dmarc_lookup - -1.20130605 2013-06-05 - - - in aggregate reports, group by IP and auth results (was only IP) - - refactored SQL::retrieve_todo into 3 methods, added tests - - SQL: added unique constraint on domain.domain - -1.20130604 2013-06-04 - - - main branches are master (devel) and releases (more obvious) - - added mailing list impact FAQ - - SQL: removed record.rcpt_dom - - corrected a XML schema error - - index.html - - widened disposition column - - only show rcpt domain in record (subgrid) - - corrected subgrid row_id - - additional validation of aggregate reports - -1.20130601 2013-05-31 - - - make sure a report record exists when fetching SMTP todo - - added insecure SMTP fallback if STARTTLS fails - - added color coded results to HTTP grid - -1.20130531 2013-05-30 - - - added gzip support to HTTP server, compressed JS files - - reason is internally an arrayref of hashrefs (was a single hashref) - - documentation additions - - removed unused JS files - - add validation and fixup of SPF result for incoming reports - - normalized domain columns in spf & dkim tables - -1.20130528 2013-05-28 - - - bump major version to 1 - - normalized domain columns in report_record - - fixups to handle reports with invalid formatting - - improved handling for IMAP SSL connections - - made internal represention of Mail::DMARC::dkim & spf consistent - with their aggregate report representation - -0.20130528 2013-05-27 - - - updated Send/SMTP to use report::aggregate - - switched back to gzip reports (instead of zip) - - dmarc_view_reports, added filtering ability, GeoIP location - -0.20130524 2013-05-23 - - - added bin/dmarc_httpd - - added bin/dmarc_view_reports - - renamed: dmarc_report -> dmarc_send_reports - -0.20130521 2013-05-21 - - - check for report_record existence before insertion - - SQL: added report_record.count column - - subclassed aggregreate reports into Report::Aggregate - - consolidates two agg. rep. generation methods to one - - SQL: added table report_error - - updated SQLite schema with native column types - -0.20130520 2013-05-19 - - - added bin/dmarc_receive (via IMAP, mbox, or message file) - - added report retrieval via IMAP - - extract sender domain from subject or MIME metadata - - SQL: added author.extra_contact - - SQL: removed 'NOT NULL' requirements for values often missing from incoming - reports. - -0.20130517 2013-05-17 - - - send reports with zip until 7/1, gzip after - - replace Socket 2 with Socket6 (better Windows compatibility) - - added parsing of incoming email reports - - added author and domain tables - - added three related columns from/rcpt/author ids to report table - - add email hostname to MX list when attempting SMTP delivery - - during report delivery, check report URI max size - -0.20130515 2013-05-15 - - - use File::ShareDir to access share/* - - added external reporting verification - -0.20130514 2013-05-14 - - - moved DNS settings into config file - - fixed a case where disposition was not set - - added bin/dmarc_report - - sends email reports with Email::MIME & Net::SMTPS - - deletes reports after successful delivery - - required Socket 2 (correct IPv6 handling) - - several SQL schema changes - - has_valid_reporting_uri does validation now - -0.20130510 2013-05-09 - -0.20130507 2013-05-07 - - - added sql and MySQL schema - - added bin/dmarc_lookup - - replaced Regexp::Common IP validation with Net::IP (perl 5.8 compat) - - added Results.pm tests - - added full section numbers to Draft quotes - -0.20130506 2013-05-06 - - - added Result and Result/Evaluated.pm - - consolidated DNS functions into DNS.pm - - uses Regexp::Common, requiring perl 5.10. - - Mail::DMARC::Policy is well defined and tested - - setting up package - diff --git a/Changes.md b/Changes.md new file mode 100644 index 00000000..7e6e552b --- /dev/null +++ b/Changes.md @@ -0,0 +1,317 @@ + +### 1.20191004 + +- updated PSL +- update jQuery, jQuery grid +- empty ENV FROM when missing #144 + +### 1.20190831 + +- improve aggregate report docs #142 +- added dmarc_whitelist hosts #119 + +### 1.20190308 + +- Lower memory usage when sending reports + +### 1.20181001 + +- Check author when saving a new report record +- Fix bug in RUA filtering when recipient had a size filter +- Fix TLS fails for report sending to certain domains +- Fix report sending loop problem + +### 1.20180125 + +- Allow domains listed in the public suffix list to align. + +### 1.20170911 + +- STARTTLS workaround for Net::SMTPS issue. + +### 1.20170906 + +- Ignore the case of tag keys when parsing DMARC records + +### 1.20170222 + +- Ensure entities in XML agg reports are properly escaped #104 +- geoip v6 support and field selection #103 +- use a larger integer type for report_record.count #102 +- improved apt package lookups in install_deps.pl #98 + +### 1.20160612 + +- fix aggregrate schema test #96 +- Do not reject NXDOMAIN as per rfc #94 +- added none result for no policy #93 +- avoid deadlock with some invalid rua data #92 +- avoid loop when sending reports via http #92 + +### 1.20150908 + +- Optionally log sending of reports to syslog + +### 1.20150527 + +- check for an updated PSL file and load if necessary +- handle domains with missing rua/ruf +- add timeout to sending script + +### 1.20150317 + +- squash subdomains w/o DMARC records into parent report (#59) +- add batch reporting (suppress throttling until...) +- align reports with hour/UTC day +- swap git contributors plugin + +### 1.20150310 + +- lower case domain names at entry points (resolves #53) +- tolerate substitution of = with : in DMARC DNS rec + +### 1.20150228 + +- fix the policy_evaluated fields in outbound reports +- accommodate a common DMARC error substiting = with : +- initialized config file first (was non-deterministic) +- tolerate missing SPF auth type scope + +### 1.20150222 + +- remove ./mail-dmarc.ini (sample in share/mail-dmarc.ini) +- load PSL before dmarc_httpd forks, so we only load it once +- quieter report sending output unless --verbose + +### 1.20150211 + +- optionally DKIM sign sent reports +- warn when DMARC record format is invalid +- accept callbacks (lazy eval) for SPF & DKIM results +- make the report record building consistent for eval and reporting +- rewrite DKIM result invalid -> temperror +- capture test warnings, so 'make test' is prettier + +### 1.20150123 + +- enable lazy evaluation of SPF & DKIM (Ricardo Signes) +- check ShareDir for mail-dmarc.ini, if not in a standard location +- map DKIM status=invalid to status->temperror +- add config arg to dmarc_update_public_suffix_list (Ricardo Signes) +- Send only a single cc email (Marc Bradshaw) +- DMARC: update docs to show SPF one-shot syntax +- PurePerl: one shot accepts a Mail::DKIM::Verifier +- trap errors thrown by is_dkim_aligned +- INSTALL: added 'install mail-dmarc.ini' step +- Show "new record" output only in verbose mode. (Marc Bradshaw) +- require DBIx::Simple 1.35 (was any) + +### 1.20141230 + +- Add script to update the public suffix list file (Marc Bradshaw) + +### 1.20141206 + +- Delete reports with no valid rua (Marc Bradshaw) +- Ignore DomainKeys signatures (Marc Bradshaw) +- allow configurable delay between sending emails (Marc Bradshaw) +- permit absolute paths for public suffix list file location (Marc Bradshaw) +- fix lookup for *.foo entries (Marc Bradshaw) + +### 1.20141119 + +- added auto_save option for validation reports +- updated bin/install_deps.pl + +### 1.20141030 + +- percent policy logic wasn't being applied correctly +- fix for reasons not stored in SQL + +### 1.20140711 + +- Store/SQL: use full sql name in WHERE clause +- DMARC/HTTP: added error handling and tests +- removed excess comma in mail_dmarc_schema.mysql +- added quotes around ($commit || ''), just in case +- try IMAP fetch without SORT if no results, for IMAP servers like Gmail that don't support SORT +- warn but still pass test if DNS query fails + +### 1.20140623 + +- updated tests to accomodate the cached PSL + +### 1.20140622 + +- load PSL into hash to speed subsequent lookups (esp for daemon) +- uncommented Net::Server in Prereqs/Recommended section +- added INSTALL +- updated dmarc_httpd description to note validation feature +- updated public_suffix_list + +### 1.20140210 + +- NEW FEATURE: added HTTP validation service (see dmarc_httpd) +- install_deps: install optional prereqs by default +- added Best Current Practices link on main page +- minor tweaks to Pod (Ricardo Signes) +- PurePerl: added comments about Sender header when message has multiple-address format used in the From header +- updated public_suffix_list + +### 1.20130906 + +- handle errors encountered when reporting address is illegal +- delete reports that return a SMTP 5XX code for the recipient +- delete reports after encountering 12 errors +- added 'too big' notices when report size exceeds limit +- updated install_deps.pl + +### 1.20130625 + +- added a bunch of tests from http://dmarc-qa.com +- URI: supress undef error if URI scheme not defined +- policy->parse: properly parse records with unnecessary trailing ; +- reporting is 'external' based on Org Domain (was email domain) + +### 1.20130616 + +- combined update/replace SQL methods +- dmarc_view_reports: fix duplicated variable name + +### 1.20130615 + +- bug fixes and purge unused classes + +### 1.20130614 + +- Added whitelist feature +- SMTP: remove Subject: Report-ID +- SMTP: more types of SMTP errors are stored and reported +- dmarc_send_reports: added verbose option +- dmarc_view_reports: fix for searches with MySQL backend + +### 1.20130612 + +- dmarc_view_reports: improve gentoo support by adding /usr to search path for GeoIP DBs on gentoo - Benny Pedersen + +### 1.20130610 + +- tolerate receiving reports with no records (ahem, hotmail.com) +- simplify SMTP flow-of-control, additional SMTP tests +- avoid the join/split of binip in SQL::populate_agg_records +- replace carp with warn in several places (more legible warning) +- added RUA validity checks to dmarc_lookup + +### 1.20130605 + +- in aggregate reports, group by IP and auth results (was only IP) +- refactored SQL::retrieve_todo into 3 methods, added tests +- SQL: added unique constraint on domain.domain + +### 1.20130604 + +- main branches are master (devel) and releases (more obvious) +- added mailing list impact FAQ +- SQL: removed record.rcpt_dom +- corrected a XML schema error +- index.html + - widened disposition column + - only show rcpt domain in record (subgrid) + - corrected subgrid row_id +- additional validation of aggregate reports + +### 1.20130601 + +- make sure a report record exists when fetching SMTP todo +- added insecure SMTP fallback if STARTTLS fails +- added color coded results to HTTP grid + +### 1.20130531 + +- added gzip support to HTTP server, compressed JS files +- reason is internally an arrayref of hashrefs (was a single hashref) +- documentation additions +- removed unused JS files +- add validation and fixup of SPF result for incoming reports +- normalized domain columns in spf & dkim tables + +### 1.20130528 + +- bump major version to 1 +- normalized domain columns in report_record +- fixups to handle reports with invalid formatting +- improved handling for IMAP SSL connections +- made internal represention of Mail::DMARC::dkim & spf consistent with their aggregate report representation + +### 0.20130528 + +- updated Send/SMTP to use report::aggregate +- switched back to gzip reports (instead of zip) +- dmarc_view_reports, added filtering ability, GeoIP location + +### 0.20130524 + +- added bin/dmarc_httpd +- added bin/dmarc_view_reports +- renamed: dmarc_report -> dmarc_send_reports + +### 0.20130521 + +- check for report_record existence before insertion +- SQL: added report_record.count column +- subclassed aggregreate reports into Report::Aggregate + - consolidates two agg. rep. generation methods to one +- SQL: added table report_error +- updated SQLite schema with native column types + +### 0.20130520 + +- added bin/dmarc_receive (via IMAP, mbox, or message file) +- added report retrieval via IMAP +- extract sender domain from subject or MIME metadata +- SQL: added author.extra_contact +- SQL: removed 'NOT NULL' requirements for values often missing from incoming reports. + +### 0.20130517 + +- send reports with zip until 7/1, gzip after +- replace Socket 2 with Socket6 (better Windows compatibility) +- added parsing of incoming email reports +- added author and domain tables +- added three related columns from/rcpt/author ids to report table +- add email hostname to MX list when attempting SMTP delivery +- during report delivery, check report URI max size + +### 0.20130515 + +- use File::ShareDir to access share/* +- added external reporting verification + +### 0.20130514 + +- moved DNS settings into config file +- fixed a case where disposition was not set +- added bin/dmarc_report + - sends email reports with Email::MIME & Net::SMTPS +- deletes reports after successful delivery +- required Socket 2 (correct IPv6 handling) +- several SQL schema changes +- has_valid_reporting_uri does validation now + +### 0.20130510 + +### 0.20130507 + +- added sql and MySQL schema +- added bin/dmarc_lookup +- replaced Regexp::Common IP validation with Net::IP (perl 5.8 compat) +- added Results.pm tests +- added full section numbers to Draft quotes + +### 0.20130506 + +- added Result and Result/Evaluated.pm +- consolidated DNS functions into DNS.pm + - uses Regexp::Common, requiring perl 5.10. +- Mail::DMARC::Policy is well defined and tested +- setting up package diff --git a/DEVELOP.md b/DEVELOP.md index 51714d45..e694595b 100644 --- a/DEVELOP.md +++ b/DEVELOP.md @@ -3,13 +3,6 @@ [The source code is hosted on GitHub](https://github.com/msimerson/mail-dmarc) -# About the branches - -There are two main branches: master and releases. Master is where the action is, but the rides on that playground require Dist::Zilla. Seriously, you can't even run 'make test' in the master branch without the D.Z. If you fear/loathe/hate the D.Z, stick with the release branch. - -The releases branch is automatically updated when new releases are made. It contains all the automatically generated files that the master branch doesn't, such as README, Makefile.PL, and Build.PL. It is identical to the distribution as you'd find it on CPAN, making it far easier for causual programmers to patch. - - # Download the source To make changes or submit patches, visit the GitHub URL and click the ***Fork*** button. Then clone your fork to your local disk: diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..75ff8997 --- /dev/null +++ b/LICENSE @@ -0,0 +1,379 @@ +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +Terms of the Perl programming language system itself + +a) the GNU General Public License as published by the Free + Software Foundation; either version 1, or (at your option) any + later version, or +b) the "Artistic License" + +--- The GNU General Public License, Version 1, February 1989 --- + +This software is Copyright (c) 2018 by Matt Simerson. + +This is free software, licensed under: + + The GNU General Public License, Version 1, February 1989 + + GNU GENERAL PUBLIC LICENSE + Version 1, February 1989 + + Copyright (C) 1989 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The license agreements of most software companies try to keep users +at the mercy of those companies. By contrast, our General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. The +General Public License applies to the Free Software Foundation's +software and to any other program whose authors commit to using it. +You can use it for your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Specifically, the General Public License is designed to make +sure that you have the freedom to give away or sell copies of free +software, that you receive source code or can get it if you want it, +that you can change the software or use pieces of it in new free +programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of a such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must tell them their rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any program or other work which +contains a notice placed by the copyright holder saying it may be +distributed under the terms of this General Public License. The +"Program", below, refers to any such program or work, and a "work based +on the Program" means either the Program or any work containing the +Program or a portion of it, either verbatim or with modifications. Each +licensee is addressed as "you". + + 1. You may copy and distribute verbatim copies of the Program's source +code as you receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice and +disclaimer of warranty; keep intact all the notices that refer to this +General Public License and to the absence of any warranty; and give any +other recipients of the Program a copy of this General Public License +along with the Program. You may charge a fee for the physical act of +transferring a copy. + + 2. You may modify your copy or copies of the Program or any portion of +it, and copy and distribute such modifications under the terms of Paragraph +1 above, provided that you also do the following: + + a) cause the modified files to carry prominent notices stating that + you changed the files and the date of any change; and + + b) cause the whole of any work that you distribute or publish, that + in whole or in part contains the Program or any part thereof, either + with or without modifications, to be licensed at no charge to all + third parties under the terms of this General Public License (except + that you may choose to grant warranty protection to some or all + third parties, at your option). + + c) If the modified program normally reads commands interactively when + run, you must cause it, when started running for such interactive use + in the simplest and most usual way, to print or display an + announcement including an appropriate copyright notice and a notice + that there is no warranty (or else, saying that you provide a + warranty) and that users may redistribute the program under these + conditions, and telling the user how to view a copy of this General + Public License. + + d) You may charge a fee for the physical act of transferring a + copy, and you may at your option offer warranty protection in + exchange for a fee. + +Mere aggregation of another independent work with the Program (or its +derivative) on a volume of a storage or distribution medium does not bring +the other work under the scope of these terms. + + 3. You may copy and distribute the Program (or a portion or derivative of +it, under Paragraph 2) in object code or executable form under the terms of +Paragraphs 1 and 2 above provided that you also do one of the following: + + a) accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of + Paragraphs 1 and 2 above; or, + + b) accompany it with a written offer, valid for at least three + years, to give any third party free (except for a nominal charge + for the cost of distribution) a complete machine-readable copy of the + corresponding source code, to be distributed under the terms of + Paragraphs 1 and 2 above; or, + + c) accompany it with the information you received as to where the + corresponding source code may be obtained. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form alone.) + +Source code for a work means the preferred form of the work for making +modifications to it. For an executable file, complete source code means +all the source code for all modules it contains; but, as a special +exception, it need not include source code for modules which are standard +libraries that accompany the operating system on which the executable +file runs, or for standard header files or definitions files that +accompany that operating system. + + 4. You may not copy, modify, sublicense, distribute or transfer the +Program except as expressly provided under this General Public License. +Any attempt otherwise to copy, modify, sublicense, distribute or transfer +the Program is void, and will automatically terminate your rights to use +the Program under this License. However, parties who have received +copies, or rights to use copies, from you under this General Public +License will not have their licenses terminated so long as such parties +remain in full compliance. + + 5. By copying, distributing or modifying the Program (or any work based +on the Program) you indicate your acceptance of this license to do so, +and all its terms and conditions. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the original +licensor to copy, distribute or modify the Program subject to these +terms and conditions. You may not impose any further restrictions on the +recipients' exercise of the rights granted herein. + + 7. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of the license which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +the license, you may choose any version ever published by the Free Software +Foundation. + + 8. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to humanity, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + + To do so, attach the following notices to the program. It is safest to +attach them to the start of each source file to most effectively convey +the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 1, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19xx name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the +appropriate parts of the General Public License. Of course, the +commands you use may be called something other than `show w' and `show +c'; they could even be mouse-clicks or menu items--whatever suits your +program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + program `Gnomovision' (a program to direct compilers to make passes + at assemblers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +That's all there is to it! + + +--- The Artistic License 1.0 --- + +This software is Copyright (c) 2018 by Matt Simerson. + +This is free software, licensed under: + + The Artistic License 1.0 + +The Artistic License + +Preamble + +The intent of this document is to state the conditions under which a Package +may be copied, such that the Copyright Holder maintains some semblance of +artistic control over the development of the package, while giving the users of +the package the right to use and distribute the Package in a more-or-less +customary fashion, plus the right to make reasonable modifications. + +Definitions: + + - "Package" refers to the collection of files distributed by the Copyright + Holder, and derivatives of that collection of files created through + textual modification. + - "Standard Version" refers to such a Package if it has not been modified, + or has been modified in accordance with the wishes of the Copyright + Holder. + - "Copyright Holder" is whoever is named in the copyright or copyrights for + the package. + - "You" is you, if you're thinking about copying or distributing this Package. + - "Reasonable copying fee" is whatever you can justify on the basis of media + cost, duplication charges, time of people involved, and so on. (You will + not be required to justify it to the Copyright Holder, but only to the + computing community at large as a market that must bear the fee.) + - "Freely Available" means that no fee is charged for the item itself, though + there may be fees involved in handling the item. It also means that + recipients of the item may redistribute it under the same conditions they + received it. + +1. You may make and give away verbatim copies of the source form of the +Standard Version of this Package without restriction, provided that you +duplicate all of the original copyright notices and associated disclaimers. + +2. You may apply bug fixes, portability fixes and other modifications derived +from the Public Domain or from the Copyright Holder. A Package modified in such +a way shall still be considered the Standard Version. + +3. You may otherwise modify your copy of this Package in any way, provided that +you insert a prominent notice in each changed file stating how and when you +changed that file, and provided that you do at least ONE of the following: + + a) place your modifications in the Public Domain or otherwise make them + Freely Available, such as by posting said modifications to Usenet or an + equivalent medium, or placing the modifications on a major archive site + such as ftp.uu.net, or by allowing the Copyright Holder to include your + modifications in the Standard Version of the Package. + + b) use the modified Package only within your corporation or organization. + + c) rename any non-standard executables so the names do not conflict with + standard executables, which must also be provided, and provide a separate + manual page for each non-standard executable that clearly documents how it + differs from the Standard Version. + + d) make other distribution arrangements with the Copyright Holder. + +4. You may distribute the programs of this Package in object code or executable +form, provided that you do at least ONE of the following: + + a) distribute a Standard Version of the executables and library files, + together with instructions (in the manual page or equivalent) on where to + get the Standard Version. + + b) accompany the distribution with the machine-readable source of the Package + with your modifications. + + c) accompany any non-standard executables with their corresponding Standard + Version executables, giving the non-standard executables non-standard + names, and clearly documenting the differences in manual pages (or + equivalent), together with instructions on where to get the Standard + Version. + + d) make other distribution arrangements with the Copyright Holder. + +5. You may charge a reasonable copying fee for any distribution of this +Package. You may charge any fee you choose for support of this Package. You +may not charge a fee for this Package itself. However, you may distribute this +Package in aggregate with other (possibly commercial) programs as part of a +larger (possibly commercial) software distribution provided that you do not +advertise this Package as a product of your own. + +6. The scripts and library files supplied as input to or produced as output +from the programs of this Package do not automatically fall under the copyright +of this Package, but belong to whomever generated them, and may be sold +commercially, and may be aggregated with this Package. + +7. C or perl subroutines supplied by you and linked into this Package shall not +be considered part of this Package. + +8. The name of the Copyright Holder may not be used to endorse or promote +products derived from this software without specific prior written permission. + +9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +The End + diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 00000000..e9d759fd --- /dev/null +++ b/MANIFEST @@ -0,0 +1,142 @@ +.perltidyrc +bin/dmarc_http_client +bin/dmarc_httpd +bin/dmarc_lookup +bin/dmarc_receive +bin/dmarc_send_reports +bin/dmarc_update_public_suffix_list +bin/dmarc_view_reports +bin/install_deps.pl +Build.PL +Changes +DEVELOP.md +example/report_cgi.png +FAQ.md +INSTALL.md +lib/Mail/DMARC.pm +lib/Mail/DMARC/Base.pm +lib/Mail/DMARC/HTTP.pm +lib/Mail/DMARC/Policy.pm +lib/Mail/DMARC/PurePerl.pm +lib/Mail/DMARC/Report.pm +lib/Mail/DMARC/Report/Aggregate.pm +lib/Mail/DMARC/Report/Aggregate/Metadata.pm +lib/Mail/DMARC/Report/Aggregate/Record.pm +lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results.pm +lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results/DKIM.pm +lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results/SPF.pm +lib/Mail/DMARC/Report/Aggregate/Record/Identifiers.pm +lib/Mail/DMARC/Report/Aggregate/Record/Row.pm +lib/Mail/DMARC/Report/Aggregate/Record/Row/Policy_Evaluated.pm +lib/Mail/DMARC/Report/Receive.pm +lib/Mail/DMARC/Report/Send.pm +lib/Mail/DMARC/Report/Send/HTTP.pm +lib/Mail/DMARC/Report/Send/SMTP.pm +lib/Mail/DMARC/Report/Store.pm +lib/Mail/DMARC/Report/Store/SQL.pm +lib/Mail/DMARC/Report/Store/SQL/Grammars/MySQL.pm +lib/Mail/DMARC/Report/Store/SQL/Grammars/PostgreSQL.pm +lib/Mail/DMARC/Report/Store/SQL/Grammars/SQLite.pm +lib/Mail/DMARC/Report/URI.pm +lib/Mail/DMARC/Result.pm +lib/Mail/DMARC/Result/Reason.pm +LICENSE +Makefile.PL +MANIFEST This list of files +META.json +META.yml +README.md +share/dmarc_whitelist +share/html/css/ellipsis-xbl.xml +share/html/css/ui.jqgrid.css +share/html/css/ui.multiselect.css +share/html/index.html +share/html/js/i18n/grid.locale-ar.js.gz +share/html/js/i18n/grid.locale-bg.js.gz +share/html/js/i18n/grid.locale-bg1251.js.gz +share/html/js/i18n/grid.locale-cat.js.gz +share/html/js/i18n/grid.locale-cn.js.gz +share/html/js/i18n/grid.locale-cs.js.gz +share/html/js/i18n/grid.locale-da.js.gz +share/html/js/i18n/grid.locale-de.js.gz +share/html/js/i18n/grid.locale-dk.js.gz +share/html/js/i18n/grid.locale-el.js.gz +share/html/js/i18n/grid.locale-en.js.gz +share/html/js/i18n/grid.locale-es.js.gz +share/html/js/i18n/grid.locale-fa.js.gz +share/html/js/i18n/grid.locale-fi.js.gz +share/html/js/i18n/grid.locale-fr.js.gz +share/html/js/i18n/grid.locale-gl.js.gz +share/html/js/i18n/grid.locale-he.js.gz +share/html/js/i18n/grid.locale-hr.js.gz +share/html/js/i18n/grid.locale-hr1250.js.gz +share/html/js/i18n/grid.locale-hu.js.gz +share/html/js/i18n/grid.locale-id.js.gz +share/html/js/i18n/grid.locale-is.js.gz +share/html/js/i18n/grid.locale-it.js.gz +share/html/js/i18n/grid.locale-ja.js.gz +share/html/js/i18n/grid.locale-kr.js.gz +share/html/js/i18n/grid.locale-lt.js.gz +share/html/js/i18n/grid.locale-mne.js.gz +share/html/js/i18n/grid.locale-nl.js.gz +share/html/js/i18n/grid.locale-no.js.gz +share/html/js/i18n/grid.locale-pl.js.gz +share/html/js/i18n/grid.locale-pt-br.js.gz +share/html/js/i18n/grid.locale-pt.js.gz +share/html/js/i18n/grid.locale-ro.js.gz +share/html/js/i18n/grid.locale-ru.js.gz +share/html/js/i18n/grid.locale-sk.js.gz +share/html/js/i18n/grid.locale-sr-latin.js.gz +share/html/js/i18n/grid.locale-sr.js.gz +share/html/js/i18n/grid.locale-sv.js.gz +share/html/js/i18n/grid.locale-th.js.gz +share/html/js/i18n/grid.locale-tr.js.gz +share/html/js/i18n/grid.locale-tw.js.gz +share/html/js/i18n/grid.locale-ua.js.gz +share/html/js/i18n/grid.locale-vi.js.gz +share/html/js/jquery.jqGrid.min.js.gz +share/html/plugins/grid.addons.js.gz +share/html/plugins/grid.postext.js.gz +share/html/plugins/grid.setcolumns.js.gz +share/html/plugins/jquery.contextmenu.js.gz +share/html/plugins/jquery.searchFilter.js.gz +share/html/plugins/jquery.tablednd.js.gz +share/html/plugins/searchFilter.css +share/html/plugins/ui.multiselect.css +share/html/plugins/ui.multiselect.js.gz +share/mail-dmarc.cron +share/mail-dmarc.ini +share/mail_dmarc_schema.mysql +share/mail_dmarc_schema.pgsql +share/mail_dmarc_schema.sqlite +share/public_suffix_list +share/rua-schema.xsd +t/00.Dmarc.t +t/01.Policy.t +t/03.Base.t +t/04.PurePerl.t +t/06.Result.t +t/09.HTTP.t +t/10.Report.t +t/11.Report.Store.t +t/12.Report.Store.SQL.t +t/13.Report.Aggregate.t +t/14.Report.Aggregate.Metadata.t +t/15.Report.Aggregate.Record.t +t/16.Report.Aggregate.Record.Auth_Results.t +t/17.Report.Aggregate.Schema.t +t/20.Report.URI.t +t/21.Report.Send.t +t/22.Report.Send.SMTP.t +t/23.Report.Send.HTTP.t +t/25.Report.Receive.t +t/mail-dmarc.ini +t/travis/.travis.yml +t/travis/backends/mail-dmarc.sql.mysql.ini +t/travis/backends/mail-dmarc.sql.Pg.ini +t/travis/backends/mail-dmarc.sql.SQLite.ini +t/whitelist +TODO.md +xt/author-critic.t +xt/perlcritic.rc +xt/release-pod-syntax.t diff --git a/META.json b/META.json new file mode 100644 index 00000000..d39921a4 --- /dev/null +++ b/META.json @@ -0,0 +1,134 @@ +{ + "abstract" : "Perl implementation of DMARC", + "author" : [ + "Matt Simerson ", + "Davide Migliavacca ", + "Marc Bradshaw " + ], + "dynamic_config" : 0, + "license" : [ + "perl_5" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : 2 + }, + "name" : "Mail-DMARC", + "prereqs" : { + "build" : { + "requires" : { + "Module::Build" : "0.3601" + } + }, + "configure" : { + "requires" : { + "ExtUtils::MakeMaker" : "0", + "File::ShareDir::Install" : "0.06", + "Module::Build" : "0.3601" + } + }, + "develop" : { + "requires" : { + "Test::Pod" : "1.41" + } + }, + "runtime" : { + "recommends" : { + "CGI" : "0", + "Email::Simple" : "0", + "IO::Compress::Gzip" : "0", + "IO::Compress::Zip" : "0", + "IO::Uncompress::Gunzip" : "0", + "IO::Uncompress::Unzip" : "0", + "Mail::DKIM" : "0", + "Net::HTTP" : "0", + "Net::IMAP::Simple" : "0", + "Net::Server" : "2" + }, + "requires" : { + "CGI" : "0", + "CPAN" : "0", + "Carp" : "0", + "Config::Tiny" : "0", + "DBD::SQLite" : "1.31", + "DBIx::Simple" : "1.35", + "Data::Dumper" : "0", + "Email::MIME" : "0", + "Email::Simple" : "0", + "Encode" : "0", + "English" : "0", + "File::ShareDir" : "0", + "Getopt::Long" : "0", + "HTTP::Request" : "0", + "HTTP::Tiny" : "0", + "IO::Compress::Gzip" : "0", + "IO::Compress::Zip" : "0", + "IO::File" : "0", + "IO::Socket::SSL" : "0", + "IO::Uncompress::Gunzip" : "0", + "IO::Uncompress::Unzip" : "0", + "JSON" : "0", + "LWP::UserAgent" : "0", + "Mail::DKIM::PrivateKey" : "0", + "Mail::DKIM::Signer" : "0", + "Mail::DKIM::TextWrap" : "0", + "Net::DNS::Resolver" : "0", + "Net::HTTP" : "0", + "Net::IDN::Encode" : "0", + "Net::IP" : "0", + "Net::SMTPS" : "0", + "Net::SSLeay" : "0", + "Net::Server::HTTP" : "0", + "POSIX" : "0", + "Pod::Usage" : "0", + "Regexp::Common" : "2013031301", + "Socket" : "0", + "Socket6" : "0.23", + "Sys::Hostname" : "0", + "Sys::Syslog" : "0", + "Test::File::ShareDir" : "0", + "URI" : "0", + "XML::LibXML" : "0", + "lib" : "0", + "parent" : "0", + "perl" : "5.008", + "strict" : "0", + "warnings" : "0" + } + }, + "test" : { + "recommends" : { + "Test::Output" : "0", + "XML::SAX::ParserFactory" : "0", + "XML::Validator::Schema" : "0" + }, + "requires" : { + "Test::Exception" : "0", + "Test::File::ShareDir" : "0", + "Test::More" : "0", + "Test::Output" : "0" + } + } + }, + "release_status" : "stable", + "resources" : { + "bugtracker" : { + "web" : "https://github.com/msimerson/mail-dmarc/issues" + }, + "homepage" : "https://github.com/msimerson/mail-dmarc/wiki", + "repository" : { + "type" : "git", + "url" : "git://github.com/msimerson/mail-dmarc.git", + "web" : "https://github.com/msimerson/mail-dmarc" + } + }, + "version" : "1.20191024", + "x_contributors" : [ + "Benny Pedersen ", + "Jean Paul Galea ", + "Marisa Clardy ", + "Priyadi Iman Nurcahyo ", + "Ricardo Signes " + ] +} + diff --git a/META.yml b/META.yml new file mode 100644 index 00000000..ee32bf57 --- /dev/null +++ b/META.yml @@ -0,0 +1,93 @@ +--- +abstract: 'Perl implementation of DMARC' +author: + - 'Matt Simerson ' + - 'Davide Migliavacca ' + - 'Marc Bradshaw ' +build_requires: + Module::Build: '0.3601' + Test::Exception: '0' + Test::File::ShareDir: '0' + Test::More: '0' + Test::Output: '0' +configure_requires: + ExtUtils::MakeMaker: '0' + File::ShareDir::Install: '0.06' + Module::Build: '0.3601' +dynamic_config: 0 +license: perl +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: '1.4' +name: Mail-DMARC +recommends: + CGI: '0' + Email::Simple: '0' + IO::Compress::Gzip: '0' + IO::Compress::Zip: '0' + IO::Uncompress::Gunzip: '0' + IO::Uncompress::Unzip: '0' + Mail::DKIM: '0' + Net::HTTP: '0' + Net::IMAP::Simple: '0' + Net::Server: '2' +requires: + CGI: '0' + CPAN: '0' + Carp: '0' + Config::Tiny: '0' + DBD::SQLite: '1.31' + DBIx::Simple: '1.35' + Data::Dumper: '0' + Email::MIME: '0' + Email::Simple: '0' + Encode: '0' + English: '0' + File::ShareDir: '0' + Getopt::Long: '0' + HTTP::Request: '0' + HTTP::Tiny: '0' + IO::Compress::Gzip: '0' + IO::Compress::Zip: '0' + IO::File: '0' + IO::Socket::SSL: '0' + IO::Uncompress::Gunzip: '0' + IO::Uncompress::Unzip: '0' + JSON: '0' + LWP::UserAgent: '0' + Mail::DKIM::PrivateKey: '0' + Mail::DKIM::Signer: '0' + Mail::DKIM::TextWrap: '0' + Net::DNS::Resolver: '0' + Net::HTTP: '0' + Net::IDN::Encode: '0' + Net::IP: '0' + Net::SMTPS: '0' + Net::SSLeay: '0' + Net::Server::HTTP: '0' + POSIX: '0' + Pod::Usage: '0' + Regexp::Common: '2013031301' + Socket: '0' + Socket6: '0.23' + Sys::Hostname: '0' + Sys::Syslog: '0' + Test::File::ShareDir: '0' + URI: '0' + XML::LibXML: '0' + lib: '0' + parent: '0' + perl: '5.008' + strict: '0' + warnings: '0' +resources: + bugtracker: https://github.com/msimerson/mail-dmarc/issues + homepage: https://github.com/msimerson/mail-dmarc/wiki + repository: git://github.com/msimerson/mail-dmarc.git +version: '1.20191024' +x_contributors: + - 'Benny Pedersen ' + - 'Jean Paul Galea ' + - 'Marisa Clardy ' + - 'Priyadi Iman Nurcahyo ' + - 'Ricardo Signes ' diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 00000000..22559210 --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,175 @@ + +use strict; +use warnings; + +use 5.008; + +use ExtUtils::MakeMaker; + +use File::ShareDir::Install; +$File::ShareDir::Install::INCLUDE_DOTFILES = 1; +$File::ShareDir::Install::INCLUDE_DOTDIRS = 1; +install_share dist => "share"; + + +my %WriteMakefileArgs = ( + "ABSTRACT" => "Perl implementation of DMARC", + "AUTHOR" => "Matt Simerson , Davide Migliavacca , Marc Bradshaw ", + "BUILD_REQUIRES" => { + "Module::Build" => "0.3601" + }, + "CONFIGURE_REQUIRES" => { + "ExtUtils::MakeMaker" => 0, + "File::ShareDir::Install" => "0.06", + "Module::Build" => "0.3601" + }, + "DISTNAME" => "Mail-DMARC", + "EXE_FILES" => [ + "bin/dmarc_update_public_suffix_list", + "bin/dmarc_send_reports", + "bin/dmarc_httpd", + "bin/dmarc_lookup", + "bin/dmarc_receive", + "bin/dmarc_http_client", + "bin/dmarc_view_reports" + ], + "LICENSE" => "perl", + "MIN_PERL_VERSION" => "5.008", + "NAME" => "Mail::DMARC", + "PREREQ_PM" => { + "CGI" => 0, + "CPAN" => 0, + "Carp" => 0, + "Config::Tiny" => 0, + "DBD::SQLite" => "1.31", + "DBIx::Simple" => "1.35", + "Data::Dumper" => 0, + "Email::MIME" => 0, + "Email::Simple" => 0, + "Encode" => 0, + "English" => 0, + "File::ShareDir" => 0, + "Getopt::Long" => 0, + "HTTP::Request" => 0, + "HTTP::Tiny" => 0, + "IO::Compress::Gzip" => 0, + "IO::Compress::Zip" => 0, + "IO::File" => 0, + "IO::Socket::SSL" => 0, + "IO::Uncompress::Gunzip" => 0, + "IO::Uncompress::Unzip" => 0, + "JSON" => 0, + "LWP::UserAgent" => 0, + "Mail::DKIM::PrivateKey" => 0, + "Mail::DKIM::Signer" => 0, + "Mail::DKIM::TextWrap" => 0, + "Net::DNS::Resolver" => 0, + "Net::HTTP" => 0, + "Net::IDN::Encode" => 0, + "Net::IP" => 0, + "Net::SMTPS" => 0, + "Net::SSLeay" => 0, + "Net::Server::HTTP" => 0, + "POSIX" => 0, + "Pod::Usage" => 0, + "Regexp::Common" => "2013031301", + "Socket" => 0, + "Socket6" => "0.23", + "Sys::Hostname" => 0, + "Sys::Syslog" => 0, + "Test::File::ShareDir" => 0, + "URI" => 0, + "XML::LibXML" => 0, + "lib" => 0, + "parent" => 0, + "strict" => 0, + "warnings" => 0 + }, + "TEST_REQUIRES" => { + "Test::Exception" => 0, + "Test::File::ShareDir" => 0, + "Test::More" => 0, + "Test::Output" => 0 + }, + "VERSION" => "1.20191024", + "test" => { + "TESTS" => "t/*.t" + } +); + + +my %FallbackPrereqs = ( + "CGI" => 0, + "CPAN" => 0, + "Carp" => 0, + "Config::Tiny" => 0, + "DBD::SQLite" => "1.31", + "DBIx::Simple" => "1.35", + "Data::Dumper" => 0, + "Email::MIME" => 0, + "Email::Simple" => 0, + "Encode" => 0, + "English" => 0, + "ExtUtils::MakeMaker" => 0, + "File::ShareDir" => 0, + "File::ShareDir::Install" => "0.06", + "Getopt::Long" => 0, + "HTTP::Request" => 0, + "HTTP::Tiny" => 0, + "IO::Compress::Gzip" => 0, + "IO::Compress::Zip" => 0, + "IO::File" => 0, + "IO::Socket::SSL" => 0, + "IO::Uncompress::Gunzip" => 0, + "IO::Uncompress::Unzip" => 0, + "JSON" => 0, + "LWP::UserAgent" => 0, + "Mail::DKIM::PrivateKey" => 0, + "Mail::DKIM::Signer" => 0, + "Mail::DKIM::TextWrap" => 0, + "Module::Build" => "0.3601", + "Net::DNS::Resolver" => 0, + "Net::HTTP" => 0, + "Net::IDN::Encode" => 0, + "Net::IP" => 0, + "Net::SMTPS" => 0, + "Net::SSLeay" => 0, + "Net::Server::HTTP" => 0, + "POSIX" => 0, + "Pod::Usage" => 0, + "Regexp::Common" => "2013031301", + "Socket" => 0, + "Socket6" => "0.23", + "Sys::Hostname" => 0, + "Sys::Syslog" => 0, + "Test::Exception" => 0, + "Test::File::ShareDir" => 0, + "Test::More" => 0, + "Test::Output" => 0, + "URI" => 0, + "XML::LibXML" => 0, + "lib" => 0, + "parent" => 0, + "strict" => 0, + "warnings" => 0 +); + + +unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { + delete $WriteMakefileArgs{TEST_REQUIRES}; + delete $WriteMakefileArgs{BUILD_REQUIRES}; + $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; +} + +delete $WriteMakefileArgs{CONFIGURE_REQUIRES} + unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; + +WriteMakefile(%WriteMakefileArgs); + +{ +package +MY; +use File::ShareDir::Install qw(postamble); +} + + diff --git a/README.md b/README.md index 91895dee..dc4a4f45 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +# Status Badges + +[![Build Status](https://travis-ci.org/msimerson/mail-dmarc.svg?branch=master)](https://travis-ci.org/msimerson/mail-dmarc) + +[![Coverage Status](https://coveralls.io/repos/msimerson/mail-dmarc/badge.svg)](https://coveralls.io/r/msimerson/mail-dmarc) + # NAME Mail::DMARC - Perl implementation of DMARC @@ -66,12 +72,6 @@ The report store can use the same database to store reports you have received as - received reports will have a null value for report\_policy\_published.rua - outgoing reports will have null values for report.uuid and report\_record.count -# Code Climate - -[![Build Status](https://travis-ci.org/msimerson/mail-dmarc.svg?branch=master)](https://travis-ci.org/msimerson/mail-dmarc) - -[![Coverage Status](https://coveralls.io/repos/msimerson/mail-dmarc/badge.svg)](https://coveralls.io/r/msimerson/mail-dmarc) - # CLASSES [Mail::DMARC](https://metacpan.org/pod/Mail::DMARC) - the perl interface for DMARC @@ -275,12 +275,12 @@ The daddy of this perl module was a [DMARC module for the qpsmtpd MTA](https://g - Matt Simerson - Davide Migliavacca +- Marc Bradshaw # CONTRIBUTORS - Benny Pedersen - Jean Paul Galea -- Marc Bradshaw - Marisa Clardy - Priyadi Iman Nurcahyo - Ricardo Signes diff --git a/bin/dmarc_http_client b/bin/dmarc_http_client index 22b4201a..e48b3e7b 100755 --- a/bin/dmarc_http_client +++ b/bin/dmarc_http_client @@ -1,5 +1,4 @@ #!/usr/bin/perl -# VERSION use strict; use warnings; @@ -63,10 +62,14 @@ sub get_json_request { }); }; -# ABSTRACT: an HTTP client for submitting a DMARC validation request -# PODNAME: dmarc_http_client __END__ +=pod + +=head1 NAME + +dmarc_http_client: an HTTP client for submitting a DMARC validation request + =head1 SYNOPSIS Send JSON encoded HTTP requests to the DMARC validation service provided by dmarc_httpd. @@ -75,10 +78,26 @@ Send JSON encoded HTTP requests to the DMARC validation service provided by dmar --port=8080 --data='{"envelope_from":"cars4you.info"...}' - The data option accepts a special '-' value that will read the JSON encoded data from STDIN. Use it like this: - cat /path/to/data.json | dmarc_http_client --data=- +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back +=cut diff --git a/bin/dmarc_httpd b/bin/dmarc_httpd index 2b78d6f7..c05095ee 100755 --- a/bin/dmarc_httpd +++ b/bin/dmarc_httpd @@ -1,5 +1,4 @@ #!/usr/bin/perl -# VERSION use strict; use warnings; @@ -14,10 +13,14 @@ my $http = Mail::DMARC::HTTP->new; $http->dmarc_httpd($report); exit; -# ABSTRACT: a web server for DMARC validation and report viewing -# PODNAME: dmarc_httpd __END__ +=pod + +=head1 NAME + +dmarc_httpd: a web server for DMARC validation and report viewing + =head1 SYNOPSIS A HTTP interface for: @@ -78,4 +81,22 @@ jQuery - http://www.jquery.com/ jqGrid - http://www.trirand.com/blog/ +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + =cut diff --git a/bin/dmarc_lookup b/bin/dmarc_lookup index f6edc3a9..8e265af6 100755 --- a/bin/dmarc_lookup +++ b/bin/dmarc_lookup @@ -1,5 +1,4 @@ #!/usr/bin/perl -# VERSION use strict; use warnings; @@ -35,12 +34,17 @@ if ( $policy->rua ) { print "valid report URI: "; print $uri_count ? "yes\n" : "no\n"; }; + exit; -# PODNAME: dmarc_lookup -# ABSTRACT: look up DMARC policy for a domain __END__ +=pod + +=head1 NAME + +dmarc_lookup: look up DMARC policy for a domain + =head1 SYNOPSIS dmarc_lookup example.com [ --verbose ] @@ -70,4 +74,22 @@ Other ways to retrieve a DMARC record for a domain are: L +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + =cut diff --git a/bin/dmarc_receive b/bin/dmarc_receive index 0acf16cf..cc6965c7 100755 --- a/bin/dmarc_receive +++ b/bin/dmarc_receive @@ -1,5 +1,4 @@ #!/usr/bin/perl -# VERSION use strict; use warnings; @@ -31,10 +30,12 @@ $recv->from_file($file) if $file; exit; -# PODNAME: dmarc_receive -# ABSTRACT: receive aggregate reports via IMAP, mbox, or message file(s) __END__ +=head1 NAME + +dmarc_receive: receive aggregate reports via IMAP, mbox, or message file(s) + =head1 USAGE dmarc_receive [ --imap | --mbox | --file ] @@ -74,6 +75,4 @@ Accepts the filename of a file containing a mail message. The message is parsed Accepts the filename of a mbox format file containing mail messages. The messages are parsed and stored. - =cut - diff --git a/bin/dmarc_send_reports b/bin/dmarc_send_reports index 4967c6e8..b86358e9 100755 --- a/bin/dmarc_send_reports +++ b/bin/dmarc_send_reports @@ -1,5 +1,4 @@ #!/usr/bin/perl -# VERSION use strict; use warnings; @@ -91,8 +90,6 @@ syslog( LOG_INFO, 'dmarc_send_reports done' ) if $syslog; closelog() if $syslog; exit; -# PODNAME: dmarc_send_reports -# ABSTRACT: send aggregate reports sub send_single_report { @@ -450,3 +447,30 @@ sub log_to_syslog { return; } +__END__ + +=pod + +=head1 NAME + +dmarc_send_reports: send aggregate reports + +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=cut diff --git a/bin/dmarc_update_public_suffix_list b/bin/dmarc_update_public_suffix_list index 66a85a15..3e2941aa 100755 --- a/bin/dmarc_update_public_suffix_list +++ b/bin/dmarc_update_public_suffix_list @@ -1,5 +1,4 @@ #!/usr/bin/perl -# VERSION use strict; use warnings; @@ -29,14 +28,28 @@ Mail::DMARC->new( (defined $config_file ? (config_file => $config_file) : ()) )->update_psl_file($dryrun); -# PODNAME: dmarc_update_public_suffix_list -# ABSTRACT: command line tool to download updated public suffix list __END__ +=pod + +=head1 NAME + +dmarc_update_public_suffix_list: command line tool to download updated public suffix list + =head1 SYNOPSIS dmarc_update_public_suffix_list [ --option=value ] +=head1 DESCRIPTION + +Downloads a new Public Suffix List to the location specified by /etc/mail-dmarc.ini + +The PSL is maintained by the Mozilla Foundation. It is updated a few times per +month, you are requested to download no more than once per day. + +The URL of the file is https://publicsuffix.org/list/effective_tld_names.dat +More details can be found at https://publicsuffix.org/ + =head2 Options dmarc_update_public_suffix_list [ --dryrun --help ] @@ -57,15 +70,22 @@ To download a new Public Suffix List to the location specified my mail-dmarc.ini dmarc_update_public_suffix_list -=head1 DESCRIPTION +=head1 AUTHORS -Downloads a new Public Suffix List to the location specified by /etc/mail-dmarc.ini +=over 4 -The PSL is maintained by the Mozilla Foundation. It is updated a few times per -month, you are requested to download no more than once per day. +=item * -The URL of the file is https://publicsuffix.org/list/effective_tld_names.dat -More details can be found at https://publicsuffix.org/ +Matt Simerson -=cut +=item * + +Davide Migliavacca + +=item * +Marc Bradshaw + +=back + +=cut diff --git a/bin/dmarc_view_reports b/bin/dmarc_view_reports index 402fe642..d200ecf0 100755 --- a/bin/dmarc_view_reports +++ b/bin/dmarc_view_reports @@ -1,5 +1,4 @@ #!/usr/bin/perl -# VERSION use strict; use warnings; @@ -158,15 +157,17 @@ sub get_dns_hostname { }; exit; -# PODNAME: dmarc_view_reports -# ABSTRACT: command line report viewer + __END__ -sub {} =head1 SYNOPSIS dmarc_view_reports [ --option=value ] +=head1 DESCRIPTION + +Dumps the contents of the DMARC data store to your terminal. The most recent records are show first. + =head2 Search Options author - report author (Yahoo! Inc, google.com, etc..) @@ -219,11 +220,6 @@ metro_code dmarc_view_reports --geoip=city,city,city # repeat -=head1 DESCRIPTION - -Dumps the contents of the DMARC data store to your terminal. The most recent records are show first. - - =head1 SAMPLE OUTPUT @@ -260,5 +256,23 @@ Dumps the contents of the DMARC data store to your terminal. The most recent rec 559 hotmail.com lynboyer.com 2013-05-20 20:00:00 | -- 6 208.75.177.101 none pass pass -=cut +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=cut diff --git a/bin/install_deps.pl b/bin/install_deps.pl index ed173dcc..2604ee40 100755 --- a/bin/install_deps.pl +++ b/bin/install_deps.pl @@ -446,10 +446,10 @@ sub get_cpan_config { sub name_overrides { my $mod = shift; -# Package and port managers have naming conventions for perl modules. The -# methods will typically work out the name based on the module name and a -# couple rules. When that doesn't work, add entries here for FreeBSD (port), -# MacPorts ($dport), yum, and apt. + # Package and port managers have naming conventions for perl modules. The + # methods will typically work out the name based on the module name and a + # couple rules. When that doesn't work, add entries here for FreeBSD (port), + # MacPorts ($dport), yum, and apt. my @modules = ( { module=>'LWP::UserAgent' , info => { cat=>'www', port=>'p5-libwww', dport=>'p5-libwww-perl', yum=>'perl-libwww-perl' }, }, { module=>'Mail::Send' , info => { port => 'Mail::Tools', } }, @@ -463,5 +463,22 @@ sub name_overrides { return { module=>$mod, info => { } }; }; -# PODNAME: install_deps.pl -# ABSTRACT: install dependencies with package manager or CPAN +__END__ + +=pod + +=head1 NAME + +install_deps.pl: install dependencies with package manager or CPAN + +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=back + +=cut \ No newline at end of file diff --git a/dist.ini b/dist.ini deleted file mode 100644 index 28c4835d..00000000 --- a/dist.ini +++ /dev/null @@ -1,150 +0,0 @@ -name = Mail-DMARC -author = Matt Simerson -author = Davide Migliavacca -license = Perl_5 -copyright_holder = Matt Simerson -copyright_year = 2018 -is_trial = 0 - -;[@Basic] - GatherDir, MetaYAML, MakeMaker, Manifest, PruneCruft, License, Readme, ExtraTests -[GatherDir] -[GatherDir / Travis] -root = t/travis -include_dotfiles = 1 -[MetaYAML] -[MetaJSON] -[MakeMaker] -[Manifest] -[PruneCruft] -except = \.travis.yml -[License] -;[Readme] markdown instead -[ExtraTests] - -[ModuleBuild] - -[PruneFiles] -filename = dmarc_reports.sqlite -filename = t/reports-test.sqlite -filename = weaver.ini -filename = .mailmap - -; VERSION providers -[AutoVersion] -format = 1.{{ cldr('yyyyMMdd') }} -;[Git::NextVersion] <- worth considering - -[Git::Contributors] -;[ReadmeFromPod] -;[ReadmeMarkdownFromPod] -[ReadmeAnyFromPod] -type=markdown -filename=README.md -location=root - -;[PkgVersion] ; this plugin changes the line numbers of the code, grrr.. -[OurPkgVersion] -; adds 'our $VERSION' to modules -[PodWeaver] -; see weaver.ini - -;[PodCoverageTests] -[PodSyntaxTests] -[Test::Perl::Critic] -critic_config = t/perlcritic.rc -; causes/d Travis build failures on perl 5.10 -;[Test::Kwalitee] -;[Test::Kwalitee::Extra] - -[NextRelease] -format = %-9v %{yyyy-MM-dd VVVV}d -[TestRelease] -[ConfirmRelease] -[UploadToCPAN] - -[MetaResources] -homepage = https://github.com/msimerson/mail-dmarc/wiki -bugtracker.web = https://github.com/msimerson/mail-dmarc/issues -repository.url = git://github.com/msimerson/mail-dmarc.git -repository.web = https://github.com/msimerson/mail-dmarc -repository.type = git - -;[PrePAN] -;author = http://prepan.org/user/msimerson@github -;module = http://prepan.org/module/nXWJ8Y9sBnG - -[Git::CommitBuild] -branch = -release_branch = releases -comment = release %v - -; [@Git] - Git::Check, Commit, Tag, Push -[Git::Check] -allow_dirty = README.md -allow_dirty = dist.ini -untracked_files = ignore -[Git::Commit] -[Git::Tag] -[Git::Push] -tag_format = mail-dmarc-%v -push_to = origin -allow_dirty = [ 'Mail-DMARC-*', '.gitignore', 't/reports-test.sqlite', 'README.md' ] - -[AutoPrereqs] -skip = ^MIME::Lite$ -; Net::Server fails to install on Travis (2013-05-13) -;skip = ^Net::Server - -[Prereqs] -perl = 5.008 -Regexp::Common = 2013031301 -Config::Tiny = 0 -File::ShareDir = 0 -Net::DNS::Resolver = 0 -Net::IP = 0 -Socket6 = 0.23 -Email::MIME = 0 -HTTP::Tiny = 0 -IO::Socket::SSL = 0 -JSON = 0 -Net::SMTPS = 0 -Net::SSLeay = 0 -XML::LibXML = 0 -DBD::SQLite = 1.31 -DBIx::Simple = 1.35 -Test::File::ShareDir = 0 -Net::IDN::Encode = 0 - -; these prereqs are used for the Reporting features -[Prereqs / RuntimeRecommends] -CGI = 0 -;DBD::mysql = 4 -Email::Simple = 0 -IO::Compress::Gzip = 0 -IO::Compress::Zip = 0 -IO::Uncompress::Gunzip = 0 -IO::Uncompress::Unzip = 0 -Mail::DKIM = 0 -;Mail::Mbox::MessageParser = 0 ; breaks Travis test builds -;Mozilla::CA = 0 -Net::IMAP::Simple = 0 -Net::Server = 2 -Net::HTTP = 0 - -[Prereqs / TestRecommends] -Test::Output = 0 -XML::SAX::ParserFactory = 0 -XML::Validator::Schema = 0 - -; TODO: neither the FileFinder nor the skip work for ExecDir. I would rather -; not install bin/install_deps.pl -[FileFinder::ByName / MyBin] -dir = bin -file = dmarc_* -skip = install_deps - -[ExecDir] -finder = MyBin -skip = install_deps - -[ShareDir] diff --git a/lib/Mail/DMARC.pm b/lib/Mail/DMARC.pm index 35ba6811..15f781d0 100644 --- a/lib/Mail/DMARC.pm +++ b/lib/Mail/DMARC.pm @@ -1,8 +1,9 @@ package Mail::DMARC; -# VERSION use strict; use warnings; +our $VERSION = '1.20191024'; + use Carp; our $psl_loads = 0; @@ -292,15 +293,23 @@ sub init { 1; -# ABSTRACT: Perl implementation of DMARC __END__ -=head1 Code Climate +=pod + +=head1 Status Badges =for markdown [![Build Status](https://travis-ci.org/msimerson/mail-dmarc.svg?branch=master)](https://travis-ci.org/msimerson/mail-dmarc) =for markdown [![Coverage Status](https://coveralls.io/repos/msimerson/mail-dmarc/badge.svg)](https://coveralls.io/r/msimerson/mail-dmarc) +=head1 NAME + +Mail::DMARC - Perl implementation of DMARC + +=head1 VERSION + +version 1.20191024 =head1 SYNOPSIS @@ -598,4 +607,57 @@ DMARC L. +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 CONTRIBUTORS + +=for stopwords Benny Pedersen Jean Paul Galea Marisa Clardy Priyadi Iman Nurcahyo Ricardo Signes + +=over 4 + +=item * + +Benny Pedersen + +=item * + +Jean Paul Galea + +=item * + +Marisa Clardy + +=item * + +Priyadi Iman Nurcahyo + +=item * + +Ricardo Signes + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + =cut diff --git a/lib/Mail/DMARC/Base.pm b/lib/Mail/DMARC/Base.pm index 3a3670fc..754608a3 100644 --- a/lib/Mail/DMARC/Base.pm +++ b/lib/Mail/DMARC/Base.pm @@ -1,5 +1,5 @@ package Mail::DMARC::Base; -# VERSION +our $VERSION = '1.20191024'; use strict; use warnings; @@ -120,7 +120,6 @@ sub any_inet_pton { } return 0; } - } sub is_public_suffix { @@ -176,8 +175,7 @@ sub update_psl_file { sub find_psl_file { my ($self) = @_; - my $file = $self->config->{dns}{public_suffix_list} - || 'share/public_suffix_list'; + my $file = $self->config->{dns}{public_suffix_list} || 'share/public_suffix_list'; if ( $file =~ /^\// && -f $file && -r $file ) { print "using $file for Public Suffix List\n" if $self->verbose; return $file; @@ -305,9 +303,17 @@ sub verbose { 1; -# ABSTRACT: DMARC utility functions __END__ -sub {} + +=pod + +=head1 NAME + +Mail::DMARC::Base - DMARC utility functions + +=head1 VERSION + +version 1.20191024 =head1 METHODS @@ -347,4 +353,30 @@ Half the reason to test for domain validity is to shave seconds off our processi Mozilla Public Suffix List: http://publicsuffix.org/list/ +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + =cut + diff --git a/lib/Mail/DMARC/HTTP.pm b/lib/Mail/DMARC/HTTP.pm index d0f4fd2d..d7a700f7 100644 --- a/lib/Mail/DMARC/HTTP.pm +++ b/lib/Mail/DMARC/HTTP.pm @@ -1,5 +1,5 @@ package Mail::DMARC::HTTP; -# VERSION +our $VERSION = '1.20191024'; use strict; use warnings; @@ -200,11 +200,46 @@ sub report_json_rr { 1; -# ABSTRACT: view stored reports via HTTP __END__ +=pod + +=head1 NAME + +Mail::DMARC::HTTP - view stored reports via HTTP + +=head1 VERSION + +version 1.20191024 + =head1 SYNOPSIS See the POD docs / man page for L. +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + =cut + diff --git a/lib/Mail/DMARC/Policy.pm b/lib/Mail/DMARC/Policy.pm index e03c5228..f4dc76dd 100644 --- a/lib/Mail/DMARC/Policy.pm +++ b/lib/Mail/DMARC/Policy.pm @@ -1,8 +1,9 @@ package Mail::DMARC::Policy; -# VERSION use strict; use warnings; +our $VERSION = '1.20191024'; + use Carp; use Mail::DMARC::Report::URI; @@ -184,9 +185,17 @@ sub is_valid { 1; -# ABSTRACT: a DMARC policy in object format __END__ -sub {} + +=pod + +=head1 NAME + +Mail::DMARC::Policy - a DMARC policy in object format + +=head1 VERSION + +version 1.20191024 =head1 SYNOPSIS @@ -217,7 +226,6 @@ DMARC records are stored in TXT resource records in the DNS, at _dmarc.example.c print $_->txtdata."\n" for Net::DNS::Resolver->new(dnsrch=>0)->send('_dmarc.example.com','TXT')->answer; - =head2 dmarc_lookup dmarc_lookup example.com @@ -276,7 +284,6 @@ via DNS. ri=8400; (report interval) pct=50; (percent of messages to filter) - =head2 Tags in Detail The descriptions of each DMARC record tag and its corresponding values is from the March 31, 2013 draft of the DMARC spec: @@ -423,4 +430,30 @@ nothing" is recognized as preventing many organizations from experimenting with strong authentication-based mechanisms. See Section 7.1 for details. +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + =cut + diff --git a/lib/Mail/DMARC/PurePerl.pm b/lib/Mail/DMARC/PurePerl.pm index 3d8b1916..5aab097b 100644 --- a/lib/Mail/DMARC/PurePerl.pm +++ b/lib/Mail/DMARC/PurePerl.pm @@ -1,5 +1,5 @@ package Mail::DMARC::PurePerl; -# VERSION +our $VERSION = '1.20191024'; use strict; use warnings; @@ -578,9 +578,17 @@ sub verify_external_reporting { 1; -# ABSTRACT: Pure Perl implementation of DMARC __END__ -sub {} + +=pod + +=head1 NAME + +Mail::DMARC::PurePerl - Pure Perl implementation of DMARC + +=head1 VERSION + +version 1.20191024 =head1 METHODS @@ -691,7 +699,7 @@ Determine if a report URL is external. If the domain name portion of the URI is =head2 verify_external_reporting -=head3 8.2. Verifying External Destinations +=head3 8.2. Verifying External Destinations It is possible to specify destinations for the different reports that are outside the domain making the request. This is enabled to allow @@ -725,4 +733,29 @@ host part of the authority component of a [URI] specified in the The overriding URI MUST use the same destination host from the first step. +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + =cut diff --git a/lib/Mail/DMARC/Report.pm b/lib/Mail/DMARC/Report.pm index bd1bf830..498dfcfe 100644 --- a/lib/Mail/DMARC/Report.pm +++ b/lib/Mail/DMARC/Report.pm @@ -1,8 +1,9 @@ package Mail::DMARC::Report; -# VERSION use strict; use warnings; +our $VERSION = '1.20191024'; + use Carp; use IO::Compress::Gzip; use IO::Compress::Zip; @@ -79,9 +80,17 @@ sub save_aggregate { 1; -# ABSTRACT: A DMARC report interface __END__ -sub {} + +=pod + +=head1 NAME + +Mail::DMARC::Report - A DMARC report interface + +=head1 VERSION + +version 1.20191024 =head1 DESCRIPTION @@ -191,11 +200,8 @@ can be used to seek assistance. possible registration of a new media type, will be added here when more operational experience is acquired.] - =head1 AFRF reports - - =head1 IODEF reports https://datatracker.ietf.org/doc/draft-kucherawy-dmarc-base/?include_text=1 @@ -204,4 +210,30 @@ Section 3.5 Out of Scope: This first version of DMARC supports only a single reporting format. +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + =cut + diff --git a/lib/Mail/DMARC/Report/Aggregate.pm b/lib/Mail/DMARC/Report/Aggregate.pm index 3e4b11d1..b5a4d979 100644 --- a/lib/Mail/DMARC/Report/Aggregate.pm +++ b/lib/Mail/DMARC/Report/Aggregate.pm @@ -1,8 +1,9 @@ package Mail::DMARC::Report::Aggregate; -# VERSION use strict; use warnings; +our $VERSION = '1.20191024'; + use Carp; use Data::Dumper; use XML::LibXML; @@ -187,9 +188,18 @@ sub get_policy_evaluated_as_xml { } 1; -# ABSTRACT: aggregate report object + __END__ -sub {} + +=pod + +=head1 NAME + +Mail::DMARC::Report::Aggregate - aggregate report object + +=head1 VERSION + +version 1.20191024 =head1 DESCRIPTION @@ -232,7 +242,6 @@ reports at 00:00, 01:00, 02:00; et cetera. Report Generators using a 00:00 UTC, regardless of local timezone or time of report production, in order to facilitate correlation. - =head1 Report Structure This is a translation of the XML report format in the 2013 Draft, converted to perl data structures. @@ -298,4 +307,30 @@ This is a translation of the XML report format in the 2013 Draft, converted to p }, }; +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + =cut + diff --git a/lib/Mail/DMARC/Report/Aggregate/Metadata.pm b/lib/Mail/DMARC/Report/Aggregate/Metadata.pm index 4a27718c..3857c9b8 100644 --- a/lib/Mail/DMARC/Report/Aggregate/Metadata.pm +++ b/lib/Mail/DMARC/Report/Aggregate/Metadata.pm @@ -1,7 +1,9 @@ package Mail::DMARC::Report::Aggregate::Metadata; -# VERSION use strict; use warnings; + +our $VERSION = '1.20191024'; + use XML::LibXML; use parent 'Mail::DMARC::Base'; @@ -79,6 +81,43 @@ sub as_xml { } 1; -# ABSTRACT: metadata section of aggregate report + __END__ -sub {} + +=pod + +=head1 NAME + +Mail::DMARC::Report::Aggregate::Metadata - metadata section of aggregate report + +=head1 VERSION + +version 1.20191024 + +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut + diff --git a/lib/Mail/DMARC/Report/Aggregate/Record.pm b/lib/Mail/DMARC/Report/Aggregate/Record.pm index 803163f6..2a36aef5 100644 --- a/lib/Mail/DMARC/Report/Aggregate/Record.pm +++ b/lib/Mail/DMARC/Report/Aggregate/Record.pm @@ -1,5 +1,5 @@ package Mail::DMARC::Report::Aggregate::Record; -# VERSION +our $VERSION = '1.20191024'; use strict; use warnings; @@ -72,11 +72,45 @@ sub row { 1; -# ABSTRACT: record section of aggregate report __END__ +=pod + +=head1 NAME + +Mail::DMARC::Report::Aggregate::Record - record section of aggregate report + +=head1 VERSION + +version 1.20191024 + =head1 DESCRIPTION An aggregate report record, with object methods for identifiers, auth_results, and each row. +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + =cut diff --git a/lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results.pm b/lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results.pm index 7d4ae116..5c1bed9f 100644 --- a/lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results.pm +++ b/lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results.pm @@ -1,5 +1,5 @@ package Mail::DMARC::Report::Aggregate::Record::Auth_Results; -# VERSION +our $VERSION = '1.20191024'; use strict; use warnings; @@ -69,5 +69,42 @@ sub dkim { 1; -# ABSTRACT: auth_results section of a DMARC aggregate record __END__ + +=pod + +=head1 NAME + +Mail::DMARC::Report::Aggregate::Record::Auth_Results - auth_results section of a DMARC aggregate record + +=head1 VERSION + +version 1.20191024 + +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut + diff --git a/lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results/DKIM.pm b/lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results/DKIM.pm index 76ec9e14..4aa9e796 100644 --- a/lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results/DKIM.pm +++ b/lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results/DKIM.pm @@ -1,5 +1,5 @@ package Mail::DMARC::Report::Aggregate::Record::Auth_Results::DKIM; -# VERSION +our $VERSION = '1.20191024'; use strict; use Carp; @@ -74,5 +74,42 @@ sub is_valid { 1; -# ABSTRACT: auth_results/dkim section of a DMARC aggregate record __END__ + +=pod + +=head1 NAME + +Mail::DMARC::Report::Aggregate::Record::Auth_Results::DKIM - auth_results/dkim section of a DMARC aggregate record + +=head1 VERSION + +version 1.20191024 + +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut + diff --git a/lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results/SPF.pm b/lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results/SPF.pm index 3048d0c7..8786ffae 100644 --- a/lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results/SPF.pm +++ b/lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results/SPF.pm @@ -1,5 +1,5 @@ package Mail::DMARC::Report::Aggregate::Record::Auth_Results::SPF; -# VERSION +our $VERSION = '1.20191024'; use strict; use Carp; @@ -81,5 +81,42 @@ sub is_valid { 1; -# ABSTRACT: auth_results/spf section of a DMARC aggregate record __END__ + +=pod + +=head1 NAME + +Mail::DMARC::Report::Aggregate::Record::Auth_Results::SPF - auth_results/spf section of a DMARC aggregate record + +=head1 VERSION + +version 1.20191024 + +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut + diff --git a/lib/Mail/DMARC/Report/Aggregate/Record/Identifiers.pm b/lib/Mail/DMARC/Report/Aggregate/Record/Identifiers.pm index d8f58d63..ae1d3553 100644 --- a/lib/Mail/DMARC/Report/Aggregate/Record/Identifiers.pm +++ b/lib/Mail/DMARC/Report/Aggregate/Record/Identifiers.pm @@ -1,5 +1,5 @@ package Mail::DMARC::Report::Aggregate::Record::Identifiers; -# VERSION +our $VERSION = '1.20191024'; use strict; use warnings; @@ -33,5 +33,42 @@ sub header_from { 1; -# ABSTRACT: identifiers section of a DMARC aggregate record -__END__ \ No newline at end of file +__END__ + +=pod + +=head1 NAME + +Mail::DMARC::Report::Aggregate::Record::Identifiers - identifiers section of a DMARC aggregate record + +=head1 VERSION + +version 1.20191024 + +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut + diff --git a/lib/Mail/DMARC/Report/Aggregate/Record/Row.pm b/lib/Mail/DMARC/Report/Aggregate/Record/Row.pm index 2e904489..68ae8305 100644 --- a/lib/Mail/DMARC/Report/Aggregate/Record/Row.pm +++ b/lib/Mail/DMARC/Report/Aggregate/Record/Row.pm @@ -1,5 +1,5 @@ package Mail::DMARC::Report::Aggregate::Record::Row; -# VERSION +our $VERSION = '1.20191024'; use strict; use warnings; @@ -46,5 +46,42 @@ sub count { 1; -# ABSTRACT: row section of a DMARC aggregate record -__END__ \ No newline at end of file +__END__ + +=pod + +=head1 NAME + +Mail::DMARC::Report::Aggregate::Record::Row - row section of a DMARC aggregate record + +=head1 VERSION + +version 1.20191024 + +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut + diff --git a/lib/Mail/DMARC/Report/Aggregate/Record/Row/Policy_Evaluated.pm b/lib/Mail/DMARC/Report/Aggregate/Record/Row/Policy_Evaluated.pm index 814b5545..afa2d098 100644 --- a/lib/Mail/DMARC/Report/Aggregate/Record/Row/Policy_Evaluated.pm +++ b/lib/Mail/DMARC/Report/Aggregate/Record/Row/Policy_Evaluated.pm @@ -1,5 +1,5 @@ package Mail::DMARC::Report::Aggregate::Record::Row::Policy_Evaluated; -# VERSION +our $VERSION = '1.20191024'; use strict; use warnings; @@ -46,5 +46,41 @@ sub reason { 1; -# ABSTRACT: row/policy_evaluated section of a DMARC aggregate record -__END__ \ No newline at end of file +__END__ + +=pod + +=head1 NAME + +Mail::DMARC::Report::Aggregate::Record::Row::Policy_Evaluated - row/policy_evaluated section of a DMARC aggregate record + +=head1 VERSION + +version 1.20191024 + +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff --git a/lib/Mail/DMARC/Report/Receive.pm b/lib/Mail/DMARC/Report/Receive.pm index 5e0b1f0a..402caab4 100644 --- a/lib/Mail/DMARC/Report/Receive.pm +++ b/lib/Mail/DMARC/Report/Receive.pm @@ -1,8 +1,9 @@ package Mail::DMARC::Report::Receive; -# VERSION use strict; use warnings; +our $VERSION = '1.20191024'; + use Carp; use Data::Dumper; use Email::MIME; @@ -409,9 +410,18 @@ sub do_node_record_reason { } 1; + __END__ -# ABSTRACT: process incoming DMARC reports -sub {} + +=pod + +=head1 NAME + +Mail::DMARC::Report::Receive - process incoming DMARC reports + +=head1 VERSION + +version 1.20191024 =head1 DESCRIPTION @@ -439,4 +449,30 @@ To extract messages from the message body, the MIME attachments are decompressed Accepts a XML message, parsing it with XML::LibXML and XPath expressions. The parsed data is stored in a L object. When the parsing is complete, the report object is saved to the report store. +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + =cut + diff --git a/lib/Mail/DMARC/Report/Send.pm b/lib/Mail/DMARC/Report/Send.pm index 909ee0a3..87aef001 100644 --- a/lib/Mail/DMARC/Report/Send.pm +++ b/lib/Mail/DMARC/Report/Send.pm @@ -1,8 +1,9 @@ package Mail::DMARC::Report::Send; -# VERSION use strict; use warnings; +our $VERSION = '1.20191024'; + use parent 'Mail::DMARC::Base'; use Mail::DMARC::Report::Send::SMTP; use Mail::DMARC::Report::Send::HTTP; @@ -51,9 +52,17 @@ EO_TOO_BIG 1; -# ABSTRACT: report sending dispatch class __END__ -sub {} + +=pod + +=head1 NAME + +Mail::DMARC::Report::Send - report sending dispatch class + +=head1 VERSION + +version 1.20191024 =head1 DESCRIPTION @@ -83,4 +92,30 @@ L Other registered URI schemes may be explicitly supported in later versions. +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + =cut + diff --git a/lib/Mail/DMARC/Report/Send/HTTP.pm b/lib/Mail/DMARC/Report/Send/HTTP.pm index 6222dee0..6a7cefee 100644 --- a/lib/Mail/DMARC/Report/Send/HTTP.pm +++ b/lib/Mail/DMARC/Report/Send/HTTP.pm @@ -1,8 +1,9 @@ package Mail::DMARC::Report::Send::HTTP; -# VERSION use strict; use warnings; +our $VERSION = '1.20191024'; + use Carp; #use Data::Dumper; @@ -40,9 +41,17 @@ sub post { 1; -# ABSTRACT: utility methods to send reports by HTTP __END__ -sub {} + +=pod + +=head1 NAME + +Mail::DMARC::Report::Send::HTTP - utility methods to send reports by HTTP + +=head1 VERSION + +version 1.20191024 =head1 12.2.2. HTTP @@ -58,4 +67,30 @@ HTTP permits the use of Content-Transfer-Encoding to upload gzip content using the POST or PUT instruction after translating the content to 7-bit ASCII. +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + =cut + diff --git a/lib/Mail/DMARC/Report/Send/SMTP.pm b/lib/Mail/DMARC/Report/Send/SMTP.pm index 09e3348e..86176b7c 100644 --- a/lib/Mail/DMARC/Report/Send/SMTP.pm +++ b/lib/Mail/DMARC/Report/Send/SMTP.pm @@ -1,8 +1,9 @@ package Mail::DMARC::Report::Send::SMTP; -# VERSION use strict; use warnings; +our $VERSION = '1.20191024'; + use Carp; use English '-no_match_vars'; use Email::MIME; @@ -116,26 +117,6 @@ sub get_smtp_hosts { sub get_subject { my ( $self, $agg_ref ) = @_; -=head2 SUBJECT FIELD - -The RFC5322.Subject field for individual report submissions SHOULD conform to the following ABNF: - - dmarc-subject = %x52.65.70.6f.72.74 1*FWS ; "Report" - %x44.6f.6d.61.69.6e.3a 1*FWS ; "Domain:" - domain-name 1*FWS ; from RFC6376 - %x53.75.62.6d.69.74.74.65.72.3a ; "Submitter:" - 1*FWS domain-name 1*FWS - %x52.65.70.6f.72.74.2d.49.44.3a ; "Report-ID:" - msg-id ; from RFC5322 - -The first domain-name indicates the DNS domain name about which the -report was generated. The second domain-name indicates the DNS -domain name representing the Mail Receiver generating the report. -The purpose of the Report-ID: portion of the field is to enable the -Domain Owner to identify and ignore duplicate reports that might be -sent by a Mail Receiver. - -=cut my $rid = $$agg_ref->metadata->report_id || time; my $id = POSIX::strftime( "%Y.%m.%d.", localtime ) . $rid; @@ -254,9 +235,36 @@ sub get_helo_hostname { 1; -# ABSTRACT: utility methods for sending reports via SMTP __END__ -sub {} + +=pod + +=head1 NAME + +Mail::DMARC::Report::Send::SMTP - utility methods for sending reports via SMTP + +=head1 VERSION + +version 1.20191024 + +=head2 SUBJECT FIELD + +The RFC5322.Subject field for individual report submissions SHOULD conform to the following ABNF: + + dmarc-subject = %x52.65.70.6f.72.74 1*FWS ; "Report" + %x44.6f.6d.61.69.6e.3a 1*FWS ; "Domain:" + domain-name 1*FWS ; from RFC6376 + %x53.75.62.6d.69.74.74.65.72.3a ; "Submitter:" + 1*FWS domain-name 1*FWS + %x52.65.70.6f.72.74.2d.49.44.3a ; "Report-ID:" + msg-id ; from RFC5322 + +The first domain-name indicates the DNS domain name about which the +report was generated. The second domain-name indicates the DNS +domain name representing the Mail Receiver generating the report. +The purpose of the Report-ID: portion of the field is to enable the +Domain Owner to identify and ignore duplicate reports that might be +sent by a Mail Receiver. =head1 12.2.1 Email @@ -299,4 +307,30 @@ ABNF: For the GZIP file itself, the extension MUST be "gz"; for the XML report, the extension MUST be "xml". +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + =cut + diff --git a/lib/Mail/DMARC/Report/Store.pm b/lib/Mail/DMARC/Report/Store.pm index 46d58659..45dd9c2d 100644 --- a/lib/Mail/DMARC/Report/Store.pm +++ b/lib/Mail/DMARC/Report/Store.pm @@ -1,5 +1,5 @@ package Mail::DMARC::Report::Store; -# VERSION +our $VERSION = '1.20191024'; use strict; use warnings; @@ -50,11 +50,19 @@ sub backend { 1; -# ABSTRACT: persistent storage broker for reports __END__ -=head1 SYNOPSIS +=pod + +=head1 NAME + +Mail::DMARC::Report::Store - persistent storage broker for reports +=head1 VERSION + +version 1.20191024 + +=head1 SYNOPSIS =head1 DESCRIPTION @@ -64,4 +72,29 @@ I experimented with perl's AnyDBM storage backend, but chose to deploy with SQL This Store class provides a layer of indirection, allowing one to write a new Mail::DMARC::Report::Store::MyGreatDB module, update their config file, and not alter the innards of Mail::DMARC. Much. +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + =cut diff --git a/lib/Mail/DMARC/Report/Store/SQL.pm b/lib/Mail/DMARC/Report/Store/SQL.pm index df8a68ba..a119e8d3 100644 --- a/lib/Mail/DMARC/Report/Store/SQL.pm +++ b/lib/Mail/DMARC/Report/Store/SQL.pm @@ -1,5 +1,5 @@ package Mail::DMARC::Report::Store::SQL; -# VERSION +our $VERSION = '1.20191024'; use strict; use warnings; @@ -70,6 +70,7 @@ sub retrieve { $query .= $self->grammar->and_arg('fd.domain'); push @params, $args{from_domain}; }; + my $reports = $self->query( $query, \@params ); foreach (@$reports ) { @@ -102,7 +103,6 @@ sub next_todo { $self->populate_agg_records( \$agg, $next_todo->{rid} ); return $agg; - } sub retrieve_todo { @@ -111,8 +111,9 @@ sub retrieve_todo { # this method extracts the data from the SQL tables and populates a # list of Aggregate report objects with them. my $reports = $self->query( $self->grammar->select_todo_query, [ time ] ); - return if ! @$reports; + my @reports_todo; + return \@reports_todo if ! scalar @$reports; foreach my $report ( @{ $reports } ) { @@ -669,14 +670,17 @@ sub grammar { 1; -# ABSTRACT: store and retrieve reports from a SQL RDBMS __END__ -=head1 SYPNOSIS +=pod -Store and retrieve DMARC reports from SQL data store. +=head1 NAME -Tested with SQLite, MySQL and PostgreSQL. +Mail::DMARC::Report::Store::SQL - store and retrieve reports from a SQL RDBMS + +=head1 VERSION + +version 1.20191024 =head1 DESCRIPTION @@ -684,4 +688,36 @@ Uses ANSI SQL syntax, keeping the SQL as portable as possible. DB engine specific features are to be avoided. +=head1 SYPNOSIS + +Store and retrieve DMARC reports from SQL data store. + +Tested with SQLite, MySQL and PostgreSQL. + +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + =cut + diff --git a/lib/Mail/DMARC/Report/Store/SQL/Grammars/MySQL.pm b/lib/Mail/DMARC/Report/Store/SQL/Grammars/MySQL.pm index 252ec8fd..dc1b7172 100644 --- a/lib/Mail/DMARC/Report/Store/SQL/Grammars/MySQL.pm +++ b/lib/Mail/DMARC/Report/Store/SQL/Grammars/MySQL.pm @@ -1,5 +1,5 @@ package Mail::DMARC::Report::Store::SQL::Grammars::MySQL; -# VERSION +our $VERSION = '1.20191024'; use strict; use warnings; @@ -280,9 +280,18 @@ sub delete_from { 1; -# ABSTRACT: Grammar for working with mysql databases. __END__ +=pod + +=head1 NAME + +Mail::DMARC::Report::Store::SQL::Grammars::MySQL - Grammar for working with mysql databases. + +=head1 VERSION + +version 1.20191024 + =head1 SYPNOSIS Allow DMARC to be able to speak to MySQL databases. @@ -291,6 +300,29 @@ Allow DMARC to be able to speak to MySQL databases. Uses ANSI SQL syntax, keeping the SQL as portable as possible. -DB engine specific features are to be avoided. +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. -=cut \ No newline at end of file +=cut diff --git a/lib/Mail/DMARC/Report/Store/SQL/Grammars/PostgreSQL.pm b/lib/Mail/DMARC/Report/Store/SQL/Grammars/PostgreSQL.pm index 715cb9e8..1fdaeb3d 100644 --- a/lib/Mail/DMARC/Report/Store/SQL/Grammars/PostgreSQL.pm +++ b/lib/Mail/DMARC/Report/Store/SQL/Grammars/PostgreSQL.pm @@ -1,5 +1,5 @@ package Mail::DMARC::Report::Store::SQL::Grammars::PostgreSQL; -# VERSION +our $VERSION = '1.20191024'; use strict; use warnings; @@ -299,17 +299,48 @@ sub replace_into { 1; -# ABSTRACT: Grammar for working with pgsql databases. __END__ +=pod + +=head1 NAME + +Mail::DMARC::Report::Store::SQL::Grammars::PostgreSQL - Grammar for working with pgsql databases. + +=head1 VERSION + +version 1.20191024 + =head1 SYPNOSIS Allow DMARC to be able to speak to PostgreSQL databases. =head1 DESCRIPTION -Uses ANSI SQL syntax, keeping the SQL as portable as possible. -DB engine specific features are to be avoided. +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. -=cut \ No newline at end of file +=cut diff --git a/lib/Mail/DMARC/Report/Store/SQL/Grammars/SQLite.pm b/lib/Mail/DMARC/Report/Store/SQL/Grammars/SQLite.pm index 9afefdc5..ba3f2ee9 100644 --- a/lib/Mail/DMARC/Report/Store/SQL/Grammars/SQLite.pm +++ b/lib/Mail/DMARC/Report/Store/SQL/Grammars/SQLite.pm @@ -1,5 +1,5 @@ package Mail::DMARC::Report::Store::SQL::Grammars::SQLite; -# VERSION +our $VERSION = '1.20191024'; use strict; use warnings; @@ -280,9 +280,18 @@ sub delete_from { 1; -# ABSTRACT: Grammar for working with sqlite databases. __END__ +=pod + +=head1 NAME + +Mail::DMARC::Report::Store::SQL::Grammars::SQLite - Grammar for working with sqlite databases. + +=head1 VERSION + +version 1.20191024 + =head1 SYPNOSIS Allow DMARC to be able to speak to SQLite databases. @@ -293,4 +302,29 @@ Uses ANSI SQL syntax, keeping the SQL as portable as possible. DB engine specific features are to be avoided. -=cut \ No newline at end of file +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff --git a/lib/Mail/DMARC/Report/URI.pm b/lib/Mail/DMARC/Report/URI.pm index c933cfa1..6a072d78 100644 --- a/lib/Mail/DMARC/Report/URI.pm +++ b/lib/Mail/DMARC/Report/URI.pm @@ -1,8 +1,9 @@ package Mail::DMARC::Report::URI; -# VERSION use strict; use warnings; +our $VERSION = '1.20191024'; + use Carp; use URI; @@ -58,9 +59,17 @@ sub get_size_limit { 1; -# ABSTRACT: a DMARC report URI __END__ -sub {} + +=pod + +=head1 NAME + +Mail::DMARC::Report::URI - a DMARC report URI + +=head1 VERSION + +version 1.20191024 =head1 SYNOPSIS @@ -73,6 +82,34 @@ sub {} ... do some URI stuff ... }; +=head1 DESCRIPTION + +defines a generic syntax for identifying a resource. The DMARC +mechanism uses this as the format by which a Domain Owner specifies +the destination for the two report types that are supported. + +The place such URIs are specified (see Section 6.2) allows a list of +these to be provided. A report is to be sent to each listed URI. +Mail Receivers MAY impose a limit on the number of URIs that receive +reports, but MUST support at least two. The list of URIs is +separated by commas (ASCII 0x2C). + +Each URI can have associated with it a maximum report size that may +be sent to it. This is accomplished by appending an exclamation +point (ASCII 0x21), followed by a maximum size indication, before a +separating comma or terminating semi-colon. + +Thus, a DMARC URI is a URI within which any commas or exclamation +points are percent-encoded per [URI], followed by an OPTIONAL +exclamation point and a maximum size specification, and, if there are +additional reporting URIs in the list, a comma and the next URI. + +For example, the URI "mailto:reports@example.com!50m" would request a +report be sent via email to "reports@example.com" so long as the +report payload does not exceed 50 megabytes. + +A formal definition is provided in Section 6.3. + =head1 ABNF dmarc-uri = URI [ "!" 1*DIGIT [ "k" / "m" / "g" / "t" ] ] @@ -97,32 +134,30 @@ unit, the number is presumed to be a basic byte count. Note that the units are considered to be powers of two; a kilobyte is 2^10, a megabyte is 2^20, etc. -=head1 DESCRIPTION +=head1 AUTHORS -defines a generic syntax for identifying a resource. The DMARC -mechanism uses this as the format by which a Domain Owner specifies -the destination for the two report types that are supported. +=over 4 -The place such URIs are specified (see Section 6.2) allows a list of -these to be provided. A report is to be sent to each listed URI. -Mail Receivers MAY impose a limit on the number of URIs that receive -reports, but MUST support at least two. The list of URIs is -separated by commas (ASCII 0x2C). +=item * -Each URI can have associated with it a maximum report size that may -be sent to it. This is accomplished by appending an exclamation -point (ASCII 0x21), followed by a maximum size indication, before a -separating comma or terminating semi-colon. +Matt Simerson -Thus, a DMARC URI is a URI within which any commas or exclamation -points are percent-encoded per [URI], followed by an OPTIONAL -exclamation point and a maximum size specification, and, if there are -additional reporting URIs in the list, a comma and the next URI. +=item * -For example, the URI "mailto:reports@example.com!50m" would request a -report be sent via email to "reports@example.com" so long as the -report payload does not exceed 50 megabytes. +Davide Migliavacca -A formal definition is provided in Section 6.3. +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. =cut + diff --git a/lib/Mail/DMARC/Result.pm b/lib/Mail/DMARC/Result.pm index 18197791..20851d27 100644 --- a/lib/Mail/DMARC/Result.pm +++ b/lib/Mail/DMARC/Result.pm @@ -1,5 +1,5 @@ package Mail::DMARC::Result; -# VERSION +our $VERSION = '1.20191024'; use strict; use warnings; @@ -85,9 +85,18 @@ sub reason { 1; -# ABSTRACT: an aggregate report result object __END__ +=pod + +=head1 NAME + +Mail::DMARC::Result - an aggregate report result object + +=head1 VERSION + +version 1.20191024 + =head1 OVERVIEW A L object is the product of instantiating a L object, populating the variables, and running $dmarc->validate. The results object looks like this: @@ -168,5 +177,30 @@ The following reason types are defined and valid: Comment is a free form text field. +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + =cut diff --git a/lib/Mail/DMARC/Result/Reason.pm b/lib/Mail/DMARC/Result/Reason.pm index 8a7b9f83..a9b934eb 100644 --- a/lib/Mail/DMARC/Result/Reason.pm +++ b/lib/Mail/DMARC/Result/Reason.pm @@ -1,5 +1,5 @@ package Mail::DMARC::Result::Reason; -# VERSION +our $VERSION = '1.20191024'; use strict; use warnings; @@ -34,9 +34,18 @@ sub comment { 1; -# ABSTRACT: policy override reason __END__ +=pod + +=head1 NAME + +Mail::DMARC::Result::Reason - policy override reason + +=head1 VERSION + +version 1.20191024 + =head1 METHODS =head2 type @@ -47,3 +56,30 @@ Type is the type of override used, and is one of a number of fixed strings. Comment may or may not be present, and may be anything. +=head1 AUTHORS + +=over 4 + +=item * + +Matt Simerson + +=item * + +Davide Migliavacca + +=item * + +Marc Bradshaw + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Matt Simerson. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut + diff --git a/share/public_suffix_list b/share/public_suffix_list index 88f2f8fc..3ff319d9 100644 --- a/share/public_suffix_list +++ b/share/public_suffix_list @@ -6038,9 +6038,12 @@ org.sn perso.sn univ.sn -// so : http://www.soregistry.com/ +// so : http://sonic.so/policies/ so com.so +edu.so +gov.so +me.so net.so org.so @@ -7075,7 +7078,7 @@ org.zw // newGTLDs -// List of new gTLDs imported from https://www.icann.org/resources/registries/gtlds/v2/gtlds.json on 2019-09-26T16:43:02Z +// List of new gTLDs imported from https://www.icann.org/resources/registries/gtlds/v2/gtlds.json on 2019-10-13T16:52:09Z // This list is auto-generated, don't edit it manually. // aaa : 2015-02-26 American Automobile Association, Inc. aaa @@ -10440,7 +10443,7 @@ xin // xn--cg4bki : 2013-09-27 SAMSUNG SDS CO., LTD 삼성 -// xn--czr694b : 2014-01-16 Dot Trademark TLD Holding Company Limited +// xn--czr694b : 2014-01-16 Internet DotTrademark Organisation Limited 商标 // xn--czrs0t : 2013-12-19 Binky Moon, LLC @@ -10497,7 +10500,7 @@ xin // xn--i1b6b1a6a2e : 2013-11-14 Public Interest Registry संगठन -// xn--imr513n : 2014-12-11 Dot Trademark TLD Holding Company Limited +// xn--imr513n : 2014-12-11 Internet DotTrademark Organisation Limited 餐厅 // xn--io0a7i : 2013-11-14 China Internet Network Information Center (CNNIC) @@ -10566,7 +10569,7 @@ xin // xn--nyqy26a : 2014-11-07 Stable Tone Limited 健康 -// xn--otu796d : 2017-08-06 Dot Trademark TLD Holding Company Limited +// xn--otu796d : 2017-08-06 Internet DotTrademark Organisation Limited 招聘 // xn--p1acf : 2013-12-12 Rusnames Limited diff --git a/t/12.Report.Store.SQL.t b/t/12.Report.Store.SQL.t index 24c9c51c..48713c3b 100644 --- a/t/12.Report.Store.SQL.t +++ b/t/12.Report.Store.SQL.t @@ -61,39 +61,24 @@ while ( my $file = readdir( $dir ) ) { $provider = $1; eval "use DBD::$provider"; if ($@) { - ok( 1, "Skipping $file; DBD::$provider not available: $@" ); + ok( 1, "Skipping $provider, DBD::$provider not available" ); next; } } else { next; } $sql->config( "$backend_dir/$file" ); - if ( $provider eq 'Pg' ) { - $provider = 'PostgreSQL'; - } elsif ( $provider eq 'mysql' ) { - $provider = 'MySQL'; - } + if ( $provider eq 'Pg' ) { $provider = 'PostgreSQL'; } + if ( $provider eq 'mysql' ) { $provider = 'MySQL'; } - test_db_connect(); + test_db_connect( $provider ) or do { + ok(1, "Skipping $provider, unable to connect"); + test_cleanup( $provider ); + next; + }; test_grammar_loaded( $provider ); - if ($provider eq 'PostgreSQL') { - stderr_is { test_query_insert() } 'DBI error: ERROR: relation "reporting" does not exist -LINE 1: INSERT INTO "reporting" ("domain", "begin", "end") VALUES ($... - ^ -DBI error: ERROR: column "domin" of relation "report" does not exist -LINE 1: INSERT INTO "report" ("domin", "begin", "end") VALUES ($1, $... - ^ -', 'STDERR has expected warning'; - } elsif ($provider eq 'SQLite') { - stderr_is { test_query_insert() } 'DBI error: no such table: reporting -DBI error: table report has no column named domin -', 'STDERR has expected warning'; - } elsif ($provider eq 'MySQL') { - stderr_is { test_query_insert() } 'DBI error: Table \'dmarc_report.reporting\' doesn\'t exist -DBI error: Unknown column \'domin\' in \'field list\' -', 'STDERR has expected warning'; + test_insert_error( $provider ); - } test_query_replace(); test_query_update(); test_query_delete(); @@ -121,18 +106,53 @@ DBI error: Unknown column \'domin\' in \'field list\' test_get_row_dkim(); test_populate_agg_metadata(); test_populate_agg_records(); + + test_cleanup( $provider ); +} +closedir( $dir ); +done_testing(); +exit; + +sub test_insert_error { + my ($provider) = @_; + my $msg = "STDERR has expected warning ($provider)"; + + if ($provider eq 'PostgreSQL') { + stderr_is { test_query_insert() } 'DBI error: ERROR: relation "reporting" does not exist +LINE 1: INSERT INTO "reporting" ("domain", "begin", "end") VALUES ($... + ^ +DBI error: ERROR: column "domin" of relation "report" does not exist +LINE 1: INSERT INTO "report" ("domin", "begin", "end") VALUES ($1, $... + ^ +', $msg; + } + elsif ($provider eq 'SQLite') { + stderr_is { test_query_insert() } 'DBI error: no such table: reporting +DBI error: table report has no column named domin +', $msg; + } + elsif ($provider eq 'MySQL') { + stderr_is { test_query_insert() } 'DBI error: Table \'dmarc_report.reporting\' doesn\'t exist +DBI error: Unknown column \'domin\' in \'field list\' +', $msg; + } +} + +sub test_cleanup { + my ($provider) = @_; + if ( $provider eq 'PostgreSQL' ) { - ok ( $sql->query( - 'TRUNCATE author, domain, report, - report_error, report_policy_published, - report_record, report_record_dkim, report_record_reason, + ok ( $sql->query( + 'TRUNCATE author, domain, report, + report_error, report_policy_published, + report_record, report_record_dkim, report_record_reason, report_record_spf RESTART IDENTITY;' ), 'truncate_testing_pg_database' ); } + elsif ($provider eq 'SQLite') { + unlink "t/reports-test.sqlite"; + } } -closedir( $dir ); -done_testing(); -exit; sub test_populate_agg_records { my $agg = Mail::DMARC::Report::Aggregate->new(); @@ -550,13 +570,21 @@ sub test_query_any { } sub test_db_connect { - my $dbh = $sql->db_connect(); - ok( $dbh, "db_connect" ); + my ($grammar) = @_; + my $dbh; + eval { $dbh = $sql->db_connect(); }; + if ($@) { + warn $@; + return 0; + } + + ok( $dbh, "db_connect: $grammar" ); isa_ok( $dbh, "DBIx::Simple" ); + return 1; } sub test_grammar_loaded { - my $grammarName = shift; + my ($grammarName) = @_; isa_ok( $sql->grammar(), "Mail::DMARC::Report::Store::SQL::Grammars::$grammarName" ); } diff --git a/t/17.Report.Aggregate.Schema.t b/t/17.Report.Aggregate.Schema.t index 87976d8b..54af44ce 100644 --- a/t/17.Report.Aggregate.Schema.t +++ b/t/17.Report.Aggregate.Schema.t @@ -4,6 +4,7 @@ use warnings; use Data::Dumper; use Test::Exception; use Test::More; +use Test::File::ShareDir -share => { -dist => { 'Mail-DMARC' => 'share' } }; use lib 'lib'; use Mail::DMARC::PurePerl; @@ -28,6 +29,12 @@ if ($@) { } my $dmarc = Mail::DMARC::PurePerl->new(); +my $store = $dmarc->report->store; + +$store->config('t/mail-dmarc.ini'); +$store->backend->config('t/mail-dmarc.ini'); + +die 'Not using test store' if $store->backend->config->{'report_store'}->{'dsn'} ne 'dbi:SQLite:dbname=t/reports-test.sqlite'; $dmarc->source_ip('66.128.51.165'); $dmarc->envelope_to('recipient.example.com'); @@ -55,15 +62,12 @@ $dmarc->spf([ my $policy = $dmarc->discover_policy; my $result = $dmarc->validate($policy); -$dmarc->save_aggregate(); - -my $store = $dmarc->{'report'}->{'store'}; -$store->{SQL}->config('t/mail-dmarc.ini'); -die 'Not using test store' if $store->{'SQL'}->{'config'}->{'report_store'}->{'dsn'} ne 'dbi:SQLite:dbname=:memory:'; +my $report_id = $dmarc->save_aggregate(); +ok( $report_id, "saved report $report_id"); -my $a = $store->{'SQL'}->query('UPDATE report SET begin=begin-86400, end=end-86400 WHERE id=1'); - $a = $store->{'SQL'}->query('INSERT INTO report_error(report_id,error,time) VALUES(1," Test error & encoding",100)'); +my $a = $store->backend->query('UPDATE report SET begin=begin-86400, end=end-86400 WHERE id=1'); + $a = $store->backend->query('INSERT INTO report_error(report_id,error,time) VALUES(1," Test error & encoding",100)'); my $agg = $store->retrieve_todo()->[0]; @@ -83,6 +87,4 @@ sub test_against_schema { $parser->parse_string( $xml ); }, 'Check schema' ); # print $xml; - -}; - +} diff --git a/t/mail-dmarc.ini b/t/mail-dmarc.ini index b2ba5621..b3f74fee 100644 --- a/t/mail-dmarc.ini +++ b/t/mail-dmarc.ini @@ -11,8 +11,7 @@ extra_contact_info = http://www.example.com/dmarc-policy/ ; Default is sqlite. [report_store] backend = SQL -dsn = dbi:SQLite:dbname=:memory: -;dsn = dbi:SQLite:dbname=t/reports-test.sqlite +dsn = dbi:SQLite:dbname=t/reports-test.sqlite ;dsn = dbi:mysql:database=dmarc_report;host=db;port=3306 ;dsn = dbi:Pg:database=dmarc_report;host=db;port=5432 user = diff --git a/weaver.ini b/weaver.ini deleted file mode 100644 index ba48887f..00000000 --- a/weaver.ini +++ /dev/null @@ -1,27 +0,0 @@ -[@CorePrep] - -[Name] -[Version] - -[Region / prelude] - -[Generic / SYNOPSIS] -[Generic / DESCRIPTION] -[Generic / OVERVIEW] - -[Collect / ATTRIBUTES] -command = attr - -[Collect / METHODS] -command = method - -[Leftovers] - -[Region / postlude] - -[Authors] - -[Contributors] -contributor = Fork on GitHub, contribute, and appear here programatically! - -[Legal] diff --git a/xt/author-critic.t b/xt/author-critic.t new file mode 100644 index 00000000..c391d112 --- /dev/null +++ b/xt/author-critic.t @@ -0,0 +1,20 @@ +#!perl + +BEGIN { + unless ($ENV{AUTHOR_TESTING}) { + require Test::More; + Test::More::plan(skip_all => 'these tests are for testing by the author'); + } +} + + +use strict; +use warnings; + +use Test::More; +use English qw(-no_match_vars); + +eval "use Test::Perl::Critic"; +plan skip_all => 'Test::Perl::Critic required to criticise code' if $@; +Test::Perl::Critic->import( -profile => "xt/perlcritic.rc" ) if -e "xt/perlcritic.rc"; +all_critic_ok(); diff --git a/t/perlcritic.rc b/xt/perlcritic.rc similarity index 91% rename from t/perlcritic.rc rename to xt/perlcritic.rc index bc79ca82..39f52eef 100644 --- a/t/perlcritic.rc +++ b/xt/perlcritic.rc @@ -5,7 +5,6 @@ verbose = [%p] %m at line %l, column %c. %e. (Severity: %s)\n [-Documentation::RequirePodSections] -; these interfere with Dist::Zilla::PkgVersion [-TestingAndDebugging::RequireUseStrict] [-TestingAndDebugging::RequireUseWarnings] diff --git a/xt/release-pod-syntax.t b/xt/release-pod-syntax.t new file mode 100644 index 00000000..e53b5c83 --- /dev/null +++ b/xt/release-pod-syntax.t @@ -0,0 +1,13 @@ +#!perl + +BEGIN { + unless ($ENV{RELEASE_TESTING}) { + require Test::More; + Test::More::plan(skip_all => 'these tests are for release candidate testing'); + } +} + +use Test::More; +use Test::Pod 1.41; + +all_pod_files_ok();