Update secrets and SSH to ed25519

This commit is contained in:
Greg Hellings
2023-08-19 01:08:26 +00:00
parent 69a10eb0e1
commit 9c22f7414c
7 changed files with 212 additions and 43 deletions
+5 -4
View File
@@ -1,11 +1,12 @@
# vim: set ft=bash:
if [ ! -f "${HOME}/.ssh/id_rsa" ]; then
file="${HOME}/.ssh/id_ed25519"
if [ ! -f "${file}" ]; then
echo "Generating a new key"
ssh-keygen -t rsa -b 8192 -f "${HOME}/.ssh/id_rsa" -N ''
cat "${HOME}/.ssh/id_rsa.pub" >> /etc/nixos/home/ssh/authorized_keys
ssh-keygen -t ed25519 -f "${file}" -N ''
cat "${file}.pub" >> /etc/nixos/home/ssh/authorized_keys
echo "Authing key to GitHub - may fail"
gh auth refresh -h github.com -s admin:public_key
gh ssh-key add -t ${HOSTNAME}-auto ~/.ssh/id_rsa.pub || true
gh ssh-key add -t ${HOSTNAME}-auto "${file}" || true
fi
cp /etc/nixos/home/ssh/authorized_keys "${HOME}/.ssh/authorized_keys"