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

@@ -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