From fc074a6b9f1e46bc3a9ecd9b28693ed183274b81 Mon Sep 17 00:00:00 2001 From: Anton Tolchanov Date: Mon, 15 Jul 2024 15:49:04 +0100 Subject: [PATCH] client/tailscale: add the nodeAttrs section This change allows ACL contents to include node attributes https://tailscale.com/kb/1337/acl-syntax#node-attributes-nodeattrs Updates tailscale/corp#20583 Signed-off-by: Anton Tolchanov --- client/tailscale/acl.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/client/tailscale/acl.go b/client/tailscale/acl.go index 1d215dcf4..48a030a8b 100644 --- a/client/tailscale/acl.go +++ b/client/tailscale/acl.go @@ -37,6 +37,16 @@ type ACLTest struct { Allow []string `json:"allow,omitempty"` // old name for accept } +// NodeAttrGrant defines additional string attributes that apply to specific devices. +type NodeAttrGrant struct { + // Target specifies which nodes the attributes apply to. The nodes can be a + // tag (tag:server), user (alice@example.com), group (group:kids), or *. + Target []string `json:"target,omitempty"` + + // Attr are the attributes to set on Target(s). + Attr []string `json:"attr,omitempty"` +} + // ACLDetails contains all the details for an ACL. type ACLDetails struct { Tests []ACLTest `json:"tests,omitempty"` @@ -44,6 +54,7 @@ type ACLDetails struct { Groups map[string][]string `json:"groups,omitempty"` TagOwners map[string][]string `json:"tagowners,omitempty"` Hosts map[string]string `json:"hosts,omitempty"` + NodeAttrs []NodeAttrGrant `json:"nodeAttrs,omitempty"` } // ACL contains an ACLDetails and metadata.