You are not logged in.

#1 2017-05-30 10:17:08

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 341

[SOLVED] Adding ssh key to account results in "SSH key is invalid"

I created an SSH key pair as per https://wiki.archlinux.org/index.php/Ar … Repository, but when I try to copy & paste the public key to my AUR account page I get the message:
The SSH public key is invalid.

Any idea what I might be doing wrong?

Last edited by pgoetz (2017-06-05 10:27:47)

Offline

#2 2017-05-30 11:50:35

bulletmark
Member
From: Brisbane, Australia
Registered: 2013-10-22
Posts: 653

Re: [SOLVED] Adding ssh key to account results in "SSH key is invalid"

The public key has to be on one line. Suspecting this error, I just inserted a line break in the middle of mine and see the same message.

Offline

#3 2017-05-31 09:43:15

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 341

Re: [SOLVED] Adding ssh key to account results in "SSH key is invalid"

bulletmark wrote:

The public key has to be on one line.

I'm using the Mate terminal to copy and paste the public key, and have noticed that I appear to get random line breaks now and again.  However in this case I copied the key from the Accounts SSH Public Key text form field (that is being declared invalid) and pasted into a vi session.  There are no line breaks in what I pasted, which indicates no line breaks in the form field, either.  Looking at the repasted and saved file (and the original public key) using octal dump

od -a id_rsa_aur.pub

There is a new line (nl) character at the end of the file, but this was generated by ssh-keygen, so is presumably valid.

Offline

#4 2017-05-31 10:20:41

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,525
Website

Re: [SOLVED] Adding ssh key to account results in "SSH key is invalid"

The generated public key contains the key itself followed by a user@host.  The user@host part should not be pasted into the AUR page - if it is inclued it will generate this error.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2017-05-31 21:46:58

bulletmark
Member
From: Brisbane, Australia
Registered: 2013-10-22
Posts: 653

Re: [SOLVED] Adding ssh key to account results in "SSH key is invalid"

Trilby wrote:

The generated public key contains the key itself followed by a user@host.  The user@host part should not be pasted into the AUR page - if it is inclued it will generate this error.

Maybe the developers have already fixed this since you posted but when I add anything to the end of my key it automatically and silently gets removed when you press the update button.

Offline

#6 2017-05-31 21:55:53

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,525
Website

Re: [SOLVED] Adding ssh key to account results in "SSH key is invalid"

You're correct bulletmark - I'm pretty sure I had an error previously from this, but now any excess is trimmed from the key.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2017-06-02 13:46:49

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 341

Re: [SOLVED] Adding ssh key to account results in "SSH key is invalid"

Trilby wrote:

The generated public key contains the key itself followed by a user@host.  The user@host part should not be pasted into the AUR page - if it is inclued it will generate this error.

So, I removed the pgoetz@frog from the end of the public key and am still getting the The SSH public key is invalid. error message.  Copying the key from the text field to a vi session indicates there are no line breaks in what I pasted.  Further, I followed the instructions from the AUR Wiki page more or less precisely to generate  the key:

$ cd .ssh
$ ssh-keygen -f id_rsa_aur

Any other ideas?  Maybe my default key size setting is too short?  I can't imagine that the name of the key matters, but in any case in my first attempt I copied the instructions from the wiki exactly and still got the same error message.

It would be helpful to know what the web form is doing to check the validity of the key.

Last edited by pgoetz (2017-06-02 13:49:50)

Offline

#8 2017-06-02 17:05:48

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] Adding ssh key to account results in "SSH key is invalid"

https://git.archlinux.org/aurweb.git/tr … c.php#n855

It's really not doing much... anything that contains a valid key type followed by a space followed by some text will be accepted (and later, the zeroth and first " "-separated array elements will be saved into your account settings). Are you using a valid key type?

FWIW, if you had posted the public key you were trying to use in the first place, it would be easier to figure out what is wrong with it. It isn't dangerous to post your public key -- the worst that can happen is someone maliciously gives you permission to SSH into their computer. tongue

Last edited by eschwartz (2017-06-02 17:07:54)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#9 2017-06-05 10:26:48

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 341

Re: [SOLVED] Adding ssh key to account results in "SSH key is invalid"

Eschwartz wrote:

FWIW, if you had posted the public key you were trying to use in the first place, it would be easier to figure out what is wrong with it. It isn't dangerous to post your public key -- the worst that can happen is someone maliciously gives you permission to SSH into their computer. tongue

Doh!  Sorry, for some reason this didn't occur to me, and thanks for the suggestion.  I finally got the form to accept the key by opening the file in vi and copy/pasting each line (vi line breaking) individually into the form.  My mistake was looking for newline and/or carriage return characters in the paste output when in fact it's just space characters (sp in od -a) that are being inserted.  I noticed this while trying to paste the key into this response (see below):

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9XbA2yIKTvtivpmKqYzvAFLYQC74ale3i2y9m+   MhFBBi6FQGYmYxqVW/hxC4+mckxHK4rX/IdSJGL8CwZJ/yMjt8D3Jsy0k/ghnN1+mVw0Ay4+        b6cEOL8flZJGY0yak6EHypD6izN5FHfx/ALQ+GlIO7xki90h/KPpb4BrfIROSCdi6rV2x+          RKRdpVIj7A60WN9E9eim/TLaSAoOc94JSp7JVv5dW4zuxIO/                                jBvdkuxCTCoLYWL6a5ja61iMrUSuiDvgNpNaD9R1ndFtgjAlmyn4Ns3kMByfkmbYP44bAwj5l2FrTTFtknAGCaarb1BkE33QeBCXi43H7Zb/MTv+h pgoetz@frog

I'm not sure if the Mate terminal app is responsible for this or if it's a window manager paste buffer thing, but man is it frustrating.

Marking this as solved.  And to confirm, I left the pgoetz@frog thing in the form field, and it accepted the key with no issues.

Offline

Board footer

Powered by FluxBB