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 <anton@tailscale.com>
This commit is contained in:
Anton Tolchanov 2024-07-15 15:49:04 +01:00 committed by Anton Tolchanov
parent 014bf25c0a
commit fc074a6b9f
1 changed files with 11 additions and 0 deletions

View File

@ -37,6 +37,16 @@ type ACLTest struct {
Allow []string `json:"allow,omitempty"` // old name for accept 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. // ACLDetails contains all the details for an ACL.
type ACLDetails struct { type ACLDetails struct {
Tests []ACLTest `json:"tests,omitempty"` Tests []ACLTest `json:"tests,omitempty"`
@ -44,6 +54,7 @@ type ACLDetails struct {
Groups map[string][]string `json:"groups,omitempty"` Groups map[string][]string `json:"groups,omitempty"`
TagOwners map[string][]string `json:"tagowners,omitempty"` TagOwners map[string][]string `json:"tagowners,omitempty"`
Hosts map[string]string `json:"hosts,omitempty"` Hosts map[string]string `json:"hosts,omitempty"`
NodeAttrs []NodeAttrGrant `json:"nodeAttrs,omitempty"`
} }
// ACL contains an ACLDetails and metadata. // ACL contains an ACLDetails and metadata.