security/acme-client: Add support for Transip DNS API (#2871)

This commit is contained in:
MeganerdNL
2022-03-23 12:59:45 +01:00
committed by GitHub
parent d2798e2000
commit 8de7489732
3 changed files with 74 additions and 0 deletions
@@ -1060,6 +1060,22 @@
<label>Password</label>
<type>password</type>
</field>
<field>
<label>Transip</label>
<type>header</type>
<style>table_dns table_dns_transip</style>
</field>
<field>
<id>validation.dns_transip_username</id>
<label>Username</label>
<type>text</type>
<help>Your TransIP username.</help>
<field>
<id>validation.dns_transip_key</id>
<label>API Key</label>
<type>text</type>
<help>Requires the whole key file in a format that is compatible with TransIP.</help>
</field>
<field>
<label>UnoEuro</label>
<type>header</type>
@@ -0,0 +1,51 @@
<?php
/*
* Copyright (C) 2022 Wouter Deurholt
* 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\LeValidation;
use OPNsense\AcmeClient\LeValidationInterface;
use OPNsense\Core\Config;
/**
* Transip API
* @package OPNsense\AcmeClient
*/
class DnsTransip extends Base implements LeValidationInterface
{
public function prepare()
{
$configdir = (string)sprintf(self::ACME_CONFIG_DIR, $this->cert_id);
$secret_key_filename = "${configdir}/secret.key";
$secret_key_data = (string)$this->config->dns_transip_key . "\n";
file_put_contents($secret_key_filename, $secret_key_data);
// Add env variables
$this->acme_env['TRANSIP_Username'] = (string)$this->config->dns_transip_username;
$this->acme_env['TRANSIP_Key_File'] = $secret_key_filename;
}
}
@@ -488,6 +488,7 @@
<dns_selectel>selectel.com / selectel.ru domain API</dns_selectel>
<dns_selfhost>Selfhost API</dns_selfhost>
<dns_servercow>Servercow API v1</dns_servercow>
<dns_transip>Transip API</dns_transip>
<dns_unoeuro>UnoEuro API</dns_unoeuro>
<dns_variomedia>Variomedia.de API</dns_variomedia>
<dns_vscale>Vscale API</dns_vscale>
@@ -942,6 +943,12 @@
<dns_servercow_password type="TextField">
<Required>N</Required>
</dns_servercow_password>
<dns_transip_username type="TextField">
<Required>N</Required>
</dns_transip_username>
<dns_transip_key type="TextField">
<Required>N</Required>
</dns_transip_key>
<dns_uno_key type="TextField">
<Required>N</Required>
</dns_uno_key>