config

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultClientDir is the default dir where blessclient will look for a config and cache
	DefaultClientDir = "~/.blessclient"
	// DefaultConfigFile is the default file where blessclient will look for its config
	DefaultConfigFile = "~/.blessclient/config.yml"
	// DefaultCacheDir is a default cache dir
	DefaultCacheDir = "~/.blessclient/cache"
	// DefaultKMSAuthCache is the default kmsauth cache
	DefaultKMSAuthCache = "kmsauth"
	// DefaultAWSProfile is the default bless aws profile
	DefaultAWSProfile = "bless"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bastion

type Bastion struct {
	Host `yaml:",inline"`

	Hosts        []Host `yaml:"hosts"`
	IdentityFile string `yaml:"identity_file"`
	User         string `yaml:"user"`
}

Bastion is an internet accessibly server used to "jump" to other servers

type ClientConfig

type ClientConfig struct {
	ClientDir       string `json:"client_dir" yaml:"client_dir"`
	ConfigFile      string `json:"config_file" yaml:"config_file"`
	CacheDir        string `json:"cache_dir" yaml:"cache_dir"`
	KMSAuthCacheDir string `json:"kmsauth_cache_dir" yaml:"kmsauth_cache_dir"`

	SSHPrivateKey string `json:"ssh_private_key" yaml:"ssh_private_key"`

	// cert related
	CertLifetime Duration `json:"cert_lifetime" yaml:"cert_lifetime,inline"`
	RemoteUsers  []string `json:"remote_users" yaml:"remote_users"`
	BastionIPS   []string `json:"bastion_ips" yaml:"bastion_ips"`
}

ClientConfig is the client config

type Config

type Config struct {
	Version int `json:"version" yaml:"version"`

	ClientConfig ClientConfig `json:"client_config" yaml:"client_config"`
	LambdaConfig LambdaConfig `json:"lambda_config" yaml:"lambda_config"`
	SSHConfig    *SSHConfig   `json:"ssh_config,omitempty" yaml:"ssh_config,omitempty"`
}

Config is a blessclient config

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig generates a config with some defaults

func FromFile

func FromFile(file string) (*Config, error)

FromFile reads the config from file

func (*Config) Persist

func (c *Config) Persist() error

Persist persists a config to disk

func (*Config) SetPaths

func (c *Config) SetPaths(configPath string)

SetPaths sets paths on the config

type Duration

type Duration struct {
	time.Duration
}

Duration is a wrapper around Duration to marshal/unmarshal

func (Duration) AsDuration

func (d Duration) AsDuration() time.Duration

AsDuration returns as duration

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON marshals to json

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals

type Host

type Host struct {
	Pattern string `yaml:"pattern"`
}

Host represents a Host block in an ssh config

type LambdaConfig

type LambdaConfig struct {
	// RoleARN used to assume and invoke bless lambda
	RoleARN      string   `json:"role_arn" yaml:"role_arn"`
	FunctionName string   `json:"function_name" yaml:"function_name"`
	Regions      []Region `json:"regions,omitempty" yaml:"regions,omitempty"`
}

LambdaConfig is the lambda config

type Region

type Region struct {
	AWSRegion    string `json:"aws_region" yaml:"aws_region"`
	KMSAuthKeyID string `json:"kms_auth_key_id" yaml:"kms_auth_key_id"`
}

Region is an aws region

type SSHConfig

type SSHConfig struct {
	Bastions []Bastion `yaml:"bastions"`
}

SSHConfig is an SSH config We make some assumptions here around the structure of the machines A bastion is internet accessible and can be used to reach other machines

func (*SSHConfig) String

func (s *SSHConfig) String() (string, error)

String generates the ssh config string

Jump to

Keyboard shortcuts

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