liuch / dmarc-srg

A php parser, viewer and summary report generator for incoming DMARC reports.
GNU General Public License v3.0
218 stars 32 forks source link

Support for application/x-gzip #43

Closed TendrilIT closed 1 year ago

TendrilIT commented 1 year ago

Some records are encoded as 'application/x-gzip' (Amazon Route 53), but they aren't properly opened and processed.

Adding 'application/x-gzip' to the $mime_type array in classes/Mail/MailMessage.php:82 fixes this error when running utils/fetch_reports.php source=email:

Failed to get incoming report: Error message:

but then it fails in 'classes/ReportFile/ReportFile.php':

Failed to get incoming report: Error message: - gzopen(): Filename cannot be empty

I'm unsure where to look next in order to fix this issue.

Thank you for this tool!

liuch commented 1 year ago

Hello! May I ask you a few questions?

  1. What is the extension of the report file?
  2. Is it a regular gzip file?
  3. Have you tried to upload this file via web interface? Did that succeed?

I'm unsure where to look next in order to fix this issue

It needs to be fixed at least in three places.

TendrilIT commented 1 year ago
  1. The attachment looks like this: amazonses.com!XXXXXXX.XXX!1666569600!1666656000.xml.gz (domain replaced with XXXXXXX.XXX)
  2. It appears to be a regular gzip file. I can unzip it with the gzip command
  3. I just tried uploading through the web interface and it was successful. However, I had to create /var/spool/dmarc-srg/rua first. (I had forgotten to create this path when installing)
liuch commented 1 year ago

Thank you a lot! I'll fix the code soon.

However, I had to create /var/spool/dmarc-srg/rua first. (I had forgotten to create this path when installing)

You might use Uploading local report files to load the report file from your local desktop.

liuch commented 1 year ago

Fixed: https://github.com/liuch/dmarc-srg/commit/bd1b045b9baa484fbb989bcc008e264dbf5ab187 Could you check it out?

TendrilIT commented 1 year ago

Fixed! Thank you very much!

liuch commented 1 year ago

That's fine. So I'm closing this issue then.