ssh

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPermissionDenied = fmt.Errorf("permission denied")

ErrPermissionDenied is returned when a user is not allowed connect.

Functions

func AuthenticationMiddleware added in v0.6.2

func AuthenticationMiddleware(sh ssh.Handler) ssh.Handler

AuthenticationMiddleware handles authentication.

func CommandMiddleware added in v0.6.0

func CommandMiddleware(sh ssh.Handler) ssh.Handler

CommandMiddleware handles git commands and CLI commands. This middleware must be run after the ContextMiddleware.

func ContextMiddleware added in v0.6.0

func ContextMiddleware(cfg *config.Config, dbx *db.DB, datastore store.Store, be *backend.Backend, logger *log.Logger) func(ssh.Handler) ssh.Handler

ContextMiddleware adds the config, backend, and logger to the session context.

func LoggingMiddleware added in v0.6.0

func LoggingMiddleware(sh ssh.Handler) ssh.Handler

LoggingMiddleware logs the ssh connection and command.

func SessionHandler

func SessionHandler(s ssh.Session) *tea.Program

SessionHandler is the soft-serve bubbletea ssh session handler. This middleware must be run after the ContextMiddleware.

Types

type SSHServer

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

SSHServer is a SSH server that implements the git protocol.

func NewSSHServer

func NewSSHServer(ctx context.Context) (*SSHServer, error)

NewSSHServer returns a new SSHServer.

func (*SSHServer) Close

func (s *SSHServer) Close() error

Close closes the SSH server.

func (*SSHServer) KeyboardInteractiveHandler

func (s *SSHServer) KeyboardInteractiveHandler(ctx ssh.Context, _ gossh.KeyboardInteractiveChallenge) bool

KeyboardInteractiveHandler handles keyboard interactive authentication. This is used after all public key authentication has failed.

func (*SSHServer) ListenAndServe

func (s *SSHServer) ListenAndServe() error

ListenAndServe starts the SSH server.

func (*SSHServer) PublicKeyHandler

func (s *SSHServer) PublicKeyHandler(ctx ssh.Context, pk ssh.PublicKey) (allowed bool)

PublicKeyAuthHandler handles public key authentication.

func (*SSHServer) Serve

func (s *SSHServer) Serve(l net.Listener) error

Serve starts the SSH server on the given net.Listener.

func (*SSHServer) Shutdown

func (s *SSHServer) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the SSH server.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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