From acae60ec72fc316b00c9e8df0ddeed367058eb1c Mon Sep 17 00:00:00 2001 From: Zdenek Styblik Date: Sun, 4 Aug 2024 21:08:44 +0200 Subject: [PATCH] If there are no vhosts at all, listen at port 80 and 443 ... since this is default/stock behaviour at least on Debian. Also, "ssl" is no longer bool, it's a dict. --- action_plugins/apache_ports_generator.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/action_plugins/apache_ports_generator.py b/action_plugins/apache_ports_generator.py index a97fc1f..24c3e1c 100644 --- a/action_plugins/apache_ports_generator.py +++ b/action_plugins/apache_ports_generator.py @@ -49,7 +49,10 @@ def run(self, tmp=None, task_vars=None): vhosts = self._task.args.get("vhosts", []) if not vhosts: - vhosts = [{"listen_ip": "", "port": 80, "ssl": False}] + vhosts = [ + {"listen_ip": "", "port": 80, "ssl": {}}, + {"listen_ip": "", "port": 443, "ssl": {}}, + ] # Ref. https://httpd.apache.org/docs/2.4/bind.html # Structure: @@ -84,10 +87,10 @@ def run(self, tmp=None, task_vars=None): if port not in bindings: bindings[port] = {} - ssl = vhost.get("ssl", False) + ssl = vhost.get("ssl", {}) # According to documentation, https is default proto for port 443. # Therefore there is no need to specify it. - if ssl is True and port != 443: + if ssl and port != 443: ssl = "https" else: ssl = ""