[pve-devel] [manager 3/6] refactor validating_url

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


The validating have to be done in the Plugin to be generic.
---
 PVE/API2/ACME.pm | 27 +--------------------------
 1 file changed, 1 insertion(+), 26 deletions(-)

diff --git a/PVE/API2/ACME.pm b/PVE/API2/ACME.pm
index 2c05db9b..db94586d 100644
--- a/PVE/API2/ACME.pm
+++ b/PVE/API2/ACME.pm
@@ -59,32 +59,7 @@ my $order_certificate = sub {
 	    print "... already validated!\n";
 	} else {
 	    print "... pending!\n";
-	    print "Setting up webserver\n";
-	    my $validation = eval { PVE::ACME::StandAlone->setup($acme, $auth) };
-	    die "failed setting up webserver - $@\n" if $@;
-
-	    print "Triggering validation\n";
-	    eval {
-		$acme->request_challenge_validation($validation->{url}, $validation->{key_auth});
-		print "Sleeping for 5 seconds\n";
-		sleep 5;
-		while (1) {
-		    $auth = $acme->get_authorization($auth_url);
-		    if ($auth->{status} eq 'pending') {
-			print "Status is still 'pending', trying again in 30 seconds\n";
-			sleep 30;
-			next;
-		    } elsif ($auth->{status} eq 'valid') {
-			print "Status is 'valid'!\n";
-			last;
-		    }
-		    die "validating challenge '$auth_url' failed\n";
-		}
-	    };
-	    my $err = $@;
-	    eval { $validation->teardown() };
-	    warn "$@\n" if $@;
-	    die $err if $err;
+	    PVE::ACME::validating_url($acme, $auth, $auth_url, $node_config);
 	}
     }
     print "\nAll domains validated!\n";
-- 
2.20.1





More information about the pve-devel mailing list