more hosts, keychain, small stuff

This commit is contained in:
2025-11-08 00:49:55 +01:00
parent b65521d46c
commit 9ebe896757
8 changed files with 458 additions and 16 deletions

View File

@@ -5,13 +5,13 @@ dpkg-reconfigure openssh-server
ip addr replace dev eth1 10.192.40.2/29
# the "southbound" interface towards all the clients that we are DHCP server for
ip addr replace dev eth2 192.168.0.1/24
ip addr replace dev eth2 192.168.0.254/24
# "eastbound" gw<->jumphost1 eth3 and 172.16.200/23 behind jumphost1
ip addr replace dev eth3 172.16.202.32/31
# ip route replace 172.16.200/23 via 172.16.202.33
echo "nameserver 192.168.0.1" > /etc/resolv.conf
echo "nameserver 192.168.0.254" > /etc/resolv.conf
# ----------------------------------------------------------------------
@@ -25,8 +25,10 @@ echo "nameserver 192.168.0.1" > /etc/resolv.conf
/usr/local/bin/online-users.sh
) > /online-users.txt & # ← background the whole subshell
(/usr/sbin/sshd -D) &
# launch dnsmasq (automatically backgrounds)
dnsmasq --no-daemon
(dnsmasq --no-daemon --log-facility=/dns.log --log-queries) &
# dnsmasq --no-daemon
/usr/sbin/sshd -D

View File

@@ -9,6 +9,7 @@ create_user_from_shared_names_list () {
my_pwd=${my_pwhash_pwd#*,}
useradd -m ${my_username} -p "${my_pwhash}" -s /bin/bash
# su - ${my_username} -c 'mkdir -p .ssh'
su - ${my_username} -c "echo 'alias fireworks=\"fireworks.sh Fireworks\"' >> ~/.bash_aliases"
echo "$my_pwd" > /home/${my_username}/PASSWORD
}

View File

@@ -1,9 +1,13 @@
#!/bin/bash
dpkg-reconfigure openssh-server
# my_username=$(shuf -n 1 /etc/workshopnames.yml | cut -b 3-)
udhcpc -i eth0 -x hostname:$(hostname) -F $(hostname)
# once we have our IP, create the matching user.
my_last_octet=$(ip -4 a s dev eth0 | grep / | cut -f 4 -d . | cut -f 1 -d /)
# udhcpc -i eth0 -x hostname:$(hostname) -F $(hostname)
# # once we have our IP, create the matching user.
# my_last_octet=$(ip -4 a s dev eth0 | grep / | cut -f 4 -d . | cut -f 1 -d /)
my_last_octet=$(( $(hostname | tr -cd '0-9') )) ## just keep the numbers from the hostname
# ip addr replace dev eth0 192.168.0.${my_last_octet}/24
# ip route replace default via 192.168.0.1
udhcpc -i eth0 -x hostname:$(hostname) -F $(hostname) -r 192.168.0.${my_last_octet} # request .1 for linux1, etc. GW should be .254
my_username_pwhash=$(sed -n "${my_last_octet}{p;q}" /etc/workshopnames.yml)
my_username="${my_username_pwhash%%:*}"
my_pwhash_pwd="${my_username_pwhash#*: }"
@@ -14,4 +18,5 @@ su - ${my_username} -c 'mkdir .ssh'
echo "$my_pwd" > /home/${my_username}/PASSWORD
# cp /root/.ssh/authorized_keys /home/${my_username}/.ssh/ && chown ${my_username}:${my_username} /home/${my_username}/.ssh/authorized_keys
printf "172.16.202.33\tjumphost1\n" >> /etc/hosts
su - ${my_username} -c "echo 'alias fireworks=\"fireworks.sh Fireworks\"' >> ~/.bash_aliases"
/usr/sbin/sshd -D