Skip to content

Commit

Permalink
Fix wrong default route on challenge when routes are dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
kea committed Feb 12, 2024
1 parent d4997ad commit 003d2c7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion certbot_nginx_unit/configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,14 @@ def _ensure_challenge_listener(self):
if "listeners" not in self._configuration:
raise errors.PluginError("No listeners configured")
if "*:80" not in self._configuration["listeners"]:
self._configuration["listeners"]["*:80"] = {"pass": "routes"}
self._backup_routes = self._configuration.get("routes", [])
default_route = self._ensure_acme_route("routes")
self._configuration["listeners"]["*:80"] = {"pass": default_route}
listener_route = "/config/listeners/*:80"
listener80 = json.dumps(self._configuration["listeners"]["*:80"]).encode()
self.unitc.put(listener_route, listener80, success_message, error_message)
self._to_remove.append("/config/listeners/*:80")
return
if "pass" not in self._configuration["listeners"]["*:80"]:
raise errors.PluginError("Cannot configure the route for the *:80 listener")

Expand Down

0 comments on commit 003d2c7

Please sign in to comment.