Bug 1213293 - Augeas can not parse default /root/.ssh/known_hosts
Summary: Augeas can not parse default /root/.ssh/known_hosts
Alias: None
Product: Fedora
Classification: Fedora
Component: augeas
Version: 22
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Dominic Cleal
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2015-04-20 09:33 UTC by Lingfei Kong
Modified: 2015-06-14 17:32 UTC (History)
7 users (show)

Fixed In Version: augeas-1.4.0-1.fc22
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2015-06-14 17:32:07 UTC
Type: Bug

Attachments (Terms of Use)
/root/.ssh/known_hosts (1.26 KB, text/plain)
2015-04-20 09:34 UTC, Lingfei Kong
no flags Details

Description Lingfei Kong 2015-04-20 09:33:52 UTC
Description of problem:
Augeas can not parse default /root/.ssh/known_hosts

Augeas in RHEL works well with the same known_hosts file.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Copy attachment file: know_hosts to /root/.ssh/known_hosts (Backup your known_hosts first)

2. Run command: echo 'print /augeas//error' | augtool
# augtool print /augeas//error

Actual results:
# augtool print /augeas//error
/augeas/files/root/.ssh/known_hosts/error = "parse_failed"
/augeas/files/root/.ssh/known_hosts/error/pos = "0"
/augeas/files/root/.ssh/known_hosts/error/line = "1"
/augeas/files/root/.ssh/known_hosts/error/char = "0"
/augeas/files/root/.ssh/known_hosts/error/lens = "/usr/share/augeas/lenses/dist/known_hosts.aug:44.10-.46:"
/augeas/files/root/.ssh/known_hosts/error/message = "Iterated lens matched less than it should"

Expected results:
No errors

Additional info:
The attachment is file /root/.ssh/known_hosts

Comment 1 Lingfei Kong 2015-04-20 09:34:20 UTC
Created attachment 1016273 [details]

Comment 2 Dominic Cleal 2015-04-20 11:55:04 UTC
It fails on the first field, which is a comma-separated hostname,IP pair.  The regexp only expects a value without commas.  I'm unsure whether to split it into two fields, or parse as a single value.

Comment 3 lutter@watzmann.net 2015-04-20 23:20:13 UTC
Dominic's analysis of the problem is spot on; looking at the tree structure, it's really not flexible enough to expose multiple host names uniformly so that querying is easy.

I am almost tempted to break backwards compatibility and change the tree to something like

  { "1"
    { "hostname" = ... }
    { "hostname" = ... }*
    { "type" = ... }
    { "key" = .. } }

Comment 4 Dominic Cleal 2015-04-21 07:19:38 UTC
(In reply to lutter from comment #3)
> I am almost tempted to break backwards compatibility and change the tree to
> something like
>   { "1"
>     { "hostname" = ... }
>     { "hostname" = ... }*
>     { "type" = ... }
>     { "key" = .. } }

Yeah, I think this would be best.  Reading sshd(8), it says this is simply a comma-separated list of multiple hostnames, so this representation would make the most sense.

Comment 5 Dominic Cleal 2015-05-21 12:06:57 UTC
https://github.com/hercules-team/augeas/commit/0cf81830cdb404c7fa4107d080f094b9cb30ee18 added the following comma-separated values as aliases rather than changing the tree representation entirely.

Comment 7 Fedora Update System 2015-06-02 08:45:55 UTC
augeas-1.4.0-1.fc22 has been submitted as an update for Fedora 22.

Comment 8 Fedora Update System 2015-06-04 20:18:36 UTC
Package augeas-1.4.0-1.fc22:
* should fix your issue,
* was pushed to the Fedora 22 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing augeas-1.4.0-1.fc22'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).

Comment 9 Fedora Update System 2015-06-14 17:32:07 UTC
augeas-1.4.0-1.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.