# Access your homelab with SSH from the browser with Cloudflare

# 🌐 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](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/use-cases/ssh/#connect-to-ssh-server-with-cloudflared-access)

## Prerequisites 📋

- Have a Cloudflare account 🌩️
- Having a server running with `cloudflared` installed you can follow [this guide](https://blog.jonathan.com.ar/build-your-own-homelab-with-a-raspberry-pi-zero-2-w-and-cloudflare-zero-trust)

## 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](https://cdn.discordapp.com/attachments/875262629516546089/1190118801614839868/a1.png?ex=65a0a381&is=658e2e81&hm=ab387d69393286f33bc1e032f00772a977be3f2ba4de3fc0d7f651d47cac41e2&)

### 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](https://cdn.discordapp.com/attachments/875262629516546089/1190119200191172720/image.png?ex=65a0a3e0&is=658e2ee0&hm=677694ff045d14454102e22b8aac32ac526e30735ef9f3abbf871f0e66fc3183&)

### 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.

4. Click on `Next`
5. Policy name + Allow + Session duration
6. 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](https://cdn.discordapp.com/attachments/875262629516546089/1190119977878032464/image.png?ex=65a0a49a&is=658e2f9a&hm=b59195ba06c25df90e7df561234109d2e6a551f0936948f8c5365ea3b1200de2&)

### 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

7. 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](https://cdn.discordapp.com/attachments/875262629516546089/1190121048092454912/image.png?ex=65a0a599&is=658e3099&hm=79fb71f7411a08510526e309a82aa59339d17ba698e9e0eba926067a288a6643&)

8. 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](https://cdn.discordapp.com/attachments/875262629516546089/1190123252400521236/image.png?ex=65a0a7a6&is=658e32a6&hm=82fd8a7c233a908199179b886a21c01c0eb2a8a37e6944c4f338fff8f3d0dba7&)

