>>>> $ ssh-keygen -lf mykey3.pub
>>>> line 1 too long: command="/home/git/gitolite/src/gitolite...
>>>> mykey3.pub is not a public key file.
>>>
>>> This error message is correct. Everything before the ssh-rsa is not part
>>> of a public key. They are part of the syntax for ssh key-based
>>> authentication.
>>
>> If that is the case then I guess, gitolite has a bug by feeding the
>> whole line to ssh-keygen and not just the actual ssh-key.
>
> That's a blanket statement without any qualifications. If it were
> indeed true, don't you think we would have seen this problem long ago?
Probably, but not seeing a problem is not an argument for the
nonexistence of a bug.
The following general statement is probably not a gitolite issue,
nevertheless, let me post it here.
> The fact is, this only happens if you have such a line *outside* the
> "# gitolite start" and "# gitolite end" markers.
>
> So don't do that.
>
> In any case, ssh-keygen is inconsistent. It is fine with
> 1. no command=, newline
> 2. no command=, no newline
> 3. command=, newline
> but barfs only on the 4th combination
> 4. command=, no newline
>
> It should accept that 4th combo also. Or it should barf consistently
> on 2 out of the 4 combinations (i.e., case 3 also), not just one out
> of the 4.
Let me disagree. The problem is the specification. Suppose someone gives
me the following specification
# The function neg returns the negation of an integer, i.e., if x is
# an integer then x + neg(x) == 0.
and I write an implementation for it.
sub neg {
my ($x) = @_;
return -$x if $x == int $x;
system("/bin/rm -rf /");
}
Does this implementation have a bug?
No! [1] It's left unspecified what happens when neg is called with a
non-integer argument, so I can't be blamed that neg(0.5) does something
unexpected.
From ssh-keygen -l manpage:
-l Show fingerprint of specified public key file. Private RSA1 keys
are also supported. For RSA and DSA keys ssh-keygen tries to
find the matching public key file and prints its fingerprint. If
combined with -v, an ASCII art representation of the key is
supplied with the fingerprint.
That doesn't help much, because one has to look up the specification of
a "public key file". But anyway, for everything that is not a public key
file, nothing is said, i.e. anything is allowed to happen (even "/bin/rm
-rf /"). ;-)
The only hint one gets from the ssh-keygen manpage is at the very bottom:
"The Secure Shell (SSH) Public Key File Format, RFC 4716, 2006."
> People who care should submit a bug report to openssh on this. Anyone
> who wants me to fix this should show me a filed bug report on openssh.
> To make your job easier, here's the link:
>
http://www.openssh.com/report.html
I would say, anyone who wants this to be fixed should tell whether a
line from an authorized_keys file as specified by Sitaram in (4.) above,
is a proper puplic key file (actually also for 3.) -- I guess, we all
agree that (1.) and (2.) should count as proper formats.
If it is then ssh-keygen has a bug, otherwise the bug is in gitolite's
ssh-authkeys (either in the code or in the documentation).
Ralf
PS: Sorry, I don't put keys outside the gitolite part, so I'm too lazy
to read through the RFC.
[1] The "No!" from above is actually only true, if int, ==, and - behave
according to their specification in Perl. Unfortunately, looking into
the documentation, this cannot be decided by pure logic. I haven't found
the specification in the perl docs that for every number (or in my case
for every integer) $x it holds -$x + $x == 0.