data

package
v0.0.0-...-3574775 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: Artistic-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseAWSCredentials

func ParseAWSCredentials(bytes []byte, keys chan Key)

Types

type ARN

type ARN string

type AWSAccount

type AWSAccount struct {
	Arn     AWSAccountID
	Aliases StringSet
	// contains filtered or unexported fields
}

func NewAWSAccount

func NewAWSAccount(arn AWSAccountID, connID ID, keys []KeyBindingImpl, aliases ...string) *AWSAccount

func (*AWSAccount) AddBinding

func (a *AWSAccount) AddBinding(k Key)

func (*AWSAccount) Bindings

func (a *AWSAccount) Bindings() <-chan KeyBindingImpl

func (*AWSAccount) ConnectionID

func (a *AWSAccount) ConnectionID() ID

func (*AWSAccount) Id

func (a *AWSAccount) Id() ID

func (*AWSAccount) Merge

func (a *AWSAccount) Merge(account Account)

func (*AWSAccount) String

func (a *AWSAccount) String() string

type AWSAccountID

type AWSAccountID string

type AWSIamAccount

type AWSIamAccount struct {
	Arn        ARN
	Username   string
	CreateDate time.Time
	// contains filtered or unexported fields
}

func NewIAMAccount

func NewIAMAccount(md *iam.User, conn ID) *AWSIamAccount

func NewIAMAccountFromKey

func NewIAMAccountFromKey(md *iam.AccessKeyMetadata, userMd *iam.User, conn ID) *AWSIamAccount

func (*AWSIamAccount) AddBinding

func (a *AWSIamAccount) AddBinding(k Key)

func (*AWSIamAccount) Bindings

func (a *AWSIamAccount) Bindings() <-chan KeyBindingImpl

func (*AWSIamAccount) ConnectionID

func (a *AWSIamAccount) ConnectionID() ID

func (*AWSIamAccount) Id

func (a *AWSIamAccount) Id() ID

func (*AWSIamAccount) Identifiers

func (a *AWSIamAccount) Identifiers() []ID

func (*AWSIamAccount) Merge

func (a *AWSIamAccount) Merge(other Account)

func (*AWSIamAccount) String

func (a *AWSIamAccount) String() string

type AWSInstanceAccount

type AWSInstanceAccount struct {
	InstanceId, NameTag, PublicDNS string
	// contains filtered or unexported fields
}

func NewAWSInstanceAccount

func NewAWSInstanceAccount(instance *ec2.Instance, connID ID, keys []KeyBindingImpl) *AWSInstanceAccount

func (*AWSInstanceAccount) AddBinding

func (a *AWSInstanceAccount) AddBinding(k Key)

func (*AWSInstanceAccount) Bindings

func (a *AWSInstanceAccount) Bindings() <-chan KeyBindingImpl

func (*AWSInstanceAccount) ConnectionID

func (a *AWSInstanceAccount) ConnectionID() ID

func (*AWSInstanceAccount) Id

func (a *AWSInstanceAccount) Id() ID

func (*AWSInstanceAccount) Merge

func (a *AWSInstanceAccount) Merge(account Account)

func (*AWSInstanceAccount) String

func (a *AWSInstanceAccount) String() string

type AWSKey

type AWSKey struct {
	AwsKeyId, AwsSecretKey string
	Active                 bool
	// contains filtered or unexported fields
}

func NewAwsKey

func NewAwsKey(id string, createDate time.Time, active bool, aNames ...string) *AWSKey

func (*AWSKey) Expire

func (key *AWSKey) Expire()

func (*AWSKey) GetNames

func (key *AWSKey) GetNames() StringSet

func (*AWSKey) Id

func (key *AWSKey) Id() ID

func (*AWSKey) Identifiers

func (key *AWSKey) Identifiers() []ID

func (*AWSKey) Ids

func (key *AWSKey) Ids() []string

func (*AWSKey) IsDeprecated

func (key *AWSKey) IsDeprecated() bool

func (*AWSKey) Json

func (key *AWSKey) Json() ([]byte, error)

func (*AWSKey) Merge

func (key *AWSKey) Merge(k Key)

Does nothing for AWS keys

func (*AWSKey) ReplacementID

func (key *AWSKey) ReplacementID() ID

func (*AWSKey) StandardString

func (key *AWSKey) StandardString(id ID, other ...string) string

func (*AWSKey) String

func (key *AWSKey) String() string

type Account

type Account interface {
	Ider
	Bindings() <-chan KeyBindingImpl
	Merge(a Account)
	ConnectionID() ID
}

type BindingLocation

type BindingLocation string

* Where a Key is bound on an account

const (
	FILE                      BindingLocation = "FILE"
	AUTHORIZED_KEYS           BindingLocation = "AUTHORIZED_KEYS"
	AWS_CREDENTIALS           BindingLocation = "CREDENTIALS"
	INSTANCE_ROOT_CREDENTIALS BindingLocation = "INSTANCE ROOT"
)

type Change

type Change struct {
	Type        string
	Account     ID
	Add, Remove []KeyBindingImpl
}

func (*Change) Id

func (c *Change) Id() ID

type FanInAccounts

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

func NewFanInAccount

func NewFanInAccount() *FanInAccounts

func (*FanInAccounts) Add

func (f *FanInAccounts) Add(c <-chan Account)

func (*FanInAccounts) DoneAdding

func (f *FanInAccounts) DoneAdding()

func (*FanInAccounts) Output

func (f *FanInAccounts) Output() chan Account

func (*FanInAccounts) Wait

func (f *FanInAccounts) Wait()

type FanInKeys

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

func NewFanInKey

func NewFanInKey(c chan Key) *FanInKeys

func (*FanInKeys) Add

func (f *FanInKeys) Add(c <-chan Key)

func (*FanInKeys) DoneAdding

func (f *FanInKeys) DoneAdding()

func (*FanInKeys) Input

func (f *FanInKeys) Input() chan Key

func (*FanInKeys) Output

func (f *FanInKeys) Output() chan Key

func (*FanInKeys) Wait

func (f *FanInKeys) Wait()

type Fetcher

type Fetcher interface {
	Fetch(id ID) (Key, error)
}

type ID

type ID string

func IdFromBytes

func IdFromBytes(s []byte) ID

func IdFromString

func IdFromString(s string) ID

type IDList

type IDList struct {
	Ids []ID
}

func (*IDList) Add

func (l *IDList) Add(i ID)

func (*IDList) AddArray

func (l *IDList) AddArray(other []ID)

func (*IDList) AddList

func (l *IDList) AddList(other *IDList)

func (*IDList) Contains

func (l *IDList) Contains(i ID) bool

func (*IDList) Length

func (l *IDList) Length() int

func (IDList) MarshalJSON

func (l IDList) MarshalJSON() ([]byte, error)

func (*IDList) UnmarshalJSON

func (l *IDList) UnmarshalJSON(data []byte) error

type Identiferser

type Identiferser interface {
	Identifiers() []ID
}

type Ider

type Ider interface {
	Id() ID
}

type Key

type Key interface {
	Id() ID
	//IdString() string
	Identifiers() []ID
	GetNames() StringSet
	IsDeprecated() bool
	Expire()
	ReplacementID() ID
	Merge(Key)
}

func LoadJsonFile

func LoadJsonFile(path string) Key

func LoadTypeFromJSON

func LoadTypeFromJSON(s []byte, o Key) Key

func NewKey

func NewKey(content string, t time.Time, names ...string) Key

Create a new Key from the given content

func Read

func Read(path string) Key

Create a new Key from the given path

func SSHLoadJson

func SSHLoadJson(s []byte) Key

type KeyBinding

type KeyBinding interface {
	Describe(keylib Fetcher) (s string, key interface{})
	// TODO:  this should move into a speicfic binding type
	GetSshLine(keylib Fetcher) (string, error)
}

type KeyBindingImpl

type KeyBindingImpl struct {
	KeyID ID
	//AccountID ID `json:",omitempty"`
	Location BindingLocation `json:",omitempty"`
	Name     string          `json:",omitempty"`
}

func (*KeyBindingImpl) Describe

func (k *KeyBindingImpl) Describe(keylib Fetcher) (s string, key interface{})

Describe returns a key binding description and the key described

func (*KeyBindingImpl) GetSshLine

func (k *KeyBindingImpl) GetSshLine(keylib Fetcher) (string, error)

type PublicKey

type PublicKey struct {
	Key ssh.PublicKey `json:",omitifempty"`
}

func (*PublicKey) MarshalJSON

func (p *PublicKey) MarshalJSON() ([]byte, error)

func (*PublicKey) UnmarshalJSON

func (p *PublicKey) UnmarshalJSON(bytes []byte) error

type SSHAccount

type SSHAccount struct {
	Username, Host string
	// contains filtered or unexported fields
}

func NewSSHAccount

func NewSSHAccount(username string, name string, connID ID, keys []KeyBindingImpl) *SSHAccount

func (*SSHAccount) AddBinding

func (a *SSHAccount) AddBinding(k Key)

func (*SSHAccount) Bindings

func (a *SSHAccount) Bindings() <-chan KeyBindingImpl

func (*SSHAccount) ConnectionID

func (a *SSHAccount) ConnectionID() ID

func (*SSHAccount) Id

func (a *SSHAccount) Id() ID

func (*SSHAccount) Merge

func (a *SSHAccount) Merge(account Account)

func (*SSHAccount) String

func (a *SSHAccount) String() string

type SSHBinding

type SSHBinding struct {
	Id      ID
	Comment string
	Options []string
}

Use of a public Key, e.g. in an authorized_keys file

type SSHKey

type SSHKey struct {
	Ids       IDList
	PublicKey PublicKey
	Comments  StringSet
	// contains filtered or unexported fields
}

* An SSH Key, public and (optionally) private

func NewSSHKeyFromFingerprint

func NewSSHKeyFromFingerprint(name string, tm time.Time, ids ...ID) *SSHKey

func NewSshKey

func NewSshKey(pub ssh.PublicKey, t time.Time) *SSHKey

func (*SSHKey) Expire

func (key *SSHKey) Expire()

func (*SSHKey) GetNames

func (key *SSHKey) GetNames() StringSet

func (*SSHKey) Id

func (key *SSHKey) Id() ID

func (*SSHKey) Identifiers

func (key *SSHKey) Identifiers() []ID

func (*SSHKey) IsDeprecated

func (key *SSHKey) IsDeprecated() bool

func (*SSHKey) Json

func (key *SSHKey) Json() ([]byte, error)

func (*SSHKey) KeyType

func (key *SSHKey) KeyType() string

func (*SSHKey) Merge

func (s *SSHKey) Merge(k Key)

func (*SSHKey) PublicKeyString

func (key *SSHKey) PublicKeyString() string

func (*SSHKey) ReplacementID

func (key *SSHKey) ReplacementID() ID

func (*SSHKey) StandardString

func (key *SSHKey) StandardString(id ID, other ...string) string

func (*SSHKey) String

func (key *SSHKey) String() string

type StringSet

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

func (*StringSet) Add

func (set *StringSet) Add(s string)

func (*StringSet) AddArray

func (set *StringSet) AddArray(a []string)

func (*StringSet) AddSet

func (set *StringSet) AddSet(other StringSet)

func (*StringSet) Contains

func (s *StringSet) Contains(str string) bool

func (*StringSet) Count

func (s *StringSet) Count() int

func (*StringSet) Join

func (s *StringSet) Join(sep string) string

func (*StringSet) MarshalJSON

func (s *StringSet) MarshalJSON() ([]byte, error)

func (*StringSet) StringArray

func (s *StringSet) StringArray() []string

func (*StringSet) UnmarshalJSON

func (s *StringSet) UnmarshalJSON(data []byte) error

func (*StringSet) Values

func (s *StringSet) Values() chan string

Jump to

Keyboard shortcuts

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