Skip to content

Commit 7f807fe

Browse files
aeijdenbergbradfitz
authored andcommitted
ssh/tailssh: fix /usr/bin/login args on macOS
Fixes tailscale#4931 Signed-off-by: Adam Eijdenberg <adam@continusec.com>
1 parent 35782f8 commit 7f807fe

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

ssh/tailssh/incubator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ func beIncubator(args []string) error {
206206
// If we are trying to launch a login shell, just exec into login
207207
// instead. We can only do this if a TTY was requested, otherwise login
208208
// exits immediately, which breaks things likes mosh and VSCode.
209-
return unix.Exec(ia.loginCmdPath, []string{ia.loginCmdPath, "-f", ia.localUser, "-h", ia.remoteIP, "-p"}, os.Environ())
209+
return unix.Exec(ia.loginCmdPath, ia.loginArgs(), os.Environ())
210210
}
211211

212212
// Inform the system that we are about to log someone in.

ssh/tailssh/incubator_darwin.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) 2022 Tailscale Inc & AUTHORS All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package tailssh
6+
7+
func (ia *incubatorArgs) loginArgs() []string {
8+
return []string{ia.loginCmdPath, "-fp", "-h", ia.remoteIP, ia.localUser}
9+
}

ssh/tailssh/incubator_linux.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,7 @@ func maybeStartLoginSessionLinux(logf logger.Logf, ia incubatorArgs) (func() err
173173
}
174174
return nil, nil
175175
}
176+
177+
func (ia *incubatorArgs) loginArgs() []string {
178+
return []string{ia.loginCmdPath, "-f", ia.localUser, "-h", ia.remoteIP, "-p"}
179+
}

0 commit comments

Comments
 (0)