sysaccess

package
v0.0.0-...-18b16e6 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package sysaccess is a generated GoMock package.

Package sysaccess is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSSHDConfigParseFailed         = errors.New("failed to parse sshd config")
	ErrInvalidKey                    = errors.New("invalid ssh key")
	ErrReadAuthorizedKeysFileFailed  = errors.New("failed to read authorized_keys file")
	ErrWriteAuthorizedKeysFileFailed = errors.New("failed to write authorized_keys file")
	ErrInvalidPortNumber             = errors.New("invalid port number")
	ErrInvalidArgs                   = errors.New("invalid arguments")
)

Possible errors

Functions

This section is empty.

Types

type MockauthorizedKeysFileUpdater

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

MockauthorizedKeysFileUpdater is a mock of authorizedKeysFileUpdater interface.

func NewMockauthorizedKeysFileUpdater

func NewMockauthorizedKeysFileUpdater(ctrl *gomock.Controller) *MockauthorizedKeysFileUpdater

NewMockauthorizedKeysFileUpdater creates a new mock instance.

func (*MockauthorizedKeysFileUpdater) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

type MockauthorizedKeysFileUpdaterMockRecorder

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

MockauthorizedKeysFileUpdaterMockRecorder is the mock recorder for MockauthorizedKeysFileUpdater.

type MockfsWatcher

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

MockfsWatcher is a mock of fsWatcher interface.

func NewMockfsWatcher

func NewMockfsWatcher(ctrl *gomock.Controller) *MockfsWatcher

NewMockfsWatcher creates a new mock instance.

func (*MockfsWatcher) Add

func (m *MockfsWatcher) Add(name string) error

Add mocks base method.

func (*MockfsWatcher) Close

func (m *MockfsWatcher) Close() error

Close mocks base method.

func (*MockfsWatcher) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockfsWatcher) Remove

func (m *MockfsWatcher) Remove(name string) error

Remove mocks base method.

type MockfsWatcherMockRecorder

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

MockfsWatcherMockRecorder is the mock recorder for MockfsWatcher.

func (*MockfsWatcherMockRecorder) Add

func (mr *MockfsWatcherMockRecorder) Add(name any) *gomock.Call

Add indicates an expected call of Add.

func (*MockfsWatcherMockRecorder) Close

func (mr *MockfsWatcherMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close.

func (*MockfsWatcherMockRecorder) Remove

func (mr *MockfsWatcherMockRecorder) Remove(name any) *gomock.Call

Remove indicates an expected call of Remove.

type MocksshHelper

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

MocksshHelper is a mock of sshHelper interface.

func NewMocksshHelper

func NewMocksshHelper(ctrl *gomock.Controller) *MocksshHelper

NewMocksshHelper creates a new mock instance.

func (*MocksshHelper) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

type MocksshHelperMockRecorder

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

MocksshHelperMockRecorder is the mock recorder for MocksshHelper.

type SSHKey

type SSHKey struct {
	OSUser     string `json:"os_user,omitempty"`
	PublicKey  string `json:"ssh_key"` // including algorithm and the key, separated by space (ASCII: 0x20)
	ActorEmail string `json:"actor_email"`
	TTL        int    `json:"ttl"` // time to live in seconds

	Type SSHKeyType `json:"-"` // key type
	// contains filtered or unexported fields
}

SSHKey contains information of a ssh key operated by DOTTY

type SSHKeyType

type SSHKeyType int

SSHKeyType indicates the type of the ssh key. There are 2 types currently: - DOTTY: which is the keys used for web console sessions - Droplet: which is the droplet ssh keys managed through DigitalOcean

const (
	SSHKeyTypeDOTTY SSHKeyType = iota
	SSHKeyTypeDroplet
)

constants for the SSH Key types

type SSHManager

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

SSHManager provides functions for managing SSH access

func NewSSHManager

func NewSSHManager(opts ...SSHManagerOpt) (*SSHManager, error)

NewSSHManager constructs a new SSHManager object

func (*SSHManager) Close

func (s *SSHManager) Close() error

Close properly shutdowns the SSH manager

func (*SSHManager) DisableManagedDropletKeys

func (s *SSHManager) DisableManagedDropletKeys()

DisableManagedDropletKeys disables the SSH manager to manage droplet keys

func (*SSHManager) EnableManagedDropletKeys

func (s *SSHManager) EnableManagedDropletKeys()

EnableManagedDropletKeys enables the SSH manager to manage droplet keys

func (*SSHManager) RemoveDOTTYKeys

func (s *SSHManager) RemoveDOTTYKeys() error

RemoveDOTTYKeys removes all dotty keys from the droplet When the agent exit, all temporary keys managed through DigitalOcean must be cleaned up to avoid leaving stale expired keys in the system

func (*SSHManager) RemoveExpiredKeys

func (s *SSHManager) RemoveExpiredKeys() (err error)

RemoveExpiredKeys removes expired keys from the authorized_keys file

func (*SSHManager) SSHDPort

func (s *SSHManager) SSHDPort() int

SSHDPort returns the port sshd is binding to

func (*SSHManager) UpdateKeys

func (s *SSHManager) UpdateKeys(keys []*SSHKey) (retErr error)

UpdateKeys updates the given ssh keys to corresponding authorized_keys files.

func (*SSHManager) WatchSSHDConfig

func (s *SSHManager) WatchSSHDConfig() (<-chan bool, error)

WatchSSHDConfig watches if sshd_config is modified, if yes, it will close the returned channel so that all subscribers to that channel will be notified

type SSHManagerOpt

type SSHManagerOpt func(opt *sshMgrOpts)

SSHManagerOpt allows creating the SSHManager instance with designated options

func WithCustomSSHDCfg

func WithCustomSSHDCfg(cfgFile string) SSHManagerOpt

WithCustomSSHDCfg specifies the path the custom sshd_config file that the sshd instance uses

func WithCustomSSHDPort

func WithCustomSSHDPort(port int) SSHManagerOpt

WithCustomSSHDPort indicates the SSHD is running on a custom port which is specified via command line argument

func WithoutManagingDropletKeys

func WithoutManagingDropletKeys() SSHManagerOpt

WithoutManagingDropletKeys tells the agent to not attempt to manage the ssh keys

Directories

Path Synopsis
internal
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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