Open URL in your local web browser from the SSH-connected remote environment.

opener

Logo

Open URL in your local web browser from the SSH-connected remote environment.

How does opener work?

opener is a daemon process that runs locally. When you send a URL to the process, it will execute a command tailored to your local environment (open on macOS, xdg-open on Linux) with the URL as an argument. As a result, the URL will be opened in your favorite web browser.

You remotely forward the socket file of the opener daemon, ~/.opener.sock, when you log in to the remote environment via SSH. In a remote environment, you use fake open command or xdg-open command to send the URL to ~/.opener.sock being forwarded from your local environment. The result is as if URL was sent to the local opener daemon, which opens the URL in your local web browser.

┌────────────────────┐                 ┌────────────────────┐
│                    │                 │                    │
│ ┌────────────────┐ │                 │ ┌────────────────┐ │
│ │   Web Browser  │ │                 │ │  open command  │ │
│ └─▲──────────────┘ │                 │ │     (fake)     │ │
│   │ Open URL       │                 │ └─┬──────────────┘ │
│ ┌─┴──────────────┐ │                 │   │                │
│ │  opener daemon │ │                 │   │ Send URL       │
│ └─┬──────────────┘ │                 │   │                │
│   │                │                 │   │                │
│ ┌─┴──────────────┐ │ SSH connection  │ ┌─▼──────────────┐ │
│ │ ~/.opener.sock │ ├─────────────────► │ ~/.opener.sock │ │
│ └────────────────┘ │ Remote forward  │ └────────────────┘ │
│                    │                 │                    │
└────────────────────┘                 └────────────────────┘
       localhost                            remote server

Setup

Local environment

You can install opener with Homebrew. Since opener is a daemon, it is managed by Homebrew-services.

$ brew install superbrothers/opener
$ brew services start opener

Set ssh config to forward ~/.opener.sock to the remote environment.

Host host.example.org
  RemoteForward /home/me/.opener.sock /Users/me/.opener.sock

Remote environment

Install a fake open or xdg-open command. Please choose your preference either way.

$ mkdir ~/bin
# open command
$ curl -L -o ~/bin/open https://raw.githubusercontent.com/superbrothers/opener/master/bin/open
$ chmod 755 ~/bin/open
# xdg-open command
$ curl -L -o ~/bin/xdg-open https://raw.githubusercontent.com/superbrothers/opener/master/bin/xdg-open
$ chmod 755 ~/bin/xdg-open
# Add ~/bin to $PATH and enable it
$ echo 'export PATH="$HOME/bin:$PATH"' >>~/.bashrc
$ source ~/.bashrc

Fake commands use socat command, so install it.

# Ubuntu 20.04
$ sudo apt install socat

Add the following settings to sshd. This is an option to delete the socket file when you lose the connection to the remote environment.

# Add a configuration file
$ echo "StreamLocalBindUnlink yes" | sudo tee /etc/ssh/sshd_config.d/opener.conf
# Restart ssh service
$ sudo systemctl restart ssh

How to use it

If set up correctly, the following command in a remote environment will send the URL through opener and open the URL in your local web browser.

$ open https://www.google.com/

License

MIT License

Owner
Kazuki Suda
CNCF Ambassador / Kubernetes Active Contributor / Kubernetes Meetup Tokyo and Kubernetes Community Days Tokyo co-organizer
Kazuki Suda
Comments
Related tags
Help developer to sync between local file and remote apollo portal web since portal web is so messy to use

apollo-synchronizer Help developer to sync between local file and remote apollo portal web since portal web is so messy to use Features download names

Oct 27, 2022
Putty-url-scheme - Open PuTTY as a url scheme

PuTTY URL Scheme Helper Open PuTTY as a url scheme Install download release bina

Apr 25, 2022
Stackie enables developers to configure their local environment/toolchain with ease.

Stackie enables developers to configure their local environment/toolchain with ease. Made for Pulumi CLI, Google Cloud Platform (gcloud), and Amazon Web Services (aws-cli).

Sep 10, 2021
Serves images taken on a FLIR Lepton connected to a Raspberry Pi SPI port to over HTTP.

go-lepton Streams images taken on a FLIR Lepton connected to a Raspberry Pi SPI port to over via WebSockets via embedded HTTP server. It sends the raw

Oct 29, 2022
This is a SSH CA that allows you to retrieve a signed SSH certificate by authenticating to Duo.

github-duo-ssh-ca Authenticate to GitHub Enterprise in a secure way by requiring users to go through a Duo flow to get a short-lived SSH certificate t

Jan 7, 2022
Integrated ssh-agent for windows. (pageant compatible. openSSH ssh-agent etc ..)
Integrated ssh-agent for windows. (pageant compatible. openSSH ssh-agent etc ..)

OmniSSHAgent About The chaotic windows ssh-agent has been integrated into one program. Chaos Map of SSH-Agent on Windows There are several different c

Dec 19, 2022
⚡️ A dev tool for microservice developers to run local applications and/or forward others from/to Kubernetes SSH or TCP
⚡️ A dev tool for microservice developers to run local applications and/or forward others from/to Kubernetes SSH or TCP

Your new microservice development environment friend. This CLI tool allows you to define a configuration to work with both local applications (Go, Nod

Jan 4, 2023
Local Storage is one of HwameiStor components. It will provision the local LVM volume.
Local Storage is one of HwameiStor components. It will provision the local LVM volume.

Local Storage Module English | Simplified_Chinese Introduction Local Storage is one of modules of HwameiStor which is a cloud native local storage sys

Aug 6, 2022
K6 extension that adds support for browser automation and end-to-end web testing using playwright-go
K6 extension that adds support for browser automation and end-to-end web testing using playwright-go

k6 extension that adds support for browser automation and end-to-end web testing using playwright-go

Dec 21, 2022
An experimental Go application that allows an SSH session to interact with the clipboard of the host machine and forward calls to open

Remote Development Manager An experimental Go application that allows an SSH session to interact with the clipboard of the host machine and forward ca

Dec 27, 2022
Web user interface and service agent for the monitoring and remote management of WinAFL.
Web user interface and service agent for the monitoring and remote management of WinAFL.

WinAFL Pet WinAFL Pet is a web user interface dedicated to WinAFL remote management via an agent running as a system service on fuzzing machines. The

Nov 9, 2022
simple web app that print its environment variable, useful for testing on k8s

Index Sample web app that pints environment variables. Start it: docker-compose up Use it: > curl localhost:8080 PATH=/usr/local/sbin:/usr/local/bin:/

Jan 10, 2022
A Go based deployment tool that allows the users to deploy the web application on the server using SSH information and pem file.

A Go based deployment tool that allows the users to deploy the web application on the server using SSH information and pem file. This application is intend for non tecnhincal users they can just open the GUI and given the server details just deploy.

Oct 16, 2021
Testcontainers is a Golang library that providing a friendly API to run Docker container. It is designed to create runtime environment to use during your automatic tests.

When I was working on a Zipkin PR I discovered a nice Java library called Testcontainers. It provides an easy and clean API over the go docker sdk to

Jan 7, 2023
Manage your ssh alias configs easily.
Manage your ssh alias configs easily.

manssh manssh is a command line tool for managing your ssh alias config easily, inspired by storm project, powered by Go. Note: This project is actual

Nov 9, 2022
go-awssh is a developer tool to make your SSH to AWS EC2 instances easy.

Describing Instances/VPCs data, select one or multiple instances, and make connection(s) to selected instances. Caching the response of API calls for 1day using Tmpfs.

Oct 11, 2021
An open-source, distributed, cloud-native CD (Continuous Delivery) product designed for developersAn open-source, distributed, cloud-native CD (Continuous Delivery) product designed for developers
An open-source, distributed, cloud-native CD (Continuous Delivery) product designed for developersAn open-source, distributed, cloud-native CD (Continuous Delivery) product designed for developers

Developer-oriented Continuous Delivery Product ⁣ English | 简体中文 Table of Contents Zadig Table of Contents What is Zadig Quick start How to use? How to

Oct 19, 2021
go-opa-validate is an open-source lib that evaluates OPA (open policy agent) policy against JSON or YAML data.
go-opa-validate is an open-source lib that evaluates OPA (open policy agent) policy against JSON or YAML data.

go-opa-validate go-opa-validate is an open-source lib that evaluates OPA (open policy agent) policy against JSON or YAML data. Installation Usage Cont

Nov 17, 2022
A cli that exposes your local resources to kubernetes
A cli that exposes your local resources to kubernetes

ktunnel Expose your local resources to kubernetes ?? Table of Contents About Getting Started Usage Documentation Contributing Authors Acknowledgments

Jan 7, 2023