Hi, all. Is it possible to get a `Error: GET /api/...
# fleet
j
Hi, all. Is it possible to get a
Error: GET /api/latest/fleet/version received status 400 unknown
if I don't hold the right role to perform the task? Trying to apply a policy to a Team via the CLI and I'm a 'Maintainer'.
Pretty sure my API key is all good in the config file.
and my default address is set to the correct domain
d
You can POST to the
policies
endpoint that you are a Team Maintainer of. Can you share the command that you are running? Are you sure you have the correct TeamID?
j
I get that error from doing things I can normally do in the GUI too like getting a list of teams
fleetctl apply -f "./fleet-policy-cis-win10.yml" --policies-team Windows
TeamID is correct
d
Can you try this syntax:
Copy code
fleetctl apply -f ./fleet-policy-cis-win10.yml --policies-team Windows
j
Same error 🤔 this is being run in the same directory as the yaml file too.
d
you probably don't need the "./" if you're in the directory already
j
Same error. I'll try getting a new token but I'm pretty sure the config file is all good.
Yeah, refreshed the API token and added
--context default
and still received the same error.
d
lets try from another angle (eliminate fleetctl and your yaml) by executing this curl:
Copy code
curl --location 'https://<your fleetserver>/api/v1/fleet/teams/<your team id>/policies' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your token>' \
--data '{
  "name": "Gatekeeper enabled",
  "query": "SELECT 1 FROM gatekeeper WHERE assessments_enabled = 1;",
  "description": "Checks if gatekeeper is enabled on macOS devices",
  "resolution": "Resolution steps",
  "platform": "darwin"
}'
j
Copy code
<html>
<head><title>400 No required SSL certificate was sent</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<center>No required SSL certificate was sent</center>
<hr><center>nginx</center>
</body>
</html>
d
Do you have a proxy setup?
j
Just realised that might be the issue. I'll sort on my end, thanks!