From ae4fe7e931c5a91a1fc3dc569a24c4a9a585fdc4 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 25 Dec 2022 17:09:14 +0100 Subject: [PATCH] add znc --- seed/znc/dictionaries/40_znc.xml | 45 ++++++++++++++++++ seed/znc/extras/machine/20_unbound.xml | 17 +++++++ seed/znc/manual/image/preinstall/znc.sh | 1 + seed/znc/templates/sysuser-znc.conf | 3 ++ seed/znc/templates/tmpfile-znc.conf | 9 ++++ seed/znc/templates/znc.conf | 61 +++++++++++++++++++++++++ seed/znc/templates/znc.crt | 2 + seed/znc/templates/znc.key | 1 + seed/znc/templates/znc.service | 2 + seed/znc/templates/znc_passwords | 8 ++++ 10 files changed, 149 insertions(+) create mode 100644 seed/znc/dictionaries/40_znc.xml create mode 100644 seed/znc/extras/machine/20_unbound.xml create mode 100644 seed/znc/manual/image/preinstall/znc.sh create mode 100644 seed/znc/templates/sysuser-znc.conf create mode 100644 seed/znc/templates/tmpfile-znc.conf create mode 100644 seed/znc/templates/znc.conf create mode 100644 seed/znc/templates/znc.crt create mode 100644 seed/znc/templates/znc.key create mode 100644 seed/znc/templates/znc.service create mode 100644 seed/znc/templates/znc_passwords diff --git a/seed/znc/dictionaries/40_znc.xml b/seed/znc/dictionaries/40_znc.xml new file mode 100644 index 00000000..9ada380b --- /dev/null +++ b/seed/znc/dictionaries/40_znc.xml @@ -0,0 +1,45 @@ + + + + + + /secrets/znc_passwords + /sysusers.d/1znc.conf + /tmpfiles.d/0znc.conf + /etc/znc/znc.conf + /etc/pki/tls/certs/znc.crt + /etc/pki/tls/private/znc.key + + + + + + 5535 + + + + + + + + + + + + + + + + + + + port + True + outgoing_ports + + + diff --git a/seed/znc/extras/machine/20_unbound.xml b/seed/znc/extras/machine/20_unbound.xml new file mode 100644 index 00000000..c8842485 --- /dev/null +++ b/seed/znc/extras/machine/20_unbound.xml @@ -0,0 +1,17 @@ + + + + + 256 + + + False + + + False + + + 512 + + + diff --git a/seed/znc/manual/image/preinstall/znc.sh b/seed/znc/manual/image/preinstall/znc.sh new file mode 100644 index 00000000..a59ba915 --- /dev/null +++ b/seed/znc/manual/image/preinstall/znc.sh @@ -0,0 +1 @@ +PKG="$PKG znc" diff --git a/seed/znc/templates/sysuser-znc.conf b/seed/znc/templates/sysuser-znc.conf new file mode 100644 index 00000000..a77bc434 --- /dev/null +++ b/seed/znc/templates/sysuser-znc.conf @@ -0,0 +1,3 @@ +g znc 998 - +u znc 998:1000 "Account for ZNC to run as" /var/lib/znc /sbin/nologin +m znc ssl-cert diff --git a/seed/znc/templates/tmpfile-znc.conf b/seed/znc/templates/tmpfile-znc.conf new file mode 100644 index 00000000..fa5efac7 --- /dev/null +++ b/seed/znc/templates/tmpfile-znc.conf @@ -0,0 +1,9 @@ +d /etc/znc 750 root znc - - +d /srv/znc 750 root znc - - +d /srv/znc/modules 750 znc znc - - +d /srv/znc/users 750 znc znc - - +d /var/lib/znc 750 root znc - - +d /var/lib/znc/.znc 750 root znc - - +L /var/lib/znc/.znc/configs - - - - /etc/znc +L /var/lib/znc/.znc/modules - - - - /srv/znc/modules +L /var/lib/znc/.znc/users - - - - /srv/znc/users diff --git a/seed/znc/templates/znc.conf b/seed/znc/templates/znc.conf new file mode 100644 index 00000000..c3f43c72 --- /dev/null +++ b/seed/znc/templates/znc.conf @@ -0,0 +1,61 @@ +%compiler-settings +commentStartToken = // +%end compiler-settings +//GNUNUX generate with command znc --makeconf +// WARNING +// +// Do NOT edit this file while ZNC is running! +// Use webadmin or *controlpanel instead. +// +// Altering this file by hand will forfeit all support. +// +// But if you feel risky, you might want to read help on /znc saveconfig and /znc rehash. +// Also check https://wiki.znc.in/Configuration + +//>GNUNUX +SSLCertFile = /etc/pki/tls/certs/znc.crt +SSLKeyFile = /etc/pki/tls/private/znc.key +// +//>GNUNUX + AllowWeb = false +// +//GNUNUX LoadModule = webadmin + + + {{PASSWORD}} + Admin = false + Nick = %%user_name + AltNick = %%{user_name}_ + Ident = %%user_name + LoadModule = chansaver +//GNUNUX LoadModule = controlpanel +//>GNUNUX + RealName = %%real_name +// + LoadModule = simple_away +//>GNUNUX + LoadModule = keepnick + LoadModule = kickrejoin + LoadModule = nickserv + IRCConnectEnabled = true +// + + %end for + +%end for + + diff --git a/seed/znc/templates/znc.crt b/seed/znc/templates/znc.crt new file mode 100644 index 00000000..88816c0b --- /dev/null +++ b/seed/znc/templates/znc.crt @@ -0,0 +1,2 @@ +%set %%chain=%%get_chain(%%external_domain_name, authority_cn=%%domain_name_eth0, authority_name="External", hide=%%hide_secret) +%%get_certificate(%%external_domain_name, authority_cn=%%domain_name_eth0, authority_name='External', hide=%%hide_secret) diff --git a/seed/znc/templates/znc.key b/seed/znc/templates/znc.key new file mode 100644 index 00000000..01f0fb0e --- /dev/null +++ b/seed/znc/templates/znc.key @@ -0,0 +1 @@ +%%get_private_key(cn=%%external_domain_name, authority_cn=%%domain_name_eth0, authority_name='External', hide=%%hide_secret) diff --git a/seed/znc/templates/znc.service b/seed/znc/templates/znc.service new file mode 100644 index 00000000..598be267 --- /dev/null +++ b/seed/znc/templates/znc.service @@ -0,0 +1,2 @@ +[Service] +ExecStartPre=+/usr/local/lib/secrets/znc_passwords diff --git a/seed/znc/templates/znc_passwords b/seed/znc/templates/znc_passwords new file mode 100644 index 00000000..3e245de7 --- /dev/null +++ b/seed/znc/templates/znc_passwords @@ -0,0 +1,8 @@ +%echo '#!/bin/bash -e' + +# Convert password with znc +password="%%user_password" +pass=$(echo -e "$password\n$password\n"|/usr/bin/znc -ns|grep -A4 '