ssh to now gives ssh -o IdentitiesOnly=no before the host, next to -o IdentityAgent. With IdentitiesOnly yes in the user's ssh configuration, ssh listed the agent's key but never offered it, and the login failed with Permission denied. An option on the command line wins over the configuration, and the tool's agent holds only the derived key, so turning the option off adds no other key. A test against the stand-in ssh requires the option before the host, and the README's ssh to section names both options. Judgement call: a user's own -o IdentitiesOnly=yes after the host is now overridden. Model: opus-5-5 Co-authored-by: clawbot <sneak+clawbot@sneak.cloud>
This commit was merged in pull request #85.
This commit is contained in:
@@ -587,7 +587,7 @@ func TestSSHIsPointedAtTheAgentAndItsStatusIsHandedOn(t *testing.T) {
|
||||
|
||||
given := recorded(t, arguments)
|
||||
require.Equal(t, "-o", given[0])
|
||||
require.Equal(t, []string{host, remoteCommand}, given[2:])
|
||||
require.Equal(t, []string{host, remoteCommand}, given[4:])
|
||||
|
||||
// The stand-in wrote the path down only because there really was
|
||||
// a socket there while it ran.
|
||||
@@ -596,6 +596,26 @@ func TestSSHIsPointedAtTheAgentAndItsStatusIsHandedOn(t *testing.T) {
|
||||
require.NoDirExists(t, filepath.Dir(socket))
|
||||
}
|
||||
|
||||
func TestIdentitiesOnlyIsTurnedOffBeforeTheHost(t *testing.T) {
|
||||
t.Setenv(mnemonic.Variable, example())
|
||||
|
||||
arguments, _ := pretendCall(t)
|
||||
|
||||
_, err := execute(t, subcommand, "to", host, remoteCommand)
|
||||
|
||||
var passed ssh.StatusError
|
||||
|
||||
require.ErrorAs(t, err, &passed)
|
||||
|
||||
// IdentitiesOnly yes in the user's ssh configuration keeps ssh
|
||||
// from offering the agent's key. An option given before the host
|
||||
// wins over the configuration.
|
||||
given := recorded(t, arguments)
|
||||
require.Equal(t,
|
||||
[]string{"-o", "IdentitiesOnly=no", host, remoteCommand}, given[2:],
|
||||
)
|
||||
}
|
||||
|
||||
func TestTheToolEndsWithTheStatusSSHEndedWith(t *testing.T) {
|
||||
t.Setenv(mnemonic.Variable, example())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user