mirror of
https://github.com/fleetdm/fleet
synced 2026-05-22 16:39:01 +00:00
#18808 Added the new `sofa_security_release_info` and `sofa_unpatched_cves` tables from `macadmins/osquery-extension` 1.0.1 These tables do not have detailed documentation in macadmins repo, so not adding documentation at this point. # Checklist for submitter <!-- Note that API documentation changes are now addressed by the product design team. --> - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://fleetdm.com/docs/contributing/committing-changes#changes-files) for more information. - [x] Manual QA for all new/changed functionality - For Orbit and Fleet Desktop changes: - [x] Manual QA must be performed in the three main OSs, macOS, Windows and Linux. - [x] Auto-update manual QA, from released version of component to new version (see [tools/tuf/test](../tools/tuf/test/README.md)).
62 lines
1.7 KiB
Go
62 lines
1.7 KiB
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
"time"
|
|
|
|
"github.com/cenkalti/backoff/v4"
|
|
orbittable "github.com/fleetdm/fleet/v4/orbit/pkg/table"
|
|
"github.com/osquery/osquery-go"
|
|
)
|
|
|
|
var (
|
|
socket = flag.String("socket", "", "Path to the extensions UNIX domain socket")
|
|
timeout = flag.Int("timeout", 3, "Seconds to wait for autoloaded extensions")
|
|
interval = flag.Int("interval", 3, "Seconds delay between connectivity checks")
|
|
// verbose must be set because osqueryd will set it on the extension when running in verbose mode.
|
|
_ = flag.Bool("verbose", false, "Enable verbose informational messages")
|
|
)
|
|
|
|
func main() {
|
|
flag.Parse()
|
|
|
|
if *socket == "" {
|
|
log.Fatalf(`Usage: %s -socket SOCKET_PATH`, os.Args[0])
|
|
}
|
|
|
|
serverTimeout := osquery.ServerTimeout(
|
|
time.Second * time.Duration(*timeout),
|
|
)
|
|
serverPingInterval := osquery.ServerPingInterval(
|
|
time.Second * time.Duration(*interval),
|
|
)
|
|
|
|
var server *osquery.ExtensionManagerServer
|
|
backOff := backoff.WithMaxRetries(backoff.NewConstantBackOff(time.Millisecond*200), 25) // retry once per 200ms for 25 times == 5 seconds
|
|
op := func() error {
|
|
s, err := osquery.NewExtensionManagerServer("com.fleetdm.fleetd_tables.osquery_extension.v1", *socket, serverTimeout, serverPingInterval)
|
|
if err != nil {
|
|
return fmt.Errorf("error creating extension: %w", err)
|
|
}
|
|
server = s
|
|
return nil
|
|
}
|
|
|
|
err := backoff.Retry(op, backOff)
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
|
|
plugins := orbittable.OrbitDefaultTables()
|
|
opts := orbittable.PluginOpts{
|
|
Socket: *socket,
|
|
}
|
|
plugins = append(plugins, orbittable.PlatformTables(opts)...)
|
|
server.RegisterPlugin(plugins...)
|
|
if err := server.Run(); err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
}
|