© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developers•13mo ago•
1 reply
alfo96

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
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
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.
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535
Error: Process completed with exit code 255.


Can you help?
Cloudflare Developers banner
Cloudflare DevelopersJoin
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

WARP fails lookup on Github Actions
Cloudflare DevelopersCDCloudflare Developers / general-help
2y ago
SSH from github action
Cloudflare DevelopersCDCloudflare Developers / general-help
3y ago
Browser rendered ssh connection issue
Cloudflare DevelopersCDCloudflare Developers / general-help
17mo ago
Cloudflare with Github actions
Cloudflare DevelopersCDCloudflare Developers / general-help
2w ago