From 77e2f52dc8f3d3d3f54bff7e00eb5ef9623fb1ee Mon Sep 17 00:00:00 2001
From: laughing_man77 <8545282-laughing_man77@users.noreply.gitlab.com>
Date: Tue, 1 Nov 2022 07:21:13 +1100
Subject: [PATCH 1/2] Refs #205: Add the automated acceptance of overwrite
 permissions to the JWT generation command.

---
 includes/Cli/Install.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/includes/Cli/Install.php b/includes/Cli/Install.php
index 6d46a7e7..400eccc3 100644
--- a/includes/Cli/Install.php
+++ b/includes/Cli/Install.php
@@ -731,8 +731,8 @@ class Install extends Script
 
         if ($generateKeys) {
             echo "Generating keys...\n";
-            shell_exec("ssh-keygen -t rsa -b 4096 -P \"\" -m PEM -f $private_key_path >/dev/null & sleep 2");
-            shell_exec("openssl rsa -in $private_key_path -pubout -outform PEM -out $public_key_path");
+            shell_exec("echo -e 'y\\n' | ssh-keygen -t rsa -b 4096 -P '' -m PEM -f $private_key_path >/dev/null & sleep 2");
+            shell_exec("echo -e 'y\\n' | openssl rsa -in $private_key_path -pubout -outform PEM -out $public_key_path");
             shell_exec("chmod 600 $private_key_path $public_key_path");
             echo "keys generated\n";
         }
-- 
GitLab


From 98e1e0256c6e829493aa383ca1459cdbda6e8732 Mon Sep 17 00:00:00 2001
From: laughing_man77 <8545282-laughing_man77@users.noreply.gitlab.com>
Date: Tue, 1 Nov 2022 07:32:23 +1100
Subject: [PATCH 2/2] Refs #205: Fix phpcs.

---
 includes/Cli/Install.php | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/includes/Cli/Install.php b/includes/Cli/Install.php
index 400eccc3..a70c2733 100644
--- a/includes/Cli/Install.php
+++ b/includes/Cli/Install.php
@@ -731,8 +731,10 @@ class Install extends Script
 
         if ($generateKeys) {
             echo "Generating keys...\n";
-            shell_exec("echo -e 'y\\n' | ssh-keygen -t rsa -b 4096 -P '' -m PEM -f $private_key_path >/dev/null & sleep 2");
-            shell_exec("echo -e 'y\\n' | openssl rsa -in $private_key_path -pubout -outform PEM -out $public_key_path");
+            $cmd = "echo -e 'y\\n' | ssh-keygen -t rsa -b 4096 -P '' -m PEM -f $private_key_path >/dev/null & sleep 2";
+            shell_exec($cmd);
+            $cmd = "echo -e 'y\\n' | openssl rsa -in $private_key_path -pubout -outform PEM -out $public_key_path";
+            shell_exec($cmd);
             shell_exec("chmod 600 $private_key_path $public_key_path");
             echo "keys generated\n";
         }
-- 
GitLab