manifest

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MPL-2.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// SecretTypeCertECDSA defines the type of a secret containing an ECDSA certificate.
	SecretTypeCertECDSA = "cert-ecdsa"
	// SecretTypeCertED25519 defines the type of a secret containing an ED25519 certificate.
	SecretTypeCertED25519 = "cert-ed25519"
	// SecretTypeCertRSA defines the type of a secret containing an RSA certificate.
	SecretTypeCertRSA = "cert-rsa"
	// SecretTypeSymmetricKey defines the type of a secret containing a symmetric key.
	SecretTypeSymmetricKey = "symmetric-key"
	// SecretTypePlain defines the type of a secret containing arbitrary data.
	SecretTypePlain = "plain"
)

Variables

View Source
var ManifestEnvTemplateFuncMap = template.FuncMap{
	"pem":    EncodeSecretDataToPem,
	"hex":    EncodeSecretDataToHex,
	"string": EncodeSecretDataToString,
	"base64": EncodeSecretDataToBase64,
}

ManifestEnvTemplateFuncMap defines the functions which can be specified for secret injections into Env variables in the Go template format.

View Source
var ManifestFileTemplateFuncMap = template.FuncMap{
	"pem":    EncodeSecretDataToPem,
	"hex":    EncodeSecretDataToHex,
	"raw":    EncodeSecretDataToRaw,
	"base64": EncodeSecretDataToBase64,
}

ManifestFileTemplateFuncMap defines the functions which can be specified for secret injections into files in the in Go template format.

Functions

func EncodeSecretDataToBase64

func EncodeSecretDataToBase64(data interface{}) (string, error)

EncodeSecretDataToBase64 encodes the byte value of a secret to a Base64 string.

func EncodeSecretDataToHex

func EncodeSecretDataToHex(data interface{}) (string, error)

EncodeSecretDataToHex encodes a secret to a hex string.

func EncodeSecretDataToPem

func EncodeSecretDataToPem(data interface{}) (string, error)

EncodeSecretDataToPem encodes a secret to an appropriate PEM block.

func EncodeSecretDataToRaw

func EncodeSecretDataToRaw(data interface{}) (string, error)

EncodeSecretDataToRaw encodes a secret to a raw byte string.

func EncodeSecretDataToString added in v0.5.0

func EncodeSecretDataToString(data interface{}) (string, error)

EncodeSecretDataToString encodes secrets to C type strings (no NULL bytes allowed as part of the string).

func ParseUserSecrets added in v0.4.0

func ParseUserSecrets(newSecrets map[string]UserSecret, originalSecrets map[string]Secret) (map[string]Secret, error)

ParseUserSecrets checks if a map of UserSecrets only contains supported values and parses them to a map of Secrets.

Types

type Certificate

type Certificate x509.Certificate

Certificate is a x509.Certificate.

func (Certificate) MarshalJSON

func (c Certificate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Certificate) UnmarshalJSON

func (c *Certificate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Marshaler interface.

type File added in v0.5.0

type File struct {
	// Data is the data to be saved as a file or environment variable.
	Data string
	// Encoding is the initial encoding of Data (as it is written in the manifest). One of {'string', 'base64', 'hex'}.
	Encoding string
	// NoTemplates specifies if Data contains templates which should be filled with information by the Coordinator.
	NoTemplates bool
}

File defines data, encoding type, and if data contains templates for a File or Env variable.

func (File) Equal added in v1.0.0

func (f File) Equal(other File) bool

Equal returns true if two File definitions are equal.

func (File) MarshalJSON added in v0.5.0

func (f File) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*File) UnmarshalJSON added in v0.5.0

func (f *File) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Marshaler interface.

type Manifest

type Manifest struct {
	// Packages contains the allowed enclaves and their properties.
	Packages map[string]quote.PackageProperties
	// Infrastructures contains the allowed infrastructure providers and their properties.
	Infrastructures map[string]quote.InfrastructureProperties
	// Marbles contains the allowed services with their corresponding enclave and configuration parameters.
	Marbles map[string]Marble
	// Users contains user definitions, including certificates used for authentication and permissions.
	Users map[string]User
	// Secrets holds user-specified secrets, which should be generated and later on stored in a marble (if not shared) or in the core (if shared).
	Secrets map[string]Secret
	// RecoveryKeys holds one or multiple RSA public keys to encrypt multiple secrets, which can be used to decrypt the sealed state again in case the encryption key on disk was corrupted somehow.
	RecoveryKeys map[string]string
	// Roles contains role definitions to manage permissions across the MarbleRun mesh
	Roles map[string]Role
	// TLS contains tags which can be assigned to Marbles to specify which connections should be elevated to TLS
	TLS map[string]TLStag
}

Manifest defines the rules of a MarbleRun deployment.

func (Manifest) Check

func (m Manifest) Check(zaplogger *zap.Logger) error

Check checks if the manifest is consistent.

func (Manifest) CheckUpdate

func (m Manifest) CheckUpdate(originalPackages map[string]quote.PackageProperties) error

CheckUpdate checks if the manifest is consistent and only contains supported values.

func (Manifest) GenerateUsers added in v1.0.0

func (m Manifest) GenerateUsers() ([]*user.User, error)

GenerateUsers creates users and assigns permissions from the manifest.

func (Manifest) IsUpdateManifest added in v1.0.0

func (m Manifest) IsUpdateManifest() bool

IsUpdateManifest returns true if the manifest specifies only packages. The Manifest still needs to be check for consistency, e.g. by calling CheckUpdate.

func (Manifest) TemplateDryRun added in v1.0.0

func (m Manifest) TemplateDryRun(secrets map[string]Secret) error

TemplateDryRun performs a dry run for Files and Env declarations in a manifest.

type Marble

type Marble struct {
	// Package references one of the allowed enclaves in the manifest.
	Package string
	// MaxActivations allows to limit the number of marbles of a kind.
	MaxActivations uint
	// Parameters contains lists for files, environment variables and commandline arguments that should be passed to the application.
	// Placeholder variables are supported for specific assets of the marble's activation process.
	Parameters Parameters
	// TLS holds a list of tags which are specified in the manifest
	TLS []string
}

Marble describes a service in the mesh that should be handled and verified by the Coordinator.

func (Marble) Equal added in v1.0.0

func (m Marble) Equal(other Marble) bool

Equal returns true if two Marble definitions are equal.

type Parameters added in v0.5.0

type Parameters struct {
	Files map[string]File
	Env   map[string]File
	Argv  []string
}

Parameters contains lists for files, environment variables and commandline arguments that should be passed to an application.

func (Parameters) Equal added in v1.0.0

func (p Parameters) Equal(other Parameters) bool

Equal returns true if two Parameters are equal. This checks if all Files and Env definitions are equal, and if the Argv lists are in the same order, and contain the same arguments.

type PrivateKey

type PrivateKey []byte

PrivateKey is a wrapper for a binary private key, which we need for type differentiation in the PEM encoding function.

type PublicKey

type PublicKey []byte

PublicKey is a wrapper for a binary public key, which we need for type differentiation in the PEM encoding function.

type ReservedSecrets added in v1.0.0

type ReservedSecrets struct {
	RootCA     Secret
	MarbleCert Secret
}

ReservedSecrets is a tuple of secrets reserved for a single Marble.

type Role added in v0.4.0

type Role struct {
	// ResourceType is the type of the affected resources.
	ResourceType string
	// ResourceNames is a list of names of type ResourceType.
	ResourceNames []string
	// Actions are the allowed actions for the defined resources.
	Actions []string
}

Role describes a set of actions permitted for a specific set of resources.

type Secret

type Secret struct {
	Type        string
	Size        uint
	Shared      bool
	UserDefined bool
	Cert        Certificate
	ValidFor    uint
	Private     PrivateKey
	Public      PublicKey
}

Secret defines a structure for storing certificates & encryption keys.

func (Secret) Equal added in v1.0.0

func (s Secret) Equal(other Secret) bool

Equal returns true if the two secrets are equal. This checks if the secrets are equal in all fields.

func (Secret) EqualDefinition added in v1.0.0

func (s Secret) EqualDefinition(other Secret) bool

EqualDefinition returns true if the two secrets are equal. This only checks if the secret definitions are equal, i.e. if the secrets are equal in all fields except for the actual secret data.

type SecretsWrapper added in v1.0.0

type SecretsWrapper struct {
	MarbleRun ReservedSecrets
	Secrets   map[string]Secret
}

SecretsWrapper is used to define the "MarbleRun" prefix when mentioned in a manifest.

type TLSTagEntry added in v0.3.1

type TLSTagEntry struct {
	Port              string
	Addr              string
	Cert              string
	DisableClientAuth bool
}

TLSTagEntry describes one connection which should be elevated to ttls.

func (TLSTagEntry) Equal added in v1.0.0

func (t TLSTagEntry) Equal(other TLSTagEntry) bool

Equal returns true if two TLSTagEntries are equal.

type TLStag added in v0.3.1

type TLStag struct {
	// Outgoing holds a list of all outgoing addresses that should be elevated to TLS.
	Outgoing []TLSTagEntry
	// Incoming holds a list of all incoming addresses that should be elevated to TLS.
	Incoming []TLSTagEntry
}

TLStag describes which entries should be used to determine the ttls connections of a marble.

func (TLStag) Equal added in v1.0.0

func (t TLStag) Equal(other TLStag) bool

Equal checks if two TLStags are equal.

type User added in v0.4.0

type User struct {
	// Certificate is the TLS certificate used by the user for authentication.
	Certificate string
	// Roles is a list of roles granting permissions to the user.
	Roles []string
}

User describes the attributes of a MarbleRun user.

type UserSecret added in v0.4.0

type UserSecret struct {
	Cert    Certificate
	Private PrivateKey
	Key     []byte
}

UserSecret is a secret uploaded by a user swagger:model

Jump to

Keyboard shortcuts

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