sshd

package
v14.35.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 32 Imported by: 0

README


stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments

Overview

This package is responsible for handling SSH connections.

Since GitLab 13.9, gitlab-shell provides an option to either use OpenSSH to handle connections or utilize an internal implementation. For more information on the internal implementation, see the Why we implemented our own SSHD solution blog post.

The package contains multiple public functions:

All these functions are used by the main function to initialize and shutdown the server. When a client tries to connect to the server, the following sequence of steps happens:

Proxy protocol

The package supports creating a server with PROXY protocol. The go-proxyproto package is used to wrap the basic listener into the one that supports PROXY protocol. PROXY protocol enables us to implement Group IP address restriction via SSH. The policies are configurable.

Configurable OpenSSH alternatives

State machine

The server maintains a state machine to implement:

  • Graceful shutdown. When a termination signal has been detected, then a service is being shut down. The status is changed accordingly and no new connections are accepted. A configurable grace period is given in order to allow the ongoing connections to complete. When the period expires, then the top-level context is canceled. That means that all the ongoing HTTP and SSH connections are closed.
  • Liveness and readiness probes that help Kubernetes to evaluate the state of the server. If a state is any other than ready (for example, during graceful shutdown), then 502 is returned.

Documentation

Index

Constants

View Source
const (
	KeepAliveMsg   = "keepalive@openssh.com"
	NotOurRefError = `exit status 128, stderr: "fatal: git upload-pack: not our ref `
)
View Source
const (
	StatusStarting status = iota
	StatusReady
	StatusOnShutdown
	StatusClosed
)

Variables

View Source
var EOFTimeout = 10 * time.Second

Functions

This section is empty.

Types

type OSGSSAPIServer added in v14.16.0

type OSGSSAPIServer struct {
	ServicePrincipalName string
}

func NewGSSAPIServer added in v14.33.0

func NewGSSAPIServer(c *config.GSSAPIConfig) (*OSGSSAPIServer, error)

func (*OSGSSAPIServer) AcceptSecContext added in v14.16.0

func (*OSGSSAPIServer) AcceptSecContext([]byte) ([]byte, string, bool, error)

func (*OSGSSAPIServer) DeleteSecContext added in v14.16.0

func (*OSGSSAPIServer) DeleteSecContext() error

func (*OSGSSAPIServer) VerifyMIC added in v14.16.0

func (*OSGSSAPIServer) VerifyMIC([]byte, []byte) error

type Server

type Server struct {
	Config *config.Config
	// contains filtered or unexported fields
}

func NewServer

func NewServer(cfg *config.Config) (*Server, error)

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(ctx context.Context) error

func (*Server) MonitoringServeMux

func (s *Server) MonitoringServeMux() *http.ServeMux

func (*Server) Shutdown

func (s *Server) Shutdown() error

Jump to

Keyboard shortcuts

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