Connect by SSH tunneling
Posted: Thu 23 Jan 2014 17:08
Hello,
I want to connect to a MySQL database through SSH tunnel in the way that the SSH user would log in with a private key with passthrase.
I have a problem with this: If I want to convert the key to pem format for EntityFramework, the passthrase can be anything, it lets me login to the server. I wouldn't like it to be so. What I would like is that my code should contain the passthrase for the sake of higher safe. So far, If anyone could obtain the key, he could login to the server using SSH. That's the reason why I wouldn't like that.
What I did so far is the following:
On Linux server:
ssh-keygen -t rsa
I specify a passthrase when required.
Of course, I copy the public key into the file named authorized_keys .
I convert the rsa file to pem.
openssl rsa -in id_rsa -outform pem > server.key
This is the time when such a pem file is created that somehow contains the passthrase, because it is enough to replace the keys in order my client programs to login.
How should i convert my id_rsa file generated by ssh-keygen so that EntityFramework could use the key file and passthrase password when connecting?
Thank you in advance.
Best regards,
Imre
I want to connect to a MySQL database through SSH tunnel in the way that the SSH user would log in with a private key with passthrase.
I have a problem with this: If I want to convert the key to pem format for EntityFramework, the passthrase can be anything, it lets me login to the server. I wouldn't like it to be so. What I would like is that my code should contain the passthrase for the sake of higher safe. So far, If anyone could obtain the key, he could login to the server using SSH. That's the reason why I wouldn't like that.
What I did so far is the following:
On Linux server:
ssh-keygen -t rsa
I specify a passthrase when required.
Of course, I copy the public key into the file named authorized_keys .
I convert the rsa file to pem.
openssl rsa -in id_rsa -outform pem > server.key
This is the time when such a pem file is created that somehow contains the passthrase, because it is enough to replace the keys in order my client programs to login.
How should i convert my id_rsa file generated by ssh-keygen so that EntityFramework could use the key file and passthrase password when connecting?
Thank you in advance.
Best regards,
Imre