aboutsummaryrefslogtreecommitdiff
path: root/admin
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2020-06-26 11:37:32 +0200
committerKarel Kočí <cynerd@email.cz>2020-06-26 13:04:46 +0200
commit43a8f7072ef401eaebe7f9e268cbb38085c9f384 (patch)
tree7cf6608f712a13eebc059c3692f29ea8d145ed30 /admin
parentc7dca50f110d5458ceff21a2274eddae2aae119b (diff)
syslog-ng: detect disabled IPv6 on loopback and fallback to IPv4
Binding in default to IPv6 is preferable but it can be disabled in kernel and that prevents syslog-ng to start. This setup should not be that common but syslog is very important service and should survive that. This introduces new plugin defining source generator `network_localhost`. This is used instead of original network source. Signed-off-by: Karel Kočí <cynerd@email.cz>
Diffstat (limited to 'admin')
-rw-r--r--admin/syslog-ng/Makefile5
-rwxr-xr-xadmin/syslog-ng/files/scl/network_localhost/detect.sh6
-rw-r--r--admin/syslog-ng/files/scl/network_localhost/plugin.conf1
-rw-r--r--admin/syslog-ng/files/syslog-ng.conf2
4 files changed, 12 insertions, 2 deletions
diff --git a/admin/syslog-ng/Makefile b/admin/syslog-ng/Makefile
index 5be6f4365..c167d3be5 100644
--- a/admin/syslog-ng/Makefile
+++ b/admin/syslog-ng/Makefile
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=syslog-ng
PKG_VERSION:=3.27.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
PKG_LICENSE:=LGPL-2.1-or-later GPL-2.0-or-later
@@ -87,6 +87,9 @@ define Package/syslog-ng/install
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) ./files/logread $(1)/sbin
+
+ $(INSTALL_DIR) $(1)/usr/share/syslog-ng/include/
+ $(CP) -r ./files/scl $(1)/usr/share/syslog-ng/include/
endef
define Package/syslog-ng/postinst
diff --git a/admin/syslog-ng/files/scl/network_localhost/detect.sh b/admin/syslog-ng/files/scl/network_localhost/detect.sh
new file mode 100755
index 000000000..ef76272c4
--- /dev/null
+++ b/admin/syslog-ng/files/scl/network_localhost/detect.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+if [ "$(sysctl net.ipv6.conf.lo.disable_ipv6 | cut -d' ' -f 3)" = "0" ]; then
+ echo 'network(ip("::1") port(514) transport(udp) ip-protocol(6) )'
+else
+ echo 'network(ip("127.0.0.1") port(514) transport(udp) ip-protocol(4) )'
+fi
diff --git a/admin/syslog-ng/files/scl/network_localhost/plugin.conf b/admin/syslog-ng/files/scl/network_localhost/plugin.conf
new file mode 100644
index 000000000..b2789424a
--- /dev/null
+++ b/admin/syslog-ng/files/scl/network_localhost/plugin.conf
@@ -0,0 +1 @@
+@module confgen context(source) name(network_localhost) exec("`scl-root`/network_localhost/detect.sh")
diff --git a/admin/syslog-ng/files/syslog-ng.conf b/admin/syslog-ng/files/syslog-ng.conf
index 2181464b4..10cb98d88 100644
--- a/admin/syslog-ng/files/syslog-ng.conf
+++ b/admin/syslog-ng/files/syslog-ng.conf
@@ -26,7 +26,7 @@ source src {
};
source net {
- network(ip("::1") port(514) transport(udp) ip-protocol(6));
+ network_localhost();
};
source s_network {