mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-25 19:21:18 -08:00
cmd/tailscale/cli: synthesize tag:bp//<id> for join's authkey exchange
HookResolveAuthKey requires a non-empty tag set on the OAuth-client- secret to auth-key exchange (see feature/oauthkey/oauthkey.go), but "tailscale join" intentionally omits --advertise-tags: the blueprint owns the node's tag set. The join command therefore hit the hook's "oauth authkeys require --advertise-tags" rejection before the auth key was ever requested from the control plane. Fill the tag in at the join call site from the resolved blueprint id: the auto-generated tag for blueprint <id> is "tag:bp//<id>" (see tailcfg.BlueprintTagNamespacePrefix), which is exactly the AuthTag the paired OAuth client server-side is scoped to. The hook accepts the request and the existing scope-mismatch validator on the corp side catches any later drift. Updates #cleanup Signed-off-by: Kabir Sikand <[email protected]>
This commit is contained in:
1 parent
2d93449efa
commit
a3467e680f
1 file changed
+9
-3
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/peterbourgon/ff/v3/ffcli"
|
||||
"tailscale.com/internal/client/tailscale"
|
||||
"tailscale.com/ipn"
|
||||
"tailscale.com/tailcfg"
|
||||
"tailscale.com/util/clientmetric"
|
||||
)
|
||||
|
||||
@@ -159,9 +160,14 @@ func runJoin(ctx context.Context, args []string, ja *joinArgsT) (retErr error) {
|
||||
authKey := ja.authKey
|
||||
if f, ok := tailscale.HookResolveAuthKey.GetOk(); ok {
|
||||
// The OAuth-client-secret -> auth-key exchange. The exchange
|
||||
// itself validates the secret against the blueprint's paired
|
||||
// client server-side.
|
||||
authKey, err = f(ctx, ja.authKey, prefs.AdvertiseTags)
|
||||
// validates the secret against the blueprint's paired client
|
||||
// server-side, which is itself scoped to "tag:bp//<id>"; we
|
||||
// synthesize that tag from the blueprint id here so the hook,
|
||||
// which requires a non-empty tag set, accepts the request
|
||||
// without --advertise-tags (a flag join intentionally does
|
||||
// not expose, because the blueprint owns the node's tags).
|
||||
bpTag := "tag:" + tailcfg.BlueprintTagNamespacePrefix + id
|
||||
authKey, err = f(ctx, ja.authKey, []string{bpTag})
|
||||
if err != nil {
|
||||
return fmt.Errorf("exchanging OAuth client secret for auth key: %w", err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user