core

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrErrNotFound is used when an item is not found, usually when attempting to fetch it from storage.

Functions

func DumpCerts added in v0.1.1

func DumpCerts(config *ServerConfig)

func DumpPerms added in v0.1.1

func DumpPerms(perms *Permissions)

DumpPerms dumps information about our permissions to stdout.

func InitStores

func InitStores(ctx context.Context, stores []*Store) ([]e2wtypes.Store, error)

InitStores initialises the stores from a configuration.

Types

type CertificateInfo added in v0.1.1

type CertificateInfo struct {
	Name  string              `json:"name"`
	Perms []*CertificatePerms `json:"permissions"`
}

CertificateInfo contains information related to client certificates.

type CertificatePerms added in v0.1.1

type CertificatePerms struct {
	Path       string   `json:"path"`
	Operations []string `json:"operations"`
}

CertificatePerms contains information about the operations allowed by the certificate.

type Config

type Config struct {
	Verbosity string            `json:"verbosity"`
	Server    *ServerConfig     `json:"server"`
	Stores    []*Store          `json:"stores"`
	Rules     []*RuleDefinition `json:"rules"`
}

Config is the configuration for the daemon.

func NewConfig

func NewConfig() (*Config, error)

NewConfig creates a new configuration. Configuration can come from the configuration file or environment variables.

type KeysConfig added in v0.1.1

type KeysConfig struct {
	Keys []string `json:"keys"`
}

KeysConfig provides information about keys for automatic unlocking.

func FetchKeysConfig added in v0.1.1

func FetchKeysConfig() (*KeysConfig, error)

FetchKeysConfig fetches keys from the JSON configuration file.

type Permissions added in v0.1.1

type Permissions struct {
	Certs []*CertificateInfo `json:"certificates"`
}

Permissions provides information about per-client permissions.

func FetchPermissions added in v0.1.1

func FetchPermissions() (*Permissions, error)

FetchPermissions fetches permissions from the JSON configuration file.

type Rule

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

Rule contains a ready-to-run rule script.

func InitRules

func InitRules(ctx context.Context, defs []*RuleDefinition) ([]*Rule, error)

InitRules initialises the rules from a configuration.

func NewRule

func NewRule(def *RuleDefinition) (*Rule, error)

NewRule creates a new rule from its definition.

func (*Rule) Matches

func (r *Rule) Matches(request string, account string) bool

Matches returns true if this rule matches the path.

func (*Rule) Name added in v0.1.1

func (r *Rule) Name() string

Name returns the name for the rule.

func (*Rule) Script

func (r *Rule) Script() string

Script returns the script for the rule.

type RuleDefinition

type RuleDefinition struct {
	Name    string `json:"name"`
	Request string `json:"request"`
	Account string `json:"account"`
	Script  string `json:"script"`
}

RuleDefinition defines a rule.

type RulesResult added in v0.1.1

type RulesResult int

RulesResult represents the result of running a set of rules.

const (
	UNKNOWN RulesResult = iota
	APPROVED
	DENIED
	FAILED
)

type ServerConfig added in v0.1.1

type ServerConfig struct {
	Name        string `json:"name"`
	Port        int    `json:"port"`
	CertPath    string `json:"certificate_path"`
	StoragePath string `json:"storage_path"`
}

ServerConfig contains configuration for the server.

type Store

type Store struct {
	Name       string `json:"name"`
	Type       string `json:"type"`
	Protected  bool   `json:"protected"`
	Passphrase string `json:"passphrase"`
}

Store defines a store within the configuration

Jump to

Keyboard shortcuts

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