Check SSH keys at time of running launchpad login and provide informative error messages if something is wrong

Bug #332019 reported by Keith Hughitt
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Low
Unassigned

Bug Description

When attempting to grab a branch on a new machine, I first used the launchpad-login command to specify my username, which appeared to work fine. Next, I tried to fetch a branch, but was greeted with the following error message:

$ bzr branch lp:myproject
Permission denied (publickey).
bzr: ERROR: Connection closed: please check connectivity and permissions (and try -Dhpss if further diagnosis is required)

It says publickey sort of in passing, but what I paid most attention to was the suggestions in the error message: "check connectivity and permissions..."

So in order to try and get more details I tried running the command with the suggested arguments:

$ bzr branch lp:myproj -Dhpss
Permission denied (publickey).
bzr: ERROR: exceptions.AttributeError: 'ProtocolThreeDecoder' object has no attribute '_in_buffer'

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 857, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 797, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 499, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/builtins.py", line 840, in run
    from_location)
  File "/usr/lib/python2.5/site-packages/bzrlib/bzrdir.py", line 878, in open_tree_or_branch
    bzrdir = klass.open(location)
  File "/usr/lib/python2.5/site-packages/bzrlib/bzrdir.py", line 756, in open
    return BzrDir.open_from_transport(t, _unsupported=_unsupported)
  File "/usr/lib/python2.5/site-packages/bzrlib/bzrdir.py", line 798, in open_from_transport
    return format.open(transport, _found=True)
  File "/usr/lib/python2.5/site-packages/bzrlib/bzrdir.py", line 1725, in open
    return self._open(transport)
  File "/usr/lib/python2.5/site-packages/bzrlib/bzrdir.py", line 2605, in _open
    return remote.RemoteBzrDir(transport)
  File "/usr/lib/python2.5/site-packages/bzrlib/remote.py", line 76, in __init__
    response = self._client.call('BzrDir.open', path)
  File "/usr/lib/python2.5/site-packages/bzrlib/smart/client.py", line 111, in call
    result, protocol = self.call_expecting_body(method, *args)
  File "/usr/lib/python2.5/site-packages/bzrlib/smart/client.py", line 124, in call_expecting_body
    method, args, expect_response_body=True)
  File "/usr/lib/python2.5/site-packages/bzrlib/smart/client.py", line 72, in _call_and_read_response
    expect_body=expect_response_body)
  File "/usr/lib/python2.5/site-packages/bzrlib/smart/message.py", line 258, in read_response_tuple
    self._wait_for_response_args()
  File "/usr/lib/python2.5/site-packages/bzrlib/smart/message.py", line 224, in _wait_for_response_args
    self._read_more()
  File "/usr/lib/python2.5/site-packages/bzrlib/smart/message.py", line 243, in _read_more
    self._protocol_decoder._in_buffer[:10],
AttributeError: 'ProtocolThreeDecoder' object has no attribute '_in_buffer'

bzr 1.6.1 on python 2.5.2 (linux2)
arguments: ['/usr/bin/bzr', 'branch', 'lp:myproj', '-Dhpss']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_US.UTF-8'
plugins:
  avahi /usr/lib/python2.5/site-packages/bzrlib/plugins/avahi [0.3.0dev0]
  bzrtools /usr/lib/python2.5/site-packages/bzrlib/plugins/bzrtools [1.6.0]
  dbus /usr/lib/python2.5/site-packages/bzrlib/plugins/dbus [unknown]
  gtk /usr/lib/python2.5/site-packages/bzrlib/plugins/gtk [0.95.0]
  launchpad /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad [unknown]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.

----------

Again, not very helpful (to me).

After searching around the web some I found someone with a similar error message (https://answers.edge.launchpad.net/launchpad/+question/56842) and they were told to check their SSH keys. Sure enough, I had forgotten to add my public key for the new machine. Add the public key fixed the problem right away.

So my request is:

Would it be possible to

1) Check the ssh key at the time the user uses the command "launchpad-login" and display a simple message "e.g. You have not yet added a public ssh key for this machine. etc," and

 2) Provide a more informative message when the user tries to do some other action?

Both of these would be very helpful :)

Revision history for this message
Andrew Bennetts (spiv) wrote :

I think there may be a bug already for 1. It may even already be fixed in a newer release of bzr?

Part 2 is a bug that has definitely been fixed in subsequent releases of bzr.

Revision history for this message
anatoly techtonik (techtonik) wrote :

1. Is not fixed for sure. launchpad-login doesn't check for validity of ssh key. It only checks that the user name exists. And when it comes to checkout it fails with similarly confusing message:

> bzr checkout lp:update-manager
Connected (version 2.0, client Twisted)
SSH <email address hidden> password:
Authentication type (password) not permitted.
bzr: ERROR: Connection error: Unable to authenticate to SSH host as <email address hidden> Bad authentication type (allowed_types=['publickey'])

The most confusing part is that is asks for a password even knowing that launchpad.net policy requires public key, even when there is no any public keys (with or without password) around.

Revision history for this message
Martin Pool (mbp) wrote :

It seems like the problem is not so much that launchpad-login should check your keys (though maybe it should) but that we should give a better message if no keys were acceptable to the server? This is a problem that could occur later on after you've run launchpad-login.

I filed bug 375867 for the separate misbehaviour of prompting for a password even when it won't help.

summary: - Check SSH keys at time of running launch-pad login and provide
+ Check SSH keys at time of running launchpad login and provide
informative error messages if something is wrong
Changed in bzr:
importance: Undecided → Low
status: New → Confirmed
Jonathan Lange (jml)
tags: added: lp-login
removed: launchpad-login
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.