From e795c55f142e34e995efb786dc8d44d0aa6e8f5f Mon Sep 17 00:00:00 2001 From: minottic Date: Thu, 4 Jan 2024 11:48:46 +0100 Subject: [PATCH] Add action to open ssh tunnel --- .github/actions/open-ssh-tunnel/action.yml | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/actions/open-ssh-tunnel/action.yml diff --git a/.github/actions/open-ssh-tunnel/action.yml b/.github/actions/open-ssh-tunnel/action.yml new file mode 100644 index 00000000..3657f267 --- /dev/null +++ b/.github/actions/open-ssh-tunnel/action.yml @@ -0,0 +1,25 @@ +name: ssh-tunnel +description: "Open ssh tunnel" + +inputs: + bastion_user: + description: username@host for the ssh tunnel + required: true + type: string + bastion_ssh_key: + description: private ssh key content + required: true + type: string + +runs: + using: "composite" + steps: + - run: | + mkdir .ssh; + BASTION_USER=${{ inputs.bastion_user}}; + echo ${{ inputs.bastion_ssh_key }} | base64 -d > .ssh/github_bastion; + chmod 600 .ssh/github_bastion; + ssh-keyscan ${BASTION_USER#*@} > .ssh/known_hosts 2> /dev/null; + chmod 644 .ssh/known_hosts; + ssh -i .ssh/github_bastion ${{ inputs.bastion_user }} -o UserKnownHostsFile=.ssh/known_hosts -D 1080 -f -q -N; + shell: bash