Access your homelab with SSH from the browser with Cloudflare

ยท

3 min read

๐ŸŒ Access your homelab with SSH from the browser with Cloudflare

Introduction ๐Ÿ“œ

This is a guide on how to access your homelab with SSH from the browser with Cloudflare. This is useful if you want to access your homelab from a computer where you can't install an SSH client, like a Chromebook or a computer where you don't have admin rights.

Guide from docs

Prerequisites ๐Ÿ“‹

  • Have a Cloudflare account ๐ŸŒฉ๏ธ
  • Having a server running with cloudflared installed you can follow this guide

Steps ๐Ÿ“

  1. Go to your Cloudflare dashboard and click on Zero Trust on the left menu
  2. Click on Access then Applications and then Add an application
  3. Select Self-hosted

Application Configuration ๐Ÿ› ๏ธ

  • Application name: you can put whatever you want, for example, SSH-Blog
  • Session duration: you can put also whatever you want, for example 24 hours (I'll suggest you put a short duration for security reasons)
  • Application domain: Put the domain you want to use, for example, ssh-blog.example.com

Application Configuration

Application Appearance ๐ŸŽจ

  • Up to you; you can put whatever you want

Tags ๐Ÿท๏ธ

  • Up to you; you can put whatever you want

Block Pages ๐Ÿšซ

  • I'll usually do something like this this

Identity Providers ๐Ÿ”‘

  • I'll suggest you use at least 1 for this kind of application; you can choose whatever fits you better. For my case, I'm using One-Time PIN and GitHub.

  • Click on Next

  • Policy name + Allow + Session duration
  • Assign a group (create one if you don't have any)

In my case, the group I'm using is a list of emails, so only people with those emails can access the application.

IMG

Create Additional Rules (Optional)

  • Only necessary if your groups don't contain any rule or you want to add more rules.

Additional Settings ๐Ÿ› ๏ธ

  • I'll leave this by default

  • Click on Next

Setup ๐Ÿ› ๏ธ

CORS Settings ๐Ÿ› ๏ธ

  • I'll leave this by default

Cookies Settings ๐Ÿช

  • I'll leave this by default

Additional Settings ๐Ÿ› ๏ธ

  • Here is one important thing: you need to select under Browser rendering the option SSH

SSH

  1. Now click on Add application

Configure Tunnel ๐Ÿš‡

  1. Go into Access then Tunnels and select your tunnel then Configure
  2. Select Public Hostname then Add a public hostname
  3. Use the same domain you used in the application configuration, for example, ssh-blog.example.com
  4. Service type: SSH
  5. URL: localhost:22

Conclusion ๐Ÿ“

Now you can access your homelab with SSH from the browser with Cloudflare. You can access it by going to ssh-blog.example.com and you'll see something like this:

Example

ย