From dd586837e8c7121bcffbc9a4a9ecd823c2816846 Mon Sep 17 00:00:00 2001 From: Pavel Demkovich Date: Tue, 13 Oct 2020 15:40:11 +0300 Subject: [PATCH] znc: Add support for many configurable listeners for znc Function add_listener called from /etc/init.d/znc, but not implemented Signed-off-by: Pavel Demkovich --- net/znc/files/znc.conf | 14 +++++++++++--- net/znc/files/znc.init | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/net/znc/files/znc.conf b/net/znc/files/znc.conf index 1b0d842a53..086eb40bcc 100644 --- a/net/znc/files/znc.conf +++ b/net/znc/files/znc.conf @@ -1,7 +1,5 @@ config znc - # where to listen for connections - list listener '192.168.1.1 1234' - # If using SSL sockets, use the following certifcate: + # If using SSL sockets, use the following certificate: # option znc_ssl_cert '/etc/znc.cert' # load global modules (You need to install them first): @@ -10,6 +8,16 @@ config znc # remove this to enable the service option disabled 1 +config listener 'sampleListener' + option allowirc 'true' + option allowweb 'false' + option host '192.168.1.1' + option port '1234' + option ipv4 'true' + option ipv6 'false' + # you must set option_ssl_cert in znc section before change + option ssl 'false' + config user 'sampleUser' # Use either a plain text password or use the full sha256#... line. # You can generate one with 'znc -s'. diff --git a/net/znc/files/znc.init b/net/znc/files/znc.init index 0277afff61..9355cbb724 100644 --- a/net/znc/files/znc.init +++ b/net/znc/files/znc.init @@ -71,7 +71,7 @@ znc_global() { mkdir -p $ZNC_CONFIG_PATH/configs/ [ ! -f "$ZNC_CONFIG" ] || rm "$ZNC_CONFIG" - add_param "Version" "1.0" + add_param "Version" "1.6" config_get anoniplimit "$znc" anoniplimit config_get maxbuffersize "$znc" maxbuffersize @@ -93,6 +93,37 @@ znc_global() { fi } +add_listener() { + local listener="$1" + local host + local port + local allowirc + local allowweb + local ipv4 + local ipv6 + local ssl + + config_get host "$listener" host + config_get port "$listener" port + config_get allowirc "$listener" allowirc + config_get allowweb "$listener" allowweb + config_get ipv4 "$listener" ipv4 + config_get ipv6 "$listener" ipv6 + config_get ssl "$listener" ssl + + echo "" >> $ZNC_CONFIG + + [ -z "$host" ] || add_param " Host" "$host" + [ -z "$port" ] || add_param " Port" "$port" + [ -z "$allowirc" ] || add_param " AllowIRC" "$allowirc" + [ -z "$allowweb" ] || add_param " AllowWeb" "$allowweb" + [ -z "$ipv4" ] || add_param " IPv4" "$ipv4" + [ -z "$ipv6" ] || add_param " IPv6" "$ipv6" + [ -z "$ssl" ] || add_param " SSL" "$ssl" + + echo "" >> $ZNC_CONFIG +} + add_user() { local user="$1" local password -- 2.30.2