added ssh

This commit is contained in:
Kasper Juul Hermansen 2022-08-14 21:44:28 +02:00
parent 7ab29ce157
commit a55ea6c372
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23
2 changed files with 27 additions and 0 deletions

View File

@ -16,3 +16,5 @@ scripts:
type: shell
deploy_release:
type: shell
setup_ssh:
type: shell

25
scripts/setup_ssh.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/sh
set -e
if [ ! -d ~/.ssh ]; then
mkdir -p ~/.ssh
chmod 700 ~/.ssh
fi
if [ -n "$SSH_KEY" ]; then
SSH_KEY_ID="$HOME/.ssh/id_ed25519"
echo $SSH_KEY > $SSH_KEY_ID
chmod 600 $SSH_KEY_ID
# Append the required to the ssh config file.
# Switch out the hostname for different hosts.
# The line count is 5
echo "\nHost ci.i.kjuulh.io\n"\
" IdentityFile ${SSH_KEY_ID}\n"\
" IdentitiesOnly yes\n"\
" UserKnownHostsFile=/dev/null\n"\
" StrictHostKeyChecking no"\
>> $HOME/.ssh/config
fi