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) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 078BB696F9 for ; Thu, 11 Mar 2021 12:06:28 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id EBFBE279BF for ; Thu, 11 Mar 2021 12:06:27 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (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 id 2B918279B1 for ; Thu, 11 Mar 2021 12:06:26 +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 E41A046280 for ; Thu, 11 Mar 2021 12:06:25 +0100 (CET) To: pmg-devel@lists.proxmox.com References: <20210309141401.19237-1-w.bumiller@proxmox.com> <20210309141401.19237-7-w.bumiller@proxmox.com> From: Dominik Csapak Message-ID: Date: Thu, 11 Mar 2021 12:06:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210309141401.19237-7-w.bumiller@proxmox.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.192 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -0.001 Looks like a legit reply (A) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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 api 6/8] add certificates api endpoint 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: Thu, 11 Mar 2021 11:06:28 -0000 On 3/9/21 3:13 PM, Wolfgang Bumiller wrote: > This adds /nodes/{nodename}/certificates endpoint > containing: > > /custom/{type} - update smtp or api certificates manually > /acme/{type} - update via acme > > Signed-off-by: Wolfgang Bumiller > --- > src/Makefile | 1 + > src/PMG/API2/Certificates.pm | 690 +++++++++++++++++++++++++++++++++++ > src/PMG/API2/Nodes.pm | 7 + > 3 files changed, 698 insertions(+) > create mode 100644 src/PMG/API2/Certificates.pm > > diff --git a/src/Makefile b/src/Makefile > index ebc6bd8..e0629b2 100644 > --- a/src/Makefile > +++ b/src/Makefile > @@ -155,6 +155,7 @@ LIBSOURCES = \ > PMG/API2/When.pm \ > PMG/API2/What.pm \ > PMG/API2/Action.pm \ > + PMG/API2/Certificates.pm \ > PMG/API2/ACME.pm \ > PMG/API2/ACMEPlugin.pm \ > PMG/API2.pm \ > diff --git a/src/PMG/API2/Certificates.pm b/src/PMG/API2/Certificates.pm > new file mode 100644 > index 0000000..d196af6 > --- /dev/null > +++ b/src/PMG/API2/Certificates.pm > @@ -0,0 +1,690 @@ > +package PMG::API2::Certificates; > + > +use strict; > +use warnings; > + > +use PVE::Certificate; > +use PVE::Exception qw(raise raise_param_exc); > +use PVE::JSONSchema qw(get_standard_option); > +use PVE::Tools qw(extract_param file_get_contents file_set_contents); > + > +use PMG::CertHelpers; > +use PMG::NodeConfig; > +use PMG::RS::CSR; > + > +use PMG::API2::ACMEPlugin; > + > +use base qw(PVE::RESTHandler); > + > +my $acme_account_dir = PMG::CertHelpers::acme_account_dir(); > + > +sub first_typed_pem_entry : prototype($$) { > + my ($label, $data) = @_; > + > + if ($data =~ /^(-----BEGIN (?