Security

IP allowlist

Limit the addresses from which your organization's keys and people can call the API.

Set an IP allowlist when your agents and people should only reach Skywake from known networks, such as your office or your own servers. Calls from any other address are refused, even with a valid key.

auth="authorization: Bearer $SKYWAKE_API_KEY"
org=$(curl -s "$SKYWAKE_URL/v2/whoami" -H "$auth" | jq -r .organization)

curl -s -X PUT "$SKYWAKE_URL/v1/orgs/$org/ip-allowlist" -H "$auth" \
  -H "content-type: application/json" -d '{"cidrs": ["127.0.0.0/8", "203.0.113.0/24"]}'

curl -s "$SKYWAKE_URL/v1/orgs/$org/ip-allowlist" -H "$auth"

curl -s -X PUT "$SKYWAKE_URL/v1/orgs/$org/ip-allowlist" -H "$auth" \
  -H "content-type: application/json" -d '{"cidrs": []}'

The example sets a list, reads it back and clears it. Its list includes 127.0.0.0/8 because it runs on the same machine as the API; yours would list your own networks. The allowlist has no v2 route, SDK call or CLI command yet, so it uses /v1, which goes away one release after v2.

You can also set it in the console under Settings → IP allowlist.

Rules

  • Entries are CIDRs such as 203.0.113.0/24 or 2001:db8::/32. A single address matches only itself. You can have up to 100 entries.
  • An empty list lets every address in. That is the default.
  • A call from any other address fails with 403 and the code ip_not_allowed. The list applies to API keys and console sessions alike.
  • If the new list leaves out the address you are setting it from, the request fails with 409. This way an admin can never lock themselves out.
  • To read or set the list, you need to be an org admin, for example with an admin key for every environment. $org is your organization's id, which GET /v2/whoami and skywake whoami show.
  • Each API server rereads the list at most every 5 seconds, so a change can take that long to reach every server.

Behind a proxy

If the API runs behind a load balancer, set SKYWAKE_API_TRUST_PROXY (api.trustProxy on the Helm chart) to the number of proxies in front of it. Then the API sees the caller's address instead of the proxy's.

The console checks people by the address of their own connection. If the console runs behind a proxy, list the proxy's addresses or CIDRs in the console's TRUSTED_PROXIES (console.trustedProxies on the Helm chart). Only then does the console read X-Forwarded-For and X-Real-IP, and it uses only the address that the nearest untrusted hop added. Without this setting, it ignores those headers when a browser sends them, and everyone seems to come from the proxy. The audit log records the same address.

Changes made in the console's live views reach the console through zero-cache, which passes on X-Forwarded-For. Add zero-cache's address to TRUSTED_PROXIES only when zero-cache itself sits behind a proxy that adds the client's address to that header. If browsers reach zero-cache directly, they could write the header themselves, so leave zero-cache out. In that case, while an allowlist is set, those changes are refused instead of being let through.

Audit

Changes to the list are recorded in the audit log as setIpAllowlist, with the new list. For the full requests and responses, see getIpAllowlist and setIpAllowlist in the API reference.

Next