[pve-devel] [common 1/9] Add dynamic plugin lookup for ACME

Wolfgang Link w.link at proxmox.com
Mon Oct 14 13:08:14 CEST 2019


The dynamic approach reduces failure if new plugins will included.
---
 src/PVE/ACME.pm            | 4 ++++
 src/PVE/ACME/Challenge.pm  | 8 ++++++++
 src/PVE/ACME/StandAlone.pm | 4 ++++
 3 files changed, 16 insertions(+)

diff --git a/src/PVE/ACME.pm b/src/PVE/ACME.pm
index 38a14a5..da4cbcc 100644
--- a/src/PVE/ACME.pm
+++ b/src/PVE/ACME.pm
@@ -17,6 +17,9 @@ use LWP::UserAgent;
 
 use Crypt::OpenSSL::RSA;
 
+use PVE::ACME::Challenge;
+use PVE::ACME::StandAlone;
+
 use PVE::Certificate;
 use PVE::Tools qw(
 file_set_contents
@@ -24,6 +27,7 @@ file_get_contents
 );
 
 Crypt::OpenSSL::RSA->import_random_seed();
+PVE::ACME::StandAlone->register();
 
 my $LETSENCRYPT_STAGING = 'https://acme-staging-v02.api.letsencrypt.org/directory';
 
diff --git a/src/PVE/ACME/Challenge.pm b/src/PVE/ACME/Challenge.pm
index 40d32b6..786666c 100644
--- a/src/PVE/ACME/Challenge.pm
+++ b/src/PVE/ACME/Challenge.pm
@@ -3,6 +3,14 @@ package PVE::ACME::Challenge;
 use strict;
 use warnings;
 
+use base qw(PVE::SectionConfig);
+
+my $defaultData = {};
+
+sub private {
+    return $defaultData;
+}
+
 sub supported_challenge_types {
     return {};
 }
diff --git a/src/PVE/ACME/StandAlone.pm b/src/PVE/ACME/StandAlone.pm
index f48d638..3766862 100644
--- a/src/PVE/ACME/StandAlone.pm
+++ b/src/PVE/ACME/StandAlone.pm
@@ -8,6 +8,10 @@ use HTTP::Response;
 
 use base qw(PVE::ACME::Challenge);
 
+sub type {
+    return 'standalone';
+}
+
 sub supported_challenge_types {
     return { 'http-01' => 1 };
 }
-- 
2.20.1





More information about the pve-devel mailing list