MCPcopy
hub / github.com/tailscale/tailscale / TestClientAuthNone

Function TestClientAuthNone

tempfork/sshtest/ssh/client_auth_test.go:572–599  ·  view source on GitHub ↗

Test if username is received on server side when NoClientAuth is used

(t *testing.T)

Source from the content-addressed store, hash-verified

570
571// Test if username is received on server side when NoClientAuth is used
572func TestClientAuthNone(t *testing.T) {
573 user := "testuser"
574 serverConfig := &ServerConfig{
575 NoClientAuth: true,
576 }
577 serverConfig.AddHostKey(testSigners["rsa"])
578
579 clientConfig := &ClientConfig{
580 User: user,
581 HostKeyCallback: InsecureIgnoreHostKey(),
582 }
583
584 c1, c2, err := netPipe()
585 if err != nil {
586 t.Fatalf("netPipe: %v", err)
587 }
588 defer c1.Close()
589 defer c2.Close()
590
591 go NewClientConn(c2, "", clientConfig)
592 serverConn, err := newServer(c1, serverConfig)
593 if err != nil {
594 t.Fatalf("newServer: %v", err)
595 }
596 if serverConn.User() != user {
597 t.Fatalf("server: got %q, want %q", serverConn.User(), user)
598 }
599}
600
601// Test if authentication attempts are limited on server when MaxAuthTries is set
602func TestClientAuthMaxAuthTries(t *testing.T) {

Callers

nothing calls this directly

Calls 8

AddHostKeyMethod · 0.95
InsecureIgnoreHostKeyFunction · 0.85
netPipeFunction · 0.85
NewClientConnFunction · 0.85
newServerFunction · 0.85
FatalfMethod · 0.65
CloseMethod · 0.65
UserMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…