From 38804c05f619b2d9fb95e1f65f6f9ff7c719b7bb Mon Sep 17 00:00:00 2001 From: Robert Schumann Date: Sun, 6 Sep 2020 13:55:09 +0200 Subject: [PATCH] support new imap variables from parser * keeps compat with existing env vars * fixes #8 --- README.md | 8 +++++--- manifest/usr/bin/dmarcts-report-parser.conf | 11 ++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ae6427c..421831d 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,9 @@ docker run -e ... -ti gutmensch/dmarc-report New dmarc reports will be fetched every 15 minutes past the hour, every hour. Therefore it can take up to one hour for the first report to be fetched. ## Versions for last build latest -dmarcts report viewer: 2019-01-04 +dmarcts report viewer: 2020-09-06 -dmarcts report parser: 2019-01-04 +dmarcts report parser: 2020-09-06 ## Sample docker compose / Environment variables The variables should be self-explanatory. Make sure to create the IMAP folders before the cron job runs! @@ -46,11 +46,13 @@ services: - "REPORT_DB_NAME=dmarc_report" - "REPORT_DB_USER=dmarc_report" - "REPORT_DB_PASS=dbpassword" - - "PARSER_IMAP_SERVER_WITH_PORT=mail:143" + - "PARSER_IMAP_SERVER=mail" + - "PARSER_IMAP_PORT=143" - "PARSER_IMAP_USER=foobar@example.com" - "PARSER_IMAP_PASS=foobar" - "PARSER_IMAP_READ_FOLDER=Inbox" - "PARSER_IMAP_MOVE_FOLDER=processed" + - "PARSER_IMAP_MOVE_FOLDER_ERR=error" db: image: mariadb:10 diff --git a/manifest/usr/bin/dmarcts-report-parser.conf b/manifest/usr/bin/dmarcts-report-parser.conf index 555734b..15284fd 100644 --- a/manifest/usr/bin/dmarcts-report-parser.conf +++ b/manifest/usr/bin/dmarcts-report-parser.conf @@ -13,7 +13,15 @@ $dbuser = $ENV{'REPORT_DB_USER'}; $dbpass = $ENV{'REPORT_DB_PASS'}; $dbhost = $ENV{'REPORT_DB_HOST'}; # Set the hostname if we can't connect to the local socket. -$imapserver = $ENV{'PARSER_IMAP_SERVER_WITH_PORT'}; +if(exists $ENV{PARSER_IMAP_SERVER_WITH_PORT} && defined $ENV{PARSER_IMAP_SERVER_WITH_PORT}) { + my @server_attr = split ':', $ENV{PARSER_IMAP_SERVER_WITH_PORT}; + $imapserver = $server_attr[0]; + $imapport = $server_attr[1]; +} else { + $imapserver = $ENV{'PARSER_IMAP_SERVER'}; + $imapport = $ENV{'PARSER_IMAP_PORT'}; +} + $imapuser = $ENV{'PARSER_IMAP_USER'}; $imappass = $ENV{'PARSER_IMAP_PASS'}; $imapssl = $ENV{'PARSER_IMAP_SSL'} // '0'; # If set to 1, remember to change server port to 993 and disable imaptls. @@ -28,6 +36,7 @@ $imapreadfolder = $ENV{'PARSER_IMAP_READ_FOLDER'}; # If $imapmovefolder is set, processed IMAP messages will be moved (overruled by # the --delete option!) $imapmovefolder = $ENV{'PARSER_IMAP_MOVE_FOLDER'}; +$imapmovefoldererr = $ENV{'PARSER_IMAP_MOVE_FOLDER_ERR'}; # maximum size of XML files to store in database, long files can cause transaction aborts $maxsize_xml = 50000;