Documentation
¶
Index ¶
- Constants
- func AgentCmd() *cobra.Command
- func DownloadPluginCmd() *cobra.Command
- func DownloadPolicyCmd() *cobra.Command
- func SetAgentVersion(v string)
- func SubmitEvidenceCmd() *cobra.Command
- type AgentRunner
- func (ar *AgentRunner) DownloadPlugins(ctx context.Context) error
- func (ar *AgentRunner) DownloadPolicies(ctx context.Context) error
- func (ar *AgentRunner) InstanceID() uuid.UUID
- func (ar *AgentRunner) Prefetch(ctx context.Context, cfg *agentConfig) error
- func (ar *AgentRunner) ReportStartupFailure(ctx context.Context, cfg *agentConfig, err error)
- func (ar *AgentRunner) Run(ctx context.Context) error
- func (ar *AgentRunner) SendAgentRunEvidence(ctx context.Context) error
- func (ar *AgentRunner) SendHeartbeat(ctx context.Context, staticAgentUUID uuid.UUID) error
- func (ar *AgentRunner) UpdateConfig(config *agentConfig)
- type AgentRunnerOption
- type DownloadRunner
- type PolicyDownloadRunner
Constants ¶
const AgentPluginDir = ".compliance-framework/plugins"
const AgentPolicyDir = ".compliance-framework/policies"
const AnnotationProtocolVersionKey = "org.ccf.plugin.protocol.version"
const DefaultProtocolVersion int32 = 1
const RunnerV2ProtocolVersion int32 = 2
Variables ¶
This section is empty.
Functions ¶
func DownloadPluginCmd ¶
func DownloadPolicyCmd ¶
func SetAgentVersion ¶ added in v0.9.0
func SetAgentVersion(v string)
SetAgentVersion sets the version reported in config reports. main passes the goreleaser ldflag value; "dev" (or empty) falls back to the module version for `go install` builds.
func SubmitEvidenceCmd ¶ added in v0.5.0
Types ¶
type AgentRunner ¶
type AgentRunner struct {
// contains filtered or unexported fields
}
func NewAgentRunner ¶ added in v0.1.3
func NewAgentRunner(opts ...AgentRunnerOption) *AgentRunner
func (*AgentRunner) DownloadPlugins ¶
func (ar *AgentRunner) DownloadPlugins(ctx context.Context) error
DownloadPlugins checks each item in the config and retrieves the source of the plugin building a set of unique sources. It then checks if the source is a path that exists on the filesystem, if it isn't, it will download the plugin to the filesystem.
We also update the map of plugin sources, this could be an identity map if it's a local file or maps from the URL to the local file if we downloaded a remote file.
We return any errors that occurred during the download process. TODO: What is the right error handling here?
func (*AgentRunner) DownloadPolicies ¶
func (ar *AgentRunner) DownloadPolicies(ctx context.Context) error
func (*AgentRunner) InstanceID ¶ added in v0.9.0
func (ar *AgentRunner) InstanceID() uuid.UUID
InstanceID returns the instance ID.
func (*AgentRunner) Prefetch ¶ added in v0.9.0
func (ar *AgentRunner) Prefetch(ctx context.Context, cfg *agentConfig) error
Prefetch downloads every plugin and policy source of cfg and resolves plugin protocol versions, WITHOUT touching the running configuration's pluginLocations or policyLocations. The reconciler calls it before cancelling the running configuration, so a download failure never tears down a working agent (prepare-then-cancel, R32).
func (*AgentRunner) ReportStartupFailure ¶ added in v0.9.0
func (ar *AgentRunner) ReportStartupFailure(ctx context.Context, cfg *agentConfig, err error)
ReportStartupFailure records that the configuration the agent starts with could not be downloaded, exactly as Run always has on a startup download failure: the plugins using the failed source are marked failed and the startup-failure agent evidence is sent (when agent evidence and emit_on_run_completion are enabled). The agent then exits 1.
func (*AgentRunner) SendAgentRunEvidence ¶ added in v0.6.0
func (ar *AgentRunner) SendAgentRunEvidence(ctx context.Context) error
func (*AgentRunner) SendHeartbeat ¶ added in v0.1.3
func (*AgentRunner) UpdateConfig ¶ added in v0.1.3
func (ar *AgentRunner) UpdateConfig(config *agentConfig)
type AgentRunnerOption ¶ added in v0.9.0
type AgentRunnerOption func(*AgentRunner)
AgentRunnerOption configures an AgentRunner.
func WithInstanceID ¶ added in v0.9.0
func WithInstanceID(id uuid.UUID) AgentRunnerOption
WithInstanceID sets the instance ID the heartbeat and config reports use.
type DownloadRunner ¶
type DownloadRunner struct {
// contains filtered or unexported fields
}
type PolicyDownloadRunner ¶
type PolicyDownloadRunner struct {
// contains filtered or unexported fields
}