aboutsummaryrefslogtreecommitdiff
path: root/nix/generate-keys.sh
blob: 89484e7806eb11622d70a3a093668556d03ab7ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env bash
# Generate a host key for a specific host
set -euo pipefail

# Resolve paths relative to this script, not the caller's CWD
cd -- "$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")"

HOST="$1"
mkdir -p "./host-keys/${HOST}"
ssh-keygen -t ed25519 -f "./host-keys/${HOST}/ssh_host_ed25519_key" -N ""
echo "✅ Generated host key for ${HOST}"
echo ""
echo "👉 Derive age public key with:"
# echo "   cat ./host-keys/${HOST}/ssh_host_ed25519_key.pub | nix run nixpkgs#ssh-to-age"
echo "   cat ./host-keys/${HOST}/ssh_host_ed25519_key.pub | ssh-to-age"