Documentation
¶
Index ¶
- Constants
- func AcquireLock(dataDir, addr string) (func(), error)
- func GenerateAuthToken() (string, error)
- func ReadAuthToken(dataDir string) string
- func TokenPath(dataDir string) string
- func WarnIfDaemonActive(dataDir string, w io.Writer, languages ...i18n.Locale)
- func WriteAuthTokenFile(dataDir, token string) error
- type Client
- func (c Client) CreateLease(task string) (string, error)
- func (c Client) CreateSession(leaseID string) (string, error)
- func (c Client) CreateSnapshot(sessionID, typ, path, name string) (SnapshotCreateResponse, error)
- func (c Client) EvidenceManifest(runID string, materialize bool) (evidence.MaterializedManifest, error)
- func (c Client) Exec(sessionID string, command []string, stream bool, out io.Writer) (string, error)
- func (c Client) ExplainGraph(opts provenance.ExplainOptions) (provenance.ExplainManifest, error)
- func (c Client) ExportBatchForensics(opts forensics.BatchExportOptions) (forensics.BatchBundleInfo, error)
- func (c Client) ExportForensics(runID string) (forensics.BundleInfo, error)
- func (c Client) GraphLens(opts provenance.GraphLensOptions) (provenance.GraphLensManifest, error)
- func (c Client) ImportSignals(runID, engine string, signals []signal.EvalSignal) (signal.EvalReport, error)
- func (c Client) InspectSession(sessionID string) (control.SessionInfo, error)
- func (c Client) ListSessions() ([]control.SessionInfo, error)
- func (c Client) ObserveSummary(runID string, topN int) (observability.Summary, error)
- func (c Client) RemoveSession(sessionID string) error
- func (c Client) ResumeSnapshot(snapshotNameOrID, leaseID string) (string, error)
- func (c Client) RunBuiltinSignals(runID string) (signal.EvalReport, error)
- func (c Client) SecurityDeviations(runID string) (baseline.DeviationsReport, error)
- func (c Client) SecurityResponses(runID string) (securitymodel.ResponseActionsReport, error)
- func (c Client) SecurityRisks(runID string) (securitymodel.RiskSignalsReport, error)
- func (c Client) SetSessionCPUProfile(sessionID, profile string) error
- func (c Client) SignalContext(runID string) (signal.EvalContext, error)
- func (c Client) StopSession(sessionID string) error
- func (c Client) TelemetryAuditAssociations(ctx context.Context, opts telemetry.AuditAssociationOptions) (telemetry.AuditAssociationReport, error)
- func (c Client) TelemetryCorrelations(runID, eventID string) (telemetry.CorrelationReport, error)
- func (c Client) TelemetryProducerHealth(runID string) (telemetry.ProducerHealthReport, error)
- func (c Client) Timeline(opts provenance.TimelineOptions) (provenance.TimelineManifest, error)
- func (c Client) VerifyGraph(runID string) (provenance.VerifyResult, error)
- type LockInfo
- type Server
- type SnapshotCreateResponse
Constants ¶
const TokenFileName = "auth-token"
TokenFileName is the file (inside the data directory) that holds the daemon bearer token generated at serve startup.
Variables ¶
This section is empty.
Functions ¶
func AcquireLock ¶ added in v0.2.0
AcquireLock records that this process owns dataDir as the control daemon and returns a release func to remove the lock on shutdown. A stale lock (its pid is gone) is overwritten. The lock is advisory: it powers WarnIfDaemonActive so direct CLI writes can surface the two-writer hazard, not a hard mutex.
func GenerateAuthToken ¶ added in v0.10.1
GenerateAuthToken returns a 256-bit random token, hex encoded.
func ReadAuthToken ¶ added in v0.10.1
ReadAuthToken reads the daemon bearer token persisted by `daemon serve`. It returns "" when the file is missing or unreadable; callers treat that as "no token configured".
func TokenPath ¶ added in v0.10.1
TokenPath returns the path of the persisted daemon auth token inside dataDir.
func WarnIfDaemonActive ¶ added in v0.2.0
WarnIfDaemonActive prints a stderr warning when a live daemon owns dataDir, so a direct CLI write knows it may diverge from the daemon's in-memory state. It never blocks the command (WAL keeps the file safe; the risk is logical).
func WriteAuthTokenFile ¶ added in v0.10.1
WriteAuthTokenFile persists the daemon bearer token with 0600 permissions. An existing file is tightened to 0600 as well (os.WriteFile keeps the old mode when the file already exists).
Types ¶
type Client ¶
func NewClient ¶
NewClient builds a daemon API client. dataDir must be the data directory the target daemon serves from: the bearer token is resolved from the AGENTPROV_DAEMON_TOKEN environment variable first, then from the auth-token file `daemon serve` persists in dataDir. An empty dataDir falls back to the default ".agentprov" directory.
func (Client) CreateSnapshot ¶
func (c Client) CreateSnapshot(sessionID, typ, path, name string) (SnapshotCreateResponse, error)
func (Client) EvidenceManifest ¶
func (Client) ExplainGraph ¶
func (c Client) ExplainGraph(opts provenance.ExplainOptions) (provenance.ExplainManifest, error)
func (Client) ExportBatchForensics ¶
func (c Client) ExportBatchForensics(opts forensics.BatchExportOptions) (forensics.BatchBundleInfo, error)
func (Client) ExportForensics ¶
func (c Client) ExportForensics(runID string) (forensics.BundleInfo, error)
func (Client) GraphLens ¶ added in v0.4.0
func (c Client) GraphLens(opts provenance.GraphLensOptions) (provenance.GraphLensManifest, error)
func (Client) ImportSignals ¶
func (c Client) ImportSignals(runID, engine string, signals []signal.EvalSignal) (signal.EvalReport, error)
func (Client) InspectSession ¶
func (c Client) InspectSession(sessionID string) (control.SessionInfo, error)
func (Client) ListSessions ¶
func (c Client) ListSessions() ([]control.SessionInfo, error)
func (Client) ObserveSummary ¶
func (Client) RemoveSession ¶
func (Client) ResumeSnapshot ¶
func (Client) RunBuiltinSignals ¶
func (c Client) RunBuiltinSignals(runID string) (signal.EvalReport, error)
func (Client) SecurityDeviations ¶
func (c Client) SecurityDeviations(runID string) (baseline.DeviationsReport, error)
func (Client) SecurityResponses ¶
func (c Client) SecurityResponses(runID string) (securitymodel.ResponseActionsReport, error)
func (Client) SecurityRisks ¶
func (c Client) SecurityRisks(runID string) (securitymodel.RiskSignalsReport, error)
func (Client) SetSessionCPUProfile ¶
func (Client) SignalContext ¶
func (c Client) SignalContext(runID string) (signal.EvalContext, error)
func (Client) StopSession ¶
func (Client) TelemetryAuditAssociations ¶ added in v0.10.0
func (c Client) TelemetryAuditAssociations(ctx context.Context, opts telemetry.AuditAssociationOptions) (telemetry.AuditAssociationReport, error)
func (Client) TelemetryCorrelations ¶
func (c Client) TelemetryCorrelations(runID, eventID string) (telemetry.CorrelationReport, error)
func (Client) TelemetryProducerHealth ¶ added in v0.7.2
func (c Client) TelemetryProducerHealth(runID string) (telemetry.ProducerHealthReport, error)
func (Client) Timeline ¶
func (c Client) Timeline(opts provenance.TimelineOptions) (provenance.TimelineManifest, error)
func (Client) VerifyGraph ¶
func (c Client) VerifyGraph(runID string) (provenance.VerifyResult, error)
type LockInfo ¶ added in v0.2.0
type LockInfo struct {
PID int `json:"pid"`
Addr string `json:"addr"`
StartedAt string `json:"started_at"`
}
LockInfo records which process owns a data dir as the control daemon.
func ActiveLock ¶ added in v0.2.0
ActiveLock returns the lock info if a live daemon currently owns dataDir.
type Server ¶
type Server struct {
DB *sql.DB
Paths store.Paths
Driver runtimeplane.Driver
SampleInterval time.Duration
SampleLimit int
SampleTimeout time.Duration
RawRetention time.Duration
MaxRawSamples int
EvidenceInterval time.Duration
EvidenceLimit int
SpoolInterval time.Duration
SpoolLimit int
SpoolMaxQueued int
SpoolMaxBytes int64
SpoolMaxBatchBytes int64
SpoolDropPolicy string
GCInterval time.Duration
GCLimit int
// AuthToken, when set, requires every request except the health endpoints to carry
// `Authorization: Bearer <AuthToken>`. `daemon serve` generates a strong token into
// <data-dir>/auth-token when none is provided; empty = open and is only reachable
// via the explicit --insecure-open escape hatch.
AuthToken string
// ListenAddr also defines the optional DNS host trusted in open mode.
ListenAddr string
// IngestAllowDir confines file-path inputs of /v1/leases (task) and
// /v1/telemetry/ingest-falco (file). Empty = <data-dir>/ingest.
IngestAllowDir string
// RecordAllowShell / RecordExecTimeout feed record.Options for /v1/record:
// the execution policy of the authenticated record API. Running arbitrary
// programs for authenticated callers is the product design; these only
// control the shell wrapper form (AllowShell, default false) and the
// per-exec bound (Timeout: 0 = policy default, negative = unbounded).
RecordAllowShell bool
RecordExecTimeout time.Duration
// contains filtered or unexported fields
}