PowerShell script exchange
Post Reply
PeqX
Novice
Posts: 9
Liked: never
Joined: Mar 08, 2020 8:30 am
Contact:

Cannot add Linux PrivateKey

Post by PeqX »

Hi Forum.
And sorry for perhaps posting this in a wrong forum
I'm trying to change our infrastructure ending up by testing a Veeam Backup & Replication 10 - 10.0.0.4461 Community edition on Windows.
But in the new instalation i cannot add the linux private key - just generated with linux PuttyGen(on Windows) - and the error is just incorrect options. which have never been a problem before doing it this way. So this not specified error message ?? i do not get.
I've tried with the following on privatekey generated from either PuttyGen(windows) or ssh-keygen(linux):
[*]with or without a password protected privatekey
[*]with or withour user password
[*]From Gui or PS
- and both are just giving the same error - so I'm not getting why this error.

Code: Select all

 Add-VBRCredentials -Type LinuxPubKey -Password "" -PrivateKeyPath $LinuxKey -v
cmdlet Add-VBRCredentials at command pipeline position 1
Supply values for the following parameters:
User: root
Add-VBRCredentials : Failed to convert SSH private key C:\Users\Backup\AppData\Local\Temp\tmp82E4.tmp
At line:1 char:1
+ Add-VBRCredentials -Type LinuxPubKey -Password "" -PrivateKeyPath $Li ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-VBRCredentials], CRegeneratedTraceException
    + FullyQualifiedErrorId : Veeam.Backup.Common.CRegeneratedTraceException,Veeam.Backup.PowerShell.Cmdlets.AddVBRCredentials
As I recall for other setup with Veeam - this is not a normally issue ? So am I doing something wrong here
nielsengelen
Product Manager
Posts: 5797
Liked: 1215 times
Joined: Jul 15, 2013 11:09 am
Full Name: Niels Engelen
Contact:

Re: Cannot add Linux PrivateKey

Post by nielsengelen »

What is that -v you have at the end? Also, is $LinuxKey the right path?

As listed in our user guide the cmdlets is:

Code: Select all

Add-VBRCredentials -Type LinuxPubKey -User user1 –Password password -PrivateKeyPath c:\temp\deneb.ppk (-Passphrase)
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Cannot add Linux PrivateKey

Post by oleg.feoktistov »

Hi and Welcome to the Community Forums!

Try saving the private key to the file with .ppk extension instead and then passing it to the corresponding cmdlet parameter.

Thanks,
Oleg
PeqX
Novice
Posts: 9
Liked: never
Joined: Mar 08, 2020 8:30 am
Contact:

Re: Cannot add Linux PrivateKey

Post by PeqX »

Hi
I was hoping to getting more info with using -v ( but not affected)
I have my key in C:\SSH\BackupPrivate.ppk - I have tried both saving with or without $LinuxKey is pointing
Testing the privatekey works fine in putty - But I cannot add the key still - also trying with your lines from guide

Code: Select all

Add-VBRCredentials -Type LinuxPubKey -User root -Password XXXXXX -PrivateKeyPath C:\SSH\BackupPrivate.ppk
Add-VBRCredentials : Failed to convert SSH private key C:\Users\Insatech Backup\AppData\Local\Temp\tmp6397.tmp
At line:1 char:1
+ Add-VBRCredentials -Type LinuxPubKey -User root -Password XXXXXXX  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-VBRCredentials], CRegeneratedTraceException
    + FullyQualifiedErrorId : Veeam.Backup.Common.CRegeneratedTraceException,Veeam.Backup.PowerShell.Cmdlets.AddVBRCre
   dentials

PS C:\Users\Backup> Add-VBRCredentials -Type LinuxPubKey -User root -PrivateKeyPath C:\SSH\BackupPrivate.ppk
cmdlet Add-VBRCredentials at command pipeline position 1
Supply values for the following parameters:
Password: XXXX
Add-VBRCredentials : Failed to convert SSH private key C:\Users\Insatech Backup\AppData\Local\Temp\tmpA20A.tmp
At line:1 char:1
+ Add-VBRCredentials -Type LinuxPubKey -User root -PrivateKeyPath C:\SS ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-VBRCredentials], CRegeneratedTraceException
    + FullyQualifiedErrorId : Veeam.Backup.Common.CRegeneratedTraceException,Veeam.Backup.PowerShell.Cmdlets.AddVBRCre
   dentials
I have tried with or without a passphrase on the kery - but makes no difference
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Cannot add Linux PrivateKey

Post by oleg.feoktistov »

I just tried to generate every type of certificate Putty offers with(out) a passphrase in my lab and it is being added fine to VBR.
It's weird that powershell exception keeps pointing to some temp files contained in your windows profile app data
even if you pass the whole other path to the cmdlet parameter.
Did you check what those files are?
PeqX
Novice
Posts: 9
Liked: never
Joined: Mar 08, 2020 8:30 am
Contact:

Re: Cannot add Linux PrivateKey

Post by PeqX »

Hi Oleg.
THe strange part in my view - is that eventhough I cleared the folder Temp in APPdata/Local - Veeam is actually NOT creating any files or anything in this folder - so I cannot tell you what the files contains - since this file --> C:\Users\Insatech Backup\AppData\Local\Temp\tmpA20A.tmp doesn't exist? The user have permission for that folder !

Eventhough I'm just getting the same error when trying to add a new privatekey - I do not get anything from logfiles - that explains why this error occurs
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Cannot add Linux PrivateKey

Post by oleg.feoktistov »

Just to clarify the behavior, did the tmp files exist before you deleted AppData/Local folder?
If they did, check if they appear again right after you generate private keys in Putty.
Thanks,
Oleg
PeqX
Novice
Posts: 9
Liked: never
Joined: Mar 08, 2020 8:30 am
Contact:

Re: Cannot add Linux PrivateKey

Post by PeqX »

Hi Oleg
Yes as I recall the files where in the Temp dir before emptying this

When testing both from PSConsole and GUI - still fails - but no file are created under Temp during this creation of the user.
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Cannot add Linux PrivateKey

Post by oleg.feoktistov »

Hi @PeqX,

Currently discussing your issue with QA.
Could your please share VeeamPowershell.log contained in C:\ProgramData\Veeam\Backup folder?

Thanks,
Oleg
PeqX
Novice
Posts: 9
Liked: never
Joined: Mar 08, 2020 8:30 am
Contact:

Re: Cannot add Linux PrivateKey

Post by PeqX »

Hi Oleg.
Sound greaty - and sorry for the late answer - but got in quarantine carse Covid-19

I have shared the logfile ( as txt) here --> https://www.webmeup.dk/wp-content/uploa ... rShell.txt

Looking forward to your answer

P
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Cannot add Linux PrivateKey

Post by oleg.feoktistov »

Hi,

We tested it with QA. Here is the workflow:
When specifying private key path in either New Credential Wizard or Add-VBRCredentials cmdlet,
VBR uses Putty SSHKeyConverter tool to create a tmp file in current user's profile TMP folder
and then convert it to openssh type.
The problem is that puttygencli component cannot parse the private key path specified for further conversion
because there is a space in a tmp file full path. In your case, in your username - Insatech Backup. So, puttygencli
treats C:\Users\Insatech Backup\AppData\Local\Temp\*.tmp as two separate paths divided by space.
There are two workarounds:
- Login to the machine, which hosts VBR console and Powershell snap-in, using username with no spaces.
Thus, the value of TMP variable won't contain any spaces.
- Change the value of TMP environmental variable for current user to something without spaces (e.g. C:\ProgramData).


Meanwhile, we are going to test it with other VBR versions and let you know the outcome.

Best regards,
Oleg
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Cannot add Linux PrivateKey

Post by oleg.feoktistov » 1 person likes this post

Additionally tested in V9.5 u4b and V9.5 u3a. The issue remains the same.
Addressed as a bug to fix in further releases.
Thanks!
Oleg
PeqX
Novice
Posts: 9
Liked: never
Joined: Mar 08, 2020 8:30 am
Contact:

Re: Cannot add Linux PrivateKey

Post by PeqX »

Hi Oleg - Confirming its working witjout space in USERNAME. :-) I'm very happy !
jcyanquen
Novice
Posts: 4
Liked: never
Joined: Jun 30, 2021 4:10 pm
Full Name: Juan C Yanquen
Contact:

Re: Cannot add Linux PrivateKey

Post by jcyanquen »

Hi I have the same error here. Currently working in Support Case #04912629

I'm using Veeam Backup & Replication v11. My windows username has no spaces on it, so it might be a different Issue.

GUI and PS are not clear about what is causing the error. Just a pop up window saying "Failed to parse private key file"

Any ideas?

JC
PeqX
Novice
Posts: 9
Liked: never
Joined: Mar 08, 2020 8:30 am
Contact:

Re: Cannot add Linux PrivateKey

Post by PeqX »

Hi JC
Just for clarify - the path to the key does not contain spaces - like C:\My Keys\sshkey - this could also be the issue!
After changing the path and username iit'll work for me
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Cannot add Linux PrivateKey

Post by oleg.feoktistov »

Hi Juan,

Cannot say from the top of my head if the cause is the same or not. I see you uploaded the logs to your case. So, let's wait for the engineer to have look at them. Will monitor the case closely.

Thanks,
Oleg
jcyanquen
Novice
Posts: 4
Liked: never
Joined: Jun 30, 2021 4:10 pm
Full Name: Juan C Yanquen
Contact:

Re: Cannot add Linux PrivateKey

Post by jcyanquen »

Hi :

Support help me finding the cause: I generated the key using Windows PuTTYgen Release 0.75, and the PPK version is 3. So, it seems VBR v11 don't understand this "newer" version and gave the generic error "Failed to parse private key file". Saving the PPK file again using version 2 solved my (initial) problem.

Now the issue is different, but I think it would be better to write in a different thread.

Thanks
JC
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Cannot add Linux PrivateKey

Post by oleg.feoktistov »

Hi Juan,

Thanks for the follow-up. Glad our engineers could help you!

Best regards,
Oleg
Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot] and 17 guests