Bug 1716359

Summary: Ssh: cannot parse Match options
Product: Red Hat Enterprise Linux 8 Reporter: Pino Toscano <ptoscano>
Component: augeasAssignee: Pino Toscano <ptoscano>
Status: CLOSED ERRATA QA Contact: YongkuiGuo <yoguo>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.1CC: linl, ptoscano, rjones, sadas, xchen, yoguo
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: augeas-1.12.0-6.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:08:04 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:

Description Pino Toscano 2019-06-03 10:22:12 UTC
Description of problem:
The Ssh lens cannot parse Match options in ssh_config file, or shippets for it.

In particular, after the openssh rebase (bug 1691045), the /etc/ssh/ssh_config.d/05-redhat.conf file starting from openssh-clients-8.0p1-1.el8.x86_64 has a Match option, and thus it cannot be parsed by the Ssh lens.

Version-Release number of selected component (if applicable):
augeas-1.12.0-1.el8

How reproducible:
Always.

Steps to Reproduce:
1. install openssh-clients
2. run `augtool print /augeas//error | grep ssh_config`

Actual results:
/augeas/files/etc/ssh/ssh_config.d/05-redhat.conf/error = "parse_failed"
/augeas/files/etc/ssh/ssh_config.d/05-redhat.conf/error/pos = "149"
/augeas/files/etc/ssh/ssh_config.d/05-redhat.conf/error/line = "3"
/augeas/files/etc/ssh/ssh_config.d/05-redhat.conf/error/char = "0"
/augeas/files/etc/ssh/ssh_config.d/05-redhat.conf/error/lens = "/usr/share/augeas/lenses/dist/ssh.aug:112.14-.28:"
/augeas/files/etc/ssh/ssh_config.d/05-redhat.conf/error/message = "Get did not match entire input"

Expected results:
- no output of the command in step 2
- `augtool -r . print /files/etc/ssh/ssh_config.d/` prints the parsed content of /etc/ssh/ssh_config.d/05-redhat.conf

Additional info:
I just reported it upstream as https://github.com/hercules-team/augeas/issues/632

Comment 3 Pino Toscano 2020-10-07 08:31:54 UTC
It was fixed recently: https://github.com/hercules-team/augeas/pull/695

So let's try to fix this for RHEL 8.4.

Comment 6 YongkuiGuo 2021-01-05 10:28:26 UTC
Verified with package:
augeas-1.12.0-6.el8.x86_64

Steps:

1. On rhel8.4.0 host
# augtool print /augeas//error | grep ssh_config
No output.

2.
# augtool print /files/etc/ssh/ssh_config.d/05-redhat.conf
/files/etc/ssh/ssh_config.d/05-redhat.conf
/files/etc/ssh/ssh_config.d/05-redhat.conf/#comment[1] = "The options here are in the \"Match final block\" to be applied as the last"
/files/etc/ssh/ssh_config.d/05-redhat.conf/#comment[2] = "options and could be potentially overwritten by the user configuration"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Condition
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Condition/final = "all"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/#comment[1] = "Follow system-wide Crypto Policy, if defined:"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/Include = "/etc/crypto-policies/back-ends/openssh.config"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/GSSAPIAuthentication = "yes"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/#comment[2] = "If this option is set to yes then remote X11 clients will have full access"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/#comment[3] = "to the original X11 display. As virtually no X11 client supports the untrusted"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/#comment[4] = "mode correctly we set this to yes."
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/ForwardX11Trusted = "yes"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/#comment[5] = "Send locale-related environment variables"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[1]
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[1]/1 = "LANG"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[1]/2 = "LC_CTYPE"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[1]/3 = "LC_NUMERIC"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[1]/4 = "LC_TIME"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[1]/5 = "LC_COLLATE"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[1]/6 = "LC_MONETARY"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[1]/7 = "LC_MESSAGES"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[2]
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[2]/1 = "LC_PAPER"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[2]/2 = "LC_NAME"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[2]/3 = "LC_ADDRESS"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[2]/4 = "LC_TELEPHONE"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[2]/5 = "LC_MEASUREMENT"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[3]
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[3]/1 = "LC_IDENTIFICATION"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[3]/2 = "LC_ALL"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[3]/3 = "LANGUAGE"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[4]
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/SendEnv[4]/1 = "XMODIFIERS"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/#comment[6] = "Uncomment this if you want to use .local domain"
/files/etc/ssh/ssh_config.d/05-redhat.conf/Match/Settings/#comment[7] = "Host *.local"

The latest ssh lens can parse Match options in /etc/ssh/ssh_config.d/05-redhat.conf file. So verified this bug.

Comment 8 errata-xmlrpc 2021-05-18 15:08:04 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (augeas bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1693