Too many authentication failures when defining lots of servers
- [x] I have the latest version of sake
- [x] I have searched through the existing issues
Info
-
OS
- [x] Linux
- [ ] Mac OS X
- [x] Windows
- [ ] other
-
Shell
- [x] Bash
- [ ] Zsh
- [ ] Fish
- [ ] Powershell
- [ ] other
- Version: 0.10.1
Problem / Steps to reproduce
- Define lots of servers with different pubkey
- Attempt any task
- Some servers will fail as ALL pubkeys are tried one by one, which may exceed
MaxAuthTrieson sshd
ssh: handshake failed: ssh: disconnect, reason 2: Too many authentication failures
Observation
From the code here, all provided identities are collected and tried for each server with pubkey support.
https://github.com/alajmo/sake/blob/47cdac64f3ae4329a18293828a464204bf9a7fbd/core/run/exec.go#L163-L166
This should not be the case, each server should only try with (own) provided and global identity.
Also this approach is not very efficient as N servers with same pubkey will generate N identical identities. If a server using pubkey2 is declared below 100 servers using pubkey1, it will need to try 100 wrong identities before it can make connection, if even can pass the MaxAuthTries.
Thanks for the bug report and finding the inefficiencies, will check it out after vacation.
Should be fixed now with v0.10.3, please re-open if the issue persists.