reversetunnel

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2016 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package reversetunnel sets up persistent reverse tunnel between remote site and teleport proxy, when site agents dial to teleport proxy's socket and teleport proxy can connect to any server through this tunnel.

Index

Constants

View Source
const (
	// RemoteSiteStatusOffline indicates that site is considered as
	// offline, since it has missed a series of heartbeats
	RemoteSiteStatusOffline = "offline"
	// RemoteSiteStatusOnline indicates that site is sending heartbeats
	// at expected interval
	RemoteSiteStatusOnline = "online"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

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

Agent is a reverse tunnel agent running as a part of teleport Proxies to establish outbound reverse tunnels to remote proxies

func NewAgent

func NewAgent(
	addr utils.NetAddr,
	remoteDomainName string,
	clientName string,
	signers []ssh.Signer,
	clt *auth.TunClient) (*Agent, error)

NewAgent returns a new reverse tunnel agent Parameters:

	  addr points to the remote reverse tunnel server
   remoteDomainName is the domain name of the runnel server, used only for logging
   clientName is hostid.domain (where 'domain' is local domain name)

func (*Agent) Close added in v1.0.0

func (a *Agent) Close() error

Close signals to close all connections

func (*Agent) Start

func (a *Agent) Start() error

Start starts agent that attempts to connect to remote server part

func (*Agent) String

func (a *Agent) String() string

String returns debug-friendly

func (*Agent) Wait

func (a *Agent) Wait() error

Wait waits until all outstanding operations are completed

type AgentOption

type AgentOption func(a *Agent) error

AgentOption specifies parameter that could be passed to Agents

type AgentPool added in v1.0.0

type AgentPool struct {
	sync.Mutex
	*log.Entry
	// contains filtered or unexported fields
}

AgentPool manages the pool of outbound reverse tunnel agents. The agent pool watches the reverse tunnel entries created by the admin and connects/disconnects to added/deleted tunnels.

func NewAgentPool added in v1.0.0

func NewAgentPool(cfg AgentPoolConfig) (*AgentPool, error)

NewAgentPool returns new isntance of the agent pool

func (*AgentPool) FetchAndSyncAgents added in v1.0.0

func (m *AgentPool) FetchAndSyncAgents() error

FetchAndSyncAgents executes one time fetch and sync request (used in tests instead of polling)

func (*AgentPool) Start added in v1.0.0

func (m *AgentPool) Start() error

Start starts the agent pool

func (*AgentPool) Stop added in v1.0.0

func (m *AgentPool) Stop()

Stop stops the agent pool

func (*AgentPool) Wait added in v1.0.0

func (m *AgentPool) Wait() error

Wait returns when agent pool is closed

type AgentPoolConfig added in v1.0.0

type AgentPoolConfig struct {
	// Client is client to the auth server this agent connects to recieve
	// a list of pools
	Client *auth.TunClient
	// HostSigners is a list of host signers this agent presents itself as
	HostSigners []ssh.Signer
	// HostUUID is a unique ID of this host
	HostUUID string
}

AgentPoolConfig holds configuration parameters for the agent pool

type RemoteSite

type RemoteSite interface {
	// ConnectToServer allows to SSH into remote teleport server
	ConnectToServer(addr, user string, auth []ssh.AuthMethod) (*ssh.Client, error)
	// DialServer dials teleport server and returns connection
	DialServer(addr string) (net.Conn, error)
	// Dial dials any address withing reach of remote site's servers
	Dial(network, addr string) (net.Conn, error)
	// GetLastConnected returns last time the remote site was seen connected
	GetLastConnected() time.Time
	// GetName returns site name (identified by authority domain's name)
	GetName() string
	// GetStatus returns status of this site (either offline or connected)
	GetStatus() string
	// GetClient returns client connected to remote auth server
	GetClient() (auth.ClientI, error)
}

RemoteSite represents remote teleport site that can be accessed via teleport tunnel or directly by proxy

type Server

type Server interface {
	// GetSites returns a list of connected remote sites
	GetSites() []RemoteSite
	// GetSite returns remote site this node belongs to
	GetSite(name string) (RemoteSite, error)
	// Start starts server
	Start() error
	// CLose closes server's socket
	Close() error
	// Wait waits for server to close all outstanding operations
	Wait()
}

Server represents server connected to one or many remote sites

func NewServer

func NewServer(addr utils.NetAddr, hostSigners []ssh.Signer,
	clt auth.ClientI, opts ...ServerOption) (Server, error)

NewServer returns an unstarted server

type ServerOption added in v1.0.0

type ServerOption func(s *server)

ServerOption sets reverse tunnel server options

func DirectSite added in v1.0.0

func DirectSite(domainName string, clt auth.ClientI) ServerOption

DirectSite instructs server to proxy access to this site not using reverse tunnel

func ServerTimeout added in v1.0.0

func ServerTimeout(duration time.Duration) ServerOption

ServerTimeout sets server timeout for read and write operations

func SetLimiter added in v1.0.0

func SetLimiter(limiter *limiter.Limiter) ServerOption

Jump to

Keyboard shortcuts

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