modules

package
v1.2.3-fred.8 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: Apache-2.0 Imports: 15 Imported by: 105

Documentation

Overview

package modules allows external packages override certain behavioral aspects of teleport

Index

Constants

View Source
const (
	// BuildOSS specifies open source build type
	BuildOSS = "oss"
	// BuildEnterprise specifies enterprise build type
	BuildEnterprise = "ent"
)

Variables

This section is empty.

Functions

func SetModules

func SetModules(m Modules)

SetModules sets the modules interface

func SetTestModules

func SetTestModules(t *testing.T, testModules *TestModules)

SetTestModules sets the value returned from GetModules to testModules and reverts the change in the test cleanup function. It must not be used in parallel tests.

func TestWithFakeModules(t *testing.T) {
   modules.SetTestModules(t, &modules.TestModules{
     TestBuildType: modules.BuildEnterprise,
     TestFeatures: modules.Features{
        Cloud: true,
     },
   })

   // test implementation

   // cleanup will revert module changes after test completes
}

func ValidateResource

func ValidateResource(res types.Resource) error

ValidateResource performs additional resource checks.

Types

type Features

type Features struct {
	// Kubernetes enables Kubernetes Access product
	Kubernetes bool
	// App enables Application Access product
	App bool
	// DB enables database access product
	DB bool
	// OIDC enables OIDC connectors
	OIDC bool
	// SAML enables SAML connectors
	SAML bool
	// AccessControls enables FIPS access controls
	AccessControls bool
	// AdvancedAccessWorkflows enables advanced access workflows
	AdvancedAccessWorkflows bool
	// Cloud enables some cloud-related features
	Cloud bool
	// HSM enables PKCS#11 HSM support
	HSM bool
	// Desktop enables desktop access product
	Desktop bool
}

Features provides supported and unsupported features

func (Features) ToProto

func (f Features) ToProto() *proto.Features

ToProto converts Features into proto.Features

type Modules

type Modules interface {
	// PrintVersion prints teleport version
	PrintVersion()
	// IsBoringBinary checks if the binary was compiled with BoringCrypto.
	IsBoringBinary() bool
	// Features returns supported features
	Features() Features
	// BuildType returns build type (OSS or Enterprise)
	BuildType() string
	// AttestHardwareKey attests a hardware key and returns its associated private key policy.
	AttestHardwareKey(context.Context, interface{}, keys.PrivateKeyPolicy, *keys.AttestationStatement, crypto.PublicKey, time.Duration) (keys.PrivateKeyPolicy, error)
}

Modules defines interface that external libraries can implement customizing default teleport behavior

func GetModules

func GetModules() Modules

GetModules returns the modules interface

type TestModules

type TestModules struct {
	// TestBuildType is returned from the BuiltType function.
	TestBuildType string
	// TestFeatures is returned from the Features function.
	TestFeatures Features
	// contains filtered or unexported fields
}

TestModules implements the Modules interface for testing.

Setting Test* fields will return those values from interface methods. IsBoringBinary and PrintVersion functions return the same values from default modules.

See SetTestModules for an example.

func (*TestModules) AttestHardwareKey

func (m *TestModules) AttestHardwareKey(_ context.Context, _ interface{}, policy keys.PrivateKeyPolicy, _ *keys.AttestationStatement, _ crypto.PublicKey, _ time.Duration) (keys.PrivateKeyPolicy, error)

AttestHardwareKey attests a hardware key.

func (*TestModules) BuildType

func (m *TestModules) BuildType() string

BuildType returns build type (OSS or Enterprise).

func (*TestModules) Features

func (m *TestModules) Features() Features

Features returns supported features.

func (*TestModules) IsBoringBinary

func (m *TestModules) IsBoringBinary() bool

IsBoringBinary checks if the binary was compiled with BoringCrypto.

func (*TestModules) PrintVersion

func (m *TestModules) PrintVersion()

PrintVersion prints teleport version

Jump to

Keyboard shortcuts

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