Git Product home page Git Product logo

open-report-parser's Introduction

Open Report Parser

A Perl based tool to parse DMARC reports, based on John Levine's rddmarc, but extended by the following features:

  • Allow to read messages from an IMAP server and not only from the local filesystem.
  • Store much more XML values into the database (for example the missing SPF and DKIM results from the policy_evaluated section) and also the entire XML for later reference.
  • Needed database tables and columns are created automatically, user only needs to provide a database. The database schema is compatible to the one used by rddmarc, but extends it by additional fields. Users can switch from rddmarc to dmarcts-report-parser without having to do any changes to the database by themselves.
  • Support for MySQL and PostgreSQL

Open Report Parser is a fork of techsneeze's dmarcts-report-parser, and was forked to more closely match the needs of Open DMARC Analyzer.

Open Report Parser Version 0 Alpha 5 (0-α5) is an Anomaly <Codebase> project by John Bradley ([email protected]).

Minimum Requirements

  • Perl 5
  • MariaDB 10.5 or equivalent
  • PostgreSQL 13.9

Dependencies

on Debian

apt-get install libfile-mimeinfo-perl libmail-imapclient-perl libmime-tools-perl libxml-simple-perl \
libio-socket-inet6-perl libio-socket-ip-perl libperlio-gzip-perl \
libmail-mbox-messageparser-perl libwww-perl unzip
  • For MySQL: libdbd-mysql-perl
  • For PostgreSQL: libdbd-pg-perl
  • For Oauth2: liblwp-protocol-https-perl libencode-perl libtime-piece-mysql-perl

on Fedora (Fedora 23)

sudo dnf install perl-File-MimeInfo perl-Mail-IMAPClient perl-MIME-tools perl-XML-Simple perl-DBI \
perl-Socket6 perl-PerlIO-gzip perl-libwww-perl unzip
  • For MySQL: perl-DBD-MySQL
  • For PostgreSQL: perl-DBD-Pg
  • For Oauth2: perl-LWP-Protocol-https perl-Encode perl-Time-Piece-MySQL

on CentOS (CentOS 7)

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install perl-File-MimeInfo perl-Mail-IMAPClient perl-MIME-tools perl-XML-Simple perl-DBI \
perl-Socket6 perl-PerlIO-gzip perl-libwww-perl unzip perl-Mail-Mbox-MessageParser
  • For MySQL: perl-DBD-MySQL
  • For PostgreSQL: perl-DBD-Pg
  • For Oauth2: perl-LWP-Protocol-https perl-Encode perl-Time-Piece-MySQL

on FreeBSD (FreeBSD 11.4)

sudo pkg install p5-File-MimeInfo p5-Mail-IMAPClient p5-MIME-tools p5-XML-Simple p5-DBI p5-Socket6 p5-PerlIO-gzip p5-Mail-Mbox-MessageParser p5-libwww unzip
  • For MySQL: p5-DBD-MySQL
  • For PostgreSQL: p5-DBD-Pg
  • For Oauth2: p5-LWP-Protocol-https p5-Encode p5-Time-Piece-MySQL

on macOS (macOS 10.13)

brew install mysql shared-mime-info
update-mime-database /usr/local/share/mime
perl -MCPAN -e 'install Mail::IMAPClient'
perl -MCPAN -e 'install Mail::Mbox::MessageParser'
perl -MCPAN -e 'install File::MimeInfo'
perl -MCPAN -e 'install LWP::UserAgent
  • For MySQL: perl -MCPAN -e 'install DBD::mysql'
  • For PostgreSQL: perl -MCPAN -e 'install DBD::pg'
  • For Oauth2:
perl -MCPAN -e 'install LWP::Protocol::https'
perl -MCPAN -e 'install Encode'
perl -MCPAN -e 'install Time::Piece'

Setting up Open Report Parser

Optaining Open Report Parser through git is probably the easiest way, in addition to doing occasional pulls to get up-to-date versions.

git clone https://github.com/userjack6880/Open-Report-Parser.git

Optionally, a zip file of the latest release can be downloaded.

Rename repoart-parser.conf.pub to report-parser.conf and edit the configuration for your environment (see the next section on Configuration Options for details). Finally, some condierations need to be taken in account due to limitations in stock configurations of MySQL/MariaSQL on some distros, it may be necessary to add the following to your configuration (i.e. in /etc/mysql/mariadb.conf.d/50-server.cnf):

innodb_large_prefix	= on
innodb_file_format	= barracuda
innodb_file_per_table	= true

Configuration Options

Script Options

$debug = 0;
$delete_reports = 0;
#$dmarc_only = 0;                           
# if set to 1, do not process tls reports, if set to -1 do not process
# dmarc reports - defaults to 1 for legacy support
# this is ignored for all methods except IMAP, use --tls to process
# TLS reports for other methods

Database Options

#$dbtype = 'mysql'; # Supported types - mysql, postgres - defaults to mysql if unset
$dbname = 'dmarc';
$dbuser = 'dmarc';
$dbpass = 'password';
#$dbhost = 'dbhost'; # Set the hostname if we can't connect to the local socket.
$dbport = '3306';

IMAP Options

$imapserver       = 'imap.server';
$imapuser         = 'username';
$imappass         = 'password';
$imapport         = '143';
$imapssl          = '0'; # If set to 1, remember to change server port to 993 and disable imaptls.
$imaptls          = '0';
$tlsverify        = '0';
$imapignoreerror  = '0'; # recommended if you use MS Exchange 2007, ...
#$imapauth        = 'simple'; # supported - simple, oauth2 - defaults to simple if unset

# see documentation for detailed setup
#$oauthclientid   = ''; 
#$oauthuri        = '';

$imapdmarcfolder  = 'dmarc';
$imaptlsfolder    = 'tls';

# If $imapxxxproc is set, processed IMAP messages will be moved (overruled by
# the --delete option!)
# $imapdmarcproc = 'dmarc.Processed';
# $imaptlsproc   = 'tls.Processed';

# If $imapxxxerr is set, IMAP messages that fail will be moved. If unset, failed messages
# will move to $imapdmarcproc (if it is set). Overruled by the --delete option!
# $imapdmarcerr = 'dmarc.notProcessed';
# $imaptlserr   = 'tls.notProcessed';

These settings are ignored when using the -m flag. When using SSL, TLS needs to be disabled and the port used should be changed to 993. TLS Verify is ignored.

Setting $imapauth to 'oauth2' enables OAuth2 authentication, and requires an initial dance to verify the application with your provider. Once this is done, it should be able to renew the token automatically on subsequent runs. Currently, only OAuth2 with M365 has been tested.

XML Storage Options

# maximum size of XML/JSON files to store in database, long files can cause transaction aborts
$maxsize_xml = 50000;
$maxsize_json = 50000;

# store XML/JSON as base64 encopded gzip in database (save space, harder usable)
$compress_xml = 0;
$compress_json = 0;

Processing Failure Action

# if there was an error during file processing (message does not contain XML or ZIP parts, 
# or a database error) the parser reports an error and does not delete the file, even if 
# delete_reports is set (or --delete is given). Deletion can be enforced by delete_failed, 
# however not for database errors.
$delete_failed = 0;

The script is looking for report-parser.conf in the current working directory. If not found it will look by the calling path. If neither is found than it will abort.

Note: Be sure to use the proper hierarchy separator for your server in all folder specs, and if your IMAP server flattens the hierarchy (i.e. Cyrus IMAP with "altnamespace: yes") then leave "Inbox" off of the beginning of such specs.

Usage

./report-parser.pl [OPTIONS] [PATH]

PATH can be the filename of a single file or a list of files - wildcard expression are allowed.

Remember: This script needs a configurations file called <report-parser.conf> in the current working directory, which defines a database server with credentials and (if used) an IMAP server with credentials.

One of the following source options must be provided:

        -i : Read reports from messages on IMAP server as defined in the 
             config file. 
        -m : Read reports from mbox file(s) provided in PATH. 
        -e : Read reports from MIME email file(s) provided in PATH. 
        -x : Read reports from xml file(s) provided in PATH. 
        -j : Read reports from json files(s) provided in PATH. 
        -z : Read reports from zip file(s) provided in PATH. 

The following options are always allowed:

        -d : Print debug info. 
        -r : Replace existing reports rather than skipping them. 
  --delete : Delete processed message files (the XML is stored in the 
             database for later reference). 
    --info : Print out number of XML files or emails processed. 
     --tls : Force TLS-Only Mode. 

Currently, processing of both DMARC and TLS reports during the same run is only supported from IMAP. All other sources will always default to DMARC reports unless the --tls flag is provided at runtime.

Latest Changes

0-α5

  • Fixed an issue with undefined variables discovered with Issue #12.
  • Fixed an issue with mimecast improperly setting mime type outlined in Issue #12.

Tested System Configurations

OS Perl SQL Source
Debian 11.6 Perl 5.32 MariaDB 10.5.18 Postfix/Dovecot IMAP Basic Auth
Debian 11.6 Perl 5.32 PostgreSQL 13.9 Postfix/Dovecot IMAP Basic Auth

Release Cycle and Versioning

This project regular release cycle is not yet determined. Versioning is under the Anomaly Versioning Scheme (2022), as outlined in VERSIONING under docs.

Support

Support will be provided as outlined in the following schedule. For more details, see SUPPORT.

Version Support Level Released End of Support End of Life
Version 1 Alpha 5 Full Support 10 July 2023 TBD TBD
Version 1 Alpha 4 Critical Support 8 June 2023 10 July 2023 TBD
Version 1 Alpha 3 End of Life 25 May 2023 8 June 2023 10 July 2023

Contributing

Public contributions are encouraged. Please review CONTRIBUTING under docs for contributing procedures. Additionally, please take a look at our CODE_OF_CONDUCT. By participating in this project you agree to abide by the Code of Conduct.

Contributors

Primary Contributors

  • John Bieling - Initial Work
  • TechZneeze.com - Expansion of Initial Work
  • John Bradley - This Fork

Thanks to all who contributed (and here) and have given feedback.

Licenses and Copyrights

Copyright © 2023 John Bradley (userjack6880), Copyright © 2016 TechSneeze.com, Copyright © 2012 John Bieling. Open Report Parser is released under GNU GPLv3. See LICENSE.

open-report-parser's People

Contributors

fenugeek avatar gutmensch avatar islander avatar jnew-gh avatar jobisoft avatar jschanz avatar kolovskiy avatar lifeofguenter avatar lwt-pressy avatar mrten avatar postilion avatar stoecker avatar techsneeze avatar userjack6880 avatar vlamke avatar wahlstedtw avatar wolfgangkarall avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

open-report-parser's Issues

[Question]: Oauth2 Support for IMAP

Hi I tried to use m365 modern Auth but it didn't connect I use this command -i and -d flag and I created azure app registration for imap. also I used auth2 uri and client ID and my debug info is below

Can you help me? I think it will help with all questions.

--- DEBUG ---
  Open Report Parser
  Version 0 Alpha 5
-------------
Open Report Parser DEBUG ENABLED
-- Script Options --

Report Source:   0
(0: IMAP, 1: Message, 2: XML, 3: MBOX, 4: ZIP, 5: JSON)
Show Processed:   0
Delete Reports:   0
Delete Failed:    0
Replace Reports:  0
DMARC Only:       1
(0: DMARC\TLS, 1: DMARC Only, -1: TLS Only)

-- Database Options --

DB Type:          mysql
DB Name:          dmarc
DB User:          dmarc
DB Host/Port:     localhost:3306
DB TX Support:    1

Max XML Size:     500000
Max JSON Size:    500000
Compress XML:     0
Compress JSON:    0

-- IMAP Options --

IMAP Server:      ps.outlook.com
IMAP Port:        143
TLS:              1
SSL:              0
TLS Verify:       1
IMAP User:        [email protected]
IMAP Ignore Err:  0
IMAP Auth:        oauth2
Oauth2 URI:       xxxxxxxxxxxxxxxxxxxxx
OAuth2 Client ID: xxxxxxxxxxxxxxxxxxxxx
DMARC Folders:
   Reports:       Inbox
   Processed:     Inbox.Processed
TLS Folders:
   Reports:       tls
   Processed:     tls.Processed
----



--- DEBUG ---
  use tls with verify servercert.
-------------


--- DEBUG ---
  connection to ps.outlook.com with Ssl => 0, User => [email protected], Ignoresizeerrors => 0
-------------
Started at Tue Nov 21 15:59:21 2023
Using Mail::IMAPClient version 3.42 on perl 5.032001
Connecting with IO::Socket::IP PeerAddr ps.outlook.com PeerPort 143 Proto tcp Timeout 600 Debug 1 SSL_verify_mode 1
Connected to ps.outlook.com
Read:   * OK The Microsoft Exchange IMAP4 service is ready. [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==]
Sending: 1 STARTTLS
Sent 12 bytes
Read:   1 OK Begin TLS negotiation now.


--- DEBUG ---
  using oauth2
-------------
no token found, requesting
malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "(end of string)") at lib/OAuth.pm line 172.

Originally posted by @Firat-Gulec in #9 (comment)

[Bug]: Config option to ignore IMAP TLS errors does not work.

Describe the bug
$tlsverify = 0 option in config does not work. I have an Exchange 2019 server which uses a self signed certificate. Although i disabled tls verify in config, the script errors out on invalid tls certificate.

To Reproduce
Steps to reproduce the behavior:
Connect on port 143 with StartTLS to IMAP server with self signed certificate while having disabled verify in config:

$imapport         = '143';
$imaptls          = '1';
$tlsverify        = '0';

Expected behavior
Should ignore TLS certificate validation if option set in config

Software Version
[] Exchange Server 2019

Server (please complete the following information):

  • Server OS Debian Bookworm
  • Perl Version 5.036000
  • MariaDB 10.11.8

Additional context
Debug log confirms:

dmarc_report-parser  | --- DEBUG ---
dmarc_report-parser  |   use tls without verify servercert.
dmarc_report-parser  | -------------

But it still errors out on invalid certificate

dmarc_report-parser  | Started at Mon Jun 10 08:56:23 2024
dmarc_report-parser  | Using Mail::IMAPClient version 3.43 on perl 5.036000
dmarc_report-parser  | Connecting with IO::Socket::IP PeerAddr xx.xx.xx.xx PeerPort 143 Proto tcp Timeout 600 Debug 1 SSL_verify_mode 0
dmarc_report-parser  | Connected to xx.xx.xx.xx
dmarc_report-parser  | Read:    * OK The Microsoft Exchange IMAP4 service is ready.
dmarc_report-parser  | Sending: 1 STARTTLS
dmarc_report-parser  | Sent 12 bytes
dmarc_report-parser  | Read:    1 OK Begin TLS negotiation now.
dmarc_report-parser  | ERROR: Unable to start TLS: SSL connect attempt failed error:0A000086:SSL routines::certificate verify failed at /usr/share/perl5/Mail/IMAPClient.pm line 462.
dmarc_report-parser  |  Mail::IMAPClient::starttls(Mail::IMAPClient=HASH(0x561b71e7a868)) called at /usr/share/perl5/Mail/IMAPClient.pm line 420
dmarc_report-parser  |  Mail::IMAPClient::Socket(Mail::IMAPClient=HASH(0x561b71e7a868), IO::Socket::IP=GLOB(0x561b71e81e88)) called at /usr/share/perl5/Mail/IMAPClient.pm line 369
dmarc_report-parser  |  Mail::IMAPClient::connect(Mail::IMAPClient=HASH(0x561b71e7a868)) called at /usr/share/perl5/Mail/IMAPClient.pm line 315
dmarc_report-parser  |  Mail::IMAPClient::new("Mail::IMAPClient", "server", "xx.xx.xx.xx", "port", 143, "ssl", 0, "starttls", ...) called at ./report-parser.pl line 403
dmarc_report-parser  | Open Report Parser: IMAP Failure: Unable to start TLS: SSL connect attempt failed error:0A000086:SSL routines::certificate verify failed

[Bug]: Not a HASH reference at /root/Open-Report-Parser/report-parser.pl line 1651.

Describe the bug
If you have the tls report being served by an IPv6 server, then the following lines don't work:
elsif($nip = inet_pton(AF_INET6, $ip)) {
$ipval = $dbx{to_hex_string}{$nip}; <== this one
$iptype = "ip6";
}

I'm not a Perl developer at all, but should it be parenthesis instead of brackets around $nip ?

The error message that is sent is the following:
Not a HASH reference at /root/Open-Report-Parser/report-parser.pl line 1651.

To Reproduce
See above

Expected behavior
This should just work out of the box

Screenshots

Software Version
[X] Version 0 Alpha 5
[] Version 0 Alpha 4
[] Version 0 Alpha 3
[] Version 0 Alpha 2

Server (please complete the following information):

  • Ubuntu LTS 20.04
  • Perl Version 5.34.0
  • MariaDB 10.6.16

[Question]: IMAP support for Google Workspace/Gmail

Posit your question!
I am trying to get this to work with an account for our Google Workspace account. I am not very experienced with OAuth2. I have a Client ID from another app, but I am not sure what URI to use. I have made an educated guess that it is

https://accounts.google.com/o/oauth2/v2/auth

When I try to connect, I get this error:

no token found, requesting
Wide character in subroutine entry at lib/OAuth.pm line 172.

Any suggestions?

[Question]: How to set up cron?

So, I have the basic functions working by reading the report files from a directory. Now I want to automate reading the files and insert the data into the database. I have so far been executing ./report-parser.pl directly from the directory it is installed into.

When setting up cron, I assumed I would be able to use the fully qualified path to report-parser.pl. But when I execute it, it complains that it cannot find OAuth.pm. I note that OAuth.pm is actually located in the /lib subdirectory.

Do I need to installed OAuth via cpan or something so that it's findable from anywhere on the sytem?

[Request]: Docker image

Having a docker image would be useful to easily set this up and get it running periodically.

[Bug]: Use of uninitialized value in concatenation (.) or string at ./report-parser.pl line 448.

Describe the bug
I ran the script for the 1st time and it produced the following error:
Use of uninitialized value in concatenation (.) or string at ./report-parser.pl line 448.

Line 448 is this:
printInfo("Processing ". $imap->message_count($imapdmarcfolder)." messages in folder <$imapdmarcfolder>.") if $dmarc_only >= 0;
It's 1 line off of the original script because I added this line in the header since I'm running it in cPanel:
use cPanelUserConfig;

My question is: can this error happen because the mailbox is still empty (because it currently is)? Or should I look for other causes of this error?

Software Version
[] Version 0 Alpha 5

Server (please complete the following information):

  • Server OS: CloudLinux v8.9.0
  • Perl Version: 5.26.3
  • SQL Variant and Version: MariaDB 10.6.17

[Question]: Consistent Error Messages when Processing Reports

We recently moved over from the techsneeze parser/reporting interface due to consistent errors when parsing reports.

We are continuing to get report parse errors.

I have included examples below. I have asked this as a question as it may be a problem on our end so any advice, tips, or suggestions to resolve are appreciated in advance. Many thanks!

Open Report Parser: wp.pl: 1688599419.913278356: source_ip is empty. Skipped.
Open Report Parser: wp.pl: 1688599419.913278356: Cannot add records to rptrecord. Rolling back DB transaction.
Open Report Parser: Skipping IMAP message with UID #51454 due to database errors.
Open Report Parser: Failed to ungzip ZIP file (</tmp/msg-32518-2.dat>)! 
Open Report Parser: The IMAP message with UID #51471 does not seem to contain a valid DMARC report. Skipped.
Open Report Parser: Failed to ungzip ZIP file (</tmp/msg-32518-3.dat>)! 
Open Report Parser: The IMAP message with UID #51539 does not seem to contain a valid DMARC report. Skipped.

[Question]: 170 MB of dependencies when installing libfile-mimeinfo-perl on Ubuntu 22.04

Installing the listed dependencies, especially libfile-mimeinfo-perl, on Ubuntu, will pull in 170 MB of dependencies, including Wayland and X11 desktop libraries. Is this really required for the DMARC parser? Or is there an alternative?

# apt-get install libfile-mimeinfo-perl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  adwaita-icon-theme at-spi2-core dconf-gsettings-backend dconf-service gsettings-desktop-schemas gtk-update-icon-cache humanity-icon-theme
  libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatspi2.0-0 libcairo-gobject2 libcolord2 libdconf1 libepoxy0 libfile-basedir-perl
  libfile-desktopentry-perl libgdk-pixbuf-2.0-0 libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgtk-3-0 libgtk-3-bin libgtk-3-common libgtkd-3-0
  libipc-system-simple-perl libllvm11 libphobos2-ldc-shared98 librsvg2-2 librsvg2-common libvte-2.91-0 libvte-2.91-common libvted-3-0
  libwayland-client0 libwayland-cursor0 libwayland-egl1 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxi6 libxinerama1 libxkbcommon0
  libxrandr2 libxtst6 session-migration tilix tilix-common ubuntu-mono x11-common
Suggested packages:
  colord gvfs librsvg2-bin python-nautilus
The following NEW packages will be installed:
  adwaita-icon-theme at-spi2-core dconf-gsettings-backend dconf-service gsettings-desktop-schemas gtk-update-icon-cache humanity-icon-theme
  libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatspi2.0-0 libcairo-gobject2 libcolord2 libdconf1 libepoxy0 libfile-basedir-perl
  libfile-desktopentry-perl libfile-mimeinfo-perl libgdk-pixbuf-2.0-0 libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgtk-3-0 libgtk-3-bin
  libgtk-3-common libgtkd-3-0 libipc-system-simple-perl libllvm11 libphobos2-ldc-shared98 librsvg2-2 librsvg2-common libvte-2.91-0
  libvte-2.91-common libvted-3-0 libwayland-client0 libwayland-cursor0 libwayland-egl1 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxi6
  libxinerama1 libxkbcommon0 libxrandr2 libxtst6 session-migration tilix tilix-common ubuntu-mono x11-common
0 upgraded, 50 newly installed, 0 to remove and 22 not upgraded.
Need to get 36.9 MB of archives.
After this operation, 170 MB of additional disk space will be used.

[Question]: Open Report Parser: The xml file does not seem to contain a valid DMARC report. Skipped.

OK, so I am switching to reading XML files directly rather than from emails. (I have a semi automated system for doing this which I will document once I have it polished). But I can't get any of my reports to be parsed. All come up with the above error.

I've added the -d flag for more detail.

`baccount@ip-xxx-xxx-xxx-xxx:~/domains/dmarc.baccount.org/public_html/Open-Report-Parser$ ./report-parser.pl -x -d ../../dmarcreports/appstate.xml

--- DEBUG ---
Open Report Parser
Version 0 Alpha 5

Open Report Parser DEBUG ENABLED
-- Script Options --

Report Source: 2
(0: IMAP, 1: Message, 2: XML, 3: MBOX, 4: ZIP, 5: JSON)
Show Processed: 0
Delete Reports: 0
Delete Failed: 0
Replace Reports: 0
DMARC Only: 1
(0: DMARC\TLS, 1: DMARC Only, -1: TLS Only)

-- Database Options --

DB Type: mysql
DB Name: dmarc
DB User: baccount
DB Host/Port: localhost:3306
DB TX Support: 1

Max XML Size: 50000
Max JSON Size: 50000
Compress XML: 0
Compress JSON: 0

-- IMAP Options --

IMAP Server: smtp.gmail.com
IMAP Port: 993
TLS: 0
SSL: 1
TLS Verify: 0
IMAP User: [email protected]
IMAP Ignore Err: 0
IMAP Auth: oauth2
Oauth2 URI: https://accounts.google.com/o/oauth2/v2/auth
OAuth2 Client ID:
DMARC Folders:
Reports: dmarc
TLS Folders:
Reports: tls


Processing xml file <../../dmarcreports/appstate.xml>

Type: 2
FileContent: ?Tێ? }?W?C_?6?W?%??'?!A?N??!??d??)̙?s?(TȞ?+???Fo????????R??g}?F?????????w.D?9?r?????????Ƚx?r????<5??=?5???i?,ÁW0O?ڴd-QU%??u??????J????q???Ac?ynγp?z8kL?X?rlOZfd郑??G?ԧ5????m? uv??sS??p?U??,
?m???4?
?>?W=2O?|????K?r?X?ts??ʉ?H??9?????
?e??Z?;y?v????P??.C?˨??A2Z???|p?Äiɥ?"??٠cڿlb???R???k?Y??Tr?V??kN?<?3?%?????_?]?K??v|?,{|ۉ
AF?Vc*?á%?(­0Ӫ??f/ܔO???79OV??/9@D???x-?~?????5?=?Źq?????٘??{?*??.?SI?yMi?????vK??
MSG: xml file <../../dmarcreports/appstate.xml>

--- DEBUG ---
getting XML from string

Open Report Parser: The xml file <../../dmarcreports/appstate.xml> does not seem to contain a valid DMARC report. Skipped.

--- DEBUG ---
Open Report Parser: Processed 1 messages(s).`

Obviously there's a lot of garbage showing in the FileContent, but it doesn't appear that way when I view it manually. And if I open it in a text editor it shows it's encoded for UTF-8 so I don't think it's an encoding error.

Ideas?

[Question]: How to get IgnoreSizeErrors option with Exchange 2019 running?

Hi,
we are trying to setup Open-DMARC-Analyzer with Open-Report-Parser.
When the Report Parser loads the DMARC Reports from our Exchange 2019, we get following error with hint to use IgnoreSizeErrors option, but we dont know how to enable or to set:

Read:   * 1 FETCH (RFC822.SIZE 19140 UID 133)
Read:   9 OK FETCH completed.
ERROR: message_string() expected 19140 bytes but received 5817 you may need the IgnoreSizeErrors option at /usr/share/perl5/Mail/IMAPClient.pm line 891.
        Mail::IMAPClient::message_string(Mail::IMAPClient=HASH(0x5650208d6108), 133) called at ./report-parser.pl line 618
        main::processIMAP(Mail::IMAPClient=HASH(0x5650208d6108), 0, "Inbox/DMARC-RUA", "Inbox/DMARC-RUA/gelesen", "Inbox/DMARC-RUA/Fehler", 0) called at ./report-parser.pl line 456

----------------------------------------------------------------
Processing IMAP message with UID #133
----------------------------------------------------------------
Type: 1
Use of uninitialized value $filecontent in concatenation (.) or string at ./report-parser.pl line 703.
FileContent:
MSG: IMAP message with UID #133
----------------------------------------------------------------


--- DEBUG ---
  getting XML from message
-------------
Use of uninitialized value $message in substitution (s///) at ./report-parser.pl line 761.
parse_data: No data passed at ./report-parser.pl line 766.

Thanks Marc

[Bug]: missing JSON in @INC

Describe the bug
When running report-parser.pl on a debian 12 base image I got an error with missing JSON in @INC

To Reproduce
Steps to reproduce the behavior:

  1. create a docker container from php:8.3-apache (debian 12 based) and copy open-report-parser with dependencies listed in the README.md
  2. add a configuration file and run report-parser.pl -i --info

Expected behavior
No error message and report-parser able to parse emails

Software Version
[X] Version 0 Alpha 5
[] Version 0 Alpha 4
[] Version 0 Alpha 3
[] Version 0 Alpha 2

Server (please complete the following information):

  • Server OS: debian 12
  • Perl Version: 5.36.0
  • SQL Variant and Version: MariaDB 10.11 (not revelant)

Additional context

You can fix the problem adding libjson-perl in the dependencies! You only need to patch README.md

[Question]: Postgres error when oauth2 is enabled + gmail

Hi,

I'm trying to connect to the imap server using oauth2 but i receive de following message, i'm using postgres 13.11:

  Open Report Parser
  Version 0 Alpha 5
-------------
Open Report Parser DEBUG ENABLED
-- Script Options --

Report Source:   0
(0: IMAP, 1: Message, 2: XML, 3: MBOX, 4: ZIP, 5: JSON)
Show Processed:   0
Delete Reports:   0
Delete Failed:    0
Replace Reports:  0
DMARC Only:       1
(0: DMARC\TLS, 1: DMARC Only, -1: TLS Only)

-- Database Options --

DB Type:          postgres
DB Name:          dmarc
DB User:          dmarc
DB Host/Port:     localhost:5432
DB TX Support:    1

Max XML Size:     50000
Max JSON Size:    50000
Compress XML:     0
Compress JSON:    0

-- IMAP Options --

IMAP Server:      imap.gmail.com
IMAP Port:        993
TLS:              0
SSL:              1
TLS Verify:       0
IMAP User:        [email protected]
IMAP Ignore Err:  0
IMAP Auth:        oauth2
Oauth2 URI:       https://accounts.google.com/o/oauth2/v2/auth
OAuth2 Client ID: xxxxxxx
DMARC Folders:
   Reports:       inbox
TLS Folders:
   Reports:       tls
----



--- DEBUG ---
  using ssl without verify servercert.
-------------


--- DEBUG ---
  connection to imap.gmail.com with Ssl => 1, User => [email protected], Ignoresizeerrors => 0
-------------
Started at Wed Mar 13 14:49:35 2024
Using Mail::IMAPClient version 3.43 on perl 5.026003
Connecting with IO::Socket::SSL PeerAddr imap.gmail.com PeerPort 993 Proto tcp Timeout 600 Debug 1 SSL_verify_mode 0
Connected to imap.gmail.com
Read:   * OK Gimap ready for requests from xxx.xxx.xxx.xxx xxxxxxxxxx


--- DEBUG ---
  using oauth2
-------------
DBD::Pg::st execute failed: ERROR:  relation "oauth" does not exist
LINE 1: ...ken, UNIX_TIMESTAMP(expire) AS expire, valid FROM oauth WHER...
                                                             ^ at lib/OAuth.pm line 63.
DBD::Pg::st fetchrow_hashref failed: no statement executing at lib/OAuth.pm line 64.
no token found, requesting
Wide character in subroutine entry at lib/OAuth.pm line 172.

Any suggestion?

[Bug]: Wrong mysql socket location

Describe the bug
The script can not connect to a database because of a wrong mysql.sock location

To Reproduce
I was using bitnami lamp which has mariadb installed by default and it has a different location for mysql.sock.
Start the script without changing it manually from report.parser.pl

Expected behavior
Script should have ran without any problems.

Software Version
[X] Version 0 Alpha 5
[] Version 0 Alpha 4
[] Version 0 Alpha 3
[] Version 0 Alpha 2

Server (please complete the following information):

  • Debian GNU/Linux 11 (bullseye) x86_64 AWS bitnami lamp
  • Perl Version [e.g. 5.32
  • MariaDB 11.2.3

Additional context
I fixed it by adding changing line 367 in report-parser.pl:

kuva

Could be nice to have some kind of option to change that in the config.

Also changing MySQL my.cnf did not fix this issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.