4 Commits

Author SHA1 Message Date
433888c3c3 [fanny] set old ssh keys
All checks were successful
Check flake syntax / flake-check (push) Successful in 4m13s
2025-02-25 17:46:55 +01:00
afbc31b96c [fanny] set old age key 2025-02-25 17:46:08 +01:00
3caa94c53b [deployment] set hostname in pubkey 2025-02-25 17:40:37 +01:00
63f3b5da1d fix host_builder.nix tabs 2025-02-22 21:11:22 +01:00
2 changed files with 13 additions and 14 deletions

View File

@@ -16,17 +16,16 @@ if [ ! -e flake.nix ]
done
fi
read -p "Enter new host name: " hostname
if [ "$hostname" = "" ]; then exit 0
fi
pwpath="machines/$hostname/secrets"
pwpath="machines"
hostkey="ssh_host_ed25519_key"
initrdkey="initrd_ed25519_key"
read -p "Enter new host name: " host
mkdir -p "$pwpath"
cd "$pwpath"
if [ "$host" = "" ]; then exit 0
fi
mkdir -p $pwpath/$host/secrets
cd $pwpath/$host/secrets
# Generate SSH keys
ssh-keygen -f $hostkey -t ed25519 -N "" -C "root@$host"
@@ -46,6 +45,6 @@ echo "Hier ist der age public key für sops etc:"
echo "$(ssh-to-age -i ./"$hostkey".pub)"
echo
echo "Hier ist eine reproduzierbare mac-addresse:"
echo "$hostname"|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/'
echo "$host"|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/'
exit 0

View File

@@ -2,7 +2,7 @@ set -o errexit
set -o pipefail
sshoptions="-o StrictHostKeyChecking=no -o ServerAliveInterval=1 -o ServerAliveCountMax=1 -p 222 -T"
hostname=$1
HOSTNAME=$1
if [ ! -e flake.nix ]
then
@@ -19,17 +19,17 @@ if [ ! -e flake.nix ]
done
fi
diskkey=$(sops -d machines/$hostname/secrets/disk.key)
diskkey=$(sops -d machines/$HOSTNAME/secrets/disk.key)
echo
if [ $# = 1 ]
then
echo "$diskkey" | ssh $sshoptions root@$hostname-initrd "systemd-tty-ask-password-agent" #root
echo "$diskkey" | ssh $sshoptions root@$HOSTNAME-initrd "systemd-tty-ask-password-agent" #root
elif [ $# = 2 ]
then
ip=$2
echo "$diskkey" | ssh $sshoptions root@$ip "systemd-tty-ask-password-agent" #root
IP=$2
echo "$diskkey" | ssh $sshoptions root@$IP "systemd-tty-ask-password-agent" #root
else
echo