Commit Graph

1469 Commits

Author SHA1 Message Date
Sean Whalen
f4a103b2fc Fix report key names in mock responses for tests 2026-04-19 21:39:01 -04:00
Sean Whalen
362174c097 9.3.1
Elasticsearch and OpenSearch now verify SSL certificates by default when `ssl = True`, even without a `cert_path`
- Added `skip_certificate_verification` option to the `elasticsearch` and `opensearch` configuration sections for consistency with `splunk_hec`
- Splunk HEC `skip_certificate_verification` now works correctly with self-signed certificates
- SMTP TLS reports no longer fail when saving to multiple output targets (e.g. Elasticsearch and OpenSearch) due to in-place mutation of the report dict
- Output client initialization errors now identify which module failed (e.g. "OpenSearch: ConnectionError..." instead of generic "Output client error")
- Enhanced error handling for output client initialization
2026-04-19 21:39:01 -04:00
Sean Whalen
23e94fb050 Refactor tests to use type casting for report objects in parsedmarc 2026-04-19 21:39:01 -04:00
Sean Whalen
6da52c52fb Update test for timestamp_to_datetime to use a specific UNIX timestamp 2026-04-19 21:39:01 -04:00
Sean Whalen
7590997e92 Track .claude/settings.json 2026-04-19 21:39:01 -04:00
copilot-swe-agent[bot]
a5bde6e12d Fix ruff formatting errors, duplicate import, and test mock key names
Co-authored-by: seanthegeek <44679+seanthegeek@users.noreply.github.com>
2026-04-19 21:39:01 -04:00
copilot-swe-agent[bot]
7e1b1918ec Rename samples/forensic→samples/failure; remove 'DMARC 2.0' references
Co-authored-by: seanthegeek <44679+seanthegeek@users.noreply.github.com>
2026-04-19 21:39:01 -04:00
copilot-swe-agent[bot]
d926adecde Update AGENTS.md to reflect forensic→failure rename and DMARCbis support
Co-authored-by: seanthegeek <44679+seanthegeek@users.noreply.github.com>
2026-04-19 21:39:01 -04:00
copilot-swe-agent[bot]
f0dcd0074c Improve tests: consolidate imports, use context managers, add subTest, add backward compat and coverage tests
Co-authored-by: seanthegeek <44679+seanthegeek@users.noreply.github.com>
2026-04-19 21:39:01 -04:00
copilot-swe-agent[bot]
373166cd7e Add 89 comprehensive tests covering core parsing and utilities
Tests cover:
- _bucket_interval_by_day: all validation branches and distribution logic
- _append_parsed_record: normalize=True/False paths
- _parse_report_record: None source_ip, missing auth results, reason handling,
  identities/identifiers mapping, human_result, envelope_from fallback, alignment
- _parse_smtp_tls_failure_details: required/optional fields, missing field errors
- _parse_smtp_tls_report_policy: valid/invalid types, policy_strings, failure details
- parse_smtp_tls_report_json: valid/bytes/missing fields/non-list policies
- Aggregate report: invalid np/testing/discovery_method, pass disposition,
  multiple records, XML recovery, schema versions, generator, errors, defaults,
  normalization, MAGIC_XML_TAG detection
- utils: timestamp conversions, IP geo lookup, reverse DNS service lookup,
  IP address info with cache, email address parsing, filename safe strings,
  mbox/outlook msg detection
- Output modules: WebhookClient, KafkaClient static methods, HECClient,
  SyslogClient, LogAnalyticsConfig/Client, backward-compatible aliases

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-19 21:39:01 -04:00
Sean Whalen
c0d49fbecb Update parsedmarc/types.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-19 21:39:01 -04:00
copilot-swe-agent[bot]
9784f80232 Make pct and fo default to None when not provided (DMARCbis reports)
Co-authored-by: seanthegeek <44679+seanthegeek@users.noreply.github.com>
2026-04-19 21:39:01 -04:00
Sean Whalen
9e9f0a2ead Fix np field 2026-04-19 21:39:01 -04:00
Sean Whalen
155f595ed7 Move np field 2026-04-19 21:39:01 -04:00
Sean Whalen
46b6972e3f Move 'np' field in the CSV export of parsed aggregate reports 2026-04-19 21:39:01 -04:00
Sean Whalen
a53e33282a Update changelog for DMARCbis report support and rename forensic reports to failure reports; bump version to 10.0.0 2026-04-19 21:39:01 -04:00
copilot-swe-agent[bot]
ace551a3f2 Fix ruff F401: use redundant alias for re-exported ForensicReport
Co-authored-by: seanthegeek <44679+seanthegeek@users.noreply.github.com>
2026-04-19 21:38:10 -04:00
copilot-swe-agent[bot]
3f26f39ff1 Make dashboard queries backward compatible to show data from both forensic and failure indexes
Co-authored-by: seanthegeek <44679+seanthegeek@users.noreply.github.com>
2026-04-19 21:38:10 -04:00
copilot-swe-agent[bot]
df5e9ee451 Fix Splunk sourcetype to use colon separator (dmarc:failure) matching original convention
Co-authored-by: seanthegeek <44679+seanthegeek@users.noreply.github.com>
2026-04-19 21:38:10 -04:00
copilot-swe-agent[bot]
c641ac5688 Add DMARCbis field validation, preserve pass disposition, add comprehensive tests
Co-authored-by: seanthegeek <44679+seanthegeek@users.noreply.github.com>
2026-04-19 21:38:10 -04:00
copilot-swe-agent[bot]
389c21d191 Rename forensic→failure in cli.py, docs, dashboards; add DMARCbis fields to ES/OS output
Co-authored-by: seanthegeek <44679+seanthegeek@users.noreply.github.com>
2026-04-19 21:38:10 -04:00
copilot-swe-agent[bot]
c6713f50b6 Rename "forensic" to "failure" in docs and dashboard configs
Update documentation files (output.md, usage.md, kibana.md, splunk.md,
elasticsearch.md, index.md, example.ini) and dashboard configurations
(Grafana JSON, Kibana ndjson, Splunk XML) to use "failure" terminology
instead of "forensic", consistent with the codebase rename.

- CLI args: --forensic-* → --failure-*
- Config keys: save_forensic → save_failure, forensic_topic → failure_topic, etc.
- Index names: dmarc_forensic → dmarc_failure
- Splunk dashboard: renamed file from dmarc_forensic_dashboard.xml to dmarc_failure_dashboard.xml
- Backward-compat note preserved: "formerly known as forensic reports"

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-19 21:38:10 -04:00
copilot-swe-agent[bot]
7492c01c91 Rename forensic references to failure in cli.py
- Rename all forensic_* variables to failure_*
- Update CLI argument names (--forensic-* to --failure-*)
- Update default filenames (forensic.json/csv to failure.json/csv)
- Update function calls to match renamed output module functions
- Update index names (dmarc_forensic to dmarc_failure)
- Update report type strings and dict keys
- Add backward-compatible config key reading (accept both old and new names)
- Update help text and log messages

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-19 21:38:10 -04:00
copilot-swe-agent[bot]
75a507e209 Rename forensic to failure in output/integration modules
Rename all 'forensic' references to 'failure' in the output modules:
- elastic.py, opensearch.py, splunk.py, kafkaclient.py, syslog.py,
  gelf.py, webhook.py, loganalytics.py, s3.py

Changes include:
- Function/method names: save_forensic_* → save_failure_*
- Variable/parameter names: forensic_* → failure_*
- Class names: _ForensicReportDoc → _FailureReportDoc,
  _ForensicSampleDoc → _FailureSampleDoc
- Index/topic/sourcetype names: dmarc_forensic → dmarc_failure
- Log messages and docstrings updated
- Import statements updated to use new names from core module
- Backward-compatible aliases added at end of each file
- DMARCbis aggregate fields added to elastic.py and opensearch.py:
  np (Keyword), testing (Keyword), discovery_method (Keyword),
  generator (Text)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-19 21:38:10 -04:00
copilot-swe-agent[bot]
77de77ddf3 Align DMARCbis fields with actual XSD schema: testing, discovery_method, generator, human_result; handle namespaced XML
Co-authored-by: seanthegeek <44679+seanthegeek@users.noreply.github.com>
2026-04-19 21:37:57 -04:00
copilot-swe-agent[bot]
f3b583cef0 Add DMARCbis fields (np, psd, t) to aggregate reports and rename forensic→failure in core parsing
Co-authored-by: seanthegeek <44679+seanthegeek@users.noreply.github.com>
2026-04-19 21:37:57 -04:00
copilot-swe-agent[bot]
59d6da74c8 Rename forensic references to failure with backward-compatible aliases
- Rename parse_forensic_report -> parse_failure_report
- Rename parsed_forensic_reports_to_csv_rows -> parsed_failure_reports_to_csv_rows
- Rename parsed_forensic_reports_to_csv -> parsed_failure_reports_to_csv
- Update all internal variable names (forensic_report -> failure_report, etc.)
- Change report_type from 'forensic' to 'failure'
- Use FailureReport type instead of ForensicReport
- Use InvalidFailureReport instead of InvalidForensicReport in function bodies
- Update all docstrings and log messages
- Add backward-compatible aliases at end of file

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-19 21:37:57 -04:00
copilot-swe-agent[bot]
b7df686c68 Initial plan 2026-04-19 21:37:57 -04:00
Sean Whalen
6effd80604 9.7.0 (#709)
- Auto-download psl_overrides.txt at startup (and whenever the reverse DNS
  map is reloaded) via load_psl_overrides(); add local_psl_overrides_path
  and psl_overrides_url config options
- Add collect_domain_info.py and detect_psl_overrides.py for bulk WHOIS/HTTP
  enrichment and automatic cluster-based PSL override detection
- Block full-IPv4 reverse-DNS entries from ever entering
  base_reverse_dns_map.csv, known_unknown_base_reverse_dns.txt, or
  unknown_base_reverse_dns.csv, and sweep pre-existing IP entries
- Add Religion and Utilities to the allowed service_type values
- Document the full map-maintenance workflow in AGENTS.md
- Substantial expansion of base_reverse_dns_map.csv (net ~+1,000 entries)
- Add 26 tests covering the new loader, IP filter, PSL fold logic, and
  cluster detection

Co-authored-by: Sean Whalen <seanthegeek@users.noreply.github.com>
9.7.0
2026-04-19 21:20:41 -04:00
Sean Whalen
10dd7c0459 Update base_reverse_dns_map.csv with additional ISP and organization entries 2026-04-19 13:55:52 -04:00
Sean Whalen
66549502d3 Update base_reverse_dns_map.csv with additional entries 2026-04-19 13:07:06 -04:00
Sean Whalen
c350a73e95 Fix ruff formatting in utils.py
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
9.6.0
2026-04-06 11:51:22 -04:00
Sean Whalen
d1e8d3b3d0 Auto-update DB-IP Country Lite database at startup
Download the latest DB-IP Country Lite mmdb from GitHub on startup and
SIGHUP, caching it locally, with fallback to a previously cached or
bundled copy. Skipped when the offline flag is set. Adds ip_db_url
config option (PARSEDMARC_GENERAL_IP_DB_URL) to override the download
URL. Bumps version to 9.6.0.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 11:50:06 -04:00
Sean Whalen
648fb93d6d Update DB-IP-country lite database 2026-04-06 11:14:47 -04:00
Sean Whalen
3d8dba6745 Fix colors in the OpenSearch Message disposition over time visualization 2026-04-05 21:01:16 -04:00
Sean Whalen
814d6985bb Stop hiding results that do not have a failure_reason in the SMTP TLS failures visualization 2026-04-05 18:34:40 -04:00
Sean Whalen
8f7ffb648c Add VSCode task configuration for Dev Dashboard 2026-04-05 18:11:36 -04:00
Sean Whalen
69eee9f1dc Update sponsorship section in README and documentation 2026-04-04 22:14:38 -04:00
Sean Whalen
d6ec35d66f Fix typo in sponsorship note heading in documentation 2026-04-04 21:52:14 -04:00
Sean Whalen
2d931ab4f1 Add sponsor link 2026-04-04 21:51:07 -04:00
Sean Whalen
25fdf53bd8 Update GitHub funding configuration 2026-04-04 20:40:15 -04:00
Sean Whalen
6a13f38ac6 Enhance debug logging for output client initialization and add environment variable aliases for debug settings 9.5.5 2026-03-27 10:31:43 -04:00
Sean Whalen
33ab4d9de9 Update CHANGELOG.md to include fix for current_time format in MSGraphConnection 2026-03-27 10:11:12 -04:00
Sean Whalen
f49ca0863d Bump version to 9.5.5, implement exponential backoff for output client initialization, update http_auth format, and add debug logging for OpenSearch connections 2026-03-27 10:09:08 -04:00
mihugo
e1851d026a Fix current_time format for MSGraphConnection (#708)
Should have caught this on previous fix for since. the current time is used on line 2145: connection.fetch_messages(reports_folder, since=current_time)
if that code is called and it usually won't be depending upon configuration it will fail  with the time format being wrong: yyyy-mm-ddThh:mm:ss.zzzzzz+00:00Z  ---     this removes the extra "Z" that is not needed since utc offset is already specified and becomes invalid.
2026-03-26 13:04:27 -04:00
Sean Whalen
1542936468 Bump version to 9.5.4, enhance Maildir folder handling, and add config key aliases for environment variable compatibility 9.5.4 2026-03-25 23:22:46 -04:00
Sean Whalen
fb3c38a8b8 9.5.3
- Fixed `FileNotFoundError` when using Maildir with Docker volume mounts. Python's `mailbox.Maildir(create=True)` only creates `cur/new/tmp` subdirectories when the top-level directory doesn't exist; Docker volume mounts pre-create the directory as empty, skipping subdirectory creation. parsedmarc now explicitly creates the subdirectories when `maildir_create` is enabled.
- Maildir UID mismatch no longer crashes the process. In Docker containers where volume ownership differs from the container UID, parsedmarc now logs a warning instead of raising an exception. Also handles `os.setuid` failures gracefully in containers without `CAP_SETUID`.
- Token file writes (MS Graph and Gmail) now create parent directories automatically, preventing `FileNotFoundError` when the token path points to a directory that doesn't yet exist.
- File paths from config (`token_file`, `credentials_file`, `cert_path`, `log_file`, `output`, `ip_db_path`, `maildir_path`, syslog cert paths, etc.) now expand `~` and `$VAR` references via `os.path.expanduser`/`os.path
9.5.3
2026-03-25 21:29:08 -04:00
Sean Whalen
c9a6145505 9.5.3
- Fixed `FileNotFoundError` when using Maildir with Docker volume mounts. Python's `mailbox.Maildir(create=True)` only creates `cur/new/tmp` subdirectories when the top-level directory doesn't exist; Docker volume mounts pre-create the directory as empty, skipping subdirectory creation. parsedmarc now explicitly creates the subdirectories when `maildir_create` is enabled.
2026-03-25 21:13:34 -04:00
Sean Whalen
e1bdbeb257 Bump version to 9.5.2 and fix interpolation issues in config parser 9.5.2 2026-03-25 20:21:08 -04:00
Sean Whalen
12c4676b79 9.5.1
- Correct ISO format for MSGraphConnection timestamps (PR #706)
9.5.1
2026-03-25 19:43:24 -04:00