[pve-devel] [common 6/9] command composer for acme.sh

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


This composer supports two different operations.
pve-setup:     this operation adds the DNS TXT record.
pve-teardown:  this operation removes the DNS TXT record
---
 src/PVE/ACME/ACME_sh.pm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/PVE/ACME/ACME_sh.pm b/src/PVE/ACME/ACME_sh.pm
index db8af9a..40be772 100644
--- a/src/PVE/ACME/ACME_sh.pm
+++ b/src/PVE/ACME/ACME_sh.pm
@@ -38,6 +38,22 @@ my $get_dnsapi_conf = sub {
     return ($api_plugin, "$API_CRED_DIR/$api_plugin.cred");
 };
 
+my $compose_cmd = sub {
+    my ($op, $token, $domain, $alias) = @_;
+
+    my ($dns_api_plugin, $cred_file_path) = &$get_dnsapi_conf();
+
+    # valid operations for this composer are pve-setup and pve-teardown
+    my @cmd = ('/usr/sbin/acme', "--$op");
+    push @cmd, '--webroot', $dns_api_plugin;
+    push @cmd, '--domain', "_acme-challenge.$domain";
+    push @cmd, '--token', $token;
+    push @cmd, '--accountconf', $cred_file_path;
+    push @cmd, '--challenge-alias', $alias if defined($alias);
+
+    return \@cmd;
+};
+
 sub validating_url {
     my ($class, $acme, $auth, $auth_url, $node_config) = @_;
 
-- 
2.20.1





More information about the pve-devel mailing list