Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1527649

Summary: cloud-init fails with ValueError: need more than 1 value to unpack
Product: Red Hat Enterprise Linux 7 Reporter: Siggy Sigwald <ssigwald>
Component: cloud-initAssignee: Eduardo Otubo <eterrell>
Status: CLOSED WONTFIX QA Contact: Frank Liang <xiliang>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4CC: eterrell, huzhao, jbadiapa, jgreguske, jpriddy, lars, leiwang, linl, mmagr, mrunge, ribarry, rmccabe, ssigwald, vijaykumar.bisalahalli, vkuznets, wshi, xiliang, yacao, yujiang
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1862933 (view as bug list) Environment:
Last Closed: 2020-07-03 18:55:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1862933, 2002301, 2002302    

Description Siggy Sigwald 2017-12-19 18:33:52 UTC
Description of problem:
unable to get cloud-init to properly exchange keys in our AWS environment our Redhat custom built image from Redhat Media.


Version-Release number of selected component (if applicable):
cloud-init.x86_64 0.7.9-9.el7_4.1

How reproducible:
every time

Actual results
From cloud-init log:

2017-12-18 19:51:52,455 - helpers.py[DEBUG]: Running config-ssh-authkey-fingerprints using lock (<FileLock using file '/var/lib/cloud/instances/i-0fe58a037326912ec/sem/config_ssh_authkey_fingerprints'>)
2017-12-18 19:51:52,455 - util.py[DEBUG]: Reading from /etc/ssh/sshd_config (quiet=False)
2017-12-18 19:51:52,455 - util.py[DEBUG]: Read 4762 bytes from /etc/ssh/sshd_config
2017-12-18 19:51:52,458 - util.py[DEBUG]: Restoring selinux mode for /home/ec2-user/.ssh (recursive=True)
2017-12-18 19:51:52,458 - handlers.py[DEBUG]: finish: modules-final/config-ssh-authkey-fingerprints: FAIL: running config-ssh-authkey-fingerprints with frequency once-per-instance
2017-12-18 19:51:52,458 - util.py[WARNING]: Running module ssh-authkey-fingerprints (<module 'cloudinit.config.cc_ssh_authkey_fingerprints' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_ssh_authkey_fingerprints.pyc'>) failed
2017-12-18 19:51:52,459 - util.py[DEBUG]: Running module ssh-authkey-fingerprints (<module 'cloudinit.config.cc_ssh_authkey_fingerprints' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_ssh_authkey_fingerprints.pyc'>) failed
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", line 777, in _run_modules
    freq=freq)
  File "/usr/lib/python2.7/site-packages/cloudinit/cloud.py", line 54, in run
    return self._runners.run(name, functor, args, freq, clear_on_fail)
  File "/usr/lib/python2.7/site-packages/cloudinit/helpers.py", line 187, in run
    results = functor(*args)
  File "/usr/lib/python2.7/site-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/python2.7/site-packages/cloudinit/ssh_util.py", line 218, in extract_authorized_keys
    ssh_cfg = parse_ssh_config_map(DEF_SSHD_CFG)
  File "/usr/lib/python2.7/site-packages/cloudinit/ssh_util.py", line 303, in parse_ssh_config_map
    lines = parse_ssh_config(fname)
  File "/usr/lib/python2.7/site-packages/cloudinit/ssh_util.py", line 297, in parse_ssh_config
    key, val = line.split('=', 1)
ValueError: need more than 1 value to unpack
2017-12-18 19:51:52,475 - stages.py[DEBUG]: Running module keys-to-console (<module 'cloudinit.config.cc_keys_to_console' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_keys_to_console.pyc'>) with frequency once-per-instance
2017-12-18 19:51:52,475 - handlers.py[DEBUG]: start: modules-final/config-keys-to-console: running config-keys-to-console with frequency once-per-instance

Comment 7 Vijay 2018-06-22 11:49:06 UTC
/etc/ssh/sshd_config file might contain only key instead of key-value pair.
For ex:

PermitRootLogin yes        -----> Key Value pair
AllowUsers swmsuser swmsadmin mrf linus root  -----> Key Value pair
DenyGroups -----> Only Key ,value is empty
DenyUsers  -----> Only Key ,value is empty

Comment 10 Ryan McCabe 2018-07-02 15:10:11 UTC
(In reply to Eduardo Otubo from comment #8)
> @ryan do you have an update on this? Did you manage to patch this upstream?
> If so, this issue might be already fixed by the 18.2 rebase
[snip]
> Please check if the issue remains.

I do not believe this is fixed upstream. The code in the ssh_util.py file still wants to unpack a a key/value pair. However it can be worked around easily by using the Allow{Users,Groups} Deny{Users,Groups} with wildcards, where necessary.

Comment 17 Rick Barry 2020-07-03 18:55:10 UTC
This BZ is being auto-closed as CLOSED/WONTFIX. If this is not appropriate and a fix is critical for RHEL 7, please re-open.

Note that RHEL 7.9 is the last minor release for RHEL 7. Security and critical bug-fixes will continue to be delivered via RHEL 7 batch updates.