sshutils

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Copyright 2015 Gravitational, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2015 Gravitational, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2015 Gravitational, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2015 Gravitational, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2015 Gravitational, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2015 Gravitational, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	SessionEnvVar   = "TELEPORT_SESSION"
	SetEnvReq       = "env"
	WindowChangeReq = "window-change"
	PTYReq          = "pty-req"
)

Variables

This section is empty.

Functions

func CloseAll

func CloseAll(closers ...io.Closer) error

func KeysEqual

func KeysEqual(ak, bk ssh.PublicKey) bool

KeysEqual is constant time compare of the keys to avoid timing attacks

func NewSigner

func NewSigner(keyBytes, certBytes []byte) (ssh.Signer, error)

Types

type AuthMethods

type AuthMethods struct {
	PublicKey PublicKeyFunc
	Password  PasswordFunc
	NoClient  bool
}

type DirectTCPIPReq

type DirectTCPIPReq struct {
	Host string
	Port uint32

	Orig     string
	OrigPort uint32
}

func ParseDirectTCPIPReq

func ParseDirectTCPIPReq(data []byte) (*DirectTCPIPReq, error)

type EnvReqParams

type EnvReqParams struct {
	Name  string
	Value string
}

type NewChanHandler

type NewChanHandler interface {
	HandleNewChan(*ssh.ServerConn, ssh.NewChannel)
}

type NewChanHandlerFunc

type NewChanHandlerFunc func(*ssh.ServerConn, ssh.NewChannel)

func (NewChanHandlerFunc) HandleNewChan

func (f NewChanHandlerFunc) HandleNewChan(s *ssh.ServerConn, c ssh.NewChannel)

type PTYReqParams

type PTYReqParams struct {
	Env   string
	W     uint32
	H     uint32
	Wpx   uint32
	Hpx   uint32
	Modes string
}

type PasswordFunc

type PasswordFunc func(conn ssh.ConnMetadata, password []byte) (*ssh.Permissions, error)

type PublicKeyFunc

type PublicKeyFunc func(conn ssh.ConnMetadata, key ssh.PublicKey) (*ssh.Permissions, error)

type RequestHandler

type RequestHandler interface {
	HandleRequest(r *ssh.Request)
}

type RequestHandlerFunc

type RequestHandlerFunc func(*ssh.Request)

func (RequestHandlerFunc) HandleRequest

func (f RequestHandlerFunc) HandleRequest(r *ssh.Request)

type Server

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

func NewServer

func NewServer(a utils.NetAddr, h NewChanHandler, hostSigners []ssh.Signer,
	ah AuthMethods, limiter *limiter.Limiter, opts ...ServerOption) (*Server, error)

func (*Server) Addr

func (s *Server) Addr() string

func (*Server) Close

func (s *Server) Close() error

Close closes listening socket and stops accepting connections

func (*Server) Start

func (s *Server) Start() error

func (*Server) Wait

func (s *Server) Wait()

type ServerOption

type ServerOption func(cfg *Server) error

func SetRequestHandler

func SetRequestHandler(req RequestHandler) ServerOption

func SetSSHConfig

func SetSSHConfig(cfg ssh.ServerConfig) ServerOption

type Upstream

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

func DialUpstream

func DialUpstream(username, addr string, signers []ssh.Signer) (*Upstream, error)

func NewUpstream

func NewUpstream(clt *ssh.Client) (*Upstream, error)

func (*Upstream) Close

func (u *Upstream) Close() error

func (*Upstream) CommandRW

func (u *Upstream) CommandRW(command string) (io.ReadWriter, error)

func (*Upstream) GetSession

func (u *Upstream) GetSession() *ssh.Session

func (*Upstream) PipeCommand

func (u *Upstream) PipeCommand(ch io.ReadWriter, command string) (int, error)

func (*Upstream) PipeShell

func (u *Upstream) PipeShell(rw io.ReadWriter) error

func (*Upstream) PipeShellToCh

func (u *Upstream) PipeShellToCh(ch ssh.Channel) error

func (*Upstream) String

func (m *Upstream) String() string

func (*Upstream) Wait

func (u *Upstream) Wait() error

type WinChangeReqParams

type WinChangeReqParams struct {
	W     uint32
	H     uint32
	Wpx   uint32
	Hpx   uint32
	Modes string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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