It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

From OpenSSH 7.8 the default format RSA key pair has changed

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-----

Instead of

----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
git@bitbucket.org: 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!

1 answer

:: Sorry to kind of hijack your thread ::

Hi,

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.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Bitbucket

Contest: Share your custom Bitbucket Pipe and win

Announced in this blog, this holiday season we’re celebrating all things CI/CD and between now and the end of 2019 we’ll be showcasing content, use cases, feature announcements and more. One featur...

1,037 views 4 4
Join discussion

Community Events

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

Events near you