ssh/tailssh: dissallow purely numeric usernames for SSH
Dissallow purely numeric usernames for SSH as these are ambiguous with numeric UID values. Updates https://github.com/tailscale/corp/issues/43245 Signed-off-by: Mario Minardi <mario@tailscale.com>
This commit is contained in:
committed by
Mario Minardi
parent
317201375f
commit
f368a96e01
@@ -831,6 +831,17 @@ func TestSSHAuthFlow(t *testing.T) {
|
||||
authErr: true,
|
||||
wantBanners: []string{`tailscale: tailnet policy does not permit you to SSH as user "alice"` + "\n"},
|
||||
},
|
||||
{
|
||||
name: "digit-only-username",
|
||||
sshUser: "321",
|
||||
state: &localState{
|
||||
sshEnabled: true,
|
||||
varRoot: varRoot,
|
||||
matchingRule: bobRule,
|
||||
},
|
||||
authErr: true,
|
||||
wantBanners: []string{`tailscale: rejecting username "321". Usernames that consist of only digits are not allowed as they are ambiguous with numerical UIDs` + "\n"},
|
||||
},
|
||||
{
|
||||
name: "accept",
|
||||
state: &localState{
|
||||
|
||||
Reference in New Issue
Block a user