aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/dmarc.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-08 18:08:25 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-08 18:08:25 +0100
commit85e5de3d81b8bf6ef7bf4592ff77d56cd59191c6 (patch)
tree16f99393319ea9fd0cff9bb089cb20ce8eb4b80d /src/plugins/lua/dmarc.lua
parent2beae2db8208a93827f0506c74bd82b0ad70a947 (diff)
downloadrspamd-85e5de3d81b8bf6ef7bf4592ff77d56cd59191c6.tar.gz
rspamd-85e5de3d81b8bf6ef7bf4592ff77d56cd59191c6.zip
[Fix] Send DMARC reports compressed
Diffstat (limited to 'src/plugins/lua/dmarc.lua')
-rw-r--r--src/plugins/lua/dmarc.lua30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/plugins/lua/dmarc.lua b/src/plugins/lua/dmarc.lua
index 58e48bd01..5c24bff53 100644
--- a/src/plugins/lua/dmarc.lua
+++ b/src/plugins/lua/dmarc.lua
@@ -66,10 +66,10 @@ Content-Transfer-Encoding: 7bit
This is an aggregate report from %s.
------=_NextPart_000_024E_01CC9B0A.AFE54C00
-Content-Type: text/xml
+Content-Type: application/gzip
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
- filename="%s!%s!%s!%s.xml"
+ filename="%s!%s!%s!%s.xml.gz"
]]
local report_footer = [[
@@ -744,10 +744,11 @@ if opts['reporting'] == true then
for k in pairs(reporting_addr) do
table.insert(tmp_addr, k)
end
- local encoded = rspamd_util.encode_base64(table.concat(
+ local encoded = rspamd_util.encode_base64(rspamd_util.gzip_compress(
+ table.concat(
{xmlf('header'),
xmlf('entries'),
- xmlf('footer')}), 78)
+ xmlf('footer')})), 78)
local function mail_cb(err, data, conn)
local function no_error(merr, mdata, wantcode)
wantcode = wantcode or '2'
@@ -808,11 +809,22 @@ if opts['reporting'] == true then
table.insert(atmp, k)
end
local addr_string = table.concat(atmp, ', ')
- local rhead = string.format(report_template, report_settings.email, addr_string,
- reporting_domain, report_settings.domain, report_id, rspamd_util.time_to_string(rspamd_util.get_time()),
- rspamd_util.random_hex(12) .. '@rspamd', report_settings.domain, report_settings.domain, reporting_domain,
- report_start, report_end)
- conn:add_write(pre_quit_cb, {rhead, encoded, report_footer, '\r\n.\r\n'})
+ local rhead = string.format(report_template,
+ report_settings.email,
+ addr_string,
+ reporting_domain,
+ report_settings.domain,
+ report_id,
+ rspamd_util.time_to_string(rspamd_util.get_time()),
+ rspamd_util.random_hex(12) .. '@rspamd',
+ report_settings.domain,
+ report_settings.domain,
+ reporting_domain,
+ report_start, report_end)
+ conn:add_write(pre_quit_cb, {rhead,
+ encoded,
+ report_footer,
+ '\r\n.\r\n'})
end
end
local function data_cb(merr, mdata)