Skip to content

feat(gateway): Admit CONNECT-IP devices by bearer token - #34

Draft
kprabhak wants to merge 1 commit into
feat/token-claimsfrom
feat/token-admission
Draft

kprabhak wants to merge 1 commit into
feat/token-claimsfrom
feat/token-admission

Conversation

@kprabhak

Copy link
Copy Markdown

Summary

A device that holds only a key and a token, with nothing registered for it, cannot join a VPC network today because the gateway admits only configured grants.

With the new optional token admission configuration, a request that matches no grant is admitted when its bearer token passes the issuer checks. The device gets the address Connect derives for it and only the configured routes, for as long as its connection stays open, even past the token's expiry.

Without that configuration the gateway behaves as before.

Depends on

Stacked on the token claims pull request. It also needs the Connect preview 28 pull request and a Connect revision with the admission callback. Its end-to-end check uses a device built with Connect's bearer token pull request.

Test plan

  • A device with a valid token joins and reaches the configured routes, and nothing else
  • A refused token creates no interface, and an empty issuer list refuses every token while static grants keep working
  • A token's ID is spent only once its session starts
  • Format, lint and tests pass

Related to datum-cloud/enhancements#883, datum-cloud/enhancements#916 and milo-os/milo#930

A device that holds only a key and a token, with no Connector or
binding registered for it, cannot join a VPC network today: the
gateway admits only the grants in its configuration.

Add an optional token_admission section to the IP configuration. When
it is present, the gateway answers CONNECT-IP requests that match no
grant through Connect's admission callback. The request must carry
"Proxy-Authorization: Bearer <token>" for the configured network, and
the token must pass the issuer checks. The device then gets the
address Connect derives for that project, network and pair of keys,
the configured routes, and no peer routes. The grant lasts for that
session, and a token's ID is spent only when its session starts. The
session lasts until its connection closes: the token's expiry does
not end it.

Routes must be 1 to 32 IPv6 prefixes that do not overlap and do not
cover fd00::/8, where device addresses are derived. A device whose
address falls inside a route is refused. An empty issuer list is
valid and refuses every token, while static grants keep working.
Each admission is logged when its session starts, with the issuer,
subject, token ID and expiry, never the token. Without the section,
the gateway behaves as before.

Raise CONNECT_REV to a Connect revision with the admission callback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant