sshproxy

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2020 License: MPL-2.0, MPL-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrVerifyHost = errors.New("trasa: could not update cert")

Functions

func ConnectNewSSH

func ConnectNewSSH(params models.ConnectionParams, uc models.UserContext, conn *websocket.Conn)

ConnectNewSSH handles new ssh connection from dashboard.

func HandleHostKeyCallback

func HandleHostKeyCallback(creds *models.UpstreamCreds, serviceID, orgID string, confirmSkipVerify func(message string) bool) ssh.HostKeyCallback

func InitStore

func InitStore(state *global.State, checkPolicyFunc models.CheckPolicyFunc)

InitStore initialises package state

func JoinSSHSession

func JoinSSHSession(params models.ConnectionParams, uc models.UserContext, conn *websocket.Conn)

func ListenSSH

func ListenSSH(closeChan chan bool) error

Types

type Adapter

type Adapter interface {
	GetUserFromPublicKey(publicKey ssh.PublicKey, orgID string) (*models.User, error)

	SetSession(addr net.Addr, session *Session) error
	GetSession(addr net.Addr) (*Session, error)
	DeleteSession(addr net.Addr) error
	UpdateSessionMeta(addr net.Addr, connMeta ssh.ConnMetadata) error
	//	UpdateSessionParams(addr net.Addr, params *models.AccessMapDetail) error
	UpdateSessionUser(addr net.Addr, user *models.User) error
	SetAuthType(addr net.Addr, authType consts.SSH_AUTH_TYPE) error

	CreateGuestChannel(sessionID string) chan GuestClient
	GetGuestChannel(sessionID string) (chan GuestClient, error)
	// contains filtered or unexported methods
}
var SSHStore Adapter

type GuestClient

type GuestClient struct {
	UserID string
	Email  string
	Conn   *websocket.Conn
}

type Session

type Session struct {
	ID       string
	AuthType consts.SSH_AUTH_TYPE

	Conn *net.Conn
	// contains filtered or unexported fields
}

func NewSession

func NewSession(serverConn *net.Conn) *Session

func (*Session) UpdateConMeta

func (s *Session) UpdateConMeta(connMeta ssh.ConnMetadata)

func (*Session) UpdateService

func (s *Session) UpdateService(params *models.Service)

type Store

type Store struct {
	*global.State
	// contains filtered or unexported fields
}

func (Store) CreateGuestChannel

func (s Store) CreateGuestChannel(sessionID string) chan GuestClient

func (Store) DeleteSession

func (s Store) DeleteSession(addr net.Addr) error

func (Store) GetGuestChannel

func (s Store) GetGuestChannel(sessionID string) (chan GuestClient, error)

func (Store) GetSession

func (s Store) GetSession(addr net.Addr) (*Session, error)

func (Store) GetUserFromPublicKey

func (s Store) GetUserFromPublicKey(publicKey ssh.PublicKey, orgID string) (*models.User, error)

func (Store) SetAuthType

func (s Store) SetAuthType(addr net.Addr, authType consts.SSH_AUTH_TYPE) error

func (Store) SetSession

func (s Store) SetSession(addr net.Addr, session *Session) error

func (Store) UpdateSessionMeta

func (s Store) UpdateSessionMeta(addr net.Addr, connMeta ssh.ConnMetadata) error

func (Store) UpdateSessionUser

func (s Store) UpdateSessionUser(addr net.Addr, user *models.User) error

type WrappedTunnel

type WrappedTunnel struct {
	io.WriteCloser
	io.Reader
	// contains filtered or unexported fields
}

WrappedTunnel wraps upstream(backend) ssh connection and writes data to session file,guests It also writes data coming from guests to upstream(backend) ssh connection

func NewWrappedTunnel

func NewWrappedTunnel(sessionID string, sessionRecord bool, backendReader io.Reader, backendWriter io.WriteCloser, guestChan chan GuestClient) (*WrappedTunnel, error)

func (*WrappedTunnel) Close

func (lr *WrappedTunnel) Close() error

func (*WrappedTunnel) ListenToNewGuests

func (lr *WrappedTunnel) ListenToNewGuests(guestChan chan GuestClient)

func (*WrappedTunnel) Read

func (lr *WrappedTunnel) Read(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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