From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <t.lamprecht@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id AC4CB81A24
 for <pmg-devel@lists.proxmox.com>; Thu, 25 Nov 2021 09:29:37 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 926B298DE
 for <pmg-devel@lists.proxmox.com>; Thu, 25 Nov 2021 09:29:07 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 88B7B957A
 for <pmg-devel@lists.proxmox.com>; Thu, 25 Nov 2021 09:29:05 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 5126845C5E
 for <pmg-devel@lists.proxmox.com>; Thu, 25 Nov 2021 09:28:59 +0100 (CET)
Message-ID: <09c3746c-fd81-1bea-748f-d66548d43c80@proxmox.com>
Date: Thu, 25 Nov 2021 09:28:58 +0100
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:95.0) Gecko/20100101
 Thunderbird/95.0
Content-Language: en-US
To: Stoiko Ivanov <s.ivanov@proxmox.com>, pmg-devel@lists.proxmox.com
References: <20211124210048.78905-1-s.ivanov@proxmox.com>
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
In-Reply-To: <20211124210048.78905-1-s.ivanov@proxmox.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.103 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [proxmox.com, postfix.org, ietf.org, disclaimer.pm]
Subject: [pmg-devel] applied: [PATCH pmg-api v2] rulesystem: limit
 linelength of disclaimer to 998 bytes
X-BeenThere: pmg-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Mail Gateway development discussion
 <pmg-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pmg-devel>, 
 <mailto:pmg-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pmg-devel/>
List-Post: <mailto:pmg-devel@lists.proxmox.com>
List-Help: <mailto:pmg-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel>, 
 <mailto:pmg-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 25 Nov 2021 08:29:37 -0000

On 24.11.21 22:00, Stoiko Ivanov wrote:
> As described in
> http://www.postfix.org/postconf.5.html#smtp_line_length_limit
> 
> postfix splits lines which are longer by inserting <cr><lf><space> to
> adhere with RFC 5322 (section 2.1.1):
> https://datatracker.ietf.org/doc/html/rfc5322#section-2.1.1
> (or actually section 4.5.3.1.6. where characters are translated to
> octets)
> 
> If a longer line is part of the disclaimer pmg-smtp-filter adds it
> without this modification, which breaks DKIM signatures (since the
> body is modified by postfix after the body hash is computed)
> 
> regular-expression matching is used instead of length(), because the
> limit is on line-length (and a disclaimer can contain multiple lines)
> 
> reported in our community forum:
> https://forum.proxmox.com/threads/.97919/
> 
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> v2->v1:
> * incorporated Thomas' feedback - huge thanks!
> * replaced the 2/3 occurences of encode('UTF-8',...) by a temporary varialbe

great that it could roughly stay the same amount of work, the memory scan should
be rather cheap.

> * read up quite a bit on the magic world of encoding)
> * verified that the encoded value is indeed the one we want to compare
>   against
> 
>  src/PMG/RuleDB/Disclaimer.pm | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
>

applied, thanks!