SSH via ASA Failing with Error "panic: runtime error: index out of range [1] with length 1"
Last Updated:
Overview
When attempting to SSH to a Linux server via Advanced Server Access (ASA), the operation fails with the following error trace:
panic: runtime error: index out of range [1] with length 1
goroutine 1 [running]:
github.com/ScaleFT/device-tools/sshutils/conf.(*SystemMatchBlockChecker).CheckMatchBlock(_, {_, _}, _, {0x0, 0x140003c0200, 0x0, 0x0, 0x0, {0x0, ...}, ...})
github.com/ScaleFT/device-tools/sshutils/conf/matchblock.go:83 +0x568
github.com/ScaleFT/device-tools/sshutils/conf.Config.GetConfigForHostWithMatchBlockChecker({0x14000113040, 0x8, 0x140004f6dd0?}, {0x140005f8c00, 0x19}, {0x10569d260, 0x140005fde30})
github.com/ScaleFT/device-tools/sshutils/conf/ssh_config.go:128 +0x1c8
github.com/ScaleFT/device-tools/sshutils/conf.Config.GetConfigForHostWithDbg({0x14000113040, 0x8, 0x8}, {0x140005f8c00, 0x19}, {0x1056989e0?, 0x140001b9490})
github.com/ScaleFT/device-tools/sshutils/conf/ssh_config.go:89 +0x108
github.com/ScaleFT/device-tools/localft/sshclient.GetConfigForHost({0x1056a4760?, 0x140001164b0?}, {0x140005f8c00, 0x19}, {0x14000113040, 0x8, 0x8})
github.com/ScaleFT/device-tools/localft/sshclient/sshclient.go:566 +0x1f0
github.com/ScaleFT/device-tools/localft/sshto.(*SFTSSHClient).getLastHopGoClient(0x140003646c0, {0x1056a4760, 0x140001164b0}, 0x140001b9420)
github.com/ScaleFT/device-tools/localft/sshto/internal.go:56 +0xa0
github.com/ScaleFT/device-tools/localft/sshto.(*SFTSSHClient).GetInternalGoClient(0x140003646c0, {0x1056a4760, 0x140001164b0}, {0x10d952818?, 0x14000277c00?}, {0x16b76b972?, 0x105efae40?}, {0x105ef8f30?, 0x10d6a0008?, 0x1047293cc?})
github.com/ScaleFT/device-tools/localft/sshto/sshto.go:1111 +0x6c
github.com/ScaleFT/device-tools/localft/proxycommand.(*fakeClient).Dial(0x140003645a0, {0x1056a4760?, 0x140001164b0})
github.com/ScaleFT/device-tools/localft/proxycommand/bridge_client.go:165 +0x1a0
github.com/ScaleFT/device-tools/localft/proxycommand.(*bridgeServer).dial(0x140005c66c0)
github.com/ScaleFT/device-tools/localft/proxycommand/bridge.go:811 +0x38
github.com/ScaleFT/device-tools/localft/proxycommand.(*bridgeServer).ListenAndServe(0x140005c66c0, {0x10569f510, 0x14000136000}, {0x10569f538, 0x14000136008})
github.com/ScaleFT/device-tools/localft/proxycommand/bridge.go:820 +0x30
github.com/ScaleFT/device-tools/sft.proxyCommandFn({0x1056a4808?, 0x14000282510}, 0x14000245760)
github.com/ScaleFT/device-tools/sft/proxycommand.go:181 +0x960
github.com/ScaleFT/device-tools/sft.cliAction.func1(0x140005c6660?)
github.com/ScaleFT/device-tools/sft/sft.go:187 +0x190
github.com/urfave/cli.HandleAction({0x1054a0fa0?, 0x14000492b20?}, 0xc?)
github.com/urfave/cli@v1.22.4/app.go:526 +0x58
github.com/urfave/cli.Command.Run({{0x1051632c9, 0xc}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x1051afb39, 0x57}, {0x0, ...}, ...}, ...)
github.com/urfave/cli@v1.22.4/command.go:174 +0x558
github.com/urfave/cli.(*App).Run(0x1400066e380, {0x1400013a000, 0x7, 0x7})
github.com/urfave/cli@v1.22.4/app.go:279 +0x838
github.com/ScaleFT/device-tools/sft.Run(...)
github.com/ScaleFT/device-tools/sft/sft.go:36
main.main()
github.com/ScaleFT/device-tools/cmd/sft/sft.go:74 +0x2b8
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535
Applies To
- Advanced Server Access (ASA)
Cause
This error indicates the ScaleFT client is not compatible with a parameter within the client's SSH configuration file.
Solution
Review the contents of the affected client's SSH configuration file. On Mac, this will be under ~/.ssh/config.
An example of problematic entries is those that may include special characters like "=" or trying to load a custom SSH toolset like Fig. Removing the offending entry should resolve the issue and allow subsequent SSH attempts to succeed.
If it is not clear which parameter in the SSH configuration file is causing the issue, we would recommend commenting out all the entries and then incrementally uncommenting each parameter to find which one introduces the issue.
