← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1679777] [NEW] Adding and reporting ssh keys fails for user in extrausers

 

Public bug reported:

If a user is added with '--extrausers' (which happens on ubuntu core)
then adding ssh keys or reporting which keys are added will fail as the users cannot be found.
This seems a general issue as extrausers, see bug 1679765.


The stack trace looks like:

2017-04-04 16:57:00,117 - util.py[WARNING]: Applying ssh credentials failed!
2017-04-04 16:57:00,117 - util.py[DEBUG]: Applying ssh credentials failed!
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh.py", line 195, in handle
    apply_credentials(keys, user, disable_root, disable_root_opts)
  File "/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh.py", line 204, in apply_credentials
    ssh_util.setup_user_keys(keys, user)
  File "/usr/lib/python3/dist-packages/cloudinit/ssh_util.py", line 241, in setup_user_keys
    (ssh_dir, pwent) = users_ssh_info(username)
  File "/usr/lib/python3/dist-packages/cloudinit/ssh_util.py", line 205, in users_ssh_info
    pw_ent = pwd.getpwnam(username)
KeyError: 'getpwnam(): name not found: ubuntu'

and then

2017-04-04 16:57:04,559 - util.py[WARNING]: Running module ssh-authkey-fingerprints (<module 'cloudinit.config.cc_ssh_authkey_fingerprints' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh_authkey_fingerprints.py'>) failed
2017-04-04 16:57:04,560 - util.py[DEBUG]: Running module ssh-authkey-fingerprints (<module 'cloudinit.config.cc_ssh_authkey_fingerprints' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh_authkey_fingerprints.py'>) failed
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 787, in _run_modules
    freq=freq)
  File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 54, in run
    return self._runners.run(name, functor, args, freq, clear_on_fail)
  File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 187, in run
    results = functor(*args)
  File "/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh_authkey_fingerprints.py", line 108, in handle
    (key_fn, key_entries) = ssh_util.extract_authorized_keys(user_name)
  File "/usr/lib/python3/dist-packages/cloudinit/ssh_util.py", line 212, in extract_authorized_keys
    (ssh_dir, pw_ent) = users_ssh_info(username)
  File "/usr/lib/python3/dist-packages/cloudinit/ssh_util.py", line 205, in users_ssh_info
    pw_ent = pwd.getpwnam(username)
KeyError: 'getpwnam(): name not found: ubuntu'

Related bugs:
 * bug 1679765: cannot lock password for user created with useradd --extrausers

** Affects: cloud-init
     Importance: Medium
         Status: Confirmed

** Changed in: cloud-init
       Status: New => Confirmed

** Changed in: cloud-init
   Importance: Undecided => Medium

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1679777

Title:
  Adding and reporting ssh keys fails for user in extrausers

Status in cloud-init:
  Confirmed

Bug description:
  If a user is added with '--extrausers' (which happens on ubuntu core)
  then adding ssh keys or reporting which keys are added will fail as the users cannot be found.
  This seems a general issue as extrausers, see bug 1679765.

  
  The stack trace looks like:

  2017-04-04 16:57:00,117 - util.py[WARNING]: Applying ssh credentials failed!
  2017-04-04 16:57:00,117 - util.py[DEBUG]: Applying ssh credentials failed!
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh.py", line 195, in handle
      apply_credentials(keys, user, disable_root, disable_root_opts)
    File "/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh.py", line 204, in apply_credentials
      ssh_util.setup_user_keys(keys, user)
    File "/usr/lib/python3/dist-packages/cloudinit/ssh_util.py", line 241, in setup_user_keys
      (ssh_dir, pwent) = users_ssh_info(username)
    File "/usr/lib/python3/dist-packages/cloudinit/ssh_util.py", line 205, in users_ssh_info
      pw_ent = pwd.getpwnam(username)
  KeyError: 'getpwnam(): name not found: ubuntu'

  and then

  2017-04-04 16:57:04,559 - util.py[WARNING]: Running module ssh-authkey-fingerprints (<module 'cloudinit.config.cc_ssh_authkey_fingerprints' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh_authkey_fingerprints.py'>) failed
  2017-04-04 16:57:04,560 - util.py[DEBUG]: Running module ssh-authkey-fingerprints (<module 'cloudinit.config.cc_ssh_authkey_fingerprints' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh_authkey_fingerprints.py'>) failed
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 787, in _run_modules
      freq=freq)
    File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 54, in run
      return self._runners.run(name, functor, args, freq, clear_on_fail)
    File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 187, in run
      results = functor(*args)
    File "/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh_authkey_fingerprints.py", line 108, in handle
      (key_fn, key_entries) = ssh_util.extract_authorized_keys(user_name)
    File "/usr/lib/python3/dist-packages/cloudinit/ssh_util.py", line 212, in extract_authorized_keys
      (ssh_dir, pw_ent) = users_ssh_info(username)
    File "/usr/lib/python3/dist-packages/cloudinit/ssh_util.py", line 205, in users_ssh_info
      pw_ent = pwd.getpwnam(username)
  KeyError: 'getpwnam(): name not found: ubuntu'

  Related bugs:
   * bug 1679765: cannot lock password for user created with useradd --extrausers

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1679777/+subscriptions


Follow ups