From a38f0e1a5d94cea85eda10d88bb69a2b11c3cf95 Mon Sep 17 00:00:00 2001 From: Felix Schueren Date: Tue, 4 Nov 2025 22:38:36 +0100 Subject: [PATCH] bumped number of hosts to 50, some cleanup of folders/helper scripts --- helpers/online-users.sh | 15 +++++++++++++++ setups/gateway.sh | 21 ++++----------------- example.clab.yml => sshlab.clab.yml | 0 3 files changed, 19 insertions(+), 17 deletions(-) create mode 100755 helpers/online-users.sh rename example.clab.yml => sshlab.clab.yml (100%) diff --git a/helpers/online-users.sh b/helpers/online-users.sh new file mode 100755 index 0000000..a59216d --- /dev/null +++ b/helpers/online-users.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# cat /var/lib/misc/dnsmasq.leases | while read line; do loctet=$(echo $line | cut -f 4 -d . | cut -f 1 -d " "); printf "${line}\t"; sed -n "$loctet{p;q}" < <(tr ":" "," < /etc/workshopnames.yml | cut -f 1,3 -d, | tr , "\t") ; done | cut -b 30- | sort -b -k 2,2V | column -t +cat /var/lib/misc/dnsmasq.leases | cut -d' ' -f3-4 | +while read -r line; do + loctet=$(echo "$line" | cut -d'.' -f4 | cut -d' ' -f1) + printf '%s\t' "$line" + sed -n "${loctet}{p;q}" < <( + tr ':' ',' < /etc/workshopnames.yml | + cut -d',' -f1,3 | + tr ',' '\t' + ) +done | +# cut -b30- | +sort -b -k2,2V | +column -t diff --git a/setups/gateway.sh b/setups/gateway.sh index d70ab7d..cc3ebd7 100755 --- a/setups/gateway.sh +++ b/setups/gateway.sh @@ -20,26 +20,13 @@ echo "nameserver 192.168.0.1" > /etc/resolv.conf # ---------------------------------------------------------------------- ( - # wait 60 seconds first - sleep 60 - # cat /var/lib/misc/dnsmasq.leases | while read line; do loctet=$(echo $line | cut -f 4 -d . | cut -f 1 -d " "); printf "${line}\t"; sed -n "$loctet{p;q}" < <(tr ":" "," < /etc/workshopnames.yml | cut -f 1,3 -d, | tr , "\t") ; done | cut -b 30- | sort -b -k 2,2V | column -t - cat /var/lib/misc/dnsmasq.leases | cut -d' ' -f3-4 | - while read -r line; do - loctet=$(echo "$line" | cut -d'.' -f4 | cut -d' ' -f1) - printf '%s\t' "$line" - sed -n "${loctet}{p;q}" < <( - tr ':' ',' < /etc/workshopnames.yml | - cut -d',' -f1,3 | - tr ',' '\t' - ) - done | - # cut -b30- | - sort -b -k2,2V | - column -t + # wait 90 seconds first + sleep 90 + /usr/local/bin/online-users.sh ) > /online-users.txt & # ← background the whole subshell +(/usr/sbin/sshd -D) & # launch dnsmasq (automatically backgrounds) dnsmasq --no-daemon -# /usr/sbin/sshd -D diff --git a/example.clab.yml b/sshlab.clab.yml similarity index 100% rename from example.clab.yml rename to sshlab.clab.yml