Merge "ssh-ng: Set log-fd for ssh to 4
by default" into main
This commit is contained in:
commit
8773439a85
|
@ -69,10 +69,10 @@ ref<Store> Machine::openStore() const
|
||||||
Store::Params storeParams;
|
Store::Params storeParams;
|
||||||
if (storeUri.starts_with("ssh://")) {
|
if (storeUri.starts_with("ssh://")) {
|
||||||
storeParams["max-connections"] = "1";
|
storeParams["max-connections"] = "1";
|
||||||
storeParams["log-fd"] = "4";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storeUri.starts_with("ssh://") || storeUri.starts_with("ssh-ng://")) {
|
if (storeUri.starts_with("ssh://") || storeUri.starts_with("ssh-ng://")) {
|
||||||
|
storeParams["log-fd"] = "4";
|
||||||
if (sshKey != "")
|
if (sshKey != "")
|
||||||
storeParams["ssh-key"] = sshKey;
|
storeParams["ssh-key"] = sshKey;
|
||||||
if (sshPublicHostKey != "")
|
if (sshPublicHostKey != "")
|
||||||
|
|
|
@ -32,6 +32,10 @@ struct SSHStoreConfig : virtual RemoteStoreConfig, virtual CommonSSHStoreConfig
|
||||||
class SSHStore : public virtual SSHStoreConfig, public virtual RemoteStore
|
class SSHStore : public virtual SSHStoreConfig, public virtual RemoteStore
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
// Hack for getting remote build log output.
|
||||||
|
// Intentionally not in `SSHStoreConfig` so that it doesn't appear in
|
||||||
|
// the documentation
|
||||||
|
const Setting<int> logFD{(StoreConfig*) this, -1, "log-fd", "file descriptor to which SSH's stderr is connected"};
|
||||||
|
|
||||||
SSHStore(const std::string & scheme, const std::string & host, const Params & params)
|
SSHStore(const std::string & scheme, const std::string & host, const Params & params)
|
||||||
: StoreConfig(params)
|
: StoreConfig(params)
|
||||||
|
@ -47,7 +51,8 @@ public:
|
||||||
sshPublicHostKey,
|
sshPublicHostKey,
|
||||||
// Use SSH master only if using more than 1 connection.
|
// Use SSH master only if using more than 1 connection.
|
||||||
connections->capacity() > 1,
|
connections->capacity() > 1,
|
||||||
compress)
|
compress,
|
||||||
|
logFD)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,10 @@ in
|
||||||
builder.succeed("mkdir -p -m 700 /root/.ssh")
|
builder.succeed("mkdir -p -m 700 /root/.ssh")
|
||||||
builder.copy_from_host("key.pub", "/root/.ssh/authorized_keys")
|
builder.copy_from_host("key.pub", "/root/.ssh/authorized_keys")
|
||||||
builder.wait_for_unit("sshd.service")
|
builder.wait_for_unit("sshd.service")
|
||||||
|
|
||||||
|
out = client.fail("nix-build ${expr nodes.client 1} 2>&1")
|
||||||
|
assert "error: failed to start SSH connection to 'root@builder': Host key verification failed" in out, f"No host verification error in {out}"
|
||||||
|
|
||||||
client.succeed(f"ssh -o StrictHostKeyChecking=no {builder.name} 'echo hello world' >&2")
|
client.succeed(f"ssh -o StrictHostKeyChecking=no {builder.name} 'echo hello world' >&2")
|
||||||
|
|
||||||
# Perform a build
|
# Perform a build
|
||||||
|
|
Loading…
Reference in a new issue