Github Actions SSH Connection fails

I’ve set up Cloudflared on my server with the following config:

tunnel: footlab-pi
credentials-file: /etc/cloudflared/e894a30f-3b76-44e1-a530-665abf34a062.json

ingress:
  - hostname: footlab.uk
    service: https://proxy:443
    originRequest:
      originServerName: footlab.uk
  - hostname: ssh.footlab.uk
    service: ssh://host.docker.internal:22
  - service: http_status:404

On Github:

name: Deploy

jobs:
  deploy:
    name: Deploy
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Set up CF
        run: |
          sudo mkdir -p --mode=0755 /usr/share/keyrings
          curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null
          echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared jammy main' | sudo tee /etc/apt/sources.list.d/cloudflared.list
          sudo apt-get update && sudo apt-get install cloudflared

      - name: Setup SSH
        run: |
          mkdir -p ~/.ssh
          echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
          chmod 600 ~/.ssh/id_ed25519

          echo "${{ secrets.SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
          chmod 644 ~/.ssh/known_hosts

          cat <<EOF > ~/.ssh/config
          Host ${{ secrets.SSH_HOST }}
            User ${{ secrets.SSH_USER }}
            IdentityFile ~/.ssh/id_ed25519
            ProxyCommand cloudflared access ssh --hostname %h
          EOF
          chmod 600 ~/.ssh/config
        shell: bash

      - name: Deploy via SSH
        run: |
          ssh -vvv -o StrictHostKeyChecking=yes ${{ secrets.SSH_HOST }} "echo 'HelloWorld!'"
        shell: bash

However, I’m seeing this error during the action execution:
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535
Error: Process completed with exit code 255.


Can you help?
Was this page helpful?