From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 9D21C91C0C for ; Mon, 20 Mar 2023 09:21:22 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7D1C72F846 for ; Mon, 20 Mar 2023 09:21:22 +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)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 20 Mar 2023 09:21:21 +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 0C59945842 for ; Mon, 20 Mar 2023 09:21:21 +0100 (CET) Date: Mon, 20 Mar 2023 09:21:20 +0100 From: Christoph Heiss To: Stoiko Ivanov Cc: pmg-devel@lists.proxmox.com Message-ID: <20230320082120.qm35vsdy4syexx7s@maui.proxmox.com> References: <20230309101846.192177-1-c.heiss@proxmox.com> <20230309101846.192177-2-c.heiss@proxmox.com> <20230316135041.4de4316e@rosa.proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230316135041.4de4316e@rosa.proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL -0.073 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 Subject: Re: [pmg-devel] [PATCH pmg-api 1/3] fix #2437: config: Add inbound TLS policy option X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Mar 2023 08:21:22 -0000 On Thu, Mar 16, 2023 at 01:50:41PM +0100, Stoiko Ivanov wrote: > On Thu, 9 Mar 2023 11:18:44 +0100 > Christoph Heiss wrote: > > > Add a new configuration file /etc/pmg/tls_inbound_policy, which is a > > postfix map containing all domains having `reject_plaintext_session` > > action set, which is then used in smtpd_sender_restriction in the > > main.cf template. > > > > Also add the accompanying API endpoint for modifying it. > I usually split this out into a patch of its own. Ack. > > One thing that is missing is adding the new file to the cluster sync (`git > grep tls_policy`). Thanks, didn't know that - will fix this for the next revision! > > > > [..] > > +sub read_tls_inbound_policy { > > + my ($filename, $fh) = @_; > > + > > + return {} if !defined($fh); > > + > > + my $tls_policy = {}; > > + > > + while (defined(my $line = <$fh>)) { > > + chomp $line; > > + next if $line =~ m/^\s*$/; > > + next if $line =~ m/^#(.*)\s*$/; > > + > > + my $parse_error = sub { > > + my ($err) = @_; > > + die "parse error in '$filename': $line - $err"; > > + }; > > + > > + if ($line =~ m/^(\S+)\s+.+\s*$/) { > The matching seems odd - IIRC + is greedy so '.+' above would match > everything anyways - making \s* superfluous? I mostly copied this straight from read_tls_policy(), so that's why .. > > Why not explicitly match for 'reject_plain_text_session'? - since we write > this literally into the file it should be there. > (erroring out on unexpected content is better than to clobber it and > replace what the users wrote there with 'reject_plaintext_session' upon > any next update (and hopefully motivates the users to not use this > particular file for other unrelated ACL entries)) That seems _very_ sensible, especially erroring out on entries with anything other than `reject_plaintext_session` set to prevent users from mis-using this file. I will rework this for v2. > > [..] >