From dfb605db4a6ad9ca512a24bdeaa60809a66796e9 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 3 Jun 2026 19:04:30 -0700 Subject: [PATCH] cmd/ssh-auth-none-demo: update SSH demo a bit Per chat with an SSH client author who wanted a URL in the output. And then make it more clear what parts are banners. Updates #cleanup Change-Id: If5033ad9dc0dba3d833f24ea39e117a455010492 Signed-off-by: Brad Fitzpatrick --- cmd/ssh-auth-none-demo/ssh-auth-none-demo.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/ssh-auth-none-demo/ssh-auth-none-demo.go b/cmd/ssh-auth-none-demo/ssh-auth-none-demo.go index a2cd3acd2..4f4262d9f 100644 --- a/cmd/ssh-auth-none-demo/ssh-auth-none-demo.go +++ b/cmd/ssh-auth-none-demo/ssh-auth-none-demo.go @@ -86,19 +86,20 @@ func main() { if cm.User() == "banners" { totalBanners = 5 } + for banner := 2; banner <= totalBanners; banner++ { time.Sleep(time.Second) if banner == totalBanners { - spac.SendAuthBanner(fmt.Sprintf("# Banner%d: access granted at %v\r\n", banner, time.Since(start))) + spac.SendAuthBanner(fmt.Sprintf("# Final banner saying access granted (+%v)\r\n", time.Since(start).Round(time.Millisecond))) } else { - spac.SendAuthBanner(fmt.Sprintf("# Banner%d at %v\r\n", banner, time.Since(start))) + spac.SendAuthBanner(fmt.Sprintf("# Another banner saying we're still waiting for auth server-side (+%v)\r\n", time.Since(start).Round(time.Millisecond))) } } return nil, nil }, BannerCallback: func(cm ssh.ConnMetadata) string { log.Printf("Got connection from user %q, %q from %v", cm.User(), cm.ClientVersion(), cm.RemoteAddr()) - return fmt.Sprintf("# Banner for user %q, %q\n", cm.User(), cm.ClientVersion()) + return fmt.Sprintf("# Example URL in auth bannner for %q, %q: https://github.com/tailscale/tailscale\r\n", cm.User(), cm.ClientVersion()) }, } }, @@ -136,6 +137,8 @@ func handleSessionPostSSHAuth(s gliderssh.Session) { } }() + fmt.Fprintf(s, "We're past auth phase now. Goodbye in ...\n") + for i := 10; i > 0; i-- { fmt.Fprintf(s, "%v ...\n", i) time.Sleep(time.Second)