[OpenWrt-Devel] znc: configure listeners in modern way

Hans Dedecker dedeckeh at gmail.com
Fri Nov 9 02:27:10 EST 2018


On Thu, Nov 8, 2018 at 7:34 PM user1024 <user1024 at tut.by> wrote:
>
> Hello
> Given patches add support multiple listeners, ssl, etc.
> Signed-off-by: User 1024 user1024 at tut.by
> diff --git a/net/znc/files/znc.conf b/net/znc/files/znc.conf
> index 1b0d842..6879cbf 100644
> --- a/net/znc/files/znc.conf
> +++ b/net/znc/files/znc.conf
> @@ -1,8 +1,8 @@
>  config znc
> -       # where to listen for connections
> -       list listener   '192.168.1.1 1234'
> -       # If using SSL sockets, use the following certifcate:
> -       # option znc_ssl_cert '/etc/znc.cert'
> +       # If you need to use SSL sockets, use the following
> certificate path
> +       # simple cmd: cat my.key my.crt dhparam.pem > /etc/znc.pem
> +       # make sure znc user can read certificate
> +       # option znc_ssl_cert '/etc/znc.pem'
>
>         # load global modules (You need to install them first):
>         # list module 'fail2ban'
> @@ -10,6 +10,22 @@ config znc
>         # remove this to enable the service
>         option disabled 1
>
> +config listener 'sampleListener'
> +       # to get plain irc protocol
> +       option allowirc 'true'
> +       # to get web irc
> +       #option allowweb 'false'
> +       # ip to bind
> +       option host '192.168.1.1'
> +       # port to use
> +       option port '1234'
> +       # listen on ipv4
> +       option ipv4 'true'
> +       # listen on ipv6
> +       #option ipv6 'false'
> +       # to get irc encrypted, valid certificate required, see znc
> section to details
> +       #option ssl 'true'
> +
>  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 0277aff..2e219e5 100644
> --- a/net/znc/files/znc.init
> +++ b/net/znc/files/znc.init
> @@ -1,5 +1,5 @@
>  #!/bin/sh /etc/rc.common
> -# Copyright (C) 2010 Openwrt.org
> +# Copyright (C) 2018 Openwrt.org
>
>  START=60
>
> @@ -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 "<Listener $listener>" >> $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 "</Listener>" >> $ZNC_CONFIG
> +}
> +
>  add_user() {
>         local user="$1"
>         local password
Hi,

The znc package belongs to the OpenWrt packages repo; patches for this
repo need to be opened as PR in https://github.com/openwrt/packages.
Also the patch has formal issues as it needs a proper git commit
description and needs to be signed off with your real name; please
read https://openwrt.org/submitting-patches

Hans
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list