Added ls.in (logserver).
authorZoltán Felleg <zoltan.felleg@userrendszerhaz.hu>
Wed, 1 Dec 2021 22:45:08 +0000 (23:45 +0100)
committerZoltán Felleg <zoltan.felleg@userrendszerhaz.hu>
Wed, 1 Dec 2021 22:45:08 +0000 (23:45 +0100)
12 files changed:
sources/ls.in/config [new file with mode: 0644]
sources/ls.in/envvars [new file with mode: 0644]
sources/ls.in/firstboot/01_setupnetworking.sh [new file with mode: 0755]
sources/ls.in/firstboot/02_settimezone.sh [new file with mode: 0755]
sources/ls.in/firstboot/03_setupldap.sh [new file with mode: 0755]
sources/ls.in/firstboot/99_cleanup.sh [new file with mode: 0755]
sources/ls.in/postinstall/01_setownership.sh [new file with mode: 0755]
sources/ls.in/postinstall/02_setpermissions.sh [new file with mode: 0755]
sources/ls.in/postinstall/03_installfiles.sh [new file with mode: 0755]
sources/ls.in/postinstall/10_setupservices.sh [new file with mode: 0755]
sources/ls.in/postinstall/20_setuprsyslog.sh [new file with mode: 0755]
sources/ls.in/postinstall/99_cleanup.sh [new file with mode: 0755]

diff --git a/sources/ls.in/config b/sources/ls.in/config
new file mode 100644 (file)
index 0000000..b4ee723
--- /dev/null
@@ -0,0 +1,22 @@
+lxc.include = /usr/share/lxc/config/common.conf
+
+lxc.arch = x86_64
+lxc.uts.name = ls.in.useribm.hu
+lxc.rootfs.path = __CONTAINER_PATH__/rootfs
+lxc.mount.auto = proc:rw sys:ro
+lxc.mount.entry = __CONTAINER_FILESYSTEMS_PATH__ var/log/remote none bind,create=dir 0 0
+
+lxc.net.0.type = veth
+lxc.net.0.flags = up
+lxc.net.0.link = bri-dev
+lxc.net.0.hwaddr = 02:0c:18:03:6d:8b
+
+lxc.autodev = 1
+
+lxc.cgroup2.devices.allow = a
+
+lxc.signal.halt = SIGRTMIN+4
+
+lxc.start.auto = 1
+lxc.start.order = 22
+lxc.start.delay = 3
diff --git a/sources/ls.in/envvars b/sources/ls.in/envvars
new file mode 100644 (file)
index 0000000..912a0d5
--- /dev/null
@@ -0,0 +1,5 @@
+DISTRIBUTION=Fedora
+DISTRIBUTION_VERSION=35
+ROOT_PACKAGES="hostname initscripts iproute rootfiles systemd-udev"
+BASE_PACKAGES="NetworkManager iputils logrotate rsyslog tar vim-minimal"
+SPEC_PACKAGES="rsyslog-doc"
diff --git a/sources/ls.in/firstboot/01_setupnetworking.sh b/sources/ls.in/firstboot/01_setupnetworking.sh
new file mode 100755 (executable)
index 0000000..442a9cf
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+
+sleep 1
+systemctl --quiet is-active NetworkManager.service
+NM_RC=$?
+WAITED=0
+while [ $NM_RC -ne 0 ]
+do
+    echo -n .
+    sleep 1
+    WAITED=1
+    systemctl --quiet is-active NetworkManager.service
+    NM_RC=$?
+done
+[ $WAITED -eq 1 ] && echo
+
+CONNECTIONS=$(nmcli --terse connection show | wc -l)
+while [ $CONNECTIONS -ne 1 ]
+do
+    echo "Number of connections: $CONNECTIONS" >&2
+    sleep 1
+    CONNECTIONS=$(nmcli --terse connection show | wc -l)
+done
+
+nmcli --terse connection show | grep ':$' >/dev/null
+ALL_CONNECTION_DEVICES_KNOWN=$?
+while [ $ALL_CONNECTION_DEVICES_KNOWN -eq 0 ]
+do
+    echo "Not all connection devices are known yet" >&2
+    sleep 1
+    nmcli --terse connection show | grep ':$' >/dev/null
+    ALL_CONNECTION_DEVICES_KNOWN=$?
+done
+
+CONNECTION_LINE=$(nmcli --terse connection show)
+CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
+
+nmcli connection delete uuid "$CONNECTION_UUID"
+
+nmcli connection add \
+    connection.autoconnect yes \
+    connection.id internal \
+    connection.interface-name $CONNECTION_DEVICE \
+    connection.type 802-3-ethernet \
+    ipv4.addresses "10.228.109.139/16" \
+    ipv4.dns "10.228.109.104, 10.228.109.253" \
+    ipv4.dns-search "in.useribm.hu" \
+    ipv4.gateway "10.228.109.254" \
+    ipv4.method "manual" \
+    ipv6.addresses "2a02:d400:0000:f268:000c:18ff:fe03:6d8b/64" \
+    ipv6.dns "2a02:d400:0000:f268:000c:18ff:fe03:6dfd, 2a02:d400:0000:f268:000c:18ff:fe03:6d68" \
+    ipv6.dns-search "in.useribm.hu" \
+    ipv6.gateway "2a02:d400:0000:f268:000c:18ff:fe03:6dfe" \
+    ipv6.method "manual" \
+    save yes
+
+nmcli connection show
diff --git a/sources/ls.in/firstboot/02_settimezone.sh b/sources/ls.in/firstboot/02_settimezone.sh
new file mode 100755 (executable)
index 0000000..20b2a71
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+
+sleep 1
+systemctl --quiet is-active dbus.service
+DBUS_RC=$?
+WAITED=0
+while [ $DBUS_RC -ne 0 ]
+do
+    if [ $WAITED -eq 0 ]
+    then
+        echo -n "Waiting for dbus.service"
+    fi
+    echo -n .
+    sleep 1
+    WAITED=1
+    systemctl --quiet is-active dbus.service
+    DBUS_RC=$?
+done
+[ $WAITED -ne 0 ] && echo
+timedatectl set-timezone Europe/Budapest
diff --git a/sources/ls.in/firstboot/03_setupldap.sh b/sources/ls.in/firstboot/03_setupldap.sh
new file mode 100755 (executable)
index 0000000..4b58626
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+
+exit 0
+authselect select sssd with-mkhomedir --force
+
+cat >>/etc/openldap/ldap.conf <<EOF
+BASE dc=user,dc=hu
+URI ldap://ldap.usr.user.hu
+EOF
diff --git a/sources/ls.in/firstboot/99_cleanup.sh b/sources/ls.in/firstboot/99_cleanup.sh
new file mode 100755 (executable)
index 0000000..b87f2f4
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+
+REAL_PATH=$(dirname $(realpath $0))
+
+echo rm -Rf $REAL_PATH
diff --git a/sources/ls.in/postinstall/01_setownership.sh b/sources/ls.in/postinstall/01_setownership.sh
new file mode 100755 (executable)
index 0000000..f2e6b94
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+
+REAL_PATH=$(dirname $(realpath $0))
+SOURCE_PATH=$REAL_PATH/install
+
+chown -R root.root $SOURCE_PATH/*
diff --git a/sources/ls.in/postinstall/02_setpermissions.sh b/sources/ls.in/postinstall/02_setpermissions.sh
new file mode 100755 (executable)
index 0000000..241386a
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+
+REAL_PATH=$(dirname $(realpath $0))
+SOURCE_PATH=$REAL_PATH/install
diff --git a/sources/ls.in/postinstall/03_installfiles.sh b/sources/ls.in/postinstall/03_installfiles.sh
new file mode 100755 (executable)
index 0000000..e4ee7ff
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+
+REAL_PATH=$(dirname $(realpath $0))
+
+tar --create \
+    --directory=$REAL_PATH \
+    --exclude=.placeholder \
+    --to-stdout \
+    install \
+    | tar --extract \
+          --backup \
+          --directory=/ \
+          --no-overwrite-dir \
+          --strip-components=1 \
+          --suffix=.orig
diff --git a/sources/ls.in/postinstall/10_setupservices.sh b/sources/ls.in/postinstall/10_setupservices.sh
new file mode 100755 (executable)
index 0000000..706332a
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+
+systemctl enable NetworkManager-wait-online.service
+
+systemctl enable logrotate.timer
diff --git a/sources/ls.in/postinstall/20_setuprsyslog.sh b/sources/ls.in/postinstall/20_setuprsyslog.sh
new file mode 100755 (executable)
index 0000000..1e00c30
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+
+mv /etc/rsyslog.conf /etc/rsyslog.conf.orig
+
+sed -e 's/^#module(load="imudp")/module(load="imudp")/' \
+    -e 's/^#input(type="imudp" port="514")/input(type="imudp" port="514")/' \
+    -e 's/^#module(load="imtcp")/module(load="imtcp")/' \
+    -e 's/^#input(type="imtcp" port="514")/input(type="imtcp" port="514")/' \
+    </etc/rsyslog.conf.orig >/etc/rsyslog.conf
diff --git a/sources/ls.in/postinstall/99_cleanup.sh b/sources/ls.in/postinstall/99_cleanup.sh
new file mode 100755 (executable)
index 0000000..b87f2f4
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+
+REAL_PATH=$(dirname $(realpath $0))
+
+echo rm -Rf $REAL_PATH