OpenSSH updates its default RSA key format, let's get prepared!
With versions of OpenSSH 7.8 and above, the private key file will start with
-----BEGIN OPENSSH PRIVATE KEY-----
----BEGIN RSA PRIVATE KEY-----
The work around is to specify the format to the old PEM when generating the keys:
ssh-keygen -m PEM -t rsa -b 4096
The new format isn't currently compatible in the Access keys of a Bitbucket repository.
When I tried to connect to a repository using a key pair generated with
ssh-keygen -t rsa -b 4096
I go this error from the Bitbucket server:
Load key ".ssh/id_rsa": invalid format
email@example.com: Permission denied (publickey).
Quote from the release note of openSSH 7.8:
ssh-keygen write OpenSSH format private keys by default instead of using OpenSSL's PEM format. The OpenSSH format, supported in OpenSSH releases since 2014 and described in the PROTOCOL.key file in the source distribution, offers substantially better protection against offline password guessing and supports key comments in private keys. If necessary, it is possible to write old PEM-style keys by adding "-m PEM" to ssh-keygen's arguments when generating or updating a key.
The version 7.8 is currently on Arch Linux but when it will hit the main distributions Ubuntu, Fedora, Debian it might create a lot of confusion.
Bitbucket should try to be compatible beforehand. Or in the meantime update the command line documentations to use the "-m PEM".
I hope this will help!
:: Sorry to kind of hijack your thread ::
Adding this comment only to let future searchers eventually find it quicker.
This problema also affects bamboo when adding SSH/RSA key to access bitbucket (or other) repositories over ssh connection.
If you create the SSH/RSA key with key-gen without the "-m PEM" parameter, you'll not be able to use the key in bamboo (at least as of version 6.8.1)
After creating the shared credential with the SSH/RSA Key, when you try to test the repository access, you'll get a error message as:
"Cannot decode connection params" (Testing Repository SSH connection from bamboo to bitbucket or github).
If you follow the instructions of Romain in this post, it will work.
Thanks Romain, for pointing it out.
Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster ! While we’re all excited about the new improvements to Bitbucket ...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events