JSCH workaround for Ubuntu 22.04 81/13481/2
authorMark Beierl <mark.beierl@canonical.com>
Wed, 31 May 2023 18:31:37 +0000 (14:31 -0400)
committerbeierlm <mark.beierl@canonical.com>
Thu, 1 Jun 2023 15:08:36 +0000 (17:08 +0200)
Clearly marked workaround code which re-enables ssh-rsa as an
accpeted public key algorithm.

Change-Id: Iabd67c650d03d9b157b45df1481ccd2643a3beb1
Signed-off-by: Mark Beierl <mark.beierl@canonical.com>
jenkins/ci-pipelines/ci_stage_3.groovy

index 2c2e008..26f928b 100644 (file)
@@ -442,6 +442,30 @@ node("${params.NODE}") {
                         }
                     }
                     println('VM is ready and accepting ssh connections')
+
+                    //////////////////////////////////////////////////////////////////////////////////////////////
+                    println('Applying sshd config workaround for Ubuntu 22.04 and old jsch client in Jenkins...')
+
+                    sh( returnStatus: true,
+                        script: "ssh -T -i ${SSH_KEY} " +
+                            "-o StrictHostKeyChecking=no " +
+                            "-o UserKnownHostsFile=/dev/null " +
+                            "ubuntu@${IP_ADDRESS} " +
+                            "'echo HostKeyAlgorithms +ssh-rsa | sudo tee -a /etc/ssh/sshd_config'")
+                    sh( returnStatus: true,
+                        script: "ssh -T -i ${SSH_KEY} " +
+                            "-o StrictHostKeyChecking=no " +
+                            "-o UserKnownHostsFile=/dev/null " +
+                            "ubuntu@${IP_ADDRESS} " +
+                            "'echo PubkeyAcceptedKeyTypes +ssh-rsa | sudo tee -a /etc/ssh/sshd_config'")
+                    sh( returnStatus: true,
+                        script: "ssh -T -i ${SSH_KEY} " +
+                            "-o StrictHostKeyChecking=no " +
+                            "-o UserKnownHostsFile=/dev/null " +
+                            "ubuntu@${IP_ADDRESS} " +
+                            "'sudo systemctl restart sshd'")
+                    //////////////////////////////////////////////////////////////////////////////////////////////
+
                 } // stage("Spawn Remote VM")
 
 ///////////////////////////////////////////////////////////////////////////////////////