How to use execute command via ssh step (OD-2220)
alion opened 1 year ago

I was set my username, remote host, and private key secret, but it's not work.

error msg: Permission denied, please try again. Permission denied, please try again. myusername@myhost: Permission denied (publickey,password).

Private key secret : I set this start with -----BEGIN OPENSSH PRIVATE KEY----- my private key -----END OPENSSH PRIVATE KEY-----

Is that correct? And any other limit on this step?

  • alion commented 1 year ago

    Private key secret : I also set the user'password as this property. it's not work also

  • Robin Shen commented 1 year ago

    The private key secret should be specified as name of a job secret whose value is your private key. Check the inline help of that property.

  • alion commented 1 year ago

    I did it this way, just omitted to describe job secret. My main point is that I don’t know if the value of the job secret is something like this: -----BEGIN OPENSSH PRIVATE KEY----- my private key -----END OPENSSH PRIVATE KEY----- or it can also be done using a password.

  • alion commented 1 year ago

    Or, how can I retrieve the text value of the private key?

  • Robin Shen commented 1 year ago

    The value should be content of a private key. Please make sure your private key can be used to login to remote machine. You may also test directly with image 1dev/ssh-client:1.0.0 and run same commands as the step to find out why it is not working:

    https://code.onedev.io/onedev/server/~files/ee9857034c88d7d9cb0a3d1b80e1eb316a4da732/server-core/src/main/java/io/onedev/server/buildspec/step/SSHCommandStep.java?position=source-132.1-149.39-1

  • alion commented 1 year ago

    Thank you, I will check.

  • alion commented 1 year ago

    I find the problem.

    We have set a passphrase for the private key we are using, and we utilize ssh-agent to avoid frequently entering the passphrase. Could you please advise on how to support passphrases or ssh-agent in this context?

  • Robin Shen commented 1 year ago

    Unfortunately private key with passphrase is not supported.

  • alion commented 1 year ago

    As far as I know, many system administrators set a passphrase for their private keys. If passphrases are not supported, the functionality of this feature will be significantly compromised. Please reconsider supporting this capability.

  • Robin Shen changed state to 'Closed' 1 year ago
    Previous Value Current Value
    Open
    Closed
  • Robin Shen commented 1 year ago

    This will not be considered right now, as supporting passphrase can be quite complex. Closing the issue now.

issue 1/1
Type
Question
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (2)
Reference
OD-2220
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover