I’ve worked (still working on) integrating Caddy into the OPNsense Firewall.
The GUI is tailored around the reverse proxy features of Caddy v2:
Exact domains with handles
Wildcard domains with subdomains and nested handles
ACME DNS-01 Challenge for a few providers
Choose Custom Certificates and CA certificates integrated with the OPNsense Certificate store
Different handle types (handle and handle_path)
TLS and NTLM for transport_http, with option to trust a CA certificate
Input validation that prevents most invalid Caddyfile configurations.
Logfile is shown in the GUI for easy troubleshooting
The GUI has been designed in a way to show how easy a reverse proxy configuration with Caddy can be, it takes just a few clicks to have a reliable reverse proxy running on the OPNsense Firewall.
If you’re interested, don’t wait and test it today, I would love some feedback.
Thanks for writing this. I was looking for exactly this. I really love how you have made the already easy task of doing reverse proxy with Caddy in Opnsense even more intuitive.
In a typical homelab usecase I have various apps working on one of the servers I have on various ports. I was able to get the reverse proxy to proxy to my backend server but then I noticed I have opened it to the world i.e. I had no redirect to some simple html page setup for people coming from outside. So I disabled the reverse proxy for now and was trying to figure out how can I present different content based on origin i.e
origin = internal - do the reverse proxy to the service I configured
origin = external - redirect to simple html or something that doesn’t compromise the security
I wonder how you take care of that in the plugin? I see there are handler but didn’t understand. Is iti possible to configure the scenario I pointed from your plugin GUI.
I think that would match the catch-all handle and then only reverse proxy it if the private_ranges are matched too. Though I’m unsure here and have to test it.
EDIT: The above example works. Programming this into the plugin will take some time though. Since I want to use UUIDs for these additional handles. So I will choose to create a ACL (Access List) submenu. I’m going to track that on github.
I have added a solution for it. Access can now be granted or denied based on client_ip in the GUI with Access Lists. These can be set per domain or subdomain.
The handles are then grouped under a named matcher with the client_ip parameter set, thus they will only match if the IP address matches. Everybody else can access the Front End domain, but nothing of the Back End domain will render since no handle will match.
Hi, I’m newish to hosting and Caddy in general and I have figured out a lot using Caddy in a Docker but recently installed it on OPNsense and am having a bit of a problem. Not a problem just not sure how the importing of the conf and global file works.
being the import in that line. What I need is an example of adding those so they will be imported into the OPNsense Caddy, after turning everything off in the GUI. I’ve tried just making two files with that exact setup (one in a global and one in a conf file) in them but it never works, I might be messing something small up though. Thank you in advanced.
I would like to know which of those security headers are really crucial to be offered, and which ones are just to “feel better”. Then I could ponder to include the “best mix” of them as a checkbox for domains if that really improves security.
Though from my understanding and reading most of the relevant docs, Caddyv2 is designed around security by default. Changing defaults is most of the time counterproductive?
None of them are required. Security headers are an application-layer concern, users should not blindly set those kinds of headers for applications out of their control.
I use them based on the setup instructions for certain docker apps that say they should be added for the program, I don’t use it for every one of them. If they do not ask for it I do not import them.
Quick edit: It works now, seems it was my confusion on what is a global that was causing the problems.
Hey there, that sounds more like a Network Infrastructure problem than a Caddy Problem. Without a network diagram its hard to help. Maybe this would be better to discuss in the OPNsense Forum. Maybe following this short tutorial here can help you too:
We worked hard, and now this Caddy plugin has been merged into OPNsense. Soon everybody can install it with one click, and have fun with the ultimate server (as reverse proxy).
It bundles reverse proxy, almost all compilable caddy-dns providers, DNS-01 challenge and Dynamic DNS in a nice GUI package thats easy to configure and reliable.