feat: save to remote can be authed by Kerberos
This commit is contained in:
@@ -337,10 +337,20 @@ func (a *App) runSaveRemotePipeline(pngBytes []byte) error {
|
||||
}
|
||||
slog.Info("save-remote dispatch",
|
||||
"host", cfg.SSH.Host, "user", cfg.SSH.User, "port", cfg.SSH.Port,
|
||||
"png_size", len(pngBytes))
|
||||
"auth_method", cfg.SSH.AuthMethod, "png_size", len(pngBytes))
|
||||
|
||||
// Select the uploader by auth method: Kerberos delegates to the system
|
||||
// ssh/scp binaries (reusing the kinit credential cache), while builtin
|
||||
// uses the in-process Go SSH client.
|
||||
var uploader application.SSHUploader
|
||||
if cfg.SSH.IsKerberos() {
|
||||
uploader = sshpkg.NewKerberosUploader(cfg.SSH)
|
||||
} else {
|
||||
uploader = sshpkg.NewUploader(cfg.SSH)
|
||||
}
|
||||
|
||||
svc := &application.CaptureAndSSHService{
|
||||
Uploader: sshpkg.NewUploader(cfg.SSH),
|
||||
Uploader: uploader,
|
||||
Clipboard: a.clip,
|
||||
Notifier: &runtimeNotifier{ctx: a.ctx},
|
||||
Cfg: cfg.SSH,
|
||||
@@ -446,7 +456,17 @@ func (a *App) TestConnection(cfg domain.S3Config) error {
|
||||
func (a *App) TestSSHConnection(cfg domain.SSHConfig) error {
|
||||
slog.Info("RPC TestSSHConnection",
|
||||
"host", cfg.Host, "user", cfg.User, "port", cfg.Port,
|
||||
"auth_method", cfg.AuthMethod,
|
||||
"strict_host_key", cfg.StrictHostKey, "has_password", cfg.Password != "")
|
||||
// Kerberos auth delegates to the system ssh binary (see KerberosUploader)
|
||||
// so its probe path differs from the in-process client.
|
||||
if cfg.IsKerberos() {
|
||||
if err := sshpkg.TestKerberosConnection(a.ctx, cfg); err != nil {
|
||||
slog.Error("RPC TestSSHConnection (kerberos) failed", "err", err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if err := sshpkg.TestConnection(a.ctx, cfg); err != nil {
|
||||
slog.Error("RPC TestSSHConnection failed", "err", err)
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user