From 681a627b00ed2202b476727fc5687d3e29064517 Mon Sep 17 00:00:00 2001 From: Rin Date: Fri, 3 May 2024 21:14:40 +0800 Subject: [PATCH] zzzzz --- dist/index.js | 9 ++++++--- index.js | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/dist/index.js b/dist/index.js index 92962af..e4e391a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -31102,7 +31102,7 @@ function start_vm(qemu_version, os, cpu, arch, bios, machine, filename, pubkey) setup_sshkey(pubkey, qemu_process, () => { let runScript = core.getInput('run'); fs.writeFileSync('/tmp/run.sh', runScript); - let ssh = spawn('ssh', ['-vvv', '-o', 'StrictHostKeyChecking=no', '-p', '2222', '-i', pubkey, 'root@localhost']); + let ssh = spawn('ssh', ['-o', 'StrictHostKeyChecking=no', '-p', '2222', '-i', pubkey, 'root@localhost']); ssh.stdout.pipe(process.stdout); ssh.stderr.pipe(process.stderr); ssh.stdin.write('chmod +x /tmp/run.sh'); @@ -31121,8 +31121,11 @@ function setup_sshkey(pubkey, qemu_process, ready_callback) { show_message("info", "Setting up SSH key for QEMU"); qemu_process.stdout.pipe(process.stdout); // let's see what's going on qemu_process.stdin.write("root\n"); - qemu_process.stdin.write(`cat > /root/.ssh/authorized_keys <<<"${pubkeyContent}"\n`); - qemu_process.stdin.write(`cat /root/.ssh/authorized_keys`); + setTimeout(() => { + qemu_process.stdin.write("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config\n"); + qemu_process.stdin.write(`cat > /root/.ssh/authorized_keys <<<"${pubkeyContent}"\n`); + qemu_process.stdin.write(`cat /root/.ssh/authorized_keys`); + }, 1000); setTimeout(() => { ready_callback(qemu_process) }, 2000); // let waitForKey = (() => { // let concat = '' diff --git a/index.js b/index.js index 1f3b11a..a327f59 100644 --- a/index.js +++ b/index.js @@ -212,7 +212,7 @@ function start_vm(qemu_version, os, cpu, arch, bios, machine, filename, pubkey) setup_sshkey(pubkey, qemu_process, () => { let runScript = core.getInput('run'); fs.writeFileSync('/tmp/run.sh', runScript); - let ssh = spawn('ssh', ['-vvv', '-o', 'StrictHostKeyChecking=no', '-p', '2222', '-i', pubkey, 'root@localhost']); + let ssh = spawn('ssh', ['-o', 'StrictHostKeyChecking=no', '-p', '2222', '-i', pubkey, 'root@localhost']); ssh.stdout.pipe(process.stdout); ssh.stderr.pipe(process.stderr); ssh.stdin.write('chmod +x /tmp/run.sh'); @@ -231,8 +231,11 @@ function setup_sshkey(pubkey, qemu_process, ready_callback) { show_message("info", "Setting up SSH key for QEMU"); qemu_process.stdout.pipe(process.stdout); // let's see what's going on qemu_process.stdin.write("root\n"); - qemu_process.stdin.write(`cat > /root/.ssh/authorized_keys <<<"${pubkeyContent}"\n`); - qemu_process.stdin.write(`cat /root/.ssh/authorized_keys`); + setTimeout(() => { + qemu_process.stdin.write("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config\n"); + qemu_process.stdin.write(`cat > /root/.ssh/authorized_keys <<<"${pubkeyContent}"\n`); + qemu_process.stdin.write(`cat /root/.ssh/authorized_keys`); + }, 1000); setTimeout(() => { ready_callback(qemu_process) }, 2000); // let waitForKey = (() => { // let concat = ''