mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 00:49:03 +00:00
**Related issue:** Resolves #34330 # Checklist for submitter If some of the following don't apply, delete the relevant line. - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files) for more information. - [x] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements) ## Testing - [x] Added/updated automated tests - [x] QA'd all new/changed functionality manually (so far just macOS) ## fleetd/orbit/Fleet Desktop - [x] Verified compatibility with the latest released version of Fleet (see [Must rule](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/workflows/fleetd-development-and-release-strategy.md)) - [x] Verified that fleetd runs on macOS, Linux and Windows <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a built-in mcp_listening_servers table to discover MCP servers by inspecting listening ports and probing endpoints; returns process info, server metadata, capabilities, tools, prompts, and resources (supports macOS, Windows, Linux). * **Tests** * Added comprehensive unit tests covering detection, IPv6 handling, SSE responses, and session lifecycle. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
58 lines
1.5 KiB
Go
58 lines
1.5 KiB
Go
//go:build windows
|
|
|
|
package table
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/fleetdm/fleet/v4/orbit/pkg/table/bitlocker_key_protectors"
|
|
cisaudit "github.com/fleetdm/fleet/v4/orbit/pkg/table/cis_audit"
|
|
mdmbridge "github.com/fleetdm/fleet/v4/orbit/pkg/table/mdm"
|
|
"github.com/fleetdm/fleet/v4/orbit/pkg/table/windowsupdatetable"
|
|
"github.com/rs/zerolog/log"
|
|
"golang.org/x/sys/windows/registry"
|
|
|
|
"github.com/osquery/osquery-go"
|
|
"github.com/osquery/osquery-go/plugin/table"
|
|
)
|
|
|
|
func PlatformTables(_ PluginOpts) ([]osquery.OsqueryPlugin, error) {
|
|
plugins := []osquery.OsqueryPlugin{
|
|
// Fleet tables
|
|
table.NewPlugin("cis_audit", cisaudit.Columns(), cisaudit.Generate),
|
|
|
|
bitlocker_key_protectors.TablePlugin(log.Logger),
|
|
|
|
windowsupdatetable.TablePlugin(windowsupdatetable.UpdatesTable, log.Logger), // table name is "windows_updates"
|
|
}
|
|
|
|
windowsServer, err := IsWindowsServer()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
if !windowsServer {
|
|
plugins = append(plugins, table.NewPlugin("mdm_bridge", mdmbridge.Columns(), mdmbridge.Generate))
|
|
}
|
|
|
|
return plugins, nil
|
|
}
|
|
|
|
func IsWindowsServer() (bool, error) {
|
|
k, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Windows NT\CurrentVersion`, registry.QUERY_VALUE)
|
|
if err != nil {
|
|
return false, fmt.Errorf("windows server check: %w", err)
|
|
}
|
|
defer k.Close()
|
|
|
|
s, _, err := k.GetStringValue("InstallationType")
|
|
if err != nil {
|
|
return false, fmt.Errorf("windows server check: %w", err)
|
|
}
|
|
|
|
if s == "Server" {
|
|
return true, nil
|
|
}
|
|
|
|
return false, nil
|
|
}
|