security/acme-client: fix vault support, added vault token (#4270)

This commit is contained in:
Marek Wester
2024-10-01 00:32:01 +02:00
committed by GitHub
parent c2862e1250
commit c96d0b8aa9
3 changed files with 16 additions and 2 deletions
@@ -368,12 +368,18 @@
<id>action.acme_vault_prefix</id>
<label>Vault Prefix</label>
<type>text</type>
<help>This specifies the prefix path in Vault.</help>
<help>This specifies the prefix path in Vault. If you select KV v2 you need to add .../data/... between the secret-mount-path and the path. Example: v1 prefix path: secret/acme, v2 prefix path: secret/data/acme.</help>
</field>
<field>
<id>action.acme_vault_token</id>
<label>Vault Token</label>
<type>password</type>
<help>This specifies the Vault token to authenticate with.</help>
</field>
<field>
<id>action.acme_vault_kvv2</id>
<label>Use KV v2</label>
<type>checkbox</type>
<help>If checked version 2 of the kv store will be used, otherwise version 1.</help>
<help>If checked version 2 of the kv store will be used, otherwise version 1. If you use v2 please consider the comment in the field "Vault Prefix".</help>
</field>
</form>
@@ -45,6 +45,9 @@ class AcmeVault extends Base implements LeAutomationInterface
if ((string)$this->config->acme_vault_kvv2 == 1) {
$this->acme_env['VAULT_KV_V2'] = 1;
}
if (!empty((string)$this->config->acme_vault_token)) {
$this->acme_env['VAULT_TOKEN'] = (string)$this->config->acme_vault_token;
}
$this->acme_args[] = '--deploy-hook vault';
return true;
}
@@ -1596,6 +1596,11 @@
<mask>/^.{1,1024}$/u</mask>
<ValidationMessage>Should be a string between 1 and 1024 characters.</ValidationMessage>
</acme_vault_prefix>
<acme_vault_token type="TextField">
<Required>N</Required>
<mask>/^.{1,1024}$/u</mask>
<ValidationMessage>Should be a string between 1 and 1024 characters.</ValidationMessage>
</acme_vault_token>
<acme_vault_kvv2 type="BooleanField">
<default>1</default>
</acme_vault_kvv2>