Golang `net/rpc` over SSH using installed SSH program

Overview

Golang net/rpc over SSH using installed SSH program

This package implements a helper functions to launch an RPC client and server. It uses the installed SSH program instead of native Go implementation from golang.org/x/crypto/ssh. This has an advantage of being able to use SSH configuration. (for example ${HOME}/.ssh/config)

How it works

Initiator launches the SSH command to connect to a remote server and launch a matching binary. Matching binary reads from STDIN and writes to STDOUT. The SSH program will transparently pipe STDOUT and STDIN between hosts.

STDERR from receiver will be shared with STDERR from client.

Initiator

Initiator (also known as client) should call sshrpc.NewSshRpcClient to open a new RPC client.

sshrpc.NewSshRpcClient takes 2 arguments:

  • destination string this is a host name that SSH will connect to. Example: "[email protected]"
  • arguments ...string variable number of arguments that are required to launch the matching program. These arguments will be interpreted by the login shell on the remote host.

Returns has 2 returns:

  • *rpc.Client see net/rpc documentation. The client is already initialized and you can use Call and Go methods.
  • error if some error happened.

Receiver

Receiver (also known as server) should setup a *rpc.Server from net/rpc and call sshrpc.StartReceiving method.

sshrpc.StartReceiving takes one argument which is the *rpc.Server. It will block indefinitely.

Receiver must NOT use stdin/stdout or the data stream will corrupt. Use STDERR if you want logging.

Examples

See examples folder for simple initiator and receiver implementation.

TODO

  • Better documentation
  • Better README
  • Add environment variable that controls SSH command line (like GIT_SSH_COMMAND)
You might also like...
Nuke-Net is a VERY VERY over powered and ridiculous web crawler that is well- very very noisy XD read more here
Nuke-Net is a VERY VERY over powered and ridiculous web crawler that is well- very very noisy XD read more here

Nuke-Net is a VERY VERY over powered and ridiculous web crawler that is well- very very noisy XD read more here

RPC over libp2p pubsub with error handling

go-libp2p-pubsub-rpc RPC over libp2p pubsub with error handling Table of Contents Background Install Usage Contributing Changelog License Background g

Control your Flipper Zero over Protobuf RPC protocol.

go-flipper Control your Flipper Zero over Protobuf RPC protocol. This library is designed to be transport agnostic, though I've tested it with RPC ove

Serve traffic (HTTP/gRPC) over SSH using Domain Sockets

Serve On SSH Introduction There is often a need to offer services for administrative purposes on servers or even for microservices that are running on

Aidos Kuneen (v2 network) daemon program that is controlled through the command line and remotely via RPC calls

adk-daemon: aidosd.v2 aidosd (v2) is a deamon which acts as bitcoind for adk. This version has been built specifically for network mesh version 2+ For

Clidle - Wordle over SSH with golang
Clidle - Wordle over SSH with golang

clidle Wordle, now over SSH. Try it: ssh clidle.ddns.net -p 3000 Or, run it loca

Chisel is a fast TCP/UDP tunnel, transported over HTTP, secured via SSH.
Chisel is a fast TCP/UDP tunnel, transported over HTTP, secured via SSH.

Chisel is a fast TCP/UDP tunnel, transported over HTTP, secured via SSH. Single executable including both client and server. Written in Go (golang). Chisel is mainly useful for passing through firewalls, though it can also be used to provide a secure endpoint into your network.

Go Library to Execute Commands Over SSH at Scale
Go Library to Execute Commands Over SSH at Scale

vSSH Go library to handle tens of thousands SSH connections and execute the command(s) with higher-level API for building network device / server auto

Chat over SSH.

ssh-chat Custom SSH server written in Go. Instead of a shell, you get a chat prompt. Demo Join the party: $ ssh ssh.chat Please abide by our project'

Owner
null
🤘 The native golang ssh client to execute your commands over ssh connection. 🚀🚀

Golang SSH Client. Fast and easy golang ssh client module. Goph is a lightweight Go SSH client focusing on simplicity! Installation ❘ Features ❘ Usage

Mohamed El Bahja 1.2k Dec 24, 2022
EDR-Recon scans Windows services, drivers, processes, registry for installed EDRs.

EDR-Recon EDR-Recon scans Windows services, drivers, processes, registry for installed EDRs. Install Binary Download the latest release from the relea

FourCore Labs 433 Dec 29, 2022
Run this bot on machine where your qbittorrent has been installed

Telegram bot for qbittorrent Run this bot on machine where your qbittorrent has been installed. Qbittorrent settings Activate Web Interface or use hea

Anton 0 Jan 13, 2022
Extended ssh-agent which supports git commit signing over ssh

ssh-agentx ssh-agentx Rationale Requirements Configuration ssh-agentx Configuration ssh-gpg-signer Linux Windows Signing commits after configuration T

Wim 10 Jun 29, 2022
one simple git ssh server (just for learning git over ssh )

wriet one simple git ssh server use golang write one simple git ssh server how to running starting service docker-compose up -d add authorized_keys i

rong fengliang 2 Mar 5, 2022
Go package to simulate bandwidth, latency and packet loss for net.PacketConn and net.Conn interfaces

lossy Go package to simulate bandwidth, latency and packet loss for net.PacketConn and net.Conn interfaces. Its main usage is to test robustness of ap

Cevat Barış Yılmaz 313 Oct 14, 2022
Antenna RPC is an RPC protocol for distributed computing, it's based on QUIC and Colfer. its currently an WIP.

aRPC - Antenna Remote Procedure Call Antenna remote procedure call (aRPC) is an RPC protocol focused on distributed processing and HPC. aRPC is implem

Raphael de Carvalho Almeida 3 Jun 16, 2021
rpc/v2 support for JSON-RPC 2.0 Specification.

rpc rpc/v2 support for JSON-RPC 2.0 Specification. gorilla/rpc is a foundation for RPC over HTTP services, providing access to the exported methods of

High Performance, Kubernetes Native Object Storage 3 Jul 4, 2021
Go Substrate RPC Client (GSRPC)Go Substrate RPC Client (GSRPC)

Go Substrate RPC Client (GSRPC) Substrate RPC client in Go. It provides APIs and types around Polkadot and any Substrate-based chain RPC calls. This c

Chino Chang 1 Nov 11, 2021