diff --git a/www/caddy/Makefile b/www/caddy/Makefile index 45d38b923..4ad87d41c 100644 --- a/www/caddy/Makefile +++ b/www/caddy/Makefile @@ -1,5 +1,6 @@ PLUGIN_NAME= caddy PLUGIN_VERSION= 1.5.5 +PLUGIN_REVISION= 1 PLUGIN_DEPENDS= caddy-custom PLUGIN_COMMENT= Easy to configure Reverse Proxy with Automatic HTTPS and Dynamic DNS PLUGIN_MAINTAINER= cedrik@pischem.com diff --git a/www/caddy/pkg-descr b/www/caddy/pkg-descr index 924946fb5..1501aed1a 100644 --- a/www/caddy/pkg-descr +++ b/www/caddy/pkg-descr @@ -37,6 +37,10 @@ Plugin Changelog * Cleanup: Javascript variables have been changed from var to let to reduce scope. * Fix: Template has been fixed to allow any TLS option in Handlers to appear independant when filled out. This increases flexibility with the "tls_server_name" option. * Add: Diagnostics view added where the current Caddyfile and JSON configuration can be displayed, validated and downloaded. +* Add: HTTP-01 Challenge Redirection can also be configured for subdomains. +* Cleanup: lang() and gettext() functions added for translations. +* Cleanup: Rewritten most help texts in forms for consistency. +* Fix: The newly introduced "configctl caddy reload" action, which calls the "service caddy reloadssl" command, will now also trigger the setup.sh script. 1.5.4 diff --git a/www/caddy/src/opnsense/scripts/OPNsense/Caddy/caddy_control.py b/www/caddy/src/opnsense/scripts/OPNsense/Caddy/caddy_control.py index c698d8244..79e9a8226 100755 --- a/www/caddy/src/opnsense/scripts/OPNsense/Caddy/caddy_control.py +++ b/www/caddy/src/opnsense/scripts/OPNsense/Caddy/caddy_control.py @@ -35,8 +35,6 @@ def run_service_command(action, action_message): if action == "validate": try: - # Call Setup script - subprocess.run(["/usr/local/opnsense/scripts/OPNsense/Caddy/setup.sh"], check=True) # Validate the Caddyfile with explicit --config flag, capturing both stdout and stderr validation_output = subprocess.check_output(["caddy", "validate", "--config", "/usr/local/etc/caddy/Caddyfile"], stderr=subprocess.STDOUT, text=True) if "Valid configuration" in validation_output: @@ -76,6 +74,15 @@ if __name__ == "__main__": if action in actions: service_action = actions[action] message = f"{action.capitalize()}ing Caddy service" if action != "validate" else "Validating Caddy configuration" + + # Call setup script for 'validate' and 'reloadssl' actions + # This is needed because the setup script triggers the caddy_certs.php script, which exports all certificates into the filesystem. + # Caddy reloads certificates when reloadssl is used. Because it is a non standard command, the caddy_setup script will not be triggered in /etc/rc.conf.d/caddy. + # The validate command needs it to make sure all certificates are in the filesystem, because otherwise the validation fails. + if service_action in ["validate", "reloadssl"]: + subprocess.run(["/usr/local/opnsense/scripts/OPNsense/Caddy/setup.sh"], check=True) + + # Continue with the service action print(run_service_command(service_action, message)) else: print(json.dumps({"status": "failed", "message": f"Unknown action: {action}"}))