Skip to content

Commit fa350c4

Browse files
authored
www/caddy: Remove DNS providers except Cloudflare for os-caddy-2.0.0 (opnsense#730)
1 parent 56e4a44 commit fa350c4

File tree

1 file changed

+18
-50
lines changed

1 file changed

+18
-50
lines changed

source/manual/how-tos/caddy.rst

Lines changed: 18 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,17 @@ Caddy: Reverse Proxy
99
Features
1010
--------
1111

12-
Caddy - The Ultimate Server - makes your sites more secure, more reliable, and more scalable than any other solution.
12+
Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
13+
1314
By default, Caddy automatically obtains and renews TLS certificates (Let's Encrypt and ZeroSSL) for all your sites.
14-
It's the most advanced HTTPS server in the world.
1515

1616
* Reverse Proxy HTTP, HTTPS and WebSockets
1717
* Route UDP/TCP traffic with the included Layer4 module: https://github.com/mholt/caddy-l4
1818
* Dynamic DNS module included: https://github.com/mholt/caddy-dynamicdns
19-
* Large selection of DNS Providers available: https://github.com/caddy-dns
19+
* Cloudflare DNS Provider included: https://github.com/caddy-dns/cloudflare
2020

2121
WWW: https://caddyserver.com/
2222

23-
All available options and help-texts can be found on `Github <https://github.com/opnsense/plugins/tree/master/www/caddy/src/opnsense/mvc/app/controllers/OPNsense/Caddy/forms>`_
24-
25-
2623
------------
2724
Installation
2825
------------
@@ -86,7 +83,7 @@ Standard Configuration
8683
Creating a Simple Reverse Proxy
8784
-------------------------------
8885

89-
.. Attention:: The domain has to be externally resolvable. Create an A-Record with an external DNS Provider that points your domain to the external IP address of your OPNsense.
86+
.. Attention:: The domain has to be externally resolvable. Create an A-Record on a public DNS server that points your domain to the external IP address of your OPNsense.
9087

9188
Go to :menuselection:`Services --> Caddy Web Server --> General Settings`
9289

@@ -213,49 +210,16 @@ Now, all anonymous connections have to authenticate with Basic Auth before acces
213210
Dynamic DNS
214211
-----------
215212

216-
.. Attention::
217-
218-
DNS modules are community maintained: `Caddy DNS <https://github.com/caddy-dns>`_
219-
220-
There are built-in and optional providers. Built in providers will work out of the box (e.g. Cloudflare).
221-
Optional providers must be manually installed via CLI.
222-
If the caddy binary changes version, any optional package must reinstalled.
223-
224-
Add optional providers: `caddy add-package <https://caddyserver.com/docs/command-line#caddy-add-package>`_
225-
226-
227213
Go to :menuselection:`Services --> Caddy Web Server --> General Settings --> DNS Provider`
228214

229-
* Select one of the supported `DNS Providers` from the list
230-
* Input the `DNS API Key`, and any number of the additional required fields in `Additional Fields`.
231-
232-
Go to :menuselection:`Services --> Caddy Web Server --> General Settings --> Dynamic DNS`
233-
215+
* Select `Cloudflare` from the list
216+
* Input the `API Key`
234217
* Choose if `DynDns IP Version` should include IPv4 and/or IPv6.
235218
* Press **Save**
236219

237220
Go to :menuselection:`Services --> Caddy Web Server --> Reverse Proxy --> Domains`
238221

239-
* Press **+** to create a new `Domain`. ``mydomain.duckdns.org`` is an example if `duckdns` is used as DNS Provider.
240-
241-
============================== ========================
242-
Options Values
243-
============================== ========================
244-
**Domain:** ``mydomain.duckdns.org``
245-
**Dynamic DNS:** ``X``
246-
============================== ========================
247-
248-
Go to :menuselection:`Services - Caddy Web Server - Reverse Proxy – Handlers`
249-
250-
* Press **+** to create a new `Handler`
251-
252-
============================== ========================
253-
Options Values
254-
============================== ========================
255-
**Domain:** ``mydomain.duckdns.org``
256-
**Upstream Domain:** ``192.168.1.1``
257-
============================== ========================
258-
222+
* Edit a domain or subdomain and enable the `Dynamic DNS` checkbox.
259223
* Press **Save** and **Apply**
260224

261225
Check the Logfile for the DynDNS updates. Set it to `Informational` and search for the chosen domain.
@@ -278,18 +242,19 @@ Check the Logfile for the DynDNS updates. Set it to `Informational` and search f
278242
Wildcard Domain with Subdomains
279243
-------------------------------
280244

281-
.. Tip:: For `DNS Providers` like `Cloudflare`, this is the recommended setup.
245+
.. Tip:: For `Cloudflare`, this is the recommended setup.
282246

283247
.. Note:: If you use :ref:`Dynamic DNS <dynamicdns-opnsense-caddy>`, subdomains are needed due to the way the API updates the DNS Records in hosted zones.
284248

285249
Go to :menuselection:`Services --> Caddy Web Server --> General Settings --> DNS Provider`
286250

287-
* Select one of the supported `DNS Providers` from the list
288-
* Input the `DNS API Key`, and any number of the additional required fields in `Additional Fields`. Read the full help for details.
251+
* Select `Cloudflare` from the list
252+
* Input the `API Key`
253+
* Set `Resolvers` to ``1.1.1.1``
289254

290255
Go to :menuselection:`Services --> Caddy Web Server --> Reverse Proxy --> Domains`
291256

292-
* | Create ``*.example.com`` as domain and activate the `DNS-01 Challenge` checkbox. Alternatively, use a certificate imported or generated in :menuselection:`System --> Trust --> Certificates`. It has to be a wildcard certificate.
257+
* | Create ``*.example.com`` as domain and activate the `DNS-01 Challenge` checkbox. Alternatively, use a certificate imported or generated in :menuselection:`System --> Trust --> Certificates`. It has to be a wildcard certificate. You could generate one with the os-acme-client plugin.
293258
* | Create all subdomains in relation to the ``*.example.com`` domain, for example ``foo.example.com`` and ``bar.example.com``.
294259
* | Check `Dynamic DNS` for the new subdomains, if needed.
295260

@@ -299,6 +264,8 @@ Go to :menuselection:`Services --> Caddy Web Server --> Reverse Proxy --> Handle
299264

300265
.. Note:: The certificate of a wildcard domain will only contain ``*.example.com``, not a SAN for ``example.com``. If there is a service that should match ``example.com`` exactly, create an additional domain for ``example.com`` with an additional `Handler` for its upstream destination. Subdomains do not support setting ports, they will always track the ports of their assigned parent wildcard domain.
301266

267+
.. Tip:: For `Cloudflare`, set `Trusted Proxies` to the Cloudflare IP ranges and `Client IP Headers` to ``Cf-Connecting-Ip``.
268+
302269

303270
.. _webgui-opnsense-caddy:
304271

@@ -345,7 +312,7 @@ Redirect ACME HTTP-01 Challenge
345312

346313
Sometimes an application behind Caddy uses its own ACME Client to get certificates, most likely with the HTTP-01 challenge. This plugin has a built in mechanism to redirect this challenge type easily to a destination behind it.
347314

348-
Make sure the chosen domain is externally resolvable. Create an A-Record with an external DNS Provider that points to the external IP Address of the OPNsense. In case of IPv6 availability, it is mandatory to create an AAAA-Record too, otherwise the TLS-ALPN-01 challenge might fail.
315+
Make sure the chosen domain is externally resolvable. Create an A-Record on a public DNS server that points to the external IP Address of the OPNsense. In case of IPv6 availability, it is mandatory to create an AAAA-Record too, otherwise the TLS-ALPN-01 challenge might fail.
349316

350317
The configured `Domain` must use an ``empty port`` or ``443`` in the GUI, otherwise it can not use the TLS-ALPN-01 challenge for itself. The upstream destination must listen on Port ``80`` and serve ``/.well-known/acme-challenge/``, for the same `Domain` that is configured in Caddy.
351318

@@ -882,7 +849,8 @@ Caddy: Troubleshooting
882849
FAQ
883850
---
884851

885-
* | A `DNS Provider` is not required to get automatic certificates.
852+
* | `Cloudflare` is not required to get automatic certificates.
853+
* | You can use the os-acme-client plugin to generate wildcard certificates. Set up an automation in the ACME client that reloads Caddy (do not restart it).
886854
* | `Port Forwards`, `NAT Reflection`, `Split Horizon DNS` or `DNS Overrides in Unbound` are not required. Only create Firewall rules that allow traffic to the default ports of Caddy.
887855
* | Even though internal clients will use the external IP address to access the reverse proxied services, the traffic will not pass over the internet. It will stay inside the OPNsense. Only in rare cases where there is multi WAN, the traffic can be routed from one WAN interface to the other over the internet, due to `reply-to` settings.
888856
* | Firewall rules to allow Caddy to reach internal services are not required. OPNsense has a default rule that allows all traffic originating from itself to be allowed.
@@ -922,7 +890,7 @@ Help, Nothing Works!
922890
**1. Check the Infrastructure:**
923891

924892
* Do `A- and/or AAAA-Record` for all `Domains` and `Subdomains` exist?
925-
* In case of activated :ref:`Dynamic DNS <dynamicdns-opnsense-caddy>`, check that the correct `A- and/or AAAA-Records` have been set automatically with the DNS Provider.
893+
* In case of activated :ref:`Dynamic DNS <dynamicdns-opnsense-caddy>`, check that the correct `A- and/or AAAA-Records` have been set automatically with Cloudflare.
926894
* Do they point to one of the external IPv4 or IPv6 addresses of the OPNsense Firewall? Check that with commands like ``nslookup example.com``
927895
* Do the OPNsense `Firewall Rules` allow connections from `any` source to destination ports `80` and `443` to the destination `This Firewall`?
928896
* Is the Caddy service running?

0 commit comments

Comments
 (0)