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:
Mario Minardi
2026-06-11 17:52:51 -06:00
committed by Mario Minardi
parent 317201375f
commit f368a96e01
2 changed files with 18 additions and 0 deletions
+11
View File
@@ -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{