repos / pico

pico services mono repo
git clone https://github.com/picosh/pico.git

commit
c7655a6
parent
e9d74c8
author
Eric Bower
date
2025-01-11 08:23:16 -0500 EST
fix(pico): use ssh shared public key auth mechanism
1 files changed,  +5, -5
M pico/ssh.go
+5, -5
 1@@ -27,10 +27,6 @@ import (
 2 	"github.com/picosh/utils"
 3 )
 4 
 5-func authHandler(ctx ssh.Context, key ssh.PublicKey) bool {
 6-	return true
 7-}
 8-
 9 func createRouter(cfg *shared.ConfigSite, handler *UploadHandler, cliHandler *CliHandler) proxy.Router {
10 	return func(sh ssh.Handler, s ssh.Session) []wish.Middleware {
11 		return []wish.Middleware{
12@@ -75,10 +71,14 @@ func StartSshServer() {
13 		DBPool: dbpool,
14 	}
15 
16+	sshAuth := shared.NewSshAuthHandler(dbpool, logger, cfg)
17 	s, err := wish.NewServer(
18 		wish.WithAddress(fmt.Sprintf("%s:%s", host, port)),
19 		wish.WithHostKeyPath("ssh_data/term_info_ed25519"),
20-		wish.WithPublicKeyAuth(authHandler),
21+		wish.WithPublicKeyAuth(func(ctx ssh.Context, key ssh.PublicKey) bool {
22+			sshAuth.PubkeyAuthHandler(ctx, key)
23+			return true
24+		}),
25 		withProxy(
26 			cfg,
27 			handler,