6 Commits

Author SHA1 Message Date
7bfffb32f4 [fanny] set old ssh keys
All checks were successful
Check flake syntax / flake-check (push) Successful in 4m10s
2025-02-25 17:49:58 +01:00
b792b738a9 [fanny] set old age key 2025-02-25 17:49:58 +01:00
8a2b948d11 [deployment] set hostname in pubkey 2025-02-25 17:49:58 +01:00
afd6444635 fix host_builder.nix tabs 2025-02-25 17:49:58 +01:00
b423efeaef Merge pull request 'Reproducible deployments new filestructure' (#85) from reproducible-deployments-filestructure into reproducible-deployments
All checks were successful
Check flake syntax / flake-check (push) Successful in 4m11s
Reviewed-on: #85
Reviewed-by: Ahtlon <ahtlon@noreply.git.dynamicdiscord.de>
2025-02-23 13:34:38 +01:00
ahtlon
3bc74a3e80 [scripts] make pwpath consistant
All checks were successful
Check flake syntax / flake-check (push) Successful in 7m11s
2025-02-23 13:16:17 +01:00
2 changed files with 14 additions and 13 deletions

View File

@@ -16,16 +16,17 @@ if [ ! -e flake.nix ]
done
fi
pwpath="machines"
hostkey="ssh_host_ed25519_key"
initrdkey="initrd_ed25519_key"
read -p "Enter new host name: " host
read -p "Enter new host name: " hostname
if [ "$host" = "" ]; then exit 0
if [ "$hostname" = "" ]; then exit 0
fi
mkdir -p $pwpath/$host/secrets
cd $pwpath/$host/secrets
pwpath="machines/$hostname/secrets"
hostkey="ssh_host_ed25519_key"
initrdkey="initrd_ed25519_key"
mkdir -p "$pwpath"
cd "$pwpath"
# Generate SSH keys
ssh-keygen -f $hostkey -t ed25519 -N "" -C "root@$host"
@@ -45,6 +46,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 "$host"|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/'
echo "$hostname"|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