Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

29 Commits

Repository files navigation

DMARC2Syslog

Python script to read DMARC reports from a mailbox, parse them, format them as syslog messages, and send them to syslog server.

Useful to send DMARC report to SIEM to build use cases.


Supported mailbox access:

  1. EWS (Exchange Web Service)

Supported Syslog messages formats:

  1. LEEF v1

Requirements:

  1. Python 3.10
  2. exchangelib 4.6.2 : installation command -> pip install exchangelib

How to use it:

  1. Provide the required configuration in the configuration file "config.ini"
  2. create a task scheduler or cron job to run the script file "start.py", as an example each 10 minutes.
  3. The script manages the last time it checked for reports and it starts from last time check.

available information for each record in the DMARC report and the LEEF key name:

XML TagLEEF Key
dmarc_report_versionver=
dmarc_report_metadata_org_nameorgName=
dmarc_report_metadata_emailemail=
dmarc_report_metadata_extra_contact_infoextraContactInfo=
dmarc_report_metadata_report_idreportID=
dmarc_report_date_range_begindateRangeBegin=
dmarc_report_date_range_enddateRangeEnd=
dmarc_report_policy_published_domianpolicyPublishedDomain=
dmarc_report_policy_published_adkimpolicyPublishedADKIM=
dmarc_report_policy_published_aspfpolicyPublishedASPF=
dmarc_report_policy_published_ppolicyPublishedP=
dmarc_report_policy_published_sppolicyPublishedSP=
dmarc_report_policy_published_pctpolicyPublishedPCT=
dmarc_report_policy_published_fopolicyPublishedFO=
dmarc_record_row_source_ipRecordRowSourceIP=
dmarc_record_row_countRecordRowCount=
dmarc_record_row_policy_evaluated_dispositionRecordRowPolicyEvaluatedDisposition=
dmarc_record_row_policy_evaluated_dkimRecordRowPolicyEvaluatedDKIM=
dmarc_record_row_policy_evaluated_spfRecordRowPolicyEvaluatedSPF=
dmarc_record_identifiers_header_fromRecordIdentifiersHeaderFrom=
dmarc_record_identifiers_envelope_fromRecordIdentifiersEnvelopeFrom=
dmarc_record_auth_results_dkim_domainRecordAuthResultsDKIMDomain=
dmarc_record_auth_results_dkim_resultRecordAuthResultsDKIMResult=
dmarc_record_auth_results_dkim_selectorRecordAuthResultsDKIMSelector=
dmarc_record_auth_results_spf_domainRecordAuthResultsSPFDomain=
dmarc_record_auth_results_spf_resultRecordAuthResultsSPFResult=

Configuration File:

SectionConfig TagValueDescription
CONFIGstart_datetimeYYYY-MM-DD-HH:MMdate/time to process the emails starting from it.
CONFIGsrv_max_workerNumbernumber of threads to process the reports
CONFIGmailbox_type[ews]connection type to mailbox
CONFIGerror_log_enable[True,False]log errors to the log file .\log\error.log
CONFIGdebug_log_enable[True,False]log debug to the log file .\log\error.log
SYSLOGsyslog_serverIPsyslog server IP
SYSLOGsyslog_portPort NumberSyslog server port number
EWSews_usernamedomain\userNameusername to connect to mailbox through EWS
EWSews_passworduserPasspassword to connect to mailbox through EWS
EWSews_emailemail@domain.commailbox email
EWSews_service_endpointhttps://mail.domian.com/ews/exchange.asmxews service endpoint URL
EWSews_disable_https_cert_verify[True,False]disable certification verification

About

Python script to read DMARC reports from a mailbox, parse them, format them as syslog messages, and send them to syslog server

Topics

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages