sessionrecording

package
v1.78.3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package sessionrecording contains session recording utils shared amongst Tailscale SSH and Kubernetes API server proxy session recording.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectToRecorder

func ConnectToRecorder(ctx context.Context, recs []netip.AddrPort, dial DialFunc) (io.WriteCloser, []*tailcfg.SSHRecordingAttempt, <-chan error, error)

ConnectToRecorder connects to the recorder at any of the provided addresses. It returns the first successful response, or a multierr if all attempts fail.

On success, it returns a WriteCloser that can be used to upload the recording, and a channel that will be sent an error (or nil) when the upload fails or completes.

In both cases, a slice of SSHRecordingAttempts is returned which detail the attempted recorder IP and the error message, if the attempt failed. The attempts are in order the recorder(s) was attempted. If successful a successful connection is made, the last attempt in the slice is the attempt for connected recorder.

Types

type CastHeader

type CastHeader struct {
	// Version is the asciinema file format version.
	Version int `json:"version"`

	// Width is the terminal width in characters.
	// It is non-zero for Pty sessions.
	Width int `json:"width"`

	// Height is the terminal height in characters.
	// It is non-zero for Pty sessions.
	Height int `json:"height"`

	// Timestamp is the unix timestamp of when the recording started.
	Timestamp int64 `json:"timestamp"`

	// Command is the command that was executed.
	// Typically empty for shell sessions.
	Command string `json:"command,omitempty"`

	// SrcNode is the FQDN of the node originating the connection.
	// It is also the MagicDNS name for the node.
	// It does not have a trailing dot.
	// e.g. "host.tail-scale.ts.net"
	SrcNode string `json:"srcNode"`

	// SrcNodeID is the node ID of the node originating the connection.
	SrcNodeID tailcfg.StableNodeID `json:"srcNodeID"`

	// Tailscale-specific fields:
	// SrcNodeTags is the list of tags on the node originating the connection (if any).
	SrcNodeTags []string `json:"srcNodeTags,omitempty"`

	// SrcNodeUserID is the user ID of the node originating the connection (if not tagged).
	SrcNodeUserID tailcfg.UserID `json:"srcNodeUserID,omitempty"` // if not tagged

	// SrcNodeUser is the LoginName of the node originating the connection (if not tagged).
	SrcNodeUser string `json:"srcNodeUser,omitempty"`

	// Env is the environment variables of the session.
	// Only "TERM" is set (2023-03-22).
	Env map[string]string `json:"env"`

	// SSHUser is the username as presented by the client.
	SSHUser string `json:"sshUser"` // as presented by the client

	// LocalUser is the effective username on the server.
	LocalUser string `json:"localUser"`

	// ConnectionID uniquely identifies a connection made to the SSH server.
	// It may be shared across multiple sessions over the same connection in
	// case of SSH multiplexing.
	ConnectionID string `json:"connectionID"`

	Kubernetes *Kubernetes `json:"kubernetes,omitempty"`
}

CastHeader is the header of an asciinema file.

type DialFunc added in v1.78.0

type DialFunc func(ctx context.Context, network, host string) (net.Conn, error)

DialFunc is a function for dialing the recorder.

type Kubernetes

type Kubernetes struct {
	// PodName is the name of the Pod being exec-ed.
	PodName string
	// Namespace is the namespace in which is the Pod that is being exec-ed.
	Namespace string
	// Container is the container being exec-ed.
	Container string
}

Kubernetes contains 'kubectl exec' session specific information for tsrecorder.

Jump to

Keyboard shortcuts

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