Alon Bar-Lev has uploaded a new change for review.

Change subject: packaging: setup: do not use private key when constructing ssh 
public
......................................................................

packaging: setup: do not use private key when constructing ssh public

configuration can have ssh-askpass which is in conflict to as.

Change-Id: Ia79ea31d259003a880f0a01b6f888fd3e7bc993f
Signed-off-by: Alon Bar-Lev <alo...@redhat.com>
---
M packaging/setup/plugins/ovirt-engine-setup/pki/ssh.py
1 file changed, 19 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/36/18436/1

diff --git a/packaging/setup/plugins/ovirt-engine-setup/pki/ssh.py 
b/packaging/setup/plugins/ovirt-engine-setup/pki/ssh.py
index 960d07d..1b0f373 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/pki/ssh.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/pki/ssh.py
@@ -46,6 +46,7 @@
     )
     def _setup(self):
         self.command.detect('ssh-keygen')
+        self.command.detect('openssl')
 
     @plugin.event(
         stage=plugin.Stages.STAGE_MISC,
@@ -80,16 +81,25 @@
         )
         rc, pubkey, stderr = self.execute(
             (
-                self.command.get('ssh-keygen'),
-                '-y',
-                '-f', '/dev/fd/0',
+                self.command.get('openssl'),
+                'rsa',
+                '-pubout',
             ),
             stdin=privkey,
             logStreams=False,
         )
+        rc, sshpubkey, stderr = self.execute(
+            (
+                self.command.get('ssh-keygen'),
+                '-i',
+                '-m', 'PKCS8',
+                '-f', '/dev/fd/0',
+            ),
+            stdin=pubkey,
+        )
         self.environment[
             osetupcons.PKIEnv.ENGINE_SSH_PUBLIC_KEY_VALUE
-        ] = pubkey[0]
+        ] = sshpubkey[0]
 
     @plugin.event(
         stage=plugin.Stages.STAGE_CLOSEUP,
@@ -103,20 +113,14 @@
     def _closeup(self):
         temp = None
         try:
-            rc, pubkey, stderr = self.execute(
-                (
-                    self.command.get('ssh-keygen'),
-                    '-y',
-                    '-f', (
-                        osetupcons.FileLocations.
-                        OVIRT_ENGINE_PKI_ENGINE_SSH_KEY
-                    ),
-                ),
-            )
             fd, temp = tempfile.mkstemp(suffix='.pub')
             os.close(fd)
             with open(temp, "w") as f:
-                f.write(pubkey[0])
+                f.write(
+                    self.environment[
+                        osetupcons.PKIEnv.ENGINE_SSH_PUBLIC_KEY_VALUE
+                    ]
+                )
                 f.write('\n')
 
             rc, fingerprint, stderr = self.execute(


-- 
To view, visit http://gerrit.ovirt.org/18436
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia79ea31d259003a880f0a01b6f888fd3e7bc993f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to