Skip to content

Commit

Permalink
If there are no vhosts at all, listen at port 80 and 443
Browse files Browse the repository at this point in the history
... since this is default/stock behaviour at least on Debian.
Also, "ssl" is no longer bool, it's a dict.
  • Loading branch information
zstyblik committed Aug 5, 2024
1 parent a33ca6d commit 5174145
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions action_plugins/apache_ports_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 = ""
Expand Down

0 comments on commit 5174145

Please sign in to comment.