22 Apr 2025 |
K900 | Or maybe we should switch to libssh and just not have the hack | 05:47:56 |
K900 | God this is not the snipe I was signing up for today | 05:48:06 |
K900 | diff --git a/lix/libstore/ssh.cc b/lix/libstore/ssh.cc
index 80c11aea7..c8c2467cb 100644
--- a/lix/libstore/ssh.cc
+++ b/lix/libstore/ssh.cc
@@ -83,7 +83,7 @@ std::unique_ptr<SSH::Connection> SSH::startCommand(const std::string & command)
addCommonSSHOpts(args);
}
- args.push_back(fmt("echo started; %s", command));
+ args.push_back(command);
execvp(args.begin()->c_str(), stringsToCharPtrs(args).data());
// could not exec ssh/bash
@@ -96,17 +96,17 @@ std::unique_ptr<SSH::Connection> SSH::startCommand(const std::string & command)
// Wait for the SSH connection to be established,
// So that we don't overwrite the password prompt with our progress bar.
- {
- std::string reply;
- try {
- reply = readLine(out.readSide.get());
- } catch (EndOfFile & e) { }
+ // {
+ // std::string reply;
+ // try {
+ // reply = readLine(out.readSide.get());
+ // } catch (EndOfFile & e) { }
- if (reply != "started") {
- warn("SSH to '%s' failed, stdout first line: '%s'", host, reply);
- throw Error("failed to start SSH connection to '%s'", host);
- }
- }
+ // if (reply != "started") {
+ // warn("SSH to '%s' failed, stdout first line: '%s'", host, reply);
+ // throw Error("failed to start SSH connection to '%s'", host);
+ // }
+ // }
conn->out = std::move(out.readSide);
conn->in = std::move(in.writeSide);
| 05:48:42 |
K900 | Anyway this works | 05:48:44 |
K900 | And I hate it | 05:48:50 |
K900 | diff --git a/lix/libstore/ssh.cc b/lix/libstore/ssh.cc
index 80c11aea7..88a407afd 100644
--- a/lix/libstore/ssh.cc
+++ b/lix/libstore/ssh.cc
@@ -83,7 +83,7 @@ std::unique_ptr<SSH::Connection> SSH::startCommand(const std::string & command)
addCommonSSHOpts(args);
}
- args.push_back(fmt("echo started; %s", command));
+ args.push_back(command);
execvp(args.begin()->c_str(), stringsToCharPtrs(args).data());
// could not exec ssh/bash
@@ -94,20 +94,6 @@ std::unique_ptr<SSH::Connection> SSH::startCommand(const std::string & command)
in.readSide.reset();
out.writeSide.reset();
- // Wait for the SSH connection to be established,
- // So that we don't overwrite the password prompt with our progress bar.
- {
- std::string reply;
- try {
- reply = readLine(out.readSide.get());
- } catch (EndOfFile & e) { }
-
- if (reply != "started") {
- warn("SSH to '%s' failed, stdout first line: '%s'", host, reply);
- throw Error("failed to start SSH connection to '%s'", host);
- }
- }
-
conn->out = std::move(out.readSide);
conn->in = std::move(in.writeSide);
| 05:49:24 |
K900 | (edit: less ugly diff) | 05:49:31 |
K900 | Does anyone have ideas | 05:49:36 |
K900 | OK filed https://git.lix.systems/lix-project/lix/issues/805 | 06:11:24 |
K900 | So fucking cursed | 06:11:27 |
piegames | Wait, so SSH simply assumes a shell when running commands and then Lix inherits that and thus may break? | 06:21:16 |
piegames | Aren't there any SSH flags to (un)set the shell? | 06:21:38 |
Irenes | sigh | 06:50:04 |
Irenes | that'd be nice, wouldn't it | 06:50:08 |
Irenes | that assumption was the cause of the shellshock vulnerability | 06:50:22 |
Irenes | or part of it | 06:50:24 |
Irenes | I honestly really doubt it was made more versatile since then, but I guess it's possible | 06:50:40 |
Irenes | it passes environment variables (that was the other half of the vuln), there might be something useful to be done with those | 06:51:22 |
Irenes | but probably you should write code that runs a subshell | 06:51:31 |
Irenes | so that you can make sure it's a specific one | 06:51:38 |
Irenes | in the 90s it was common knowledge that you should never call the system() function, which invokes the default shell of the calling user, because it's impossible to fully secure something so open | 06:52:29 |
Irenes | unfortunately if nobody talks about it, common knowledge stops being | 06:52:58 |
K900 | AFAIUI the openssh people actually consider this intentional | 07:20:14 |
K900 | As they consider the shell part of security posture | 07:20:24 |
Irenes | sigh, yeah I bet | 07:22:42 |
Irenes | and the log4j people consider their famous series of vulns intentional, too | 07:22:59 |
Irenes | substantially the same vuln was headline news twice so far, about ten years apart | 07:23:12 |
Irenes | people forgot, and assumed it must have been fixed | 07:23:20 |
Irenes | although the actual project's communication was always quite clear that they don't consider it a bug and aren't going to change anything | 07:23:47 |
Irenes | both times | 07:23:50 |