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

Related tags

DevOps Tools opener
Overview

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

Issues
  • Support tcp instead Unix socket

    Support tcp instead Unix socket

    Thanks for making this awesome tool! I was trying to get this work by having a Docker container open a webpage on the host machine. Because I’m on macOS docker is unable to share a Unix socket (https://github.com/docker/for-mac/issues/483#issuecomment-620229892), but can communicate through regular TCP.

    Therefore I’m wondering if it’s possible to add support for running the opener daemon on a TCP port?

    opened by mvgijssel 5
  • brew services start opener errors out

    brew services start opener errors out

    Running on Ubuntu 20.0.4

    ❯ brew install superbrothers/opener/opener
    ==> Tapping superbrothers/opener
    Cloning into '/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/superbrothers/homebrew-opener'...
    remote: Enumerating objects: 19, done.
    remote: Counting objects: 100% (19/19), done.
    remote: Compressing objects: 100% (13/13), done.
    Receiving objects: 100% (19/19), 7.50 KiB | 7.50 MiB/s, done.
    Resolving deltas: 100% (6/6), done.
    remote: Total 19 (delta 6), reused 16 (delta 4), pack-reused 0
    Tapped 1 formula (14 files, 72.9KB).
    ==> Downloading https://github.com/superbrothers/opener/releases/download/v0.1.0/opener-darwin-amd64.zip
    ==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/343804754/c76a3fcc-e4af-47f5-b2cf-cd410087704c?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220621%2Fus-east-
    ######################################################################## 100.0%
    ==> Installing opener from superbrothers/opener
    ==> Caveats
    Warning: opener provides a launchd plist which can only be used on macOS!
    You can manually execute the service instead with:
      opener
    ==> Summary
    🍺  /home/linuxbrew/.linuxbrew/Cellar/opener/0.1.0: 6 files, 4.1MB, built in 1 second
    ==> Running `brew cleanup opener`...
    Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
    Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
    ❯ brew services start opener
    ==> Tapping homebrew/services
    Cloning into '/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-services'...
    remote: Enumerating objects: 2025, done.
    remote: Counting objects: 100% (534/534), done.
    remote: Compressing objects: 100% (191/191), done.
    remote: Total 2025 (delta 362), reused 456 (delta 334), pack-reused 1491
    Receiving objects: 100% (2025/2025), 554.78 KiB | 18.49 MiB/s, done.
    Resolving deltas: 100% (917/917), done.
    Tapped 1 command (45 files, 815.4KB).
    Error: Formula `opener` has not implemented #plist, #service or installed a locatable service file
    ❯ brew services start opener
    Error: Formula `opener` has not implemented #plist, #service or installed a locatable service file
    
    
    enhancement 
    opened by ElanHasson 3
  • Add tap to instructions

    Add tap to instructions

    Just came across this looking for something to do just that! Thanks! The instructions specify installing from a homebrew formula, but no such formula exists in the core taps (obviously). Could you include which tap to use in the install instructions so users can add it first before trying to install the formula?

    Thanks again for the hard work!

    opened by timfallmk 1
  • Update dependency golangci/golangci-lint to v1.46.2

    Update dependency golangci/golangci-lint to v1.46.2

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | golangci/golangci-lint | stage | minor | v1.45.2 -> v1.46.2 |


    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by Mend Renovate. View repository job log here.

    renovate 
    opened by renovate[bot] 0
  • Send-back stdout/stderr from `open`

    Send-back stdout/stderr from `open`

    open on the remote machine is now able to write to stdout and stderr as the original open on the local/server machine does:

    mylinux$ open google.com
    The file /Users/example/google.com does not exist.
    Perhaps you meant 'http://google.com'?
    

    Implementation-wise, this works by relying on some kind of OS-specific bi-directional connection like e.g. SOCK_STREAM over a Unix domain socket.

    Apparently socat for example negotiates and uses SOCK_STREAM when the server supports it so it should work (worked for me) without any change on the open script implemented using socat.

    Resolves #1

    opened by mumoshu 0
  • `open` on the remote machine not printing any logs on error

    `open` on the remote machine not printing any logs on error

    The original open on macOS for example produces a useful error message on an invalid argument:

    mymac$ open google.com
    The file /Users/example/google.com does not exist.
    Perhaps you meant 'http://google.com'?
    

    but it doesn't on open on the remote machine backed by opener:

    mylinux$ open google.com
    # Nothing happens/prints
    

    This is due to that we don't write-back stdout and stderr from the open run on macOS to the remote.

    Could this be something you'd like to support? (Personally I think so but I'd like your opinion as the maintainer :)

    opened by mumoshu 0
  • Dependency Dashboard

    Dependency Dashboard

    This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

    This repository currently has no open or pending branches.

    Detected dependencies

    dockerfile
    Dockerfile
    • golang 1.18
    • golangci/golangci-lint v1.46.2
    • undefined no version found
    regex
    Makefile
    • goreleaser/goreleaser v1.9.2

    • [ ] Check this box to trigger a request for Renovate to run again on this repository
    opened by renovate[bot] 0
Releases(v0.1.1)
Owner
Kazuki Suda
CNCF Ambassador / Kubernetes Active Contributor / Kubernetes Meetup Tokyo and Kubernetes Community Days Tokyo co-organizer
Kazuki Suda
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

yeqown 3 May 16, 2022
Putty-url-scheme - Open PuTTY as a url scheme

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

Dark495 4 Apr 25, 2022
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

M-A 23 Nov 26, 2021
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).

Bjerk AS 6 Sep 10, 2021
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

Niels Hofmans 8 Jan 7, 2022
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

YAMASAKI Masahide 18 Jun 3, 2022
⚡️ 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

Vincent Composieux 1.3k Jun 28, 2022
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

HwameiStor 163 Jun 22, 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

We Open Source Performance 9 Jun 16, 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

Blake Williams 21 Jun 28, 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:/

francesco palazzini 0 Jan 10, 2022
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

Gabor Seljan 50 Jun 16, 2022
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

null 1.4k Jun 26, 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.

Jobin Jose 1 Oct 16, 2021
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

Wendell Sun 266 Jun 20, 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.

kenju 5 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

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

null 0 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 go-opa-validate is an open-source lib that evaluates OPA (open policy agent) policy against JSON or YAML data. Installation Usage Cont

chenk 5 Feb 5, 2022
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

Omri Eival 511 Jun 21, 2022