This guide helps you troubleshoot SSH connection issues when using Cloudflare Access with the auto-deploy GitHub Action.
This error typically indicates a Cloudflare Access configuration problem.
-
Check CLOUDFLARE_HOSTNAME Secret
# The hostname should match exactly what's configured in Cloudflare Access # Example: ubuntu.aswincloud.com
-
Verify Cloudflare Access SSH is Enabled
- Go to Cloudflare Zero Trust Dashboard
- Navigate to Access → Applications
- Find your SSH application
- Ensure SSH is enabled and configured
-
Check Application Configuration
- Verify the application type is "SSH"
- Ensure the correct hostname is configured
- Check that the application is active
Test the connection from your local machine:
# Test if you can connect manually
ssh -o ProxyCommand="cloudflared access ssh --hostname ubuntu.aswincloud.com" aswin@ubuntu.aswincloud.comIf this fails, the issue is with your Cloudflare Access setup.
Check that all secrets are correctly set:
| Secret | What to Check |
|---|---|
CLOUDFLARE_HOSTNAME |
Must match exactly: ubuntu.aswincloud.com |
SSH_HOST |
Should be: ubuntu.aswincloud.com |
SSH_USER |
Should be: aswin |
SSH_PRIVATE_KEY |
Complete private key content (including BEGIN/END lines) |
Important: The SSH_PRIVATE_KEY should include the complete key content:
-----BEGIN OPENSSH PRIVATE KEY-----
[private key content]
-----END OPENSSH PRIVATE KEY-----
Verify SSH key authentication is properly configured:
# On your VM, check authorized_keys
cat ~/.ssh/authorized_keys
# Check SSH key permissions
ls -la ~/.ssh/
# Should show: -rw------- for authorized_keys
# Test SSH key authentication locally
ssh -i ~/.ssh/github_actions_key aswin@YOUR_VM_IPEnsure SSH is running on your VM:
# On your VM
sudo systemctl status ssh
sudo systemctl status sshd
# If not running, start it:
sudo systemctl start ssh
sudo systemctl enable sshIf you can access your VM directly (without Cloudflare Access):
# Test direct SSH connection
ssh aswin@YOUR_VM_IPIf SSH key authentication fails, you can fall back to password authentication:
-
Update GitHub Secrets
- Add
SSH_PASSWORDsecret with your VM password - Remove
SSH_PRIVATE_KEYsecret
- Add
-
Update Workflow
env: SSH_PASSWORD: ${{ secrets.SSH_PASSWORD }}
-
Modify SSH Config
# Remove IdentityFile line from SSH config # Add PasswordAuthentication yes
If SSH over Cloudflare Access isn't working, consider:
-
HTTP/HTTPS Tunnel
- Use Cloudflare Tunnel for HTTP access
- Create a deployment API endpoint
-
Direct Connection
- Use a VPN or direct network access
- Configure firewall rules appropriately
# Test cloudflared installation
cloudflared --version
# Test access configuration
cloudflared access ssh --hostname ubuntu.aswincloud.com --dry-run
# Test with verbose output
cloudflared access ssh --hostname ubuntu.aswincloud.com --loglevel debug# Test SSH config
ssh -T vm-deploy
# Test with verbose output
ssh -vvv vm-deploy "echo test"
# Test specific hostname
ssh -o ProxyCommand="cloudflared access ssh --hostname ubuntu.aswincloud.com" aswin@ubuntu.aswincloud.com- Cloudflare Access SSH application is configured
- CLOUDFLARE_HOSTNAME secret matches exactly
- SSH_USER and SSH_PASSWORD secrets are correct
- VM SSH service is running
- Cloudflare Access is accessible from GitHub Actions runners
- No firewall blocking the connection
If you're still experiencing problems:
-
Check Cloudflare Access Logs
- Look for connection attempts in Cloudflare Zero Trust logs
- Check for authentication failures
-
Verify Network Configuration
- Ensure your VM is accessible via Cloudflare Access
- Check if there are any network restrictions
-
Test with Different Credentials
- Try creating a new Cloudflare Access application
- Test with a different SSH user
-
Contact Support
- If using Cloudflare Teams, contact Cloudflare support
- Check Cloudflare Access documentation for updates