From 79673343a588c8b70880eebdf16d9b65422b9135 Mon Sep 17 00:00:00 2001
From: Andreas Thienemann <andreas@bawue.net>
Date: Wed, 10 Oct 2018 11:04:13 +0200
Subject: [PATCH] No automatic listener for port *

The formula currently adds a Listen directive for the port '*' if
any configured vhost is configured to listen on :* which does not
work and instead prevents apache from starting.

It is possible to prevent this by setting the
exclude_listen_directive pillar to True but this is a manual
workaround.

Instead, this commit excludes :* Listeners automatically.
---
 apache/files/Debian/ports-2.2.conf.jinja    | 2 +-
 apache/files/Debian/ports-2.4.conf.jinja    | 2 +-
 apache/files/FreeBSD/ports-2.4.conf.jinja   | 2 +-
 apache/files/RedHat/apache-2.4.config.jinja | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/apache/files/Debian/ports-2.2.conf.jinja b/apache/files/Debian/ports-2.2.conf.jinja
index f9c7339..ae51eb1 100644
--- a/apache/files/Debian/ports-2.2.conf.jinja
+++ b/apache/files/Debian/ports-2.2.conf.jinja
@@ -9,7 +9,7 @@
         {%- set interfaces = site.get('interface', '*').split() %}
         {%- set port = site.get('port', 80) %}
         {%- for interface in interfaces %}
-            {%- if not site.get('exclude_listen_directive', False) %}
+            {%- if not site.get('exclude_listen_directive', False) and not port == '*' %}
                 {%- set listen_directive = interface ~ ':' ~ port %}
                 {%- if listen_directive not in listen_directives %}
                     {%- do listen_directives.append(listen_directive) %}
diff --git a/apache/files/Debian/ports-2.4.conf.jinja b/apache/files/Debian/ports-2.4.conf.jinja
index f9c7339..ae51eb1 100644
--- a/apache/files/Debian/ports-2.4.conf.jinja
+++ b/apache/files/Debian/ports-2.4.conf.jinja
@@ -9,7 +9,7 @@
         {%- set interfaces = site.get('interface', '*').split() %}
         {%- set port = site.get('port', 80) %}
         {%- for interface in interfaces %}
-            {%- if not site.get('exclude_listen_directive', False) %}
+            {%- if not site.get('exclude_listen_directive', False) and not port == '*' %}
                 {%- set listen_directive = interface ~ ':' ~ port %}
                 {%- if listen_directive not in listen_directives %}
                     {%- do listen_directives.append(listen_directive) %}
diff --git a/apache/files/FreeBSD/ports-2.4.conf.jinja b/apache/files/FreeBSD/ports-2.4.conf.jinja
index f9c7339..ae51eb1 100644
--- a/apache/files/FreeBSD/ports-2.4.conf.jinja
+++ b/apache/files/FreeBSD/ports-2.4.conf.jinja
@@ -9,7 +9,7 @@
         {%- set interfaces = site.get('interface', '*').split() %}
         {%- set port = site.get('port', 80) %}
         {%- for interface in interfaces %}
-            {%- if not site.get('exclude_listen_directive', False) %}
+            {%- if not site.get('exclude_listen_directive', False) and not port == '*' %}
                 {%- set listen_directive = interface ~ ':' ~ port %}
                 {%- if listen_directive not in listen_directives %}
                     {%- do listen_directives.append(listen_directive) %}
diff --git a/apache/files/RedHat/apache-2.4.config.jinja b/apache/files/RedHat/apache-2.4.config.jinja
index 6dcaf88..5456d5e 100644
--- a/apache/files/RedHat/apache-2.4.config.jinja
+++ b/apache/files/RedHat/apache-2.4.config.jinja
@@ -50,7 +50,7 @@ ServerRoot "{{ apache.get('serverroot', '/etc/httpd') }}"
         {%- set interfaces = site.get('interface', '*').split() %}
         {%- set port = site.get('port', 80) %}
         {%- for interface in interfaces %}
-            {%- if not site.get('exclude_listen_directive', False) %}
+            {%- if not site.get('exclude_listen_directive', False) and not port == '*' %}
                 {%- set listen_directive = interface ~ ':' ~ port %}
                 {%- if listen_directive not in listen_directives %}
                     {%- do listen_directives.append(listen_directive) %}
-- 
GitLab