## Overview `dibble` is a one-stop CLI for seeding a Fleet server with test data — users, teams, policies, reports, labels, scripts, MDM profiles, software, secrets, CAs, and vulns — replacing ~8 ad-hoc seeding tools with a single binary. It makes it easy to: - **Spin up a populated dev/test server in one command** — `dibble all` plants everything with sensible, idempotent defaults. - **Skip the flag-memorization** — running `dibble` with no args launches an interactive wizard that prompts for Fleet URL, API token, theme, and which entities to seed, and offers to save the config to `~/.dibble.yaml`. - **Seed individual entity types** — `dibble users`, `dibble teams`, `dibble policies`, etc., when you only need one slice. - **Get themed, recognizable test data** — pick a theme (hitchhikers, tng, lotr, ghibli, parksrec, …) so seeded names are easy to eyeball in the UI. Hosts are intentionally out of scope — `cmd/osquery-perf` still owns that. `dibble hosts` is a thin convenience wrapper that picks a fleet, fetches its enroll secret, and prints/runs the osquery-perf invocation for you. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Dibble: a CLI tool to seed realistic test data, including an interactive wizard and subcommands for teams/users/software/policies/scripts/reports/profiles/labels/activities/enroll-secrets/hosts/vulns, plus theme-driven “cas” and “ping”. * Theme system: multiple curated themes to generate consistent seeded identities, policies, software, labels, and scripts. * **Chores** * Ignored the built dibble binary and added a Makefile build target to compile the dibble tool. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
45 lines
1.7 KiB
Go
45 lines
1.7 KiB
Go
package command
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/fleetdm/fleet/v4/tools/dibble/pkg/seed"
|
|
)
|
|
|
|
// newCAsCmd wires `dibble cas`. The seeder writes directly to MySQL,
|
|
// bypassing the service layer so we don't need a real SCEP / DigiCert /
|
|
// NDES / EST endpoint for URL validation. Names are prefixed with "*" so
|
|
// reviewers can tell at a glance that the CA is dibble-planted and won't
|
|
// actually issue certificates (encrypted secret columns are NULL).
|
|
func newCAsCmd() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "cas",
|
|
Short: "Seed fake certificate authorities directly into MySQL (non-idempotent)",
|
|
Long: `Seed fake certificate authorities directly into MySQL. Each batch writes
|
|
one row for each of: custom_scep_proxy, custom_est_proxy, digicert, hydrant,
|
|
smallstep. A single NDES row is inserted at the start of the run (Fleet
|
|
hardcodes the NDES name and only allows one).
|
|
|
|
Encrypted secret columns are left NULL — the CAs list cleanly in the UI but
|
|
any request_certificate call against them will fail, which is the point.
|
|
|
|
Names are prefixed with "*" plus a per-run tag so seeded rows are obvious
|
|
and don't collide across runs.`,
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
dsn, _ := cmd.Flags().GetString("dsn")
|
|
count, _ := cmd.Flags().GetInt("count")
|
|
res := seed.CAs(context.Background(), seederLogger{}, seed.CAOptions{
|
|
DSN: dsn,
|
|
Count: count,
|
|
})
|
|
printf("%s", res.Summary())
|
|
return reportErrors(res.Errors)
|
|
},
|
|
}
|
|
cmd.Flags().String("dsn", "fleet:insecure@tcp(localhost:3306)/fleet", "MySQL DSN")
|
|
cmd.Flags().Int("count", 1, "Number of batches; each batch writes one row per non-NDES CA type")
|
|
return cmd
|
|
}
|