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.
Index ¶
- Constants
- func AuthorizedKeyFingerprint(publicKey []byte) (string, error)
- func CloseAll(closers ...io.Closer) error
- func Fingerprint(key ssh.PublicKey) string
- func KeysEqual(ak, bk ssh.PublicKey) bool
- func NewSigner(keyBytes, certBytes []byte) (ssh.Signer, error)
- func PrivateKeyFingerprint(keyBytes []byte) (string, error)
- type AuthMethods
- type DirectTCPIPReq
- type EnvReqParams
- type NewChanHandler
- type NewChanHandlerFunc
- type PTYReqParams
- type PasswordFunc
- type PublicKeyFunc
- type RequestHandler
- type RequestHandlerFunc
- type Server
- type ServerOption
- type Upstream
- func (u *Upstream) Close() error
- func (u *Upstream) CommandRW(command string) (io.ReadWriter, error)
- func (u *Upstream) GetClient() *ssh.Client
- func (u *Upstream) GetSession() *ssh.Session
- func (u *Upstream) PipeCommand(ch io.ReadWriter, command string) (int, error)
- func (u *Upstream) PipeShell(rw io.ReadWriter, req *PTYReqParams) error
- func (u *Upstream) SetPrefix(data []byte)
- func (u *Upstream) String() string
- func (u *Upstream) Wait() error
- type WinChangeReqParams
Constants ¶
const ( SessionEnvVar = "TELEPORT_SESSION" SetEnvReq = "env" WindowChangeReq = "window-change" PTYReq = "pty-req" )
Variables ¶
This section is empty.
Functions ¶
func AuthorizedKeyFingerprint ¶ added in v1.0.0
AuthorizedKeyFingerprint returns fingerprint from public key in authorized key format
func Fingerprint ¶ added in v1.0.0
Fingerprint returns SSH RFC4716 fingerprint of the key
func PrivateKeyFingerprint ¶ added in v1.0.0
PrivateKeyFingerprint returns fingerprint of the public key extracted from the PEM encoded private key
Types ¶
type AuthMethods ¶
type AuthMethods struct { PublicKey PublicKeyFunc Password PasswordFunc NoClient bool }
type DirectTCPIPReq ¶
func ParseDirectTCPIPReq ¶
func ParseDirectTCPIPReq(data []byte) (*DirectTCPIPReq, error)
type EnvReqParams ¶
type NewChanHandler ¶
type NewChanHandler interface {
HandleNewChan(net.Conn, *ssh.ServerConn, ssh.NewChannel)
}
type NewChanHandlerFunc ¶
type NewChanHandlerFunc func(net.Conn, *ssh.ServerConn, ssh.NewChannel)
func (NewChanHandlerFunc) HandleNewChan ¶
func (f NewChanHandlerFunc) HandleNewChan(conn net.Conn, sshConn *ssh.ServerConn, ch ssh.NewChannel)
type PTYReqParams ¶
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 RequestHandlerFunc ¶
func (RequestHandlerFunc) HandleRequest ¶
func (f RequestHandlerFunc) HandleRequest(r *ssh.Request)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a generic implementation of a frame for SSH server
func NewServer ¶
func NewServer(a utils.NetAddr, h NewChanHandler, hostSigners []ssh.Signer, ah AuthMethods, opts ...ServerOption) (*Server, error)
type ServerOption ¶
ServerOption is a functional argument for server
func SetLimiter ¶ added in v1.0.0
func SetLimiter(limiter *limiter.Limiter) ServerOption
func SetRequestHandler ¶
func SetRequestHandler(req RequestHandler) ServerOption
func SetSSHConfig ¶
func SetSSHConfig(cfg ssh.ServerConfig) ServerOption
type Upstream ¶
Upstream is a wrapper around SSH client connection that provides some handy functions to work with interactive shells and launching commands
func DialUpstream ¶
DialUpstream dials remote server and returns upstream
func NewUpstream ¶
NewUpstream returns new upstream connection to the server
func (*Upstream) CommandRW ¶
func (u *Upstream) CommandRW(command string) (io.ReadWriter, error)
CommandRW executes a command and returns read writer to communicate with the process using it's stdin and stdout
func (*Upstream) GetSession ¶
GetSession returns current active sesson
func (*Upstream) PipeCommand ¶
PipeCommand pipes input and output to the read writer, returns result code of the command execution
func (*Upstream) PipeShell ¶
func (u *Upstream) PipeShell(rw io.ReadWriter, req *PTYReqParams) error
PipeShell starts interactive shell and pipes stdin, stdout and stderr to the given read writer