New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autoconvert vagrant key #15
Comments
I would love to see a pull request that adds this functionality. It would save a bit of time. It may be better to wait until hashicorp/vagrant#2608 is released as part of Vagrant 1.7 |
Unfortunately, I still can't read Ruby code to understand where Vagrant plugin interface ends and where PuTTY interface begins. |
+1. I also thought about it as I now use Vagrant 1.7 and converting the key to PPK for every vagrant box is very awkward. |
At least the plugin already looks for the ppk beside the auto generated key of Vagrant 1.7:
So only the automatic conversion step is needed. I found this: http://webdevbyjoss.blogspot.de/2012/04/convert-openssh-keys-to-putty-on-linux.html
but there is a popup window:
It seems that puttygen.exe does not handle these command line options. Any ideas? |
This doesn't sound good:
So puttygen on Unix is not puttygen on Windows due to the GUI behaviour of C programs on Windows.This is a bit tricky, but solveable AFAIK. But then a PR or whatever is needed for the PuTTY gen project. Another idea is to convert the SSH key to PPK natively with Ruby. We don't need everything of puttygen, just this conversion step. Perhaps this code might help as a starting point: http://www.example-code.com/ruby/ssh_ppk_to_pem.asp |
I am totally open to this. I'll do some research when I can. I am open to a PR for this. |
I had a closer look at the Ruby gem chilkat. But rubygems.org is right, there is only a Mac and Linux version of it, but none for Windows. The platform we have the need for PuTTY conversion most. I even checked it on a Windows machine with following command: C:\Users\vagrant>vagrant plugin install chilkat
Installing the 'chilkat' plugin. This can take a few minutes...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:
Could not find gem 'chilkat (>= 0) x86-mingw32' in the gems available on this machine. So it seems that it is nearly impossible to find a solution for Windows that is easier than helping the PuTTY team eg. reading id_rsa natively (as there is a conversion routine linked into puttygen.exe) or give the puttygen.exe the same command line option as for the Linux version. For Mac and Linux there both is the chilkat gem, but also the command line tool puttygen. |
So, I looked into that a bit and managed to get a rough solution working:
See https://bitbucket.org/fk/putty; there's a prebuilt version of I guess I'll have to present this to PuTTY upstream and see how that turns out before opening a pull request; in case the binary name has to change for example. Still, if you need this feature right now, you can have it. |
@fkrull Great approach! So if it is possible to build the command line tool on Windows to do the conversion, there should be also a way to integrate that into the puttygen.exe. I'll have a look at your branch. |
@fkrull thnx, works like a charm. Can you create pull request for this feature? |
Sorry, that took longer than I planned, but I've now hit up the PuTTY guys to see if we can get this change upstreamed. I'll create a pull request when that is cleared up. |
Thanks for the follow up on this. |
I can't really spend any more time chasing after PuTTY, so I opened a pull request now: #19. |
I've created a library called PuTTY::Key that can handle the conversion of private keys to PuTTY's .ppk format. This requires only the Ruby OpenSSL standard library - it has no dependency on PuTTY or any of its related tools. As an alternative to pull request #19, I've opened pull request #20 to handle automatic conversion using PuTTY::Key. This avoids the requirement for a new |
This has been pushed! Thanks for this!! https://rubygems.org/gems/vagrant-multi-putty/versions/1.5.0 |
Works out of the box. Thank you very much! |
Thx, it works! |
This is awesome! Vagrant is useful again! Thanks all!!! |
If it is possible for plugin to have its own data then autoconverting a vagrant key to ppk will save a lot of time for many people.
The text was updated successfully, but these errors were encountered: