From 4ff8a028c498ffb8c9e0e55f18d4572ca651dac7 Mon Sep 17 00:00:00 2001 From: superman20 Date: Wed, 20 Oct 2021 13:02:41 -0400 Subject: [PATCH 1/3] Reformat DKIM-Signature to multiline --- plugins/dkim_sign.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/dkim_sign.js b/plugins/dkim_sign.js index 9523f7e4c..5085fbd5b 100644 --- a/plugins/dkim_sign.js +++ b/plugins/dkim_sign.js @@ -118,10 +118,14 @@ class DKIMSignStream extends Stream { } // Create DKIM header - let dkim_header = `v=1;a=rsa-sha256;bh=${bodyhash};c=relaxed/simple;d=${this.domain_name};h=${headers.join(':')};s=${this.selector};b=`; + let dkim_header = `v=1; a=rsa-sha256; c=relaxed/simple; d=${this.domain_name}; s=${this.selector}; h=${headers.join(':')}; bh=${bodyhash}; b=`; this.signer.update(`dkim-signature:${dkim_header}`); const signature = this.signer.sign(this.private_key, 'base64'); - dkim_header += signature; + dkim_header = `v=1; a=rsa-sha256; c=relaxed/simple;\r\n\td=${this.domain_name}; s=${this.selector};\r\n\th=${headers.join(':')};\r\n\tbh=${bodyhash};\r\n\tb=`; + dkim_header += signature.substring(0,74); + for (let i=74; i Date: Wed, 20 Oct 2021 13:05:24 -0400 Subject: [PATCH 2/3] Update DKIM test to accommodate new formatting --- tests/plugins/dkim_signer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/plugins/dkim_signer.js b/tests/plugins/dkim_signer.js index 996a87a9c..770ea28a1 100644 --- a/tests/plugins/dkim_signer.js +++ b/tests/plugins/dkim_signer.js @@ -33,7 +33,7 @@ frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN/XKdLCPjaYaY= function getValueFromDKIM (dkim_header, key) { const kv = dkim_header.split(';'); for (let i = 0, len = kv.length; i < len; i++) { - const arr = kv[i].match(/^([^=]+)=(.*)$/); + const arr = kv[i].match(/^\s*([^=]+)=(.*)$/); if (arr[1] === key) { return arr[2]; } From ca793e24b585eb0d2af2f0ed42bbb89a8172dc1a Mon Sep 17 00:00:00 2001 From: superman20 Date: Wed, 20 Oct 2021 13:13:56 -0400 Subject: [PATCH 3/3] Update Changes.md --- Changes.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Changes.md b/Changes.md index ef644fa94..f2ad4e347 100644 --- a/Changes.md +++ b/Changes.md @@ -1,6 +1,9 @@ ## NEXT - 2021-MM-DD +### Changes + +- reformat dkim signature to multi-line #2991 ## 2.8.28 - 2021-10-14