aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-installer/anaconda/files/0072-fix-sshd-config.patch
blob: 48f32341081c0b8924eb64f606c906ae6bd43f04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
The default config files are located in /etc/default in oe-core. Update to make
the checkbox 'Allow root SSH login with password' work.

Upstream-Status: Inappropriate [oe specific]

Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
 pyanaconda/modules/users/installation.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/pyanaconda/modules/users/installation.py b/pyanaconda/modules/users/installation.py
index ab27780c91..55bfb6eb53 100644
--- a/pyanaconda/modules/users/installation.py
+++ b/pyanaconda/modules/users/installation.py
@@ -169,7 +169,7 @@ class SetSshKeysTask(Task):
 class ConfigureRootPasswordSSHLoginTask(Task):
     """Optionally add an override allowing root to login with password over SSH."""
 
-    CONFIG_PATH = "etc/sysconfig/sshd-permitrootlogin"
+    CONFIG_PATH = "etc/default/sshd-permitrootlogin"
 
     def __init__(self, sysroot, password_allowed):
         """Create a new root password SSH login configuration task.
@@ -195,7 +195,13 @@ class ConfigureRootPasswordSSHLoginTask(Task):
                 f.write(
                     '# This file has been generated by the Anaconda Installer.\n'
                     '# Allow root to log in using ssh. Remove this file to opt-out.\n'
-                    'PERMITROOTLOGIN="-oPermitRootLogin=yes"\n'
+                    'SSHD_OPTS="-oPermitRootLogin=yes"\n'
                 )
         else:
             log.debug("Not adding an override allowing root login with password via SSH.")
+            with open(os.path.join(self._sysroot, self.CONFIG_PATH), "wt") as f:
+                f.write(
+                    '# This file has been generated by the Anaconda Installer.\n'
+                    '# Disallow root to log in using ssh. Remove this file to opt-out.\n'
+                    'SSHD_OPTS="-oPermitRootLogin=no"\n'
+                )