Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions apps/server/src/device/SshDeviceHost.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@ it.effect("preserves installed status after probes and cleans failed agent activ
const home = yield* fs.makeTempDirectoryScoped();
const modes: string[] = [];
const owners: string[] = [];
const tunnelArgs: string[][] = [];
const commandArgs: string[][] = [];
let forwards = 0;
let failForward = true;
let rejectConfig = true;
const spawner = ChildProcessSpawner.make((command) =>
Effect.gen(function* () {
if (command._tag !== "StandardCommand") return yield* Effect.die("Unexpected command");
const forwarding = command.args.includes("-N");
(forwarding ? tunnelArgs : commandArgs).push([...command.args]);
let output = "";
if (forwarding) {
if (failForward) {
Expand Down Expand Up @@ -132,6 +135,19 @@ it.effect("preserves installed status after probes and cleans failed agent activ
expect((yield* host.summary).agentDeviceInstalled).toBe(true);
yield* host.stopAgent;
expect(forwards).toBe(1);
const multiplexingOff = ["ControlMaster=no", "ControlPath=none", "ControlPersist=no"];
expect(tunnelArgs.length).toBeGreaterThan(0);
for (const args of tunnelArgs) {
for (const option of multiplexingOff) {
const index = args.indexOf(option);
expect(index).toBeGreaterThan(0);
expect(args[index - 1]).toBe("-o");
}
}
expect(commandArgs.length).toBeGreaterThan(0);
for (const args of commandArgs) {
for (const option of multiplexingOff) expect(args).not.toContain(option);
}
yield* host.stop;
expect(forwards).toBe(0);
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
Expand Down
8 changes: 8 additions & 0 deletions apps/server/src/device/SshDeviceHost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,14 @@ export const make = Effect.fn("SshDeviceHost.make")(function* (
...identityArgs(config),
"-o",
"ExitOnForwardFailure=yes",
// A multiplexed client hands its -L forwards to the control master and exits,
// so the tunnel must own its own connection.
"-o",
"ControlMaster=no",
"-o",
"ControlPath=none",
"-o",
"ControlPersist=no",
"-o",
"ServerAliveInterval=10",
"-o",
Expand Down
Loading