security/acme-client: add support for Porkbun API, closes #2561

This commit is contained in:
Frank Wall
2021-10-10 22:35:26 +02:00
parent 85997b73eb
commit 93b33f05dc
4 changed files with 69 additions and 1 deletions
+1
View File
@@ -12,6 +12,7 @@ Plugin Changelog
Added:
* add support for custom ACME CAs (#2529)
* add support for Porkbun API (#2561)
Fixed:
* fix ACME Client reset (#2562)
@@ -1338,4 +1338,19 @@
<label>Key</label>
<type>text</type>
</field>
<field>
<label>Porkbun API</label>
<type>header</type>
<style>table_dns table_dns_porkbun</style>
</field>
<field>
<id>validation.dns_porkbun_key</id>
<label>API Key</label>
<type>text</type>
</field>
<field>
<id>validation.dns_porkbun_secret</id>
<label>Secret API Key</label>
<type>password</type>
</field>
</form>
@@ -0,0 +1,45 @@
<?php
/*
* Copyright (C) 2021 Frank Wall
* 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;
/**
* Porkbun API
* @package OPNsense\AcmeClient
*/
class DnsPorkbun extends Base implements LeValidationInterface
{
public function prepare()
{
$this->acme_env['PORKBUN_API_KEY'] = (string)$this->config->dns_porkbun_key;
$this->acme_env['PORKBUN_SECRET_API_KEY'] = (string)$this->config->dns_porkbun_secret;
}
}
@@ -1,6 +1,6 @@
<model>
<mount>//OPNsense/AcmeClient</mount>
<version>3.0.0</version>
<version>3.1.0</version>
<description>A secure ACME Client plugin</description>
<items>
<settings>
@@ -454,6 +454,7 @@
<dns_ovh>OVH, kimsufi, soyoustart and runabove API</dns_ovh>
<dns_pdns>PowerDNS.com API</dns_pdns>
<dns_pleskxml>Plesk XML API</dns_pleskxml>
<dns_porkbun>Porkbun API</dns_porkbun>
<dns_schlundtech>SchlundTech</dns_schlundtech>
<dns_selectel>selectel.com / selectel.ru domain API</dns_selectel>
<dns_servercow>Servercow API v1</dns_servercow>
@@ -884,6 +885,12 @@
<dns_pdns_token type="TextField">
<Required>N</Required>
</dns_pdns_token>
<dns_porkbun_key type="TextField">
<Required>N</Required>
</dns_porkbun_key>
<dns_porkbun_secret type="TextField">
<Required>N</Required>
</dns_porkbun_secret>
<dns_sl_key type="TextField">
<Required>N</Required>
</dns_sl_key>