Bug 38038

Summary: Add ability for new SFTP tool to support SSH keys for accessing SFTP
Product: Koha Reporter: Liz Rea <wizzyrea>
Component: Command-line UtilitiesAssignee: Jake Deery <jake.deery>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: martin.renvoize, robin
Version: 24.05   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 35761    
Bug Blocks:    

Description Liz Rea 2024-09-30 15:56:40 UTC
Bug 36766 added a (pretty awesome!) tool for sftping files to a remote server from the command line - it would be great if it also supported using keys for authentication to sftp servers.

Our tool has something like the following, which works for us and probably would be good to add (or the like): 

  if (defined $privatekey && $secret ) { # case for has a key with a password
      $sftp = Net::SFTP::Foreign->new("$remote", more => '-v', user => "$user", key_path => "$privatekey", passphrase => "$secret", port => $port, late_set_perm => 1 );
  } elsif (defined $privatekey ) { # case for only a key
      $sftp = Net::SFTP::Foreign->new("$remote", user => "$user", key_path => "$privatekey", port => $port, late_set_perm => 1 );
  } else { # case for only username/password

      $sftp = Net::SFTP::Foreign->new("$remote", user => "$user", password => "$secret", port => $port, late_set_perm => 1 );
  }