mirror of
https://github.com/juanfont/headscale.git
synced 2025-11-20 01:40:21 -05:00
policy: reproduce 2863 in test
reproduce that if a user does not exist, the ssh policy ends up empty Updates #2863 Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
committed by
Kristoffer Dalby
parent
28faf8cd71
commit
a28d9bed6d
@@ -1353,6 +1353,55 @@ func TestSSHPolicyRules(t *testing.T) {
|
||||
},
|
||||
}},
|
||||
},
|
||||
{
|
||||
name: "2863-allow-predefined-missing-users",
|
||||
targetNode: taggedClient,
|
||||
peers: types.Nodes{&nodeUser2},
|
||||
policy: `{
|
||||
"groups": {
|
||||
"group:example-infra": [
|
||||
"user2@",
|
||||
"not-created-yet@",
|
||||
],
|
||||
},
|
||||
"tagOwners": {
|
||||
"tag:client": [
|
||||
"user2@"
|
||||
],
|
||||
},
|
||||
"ssh": [
|
||||
// Allow infra to ssh to tag:example-infra server as debian
|
||||
{
|
||||
"action": "accept",
|
||||
"src": [
|
||||
"group:example-infra"
|
||||
],
|
||||
"dst": [
|
||||
"tag:client",
|
||||
],
|
||||
"users": [
|
||||
"debian",
|
||||
],
|
||||
},
|
||||
],
|
||||
}`,
|
||||
wantSSH: &tailcfg.SSHPolicy{Rules: []*tailcfg.SSHRule{
|
||||
{
|
||||
Principals: []*tailcfg.SSHPrincipal{
|
||||
{NodeIP: "100.64.0.2"},
|
||||
},
|
||||
SSHUsers: map[string]string{
|
||||
"debian": "debian",
|
||||
},
|
||||
Action: &tailcfg.SSHAction{
|
||||
Accept: true,
|
||||
AllowAgentForwarding: true,
|
||||
AllowLocalPortForwarding: true,
|
||||
AllowRemotePortForwarding: true,
|
||||
},
|
||||
},
|
||||
}},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
||||
Reference in New Issue
Block a user