lukesampson / pshazz

Give your powershell some pizazz.
The Unlicense
575 stars 40 forks source link

refactor ssh plugin #76

Closed chawyehsu closed 5 years ago

chawyehsu commented 5 years ago

A total refactoring of ssh plugin, here are the changes:

And I think this should close #24 #70 #72

If you encounter some issue, please enable verbose output of this ssh plugin, in your pshazz theme json:

{
    "plugins": [ "aliases", "git", "ssh", "virtualenv", "z" ],
    "ssh": {
        "verbose": "true"    <------- enable verbose output
    }
}
lukesampson commented 5 years ago

This sounds great, thank you. Would you like to become a collaborator on this GitHub project so that you can commit directly?

chawyehsu commented 5 years ago

@lukesampson Yeah, I appreciate, though I want to join in the scoopinstaller org, haha.

TCB13 commented 5 years ago

So pshazz was supposed to also be an SSH helper that lets you never enter your private key password again now you've removed askpass. Is there anything else pshazz does related to SSH? I mean win32-openssh comes with ssh-agent working out of the box.

chawyehsu commented 5 years ago

@TCB13 The ssh plugin of pshazz does not only have the key passphrase caching feature. It does also start the ssh-agent automatically and add your keys (id_rsa) automatically, and it does also provide tab completion on ssh command.

$ ssh <TAB>
*     hostA    hostB    ...        // hosts defined in your ~/.ssh/config

askpass was just a little tool used to provide a GUI prompt to input the key passphrase and to store your key passphrase into the WCM(Windows Credential Manager).

Since Win32-OpenSSH has been able to cache your key passphrase thanks to the service running mode of ssh-agent. The ssh-agent doesn't need to interactive with askpass.

Here is the introduction about Automatically start the SSH Agent from posh-sshell, the ssh plugin of pshazz does the same thing on this feature now.

If you are using the Windows-native version of OpenSSH that ships with Windows 10 1803 or newer, then this will simply start the agent service if it's not already running and add your keys. You will be prompted once to enter your key passphrase. Once the service is running, you will not be prompted again.

If you are using the version of OpenSSH that comes with Git for Windows, then you will be prompted to enter your key the first time you open a Powershell session following a restart.

You might say, my ssh-agent starts automatically without pshazz. That's fine because you're using the win32-openssh, and the ssh-agent service is set to Automatic/Automatic (Delayed Started). If it is set to Manual, it won't start automatically, and pshazz gives help on it.

20190113085927