techsneeze / dmarcts-report-parser

A Perl based tool to parse DMARC reports from an IMAP mailbox or from the filesystem, and insert the information into a database. ( Formerly known as imap-dmarcts )
http://www.techsneeze.com/how-parse-dmarc-reports-imap/
GNU General Public License v3.0
225 stars 66 forks source link

Commit eb45c1bd5bd41ec4b62b649db4900f16ce868a19 breaks reading DMARC reports from STDIN #105

Open twesterhever opened 2 years ago

twesterhever commented 2 years ago

On several setups, I (ab?)use /etc/aliases to deliver incoming DMARC reports to the dmarcts-report-parser:

# DMARC Reports
dmarcreports:   "| /etc/postfix/dmarcts-report-parser.pl -e -"

In /etc/postfix/virtual, this destination is defined for mail addresses handling DMARC reports:

# DMARC reports
postmaster+dmarc@example.com                    dmarcreports
postmaster+dmarc@example.net                    dmarcreports

To the best of my understanding, this setup worked fine until commit eb45c1bd5bd41ec4b62b649db4900f16ce868a19, which now causes STDIN not to be a processable file anymore.

Is there another way to continue reading DMARC reports directly from STDIN? If so, I would be happy to be pointed into the right direction. Thank you in advance.

wolfgangkarall commented 2 months ago

I guess something like changing this line

https://github.com/techsneeze/dmarcts-report-parser/blob/9dd92cf4260bdbf14a541f4be00253b1c20b49ff/dmarcts-report-parser.pl#L423

should work, replace

                       } elsif (open(FILE, "<", $f)) {

with

                       } elsif (open(FILE, "<", $f) or (($f eq '-') and (*FILE = *STDIN))) {

This is not tested at all, but fits the "to be pointed into the right direction" I guess. :)