tailcfg: add recorders field to SSHRule struct

This change introduces the Recorders field to the SSHRule struct. The
field is used to store and define addresses where the ssh recorder is
located.

Signed-off-by: Charlotte Brandhorst-Satzkorn <charlotte@tailscale.com>
This commit is contained in:
Charlotte Brandhorst-Satzkorn 2023-03-21 12:29:24 -07:00 committed by Tom
parent 812025a39c
commit 3efd83555f
3 changed files with 9 additions and 0 deletions

View File

@ -1948,6 +1948,10 @@ type SSHRule struct {
// Action is the outcome to task. // Action is the outcome to task.
// A nil or invalid action means to deny. // A nil or invalid action means to deny.
Action *SSHAction `json:"action"` Action *SSHAction `json:"action"`
// Recorders defines the destinations of the SSH session recorders.
// The recording will be uploaded to http://addr:port/record.
Recorders []netip.AddrPort `json:"recorders"`
} }
// SSHPrincipal is either a particular node or a user on any node. // SSHPrincipal is either a particular node or a user on any node.

View File

@ -375,6 +375,7 @@ func (src *SSHRule) Clone() *SSHRule {
dst.Action = new(SSHAction) dst.Action = new(SSHAction)
*dst.Action = *src.Action *dst.Action = *src.Action
} }
dst.Recorders = append(src.Recorders[:0:0], src.Recorders...)
return dst return dst
} }
@ -384,6 +385,7 @@ func (src *SSHRule) Clone() *SSHRule {
Principals []*SSHPrincipal Principals []*SSHPrincipal
SSHUsers map[string]string SSHUsers map[string]string
Action *SSHAction Action *SSHAction
Recorders []netip.AddrPort
}{}) }{})
// Clone makes a deep copy of SSHPrincipal. // Clone makes a deep copy of SSHPrincipal.

View File

@ -873,12 +873,15 @@ func (v SSHRuleView) Action() *SSHAction {
return &x return &x
} }
func (v SSHRuleView) Recorders() views.Slice[netip.AddrPort] { return views.SliceOf(v.ж.Recorders) }
// A compilation failure here means this code must be regenerated, with the command at the top of this file. // A compilation failure here means this code must be regenerated, with the command at the top of this file.
var _SSHRuleViewNeedsRegeneration = SSHRule(struct { var _SSHRuleViewNeedsRegeneration = SSHRule(struct {
RuleExpires *time.Time RuleExpires *time.Time
Principals []*SSHPrincipal Principals []*SSHPrincipal
SSHUsers map[string]string SSHUsers map[string]string
Action *SSHAction Action *SSHAction
Recorders []netip.AddrPort
}{}) }{})
// View returns a readonly view of SSHPrincipal. // View returns a readonly view of SSHPrincipal.