mirror of
https://github.com/Noratrieb/vps.git
synced 2026-01-14 16:55:00 +01:00
things
This commit is contained in:
parent
009f85acc2
commit
de02947066
6 changed files with 32 additions and 5 deletions
23
scripts/copy-deploy-key.sh
Executable file
23
scripts/copy-deploy-key.sh
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copies a base64 encoded deploy key to the servers.
|
||||
|
||||
set -eu
|
||||
|
||||
printf "Enter private key (base64 encoded): "
|
||||
read -r key64
|
||||
|
||||
private=$(echo "$key64" | base64 -d)
|
||||
public=$(ssh-keygen -f <(echo "$private") -y)
|
||||
|
||||
tmp=$(mktemp -d)
|
||||
echo "$private" > "$tmp/id"
|
||||
echo "$public" > "$tmp/id.pub"
|
||||
|
||||
delete() {
|
||||
rm -r "$tmp"
|
||||
}
|
||||
trap delete EXIT
|
||||
|
||||
ssh-copy-id -i "$tmp/id" root@vps1.nilstrieb.dev
|
||||
ssh-copy-id -i "$tmp/id" root@vps2.nilstrieb.dev
|
||||
Loading…
Add table
Add a link
Reference in a new issue