Documentation ¶
Overview ¶
Package cmd implements dispatching commands on the SSH gateway using SSH's "exec" requests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command func(ctx context.Context, conn *ssh.Permissions, env map[string]string, rw io.ReadWriter) error
Command is the function signature of a command. It has access to the permissions of the connected user, the environment set by the connected user, and it can read/write to the channel.
func ListUpstreams ¶
ListUpstreams lists the upstreams that the connected user is allowed to connect to.
func UpstreamConfig ¶
UpstreamConfig generates an SSH config template.
Make sure that you have a directory ~/.ssh/config.d and that you have a line
Include config.d/*
in your ~/.ssh/config. Then you can update the SSH config as follows:
ssh -p 2222 gateway@localhost config | sed -e 's/$SSH_HOST/localhost/g' -e 's/$SSH_PORT/2222/g' > ~/.ssh/config.d/ssh_gateway
If the SSH gateway has the SSH_HOST and SSH_PORT preconfigured, you can update the SSH config as follows:
ssh -p 2222 gateway@localhost config > ~/.ssh/config.d/ssh_gateway
You should obviously replace the host "localhost" and port "2222" if that is different in your deployment.
type Dispatcher ¶
Dispatcher is a collection of named commands.
func (Dispatcher) Dispatch ¶
func (r Dispatcher) Dispatch(ctx context.Context, sshConn *ssh.ServerConn, sshChannels <-chan ssh.NewChannel, sshRequests <-chan *ssh.Request) error
Dispatch dispatches commands.