Closed pieterhelsen closed 3 years ago
Paramiko's connect method accepts passphrase
argument that can be used to unlock private keys protected with passwords. But implementing that and storing the password in config file kinda defeats the purpose of the password in the first place. I think the ssh-agent keeps password protected private keys unlocked for some time after you add them and that's probably why it works with re-adding.
I've looked info Fabric
before and it's not a better option.
Delving deeper into the issue, this appears to be related to tmux, not Paramiko. https://blog.testdouble.com/posts/2016-11-18-reconciling-tmux-and-ssh-agent-forwarding/
Describe the bug
I'm running
chiadog
in a remote harvester setup with a password-protected private key from atmux
session with multiple Windows (one for each remote harvester). After upgrading to 0.4.1 (main) and restartingchiadog
I get an error message saying that the private key file is encrypted.It appears that the Paramiko library is not able to access
ssh-agent
.The workaround for this issue is to
kill
ssh-agent and re-add the key everytime I restart the process. So since I have three remote harvesters (one Windows, two Linux), I need to do:python3 chiadog --config harvester1.yaml
to see if the issue occurschiadog
ps aux | grep ssh-agent
to find out the PIDkill [PID]
``eval
ssh-agent -s````ssh-add ~/.ssh/id_rsa
python3 chiadog --config harvester1.yaml
I am not sure whether it is
chiadog
s implementation of Paramiko or some inherent bug in the Paramiko library. I did notice that Paramiko use thePasswordRequiredException
as a bit of a catch-all, so it may be something else entirely.My main goal for this ticket:
Fabric
instead ofParamiko
, which is a simplified interface on top of Paramiko and might simplify some of the error handling.Environment: