cmdproxy

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2021 License: MIT Imports: 12 Imported by: 1

README

cmdproxy

Run any commands on remote hosts via HTTP(S).

Usage

  1. Install and run cmdprx on the remote host.
go get "github.com/ebiiim/cmdproxy/..."
go install "github.com/ebiiim/cmdproxy/cmd/cmdprx"

cmdprx -host="10.0.0.100:12345" -secret="abc"
  1. Install and run cmdprx-cli locally, then you can get results from the remote host.
go get "github.com/ebiiim/cmdproxy/..."
go install "github.com/ebiiim/cmdproxy/cmd/cmdprx-cli"

cmdprx-cli -url="http://10.0.0.100:12345" -secret="abc" -cmd="echo hello world"
Error: 
ExitCode: 0
Stdout: hello world

Stderr: 

Planned Features

Security
  • Out-of-the-box TLS support (Let's Encrypt) v0.1.0
  • Client certificate authentication
  • Source IP filter
  • Request header filter
  • Fixed source port
Feature
  • Stdin support (but no way to support streams, use gRPC?)
  • Encode errors (Base64 encoded gob?)
Usability
  • Log enhancement
  • Documentation

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClientEncode = errors.New("ErrClientEncode")
	ErrClientPOST   = errors.New("ErrClientPOST")
	ErrClientDecode = errors.New("ErrClientDecode")
)
View Source
var (
	ServerLogging = true
)

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(server, secret string) *Client

func (*Client) Run

func (c *Client) Run(cmd []string, timeout time.Duration) (*Result, error)

type Result

type Result struct {
	Error    string `json:"error"`
	ExitCode int    `json:"exitcode"`
	Stdout   []byte `json:"stdout"`
	Stderr   []byte `json:"stderr"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(secret string) *Server

func (*Server) Path

func (s *Server) Path() string

func (*Server) Run

func (s *Server) Run(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL