Documentation ¶
Overview ¶
package modules allows external packages override certain behavioral aspects of teleport
Index ¶
- Constants
- func SetModules(m Modules)
- func SetTestModules(t *testing.T, testModules *TestModules)
- func ValidateResource(res types.Resource) error
- type Features
- type Modules
- type TestModules
- func (m *TestModules) AttestHardwareKey(ctx context.Context, obj interface{}, policy keys.PrivateKeyPolicy, ...) (keys.PrivateKeyPolicy, error)
- func (m *TestModules) BuildType() string
- func (m *TestModules) Features() Features
- func (m *TestModules) IsBoringBinary() bool
- func (m *TestModules) PrintVersion()
Constants ¶
const ( // BuildOSS specifies open source build type BuildOSS = "oss" // BuildEnterprise specifies enterprise build type BuildEnterprise = "ent" )
Variables ¶
This section is empty.
Functions ¶
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 ¶
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
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
type TestModules ¶
type TestModules struct { // TestBuildType is returned from the BuiltType function. TestBuildType string // TestFeatures is returned from the Features function. TestFeatures Features MockAttestHardwareKey func(_ context.Context, _ interface{}, policy keys.PrivateKeyPolicy, _ *keys.AttestationStatement, _ crypto.PublicKey, _ time.Duration) (keys.PrivateKeyPolicy, error) // 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(ctx context.Context, obj interface{}, policy keys.PrivateKeyPolicy, as *keys.AttestationStatement, pk crypto.PublicKey, d 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