Bug 2149362

Summary: sshkey entries aren't properly escaped when they contain quotes in anaconda-ks.cfg
Product: Red Hat Enterprise Linux 9 Reporter: Brian Lane <bcl>
Component: anacondaAssignee: Brian Lane <bcl>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: low Docs Contact:
Priority: unspecified    
Version: 9.2CC: jikortus, jkonecny, jstodola
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: anaconda-34.25.2.4-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 07:35:42 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: 2121877    
Bug Blocks:    

Description Brian Lane 2022-11-29 17:37:25 UTC
This bug was initially created as a copy of Bug #2121877

I am copying this bug because: 

Anaconda needs to use the new RHEL9_SshKeyData class in order for this to work.

+++ This bug was initially created as a clone of Bug #2117734 +++

Description of problem:

I'm unsure if this is still a problem with the current version, and I'm building on Springdale Linux 9, buuut:

In my kickstart file I have:

```
sshkey --username=root "from=\"192.168.1.1\" ssh-rsa ...
```
And in anaconda-ks.cfg, you get:

```
sshkey --username=root "from=192.168.1.1" ssh-rsa 

```

If you notice, the slashes escaping the quotes are missing.


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


How reproducible:

Any build with an sshkey entry that has from="..." in it.


Steps to Reproduce:
1.  Build a machine with an sshkey that has a "from" entry with quotes.
2.  Quotes aren't properly escaped in resulting ~root/anaconda-ks.cfg
3.

Actual results:


Expected results:

Quotes properly escaped.

Additional info:

Sorry if this still isn't a bug, I'm putting this together in a rush.

--- Additional comment from Brian Lane on 2022-08-15 11:08:08 PDT ---

This is a bug in pykickstart, thanks for reporting it.

--- Additional comment from Brian Lane on 2022-08-26 15:47:22 PDT ---

https://github.com/pykickstart/pykickstart/pull/422

Comment 1 Brian Lane 2022-11-29 17:57:56 UTC
PR against rhel-9 branch here (I think that's the correct branch?) - https://github.com/rhinstaller/anaconda/pull/4454

Comment 8 errata-xmlrpc 2023-05-09 07:35:42 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 (anaconda 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-2023:2223