For years I have been using a line like this to automatically create an SSH key pair without a passphrase:
/usr/bin/ssh-keygen -q -b 1024 -N "" -C "vagrant@labman01" -f keys/labkey
I typically call ssh-keygen from an Ansible play and then proceed to provision the key to a number of vagrant guest machines when creating a lab environment.
However, since upgrading to MacOS Mojave (10.14.2) the generated key is later reported as invalid by Ansible on the Linux guests, and attempting to use the key manually on the Linux guest causes a prompt for a passphrase, as if the private key is password protected.
Doing the same on any Linux host machine, however, creates a valid key.
Is there some new trick to generate a valid, password free key pair on MacOS Mojave?
When examining the generated key file, I noticed that MacOS Mojave uses
-----BEGIN OPENSSH PRIVATE KEY----- instead of
-----BEGIN RSA PRIVATE KEY----- as the PEM header. Same thing for the footer.
There appears to be a change in the key format on OpenSSH 7.8 and later. Simply changing the header does not fix the problem.