Giter VIP home page Giter VIP logo

Comments (16)

lancechentw avatar lancechentw commented on August 9, 2024 1

I found that 512-bit RSA works, while 2048-bit RSA fails.

from rtop.

lancechentw avatar lancechentw commented on August 9, 2024 1

Do DecryptPEMBlock() like this after pem.Decode()
https://golang.org/src/crypto/x509/pem_decrypt_test.go#L15

Also, use IsEncryptedPEMBlock() to determine if decryption is needed.

from rtop.

mdevan avatar mdevan commented on August 9, 2024

Same as #13. Repeating what I posted there, could you try this?


Hmm, maybe it is picking up the key file auth method first, before the ssh-agent method. Can you try an experiment please?

  • comment out line 118 in sshhelper.go: auths = addPasswordAuth(auths)
  • recompile (make)
  • try again?

from rtop.

peterbe avatar peterbe commented on August 9, 2024

I have the same error. I tried commenting out line 118 and recompiled and it didn't solve the problem.

I'm on OSX.

from rtop.

peterbe avatar peterbe commented on August 9, 2024

By the way, I encountered that error with and without the -i flag.

from rtop.

lancechentw avatar lancechentw commented on August 9, 2024

Commenting out line 118 does not work for me, either running rtop without ssh-agent.

I think it fails at ans1.Unmarshal() in ParsePKCS1PrivateKey
https://golang.org/src/crypto/x509/pkcs1.go?h=ParsePKCS1PrivateKey#L41

from rtop.

lancechentw avatar lancechentw commented on August 9, 2024

#11 (comment) is not correct. It is not 2048-bit RSA that fails, it is a key-pair with passphrase that fails.

from rtop.

mdevan avatar mdevan commented on August 9, 2024

Please check with commit f753d19. With this rtop will natively support encrypted private keys, and also support auth via ssh-agent correctly.

from rtop.

peterbe avatar peterbe commented on August 9, 2024

Building this version, now I no longer get that same error @Lance0312 got. But instead I get a "Key passphrase:" prompt

:~/dev/GO/rtop (master=)$ ./rtop [email protected]
Key passphrase:
^C

This works though without prompting me for a passphrase:

:~/dev/GO/rtop (master=)$ ssh [email protected]

from rtop.

mdevan avatar mdevan commented on August 9, 2024

@peterbe is your ~/.ssh/id_rsa encrypted?

from rtop.

peterbe avatar peterbe commented on August 9, 2024
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,4AD650ED3EC480B5....

........

from rtop.

peterbe avatar peterbe commented on August 9, 2024

so, plain text I guess

from rtop.

lancechentw avatar lancechentw commented on August 9, 2024

@mdevan, f753d19 works great. I was working on to build something like getpass(), didn't know passwordCallback() could simply do the job ;D

I think @peterbe uses ssh-agent, am I correct? The auth order changed in f753d19 breaks how it should work. If ssh-agent has credentials cached, it should be used for auth first. Then asks user for passphrase if there's no credential cached.

from rtop.

mdevan avatar mdevan commented on August 9, 2024

@Lance0312 There is a catch in the auth order. The code in golang.org/x/crypto/ssh/client_auth.go#clientAuthenticate assumes that there is only one callback per auth type (e.g. "publickey"). So as it stands, either the agent or the key would work, but not both (as a superset). Will fix soon.

from rtop.

lancechentw avatar lancechentw commented on August 9, 2024

@mdevan, got it. I am closing this issue since we have encrypted key pair support now. @peterbe, would you please open another issue for your problem?

from rtop.

mdevan avatar mdevan commented on August 9, 2024

Try with the latest commit ba5b35e. This improves the auth method handling.

from rtop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.