Setting up Cloudflared with PuTTY

Hi there,

I am a new Cloudflare user and to finalise my setup I have decided to place my ssh connection through an Argo Tunnel.
This is all set up and working, and I have installed cloudflared on my macbook already and it works perfectly.

For my primary windows PC though I am having an issue getting PuTTY to work nicely with cloudflared.
I can run ‘cloudflared.exe access ssh --hostname my.hostname.com --url localhost:4380’ in command prompt and then connect to my server through PuTTY, however I am wanting to find a way to not have to run the command prompt every time.

Is it possible to set up a config.yml for cloudflared so I can have it start as a service to run this for me on boot? Or is it alternatively possible to add a setting into PuTTY to have this run automatically on launch?

Apologies if this is a simple question; I primarily worked off my mac and direct terminal access, but my current workstation at home is a PC so am adjusting to that where possible.

Cheers,
Tim

I’m not sure how Windows handles ssh config files, but generally, there should be a .ssh directory that has your key(s), and a ‘config’ file. This is what one of my config entries looks like:

Host main
Hostname main.example.com
User main
ProxyCommand /usr/local/bin/cloudflared access ssh --hostname %h
ServerAliveInterval 240

So now when I’m on command line and type ssh main, it uses cloudflared to connect me through the tunnel at main.example.com

Unfortunately, the main issue with windows is it doesn’t handle ssh connections natively through it’s command line; you have to use programs like PuTTY to do it so there isn’t a .ssh folder like on a *nix system.

I am starting to look at what other SSH clients are available for Windows that could allow me to do this a different way.

1 Like

For anyone else looking at this I ended up creating a basic task in Task Scheduler to run the below .vps script. This is setup to run on login, and the script causes the cmd window to immediately hide itself so it just sits in the background.

Set WshShell = CreateObject("WScript.Shell") 
WshShell.Run chr(34) & "C:\Cloudflared\bin\cloudflared.bat" & Chr(34), 0
Set WshShell = Nothing

The .bat script it calls is simply running the access ssh command for cloudflared:

C:\Cloudflared\bin\cloudflared.exe access ssh --hostname host.domain.com --url localhost:[port]

Hope this may help someone else!