How to convert generated Private Key in Openssh format to integrate subversion in IDEA IDE - intellij-idea

I needed to generate a private/public key that is in openssh format to have me integrate subversion repository to IntelliJ. I have used puttyKeygen.exe already to generate a initial key. But while integrating in IntelliJ, its failing me to authenticate with a same Private key.
How can I convert the Putty generated private/public initial key to an openssh format. As I read, that the Subversion integration in IntelliJ uses the Cygwin/openssh format of the private key.
P.S: I have tried puTTykeygen to do the same but no luck! IDEA IDE still fails to authenticate.
Anyone who can shed some light on it would be really helpful.
Thanks!
EDIT
After going through the following steps to create an Openssh private key :
puttygen has a menu: Conversion -> Export OpenSSH Key That will save the private key to the openssh format.
I have again tried integrating the IDEA using the same key that got generated using above mentioned direction. and got myself failed with the same message saying authentication failed!
I am assuming, the key I obtained is either not openssh format or is there anything I am proceeding wrong with a integration. Could anyone please let me know what possibly could be the reason of me not able to integrate subversion in IDEA?

Make sure the initial keys that are put to use are one time generated not repeatedly.
Go to Puttykeygen-> conversions-> import the private key(.ppk file) you have generated initially and then-> export openssh key-> save it to the same location and then go to IDEA and follow the below steps:
1. Go to Version control-> Checkout from Version Control-> Subversion and provide the same key and your passphrase.
2. click checkout by providing your username.
It should work!

Related

Unable to get public/private key authentication working for Azure Spring Cloud Config Server

I am having difficulty setting up my Config Server in Azure Spring Cloud using a Github repo as backend. I have it working using basic authentication where I create a token in Github which is fine for my experiments but this is not suitable for production.
I have set up my public key in Github and tested whether my setup is correct by using the following command, in essence cloning the repo using a specific private key:
GIT_SSH_COMMAND='ssh -i ../azure_id_rsa -o IdentitiesOnly=yes' git clone git#github.my-account/azure-config-server.git
Locally this works just fine so this seems to confirm that my setup in Github is correct and using the private key I should be able to clone the repo in Azure you would think.
However, if I then follow the instructions as described here in the official Azure documentation to set up my config server using the GUI, I get the following error:
Failed to update Config Server.
Reason: Fail to update config server due to 'Health check timeout with 10 minutes'.
So I tried using the "Import settings" option by uploading a yaml file. I have used this Azure template where I then paste my private key using the "private-key" section (and yes, the casing for Azure needs to be like that, according to the Azure documentation they only support the properties using hyphens rather than camel casing) as described here in the Spring documentation
But I consistently get the same error so I would think that there is something wrong with my setup but my options are exhausted. If anyone has any pointers it would be much appreciated.
Ok, I figured it out, just posting my answer here in case it helps someone. I just noticed the one difference between my private key and the one mentioned in the Spring example. My private key started with "-----BEGIN OPENSSH PRIVATE KEY-----" whereas in the Spring documentation it starts with "-----BEGIN RSA PRIVATE KEY-----". In other words it expects it to be in the pem format rather than the OpenSSH format.
So I now got it to work by generating my key as follows (where the noteworthy flag is the "-m pem"):
ssh-keygen -t rsa -m pem -b 4096 -C "my#email.com"
And then when I set up my public key in Github and pasted my private key in Azure Config Server it actually worked.
Hope this helps save someone some time as it cost me quite some figuring out.

Can't connect to SFTP (with private key file) in Copy Data Tool

I am trying to copy data from SFTP to blob but got stuck when creating SFTP source.
I have the connection details and can easily connect on Filezilla or WinSCP. However, I am unable to get it to work in Azure data factory.
I am not using code but the user interface.
The connection details on the page creating the SFTP source:
Connect via integration runtime: AutoResolveIntegrationRuntime (default)
Host: xyz
Port: 22 (can't remove it as it doesn't like it)
SSH Host Key Validation: Enable SSH Host Key Validation
SSH Host Key Finger-print: taken from WinSCP - Session - Server/protocol information
Authentication type: SSH Public Key Authentication -can't use basic as the private key holds the security info
User name:XXX
Private Key Type: Use Key Content
Private key content: loaded the .ppk file, tried also tried loading the .pem file and got different errors
Pass Phrase: none
When setting up this sftp in WinSCP or FileZilla it automatically converted the provided .pem file into .ppk.
When I loaded the .ppk file into ADF I got an error: Invalid Sftp credential provided for 'SshPublicKey' authentication type.
When I loaded the .pem file I got: Meet network issue when connect to Sftp server 'spiderftp.firstgroup.com', SocketErrorCode: 'TimedOut'.
I have also tried 'Disable SSH Host Key Validation' in SSH Host Key Validation and made no difference.
I have also opened the .ppk file in PuttyGen and used that host key finger print and still no luck.
Only getting these 2 errors depending on which file I load.
Can't find anything about this online so would be grateful for some advice.
Have you read this note in this doc?
https://learn.microsoft.com/en-us/azure/data-factory/connector-sftp#using-ssh-public-key-authentication
SFTP connector supports RSA/DSA OpenSSH key. Make sure your key file content starts with "-----BEGIN [RSA/DSA] PRIVATE KEY-----". If the private key file is a ppk-format file, please use Putty tool to convert from .ppk to OpenSSH format.
Got this working today. Like you, could connect using WinSCP and failed when using ADF.
The link Fang Liu shared contains our answers, but my issue was not the private key. I suspect Fang's suggestion resolved your problem and I'm sharing my answer here to help others who may encounter similar.
My issue:
When using Private Key Authentication in ADF the password becomes a Pass Phrase and you no longer have the ability to supply a password. To overcome the problem we disabled password authentication for the user and the SFTP connection started working.
As stated in the documentation. The Pass Phrase is used to decrypt the private key if it is encrypted.
Also worth noting:
If you store the contents of the private key in Key Vault you need
to base64 encode the entire contents of the exported key and use
that string. This includes "-----BEGIN RSA PRIVATE KEY-----" and the
end. The same applies if you want to paste the value into the
textbox of the SFTP linked service edit screen.
I did not try to manually edit the JSON of the Linked Service to explicitly provide a password and this could be workaround for someone to test if they are unable to disable the password.
I used PuTTYGen to export the PPK to a private key and had the same fingerprint issue too so I just disabled cert validation. Funnily you can use the fingerprint provided by the error and it passes validation so not sure where the bug lies. :-)

SFTP - From WinSCP to Terminal Access

I have been able to set up SSH access to my Google Cloud Platform VM via SFTP using WinSCP, but I now wish to do the same using another VM.
I have tried the ssh-keygen -t rsa , ssh-copy-id demo#198.51.100.0 method but always come up against the "Permission denied (public key)" error which from researching seems to be a pretty widespread issue with few reliable fixes (all the ones I tried didn't work).
I used PuttyGen to create the public and private key, and inserted the public key onto the server just through GCP settings, adding it under the SSH settings for my instance.
I am just confused on what to do with the private key when simply trying to sftp through the terminal on a separate VM, as before I would load the private key into WinSCP settings. Is there a folder I need to place it in or?
Regarding your first issue of "Permission denied (public key)" error, please follow the troubleshooting in this link and this.
About your other question of "what to do with the private key when simply trying to sftp through the terminal", that depends on the settings of the specific the 3rd party SFTP tool you are using. To locate the locations of SSH key after generating them, please review this document.
Once you have added the public key in the VM, you would need to boot the VM for public key to take effect. Try rebooting it and try

Multiple computers with same ssh Private and Public keys

I have about 12 computers with exactly same specs. These are used for my PoS on my business.
I am creating a customized Ubuntu ISO to improve installation time and automate things.
One issue I am facing is OpenSSH-server generated keys (Pub and private), must be generated after installation through command ssh-keygen ...
However, I have to pass explicit and plain-text password, which I would like to avoid.
I would like to know if I can share same private and public keys to everyone, so that I can remote connect on them?
In this way, I can generate keys only once and seed it through post-script installation using pressed.
One issue I am facing is OpenSSH-server generated keys (Pub and private), must be generated after installation through command ssh-keygen...
They are generated after the installation for a reason. And that reason is certainly that they should not go to anyone else (from there is the private word). But they are Host keys.
However, I have to pass explicit and plain-text password, which I would like to avoid.
Why? You can store your public key on them and you would be still able to connect with your private key, which will be still safe.
I would like to know if I can share same private and public keys to everyone, so that I can remote connect on them? In this way, I can generate keys only once and seed it through post-script installation using preseed.
You can, but it is certainly not advised and fail-prone technique possibly leading to the compromised security.

SSH Public Keys not working against CloudBees Repositories

I'm trying to use git as my repository, and I keep getting the error: Permission denied (publickey).
I've tried generating keys on my computer and placing the generated key in my cloudbees account as well as my known_hosts file.
I've also tried adding the key listed in the Jenkins job that I created in my known_hosts, and I'm still unable to connect.
I'm not really sure how to obtain the correct key or how/where to go about placing the key in the correct places.
Any help would be much appreciated.
Thanks,
Danny
There are a couple of things to try shown at http://wiki.cloudbees.com/bin/view/DEV/Git+-+Getting+Started#HTroubleshooting
That being said, it sounds like you're new to SSH, and the commands in the above FAQ may not help.
Generally speaking you will generate a public and private key pair. The public key (~/.ssh/id_rsa.pub / ~/.ssh/id_dsa.pub) will be pasted into GrandCentral as shown in the link above.