security/acme: support TrueNAS Core Server deployhook, closes #3421

This commit is contained in:
Jan Winkler
2023-06-27 16:32:57 +02:00
parent 8b4c189e09
commit 6b2809053c
5 changed files with 96 additions and 1 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
PLUGIN_NAME= acme-client
PLUGIN_VERSION= 3.17
PLUGIN_VERSION= 3.18
PLUGIN_COMMENT= ACME Client
PLUGIN_MAINTAINER= opnsense@moov.de
PLUGIN_DEPENDS= acme.sh py${PLUGIN_PYTHON}-dns-lexicon
+5
View File
@@ -8,6 +8,11 @@ WWW: https://github.com/acmesh-official/acme.sh
Plugin Changelog
================
3.18
Added:
* add support for TrueNAS deployhook (#3421)
3.17
Added:
@@ -283,6 +283,29 @@
<label>Host</label>
<type>text</type>
</field>
<field>
<label>Required Parameters</label>
<type>header</type>
<style>method_table method_table_acme_truenas</style>
</field>
<field>
<id>action.acme_truenas_apikey</id>
<label>TrueNAS API key</label>
<type>text</type>
<help>API key generated in the TrueNAS web UI.</help>
</field>
<field>
<id>action.acme_truenas_hostname</id>
<label>TrueNAS hostname</label>
<type>text</type>
<help>Hostname or IP adress of TrueNAS Core Server.</help>
</field>
<field>
<id>action.acme_truenas_scheme</id>
<label>TrueNAS scheme</label>
<type>dropdown</type>
<help>Connection scheme that will be used when uploading certificates to TrueNAS Core Server.</help>
</field>
<field>
<label>Required Parameters</label>
<type>header</type>
@@ -0,0 +1,47 @@
<?php
/*
* Copyright (C) 2023 Jan Winkler
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\AcmeClient\LeAutomation;
use OPNsense\AcmeClient\LeAutomationInterface;
/**
* Run acme.sh deploy hook truenas
* @package OPNsense\AcmeClient
*/
class AcmeTruenas extends Base implements LeAutomationInterface
{
public function prepare()
{
$this->acme_env['DEPLOY_TRUENAS_APIKEY'] = (string)$this->config->acme_truenas_apikey;
$this->acme_env['DEPLOY_TRUENAS_HOSTNAME'] = (string)$this->config->acme_truenas_hostname;
$this->acme_env['DEPLOY_TRUENAS_SCHEME'] = (string)$this->config->acme_truenas_scheme;
$this->acme_args[] = '--deploy-hook truenas --insecure';
return true;
}
}
@@ -1174,6 +1174,7 @@
<acme_panos>Upload certificate to Palo Alto Networks Firewall</acme_panos>
<acme_vault>Upload certificate to HashiCorp Vault</acme_vault>
<acme_synology_dsm>Upload certificate to Synology DSM</acme_synology_dsm>
<acme_truenas>Upload certificate to TrueNAS Core Server</acme_truenas>
<acme_unifi>Update local Unifi keystore</acme_unifi>
<configd_generic>System or Plugin Command</configd_generic>
</OptionValues>
@@ -1380,6 +1381,25 @@
<mask>/^.{1,1024}$/u</mask>
<ValidationMessage>Should be a string between 1 and 1024 characters.</ValidationMessage>
</acme_panos_host>
<acme_truenas_apikey type="TextField">
<Required>N</Required>
<mask>/^.{1,1024}$/u</mask>
<ValidationMessage>Should be a string between 1 and 1024 characters.</ValidationMessage>
</acme_truenas_apikey>
<acme_truenas_hostname type="HostnameField">
<default>localhost</default>
<Required>N</Required>
<mask>/^.{1,1024}$/u</mask>
<ValidationMessage>Should be a string between 1 and 1024 characters.</ValidationMessage>
</acme_truenas_hostname>
<acme_truenas_scheme type="OptionField">
<default>http</default>
<Required>N</Required>
<OptionValues>
<http>HTTP [default]</http>
<https>HTTPS</https>
</OptionValues>
</acme_truenas_scheme>
<acme_unifi_keystore type="TextField">
<default>/usr/local/share/java/unifi/data/keystore</default>
<Required>N</Required>