Bug 2083269

Summary: Allow enabling root access via ssh with password for kickstart installations - pykickstart part
Product: Red Hat Enterprise Linux 9 Reporter: Jan Stodola <jstodola>
Component: pykickstartAssignee: Brian Lane <bcl>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: unspecified Docs Contact: Sagar Dubewar <sdubewar>
Priority: medium    
Version: 9.0CC: anaconda-maint-list, bcl, jkonecny, jstodola, pkhedeka, release-test-team-automation, sbarcomb, sdubewar
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: pykickstart-3.32.7-1.el9 Doc Type: Enhancement
Doc Text:
.Added the `--allow-ssh` kickstart option to enable password-based SSH root logins During the graphical installation, you have an option to enable password-based SSH root logins. This functionality was not available in kickstart installations. With this update, an option `--allow-ssh` has been added to the `rootpw` kickstart command. This option enables the root user to login to the system using SSH with a password.
Story Points: ---
Clone Of: 2033849 Environment:
Last Closed: 2022-11-15 10:26:32 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: 2033849    

Description Jan Stodola 2022-05-09 15:03:31 UTC
There needs to be a way to specify that root login via ssh can be allowed when running a kickstart installation.
anaconda part of this feature is tracked in bug 2033849.


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

Description of problem:

When we do a RHEL 9 install, we need to allow root for ssh based logins by
marking the checkbox. This thing is not recorded to the kickstart generated
for the installation and further it blocks the root account if the kickstart
is used as reference kickstart.

The installation works fine with original install and root login works but
when the resultant kickstart is used for other install the root can't loging
with ssh.

This is common practice administrators follow to have a procedure recorded to
kickstart so will create impact on automated installations and post
installation things.


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

RHEL 9 Beta

How reproducible:

Everytime installing RHEL9 from kickstart recorded from a manual install.

Steps to Reproduce:
1. Install RHEL 9
2. In user section allow ssh based login for root
3. Copy the /root/anaconda-ks.cfg file for another install
4. The another install will not allow root login with ssh

Actual results:

Fails to record kickstart properly.

Expected results:

Shall record the option.

Additional info:

We don't see this to RHEL 8 so probably addition of this feature needs some
work in RHEL 9

--- Additional comment from Jan Stodola on 2022-01-14 15:26:16 CET ---

There is a workaround via %post script for kickstart installations:

%post
echo "PermitRootLogin yes" > /etc/ssh/sshd_config.d/01-permitrootlogin.conf
%end

--- Additional comment from Jan Stodola on 2022-01-17 16:41:26 CET ---

FYI, the workaround has been also added to the official documentation:

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9-beta/html-single/9.0_release_notes/index#BZ-1940653
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9-beta/html-single/performing_an_advanced_rhel_installation/index#rootpw-required_kickstart-commands-for-system-configuration

--- Additional comment from Jiri Konecny on 2022-01-21 11:57:21 CET ---

Proposing to 9.1.0 planning.

Comment 1 Brian Lane 2022-05-09 17:03:29 UTC
Are you saying that when you use sshkey https://pykickstart.readthedocs.io/en/latest/kickstart-docs.html#id57 to set a root ssh key (for the *installed* system's root) that they cannot login?

Or are you saying that it isn't included in the example kickstart that's generated?

Or something else :)

A couple example kickstarts would also be helpful.

Comment 2 Brian Lane 2022-05-09 17:12:14 UTC
Oops. I think I understand now, I missed the mention of 'password' somehow. My brain seems to assume all ssh access is via keys :)

So it looks like the problem is:
 * Anaconda has a GUI option to allow root password ssh logins
 * kickstart does not have a way to express that as part of 'rootpw'

So I think the solution here is to add a '--allow-ssh' option to the 'rootpw' command.

As always, this also needs to be added upstream first.

Comment 3 Brian Lane 2022-05-09 19:39:54 UTC
PR - https://github.com/pykickstart/pykickstart/pull/409

Comment 4 Jiri Konecny 2022-05-09 19:45:35 UTC
Thank you for creating the PR so quickly Brian.

Comment 7 Brian Lane 2022-05-31 21:29:43 UTC
rhel9-branch PR - https://github.com/pykickstart/pykickstart/pull/411 (had to replace F37 usage with RHEL9 and also tweaked the tests so they will run on py3.9 or py3.10 for easier local testing).

Comment 12 Brian Lane 2022-06-16 15:29:09 UTC
Adding https://github.com/pykickstart/pykickstart/pull/412

Comment 13 Jan Stodola 2022-06-20 15:43:49 UTC
Moving back to Verified:Tested, the patch from comment 12 is included in pykickstart-3.32.7-1.el9

Comment 17 Jan Stodola 2022-06-27 07:43:03 UTC
Checked that pykickstart-3.32.7-1.el9 is in nightly compose RHEL-9.1.0-20220627.0 and the prepared documentation looks good.

Moving to VERIFIED

Comment 19 errata-xmlrpc 2022-11-15 10:26:32 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 (pykickstart 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-2022:8138