sshkeys

package
v0.0.0-...-dae269f Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyIndexes

func KeyIndexes(keys []ssh.PublicKey, key ssh.PublicKey) []int

KeyIndexes returns a slice of ints that contain the indexes of the given key.

func KeyOneOf

func KeyOneOf(keys []ssh.PublicKey, key ssh.PublicKey) bool

KeyOneOf checks if keys is one of the given set of keys.

func Slowdown

func Slowdown[T any](f func() T) T

slowdown invokes f immediatly, but introduces a random delay to prevent timing attacks. the delay is also introduced if f() panics.

Types

type SSHKeys

type SSHKeys struct {
	component.Base
	Dependencies struct {
		SQL  *sql.SQL
		Auth *auth.Auth
	}
}

func (*SSHKeys) Add

func (ssh2 *SSHKeys) Add(ctx context.Context, user string, comment string, key ssh.PublicKey) error

Add adds a new key to the given user, unless it already exists

func (*SSHKeys) Admin

func (k *SSHKeys) Admin(ctx context.Context) (keys []ssh.PublicKey, err error)

Admin returns the set of administrative ssh keys. These are ssh keys associated to distillery admin users.

func (*SSHKeys) Keys

func (ssh2 *SSHKeys) Keys(ctx context.Context, user string) ([]models.Keys, error)

Keys returns a list of keys for the given user

func (*SSHKeys) OnUserDelete

func (ssh2 *SSHKeys) OnUserDelete(ctx context.Context, user *models.User) error

func (*SSHKeys) Remove

func (ssh2 *SSHKeys) Remove(ctx context.Context, user string, key ssh.PublicKey) error

Remove removes a given publuc key from a user.

func (*SSHKeys) TableInfo

func (ssh2 *SSHKeys) TableInfo() component.TableInfo

Jump to

Keyboard shortcuts

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