I’ve tested the ssh key using SSH port 22 without cloudflared tunnel and know that I am able to connect from the Github runner host to my vpc host but when using cloudflared tunnel, it does not work. I’ve tried adding every possible HostKeyAlgorithms but still didn’t work. Is this an issue with the Github runner or cloudflare tunnel? I am able to connect to my vpc host using cloudflare tunnel fine from my local machines using the same ssh key so I know cloudflared tunnel is configured correctly on the vpc host.
Others are also having same issue on Stackoverflow without a solution.
---
name: test cloudflared
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
cloudflared:
name: test cloudflared
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: install cloudflared
run: |
curl -L https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-archive-keyring.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/cloudflare-archive-keyring.gpg] https://pkg.cloudflare.com/cloudflared $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflared.list
sudo apt update
sudo apt-get install cloudflared
- name: test cloudflared
run: |
which cloudflared
whereis cloudflared
/usr/local/bin/cloudflared --version
- name: install-ssh-key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
name: id_rsa
known_hosts: ${{ secrets.KNOWN_HOSTS }}
config: |
Host testhost
HostName ${{ vars.HOST }}
User ${{ vars.USER }}
IdentityFile ~/.ssh/id_rsa
ProxyCommand /usr/local/bin/cloudflared access ssh --hostname %h
- name: test ssh
run: ssh -vvv testhost 'whoami'
OpenSSH_8.9p1 Ubuntu-3ubuntu0.4, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /home/runner/.ssh/config
debug1: /home/runner/.ssh/config line 2: Applying options for testhost
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/runner/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/runner/.ssh/known_hosts2'
debug1: Executing proxy command: exec /usr/local/bin/cloudflared access ssh --hostname ssh.myhost.com
debug1: identity file /home/runner/.ssh/id_rsa type -1
debug1: identity file /home/runner/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.4
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535
Error: Process completed with exit code 255.