jfrog / jfrog-cli

JFrog CLI is a client that provides a simple interface that automates access to the JFrog products.
https://www.jfrog.com/confluence/display/CLI/JFrog+CLI
Apache License 2.0
531 stars 234 forks source link

Error on SSH key without passphrase #1114

Open raspy opened 3 years ago

raspy commented 3 years ago

Describe the bug When using an SSH key that has no passphrase protection, jfrog-cli ends with an error.

To Reproduce jfrog rt dl '/path/to/download/*' --url=ssh://artifactory.domain.com:1339 --ssh-key-path=/root/.ssh/id_rsa

Expected behavior Files are downloaded.

Screenshots [Info] Performing SSH authentication... [Info] Trying to authenticate via SSH-Agent... [Info] Authentication via SSH-Agent failed. Error: SSH agent requested but SSH_AUTH_SOCK not-specified [Info] Trying to authenticate via SSH Key... [Debug] Usage Report: Sending info... [Info] Performing SSH authentication... [Info] Trying to authenticate via SSH-Agent... [Info] Authentication via SSH-Agent failed. Error: SSH agent requested but SSH_AUTH_SOCK not-specified [Info] Trying to authenticate via SSH Key... [Info] Authentication via SSH Key failed. [Debug] Usage Report: ssh: key is not password protected [Info] Authentication via SSH Key failed. { "status": "failure", "totals": { "success": 0, "failure": 0 } } [Error] ssh: key is not password protected

Versions

Additional context The error is raised from golang's crypto module. This gets directly from JFrog CLI always calling ParsePrivateKeyWithPassphrase, while for a non-encrypted key it should call ParsePrivateKey.

Vynce commented 3 years ago

I'm seeing the same issue:

jfrog.exe rt ping --url ssh://artifactory.domain.com:1234 --ssh-key-path ~/.ssh/id_rsa
[Info] Performing SSH authentication...
[Info] Trying to authenticate via SSH-Agent...
[Debug] Usage Report: Sending info...
[Info] Authentication via SSH-Agent failed. Error:
 SSH agent requested, but could not detect Pageant or Windows native SSH agent
[Info] Trying to authenticate via SSH Key...
[Info] Performing SSH authentication...
[Info] Trying to authenticate via SSH-Agent...
[Info] Authentication via SSH-Agent failed. Error:
 SSH agent requested, but could not detect Pageant or Windows native SSH agent
[Info] Trying to authenticate via SSH Key...
[Info] Authentication via SSH Key failed.
[Info] Authentication via SSH Key failed.
[Debug] Usage Report: ssh: not an encrypted key
[Error] ssh: not an encrypted key

1.39.7 works and 1.40.0 and later doesn't. 1.50.0 still has the same issue.