security/acme-client: Add custom DNS API script support#5143
security/acme-client: Add custom DNS API script support#5143NormB wants to merge 3 commits intoopnsense:masterfrom
Conversation
This adds the ability to use custom acme.sh DNS API scripts for DNS-01 validation, enabling users to integrate with DNS providers not already supported by the plugin. New features: - DnsCustom.php validation class that allows specifying a custom acme.sh DNS API script name - Support for up to 4 custom environment variables to configure the custom script - New "Custom DNS API Script" option in the DNS Service dropdown - Form fields for script name and environment variables The custom script must be placed in /usr/local/share/examples/acme.sh/dnsapi/ directory. This enables users to write their own DNS API integration scripts for providers with custom APIs or internal DNS servers. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add example scripts to help users create their own custom DNS API integrations: - dns_myinternal.sh: SSH-based script for internal BIND DNS servers - dns_myapi.sh: Template for HTTP/REST-based DNS APIs - README.md: Documentation for installation and customization Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update DnsCustom.php with proper copyright header - Use camelCase for local variables per PSR-12 - Simplify code to match existing OPNsense style - Add 2-Clause BSD license headers to example scripts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The ACME plugin only integrates DNS providers that are already supported by acme.sh. If you think that this "custom DNS API script" is useful, please submit a PR to acme.sh (and maybe specify some unsupported APIs that should work when using this script). If they add it, then we may include it in the ACME plugin. That being said, I think this approach is flawed. The |
|
Thanks for taking a look at this contribution. For us, it solves the problem related to LetsEncrypt certificates and internal split-horizon DNS servers behind an Opnsense server. |
Summary
This PR adds support for custom acme.sh DNS API scripts in the ACME Client plugin, enabling users to integrate with DNS providers not already supported by the plugin.
Features:
contrib/examples/directoryCompliance
This PR follows OPNsense development guidelines:
Maintainer Commitment
I am committed to maintaining this feature and will respond to user feedback and QA issues.
Use Case
This feature is particularly useful for:
Example Scripts Included
This PR includes ready-to-use example scripts in
security/acme-client/contrib/examples/:dns_myinternal.shdns_myapi.shREADME.mdInstallation & Usage
Step 1: Deploy an Example Script
Copy the example script to OPNsense:
scp dns_myinternal.sh root@opnsense:/usr/local/share/examples/acme.sh/dnsapi/ ssh root@opnsense "chmod 644 /usr/local/share/examples/acme.sh/dnsapi/dns_myinternal.sh"Step 2: Configure the ACME Plugin
dns_myinternalormyinternalDNS_SERVER_HOST,DNS_SERVER_USER)Step 3: Create Certificate
Creating Custom Scripts
Custom scripts must implement two functions:
Scripts can use acme.sh helper functions:
_info,_debug,_errfor logging.Test Plan
Files Changed
New files:
security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeValidation/DnsCustom.phpsecurity/acme-client/contrib/examples/dns_myinternal.shsecurity/acme-client/contrib/examples/dns_myapi.shsecurity/acme-client/contrib/examples/README.mdModified files:
security/acme-client/src/opnsense/mvc/app/models/OPNsense/AcmeClient/AcmeClient.xmlsecurity/acme-client/src/opnsense/mvc/app/controllers/OPNsense/AcmeClient/forms/dialogValidation.xmlsecurity/acme-client/pkg-descr🤖 Generated with Claude Code