ssh

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToProtoSlice

func ToProtoSlice(input []*UserKey) []*initproto.SSHUserKey

ToProtoSlice converts a SSH UserKey definition from Go to pubproto flavor.

Types

type Access

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

Access reads SSH public keys from a channel, creates the specified users if required and writes the public keys to the users authorized_keys file.

func NewAccess

func NewAccess(log *logger.Logger, userManager user.LinuxUserManager) *Access

NewAccess creates a new Access.

func (*Access) DeployAuthorizedKey

func (s *Access) DeployAuthorizedKey(ctx context.Context, sshKey UserKey) error

DeployAuthorizedKey takes an user & public key pair, creates the user if required and deploy a SSH key for them. TODO: Refactor to not write to /etc or /home.

func (*Access) GetAuthorizedKeys

func (s *Access) GetAuthorizedKeys() []UserKey

GetAuthorizedKeys returns a list of authorized keys for the specified user.

type UserKey

type UserKey struct {
	Username  string
	PublicKey string
}

UserKey describes an user that should be created with a corresponding public SSH key.

func FromProtoSlice

func FromProtoSlice(input []*initproto.SSHUserKey) []UserKey

FromProtoSlice converts a SSH UserKey definition from pubproto to the Go flavor.

Jump to

Keyboard shortcuts

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