mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
19f995d3b5
This removes policy information from `GET /api/_version_/fleet/device/{token}` from non-premium Fleet instances. Starting the server with `./build/fleet serve --dev --dev_license` ```bash $ curl -s https://localhost:8080/api/latest/fleet/device/1804e808-171f-4dda-9bec-f695b2f2371a | jq '.host.policies // "not present"' [ { "id": 3, "name": "Antivirus healthy (Linux)", "query": "SELECT score FROM (SELECT case when COUNT(*) = 2 then 1 ELSE 0 END AS score FROM processes WHERE (name = 'clamd') OR (name = 'freshclam')) WHERE score == 1;", "description": "Checks that both ClamAV's daemon and its updater service (freshclam) are running.", "author_id": 1, "author_name": "Roberto", "author_email": "test@example.com", "team_id": null, "resolution": "Ensure ClamAV and Freshclam are installed and running.", "platform": "darwin,linux", "created_at": "2022-05-23T20:53:36Z", "updated_at": "2022-06-03T13:17:42Z", "response": "" } ] ``` Starting the server with `./build/fleet serve --dev` ```bash $ curl -s https://localhost:8080/api/latest/fleet/device/1804e808-171f-4dda-9bec-f695b2f2371a | jq '.host.policies // "not present"' "not present" ```
22 lines
667 B
Go
22 lines
667 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/fleetdm/fleet/v4/server/fleet"
|
|
)
|
|
|
|
func (svc *Service) GetHost(ctx context.Context, id uint, opts fleet.HostDetailOptions) (*fleet.HostDetail, error) {
|
|
// reuse GetHost, but include premium details
|
|
opts.IncludeCVEScores = true
|
|
opts.IncludePolicies = true
|
|
return svc.Service.GetHost(ctx, id, opts)
|
|
}
|
|
|
|
func (svc *Service) HostByIdentifier(ctx context.Context, identifier string, opts fleet.HostDetailOptions) (*fleet.HostDetail, error) {
|
|
// reuse HostByIdentifier, but include premium options
|
|
opts.IncludeCVEScores = true
|
|
opts.IncludePolicies = true
|
|
return svc.Service.HostByIdentifier(ctx, identifier, opts)
|
|
}
|