unable to monitor server, error message not helpful.
alex@alex-work ~/s/rtop (master)> ./rtop alex@my-demo:2299
rtop: asn1: structure error: tags don't match (16 vs {class:2 tag:1 length:76 isCompound:false}) {optional:false explicit:false application:false defaultValue:<nil> tag:<nil> stringType:0 set:false omitEmpty:false} pkcs1PrivateKey @2
alex@alex-work ~/s/rtop (master) [1]> ssh -p 2299 my-demo
Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic x86_64)
so that's strange. I tried manually providing the private key to use, but the same result happened.
Keeping in mind that my private key is password protected, and the ssh-agent currently has access to it unencrypted.
Not sure what's going on :<
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?
alex@alex-work ~/s/rtop (master)> cat src/sshhelper.go | head -n 125 | tail -n 15
return append(auths, ssh.PasswordCallback(passwordCallback))
}
func sshConnect(user, addr, keypath string) (client *ssh.Client) {
auths := make([]ssh.AuthMethod, 0, 2)
auths = addAgentAuth(auths)
auths = addKeyAuth(auths, keypath)
//auths = addPasswordAuth(auths)
config := &ssh.ClientConfig{
User: user,
Auth: auths,
}
client, err := ssh.Dial("tcp", addr, config)
if err != nil {
alex@alex-work ~/s/rtop (master)> make
GOPATH=`pwd` go build -o rtop src/*.go
alex@alex-work ~/s/rtop (master)> ./rtop my-demo:2299
rtop: asn1: structure error: tags don't match (16 vs {class:2 tag:1 length:76 isCompound:false}) {optional:false explicit:false application:false defaultValue:<nil> tag:<nil> stringType:0 set:false omitEmpty:false} pkcs1PrivateKey @2
for the record, and I don't know if this is explicitly the cause, but I use keychain rather than ssh-agent. It still registers the environment variables though. :\
I think addAgentAuth is failing, because it should be getting the key from the agent.
Hmm, it does for me. Can you try with a non-password-protected private key?
Sorry for the slow reply. Now I'm REALLY confused.
alex@alex-work ~/s/rtop (master) [130]> keychain --clear
* keychain 2.8.0 ~ http://www.funtoo.org
* Found existing ssh-agent: 545
* ssh-agent: All identities removed.
alex@alex-work ~/s/rtop (master)> ./rtop -i ~/.ssh/test_rsa my-demo:2299
Password: (ctrl-c)
alex@alex-work ~/s/rtop (master) [2]> ssh -i ~/.ssh/test_rsa -p 2299 my-demo
Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic x86_64)
wut.
the key works on its own, but fails on its own for rtop. How is that... what?!
I can confirm that removing a passphrase from private key resolves this: ssh-keygen -p -N '' -f <key_file>
obviously, not something you want to do in general
Yah I likely am hitting another issue entirely, it might not be related to the private key password.
Please check with commit f753d19. With this rtop will natively support encrypted private keys, and also support auth via ssh-agent correctly.
Ah it's asking me for a key now, I think this is likely working, but I may be suffering from a different issue as well, seeing as the unecrypted pup key doesn't work. I can't confirm this is a solved issue, should I open another one?
Try with the latest commit ba5b35e. This improves the auth method handling.
alex@alex-work ~/s/rtop ((ba5b35e...))> ./rtop my-demo:2299
Enter passphrase for key '/home/alex/.ssh/id_rsa':
alex@my-demo's password:
rtop: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey password], no supported methods remain
alex@alex-work ~/s/rtop ((ba5b35e...)) [1]> ssh -p 2299 my-demo
Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic x86_64)
sooo there are some problems here. Even with the correct password that I just set on that machine, it fails to authenticate. It's not pulling the pubkey from the ssh agent (keychain).
this is frustrating, I don't understand what's going wrong here.
Hmm, ssh appears to be using the agent, since it is not asking for the passphrase of the encrypted private key at ~/.ssh/id_rsa. (Or its reusing a connection via ControlMaster). Assuming the rtop was properly compiled off ba5b35e, this probably means that rtop is not able to talk to the agent.
Rtop uses the env var SSH_AUTH_SOCK to get the Unix socket name to talk to. This is usually set by running "eval $(ssh-agent)" in the shell. Can you check this flow?
those environment variables are set.
alex@alex-work ~/s/rtop ((ba5b35e...))> env
...
SHLVL=4
SSH_AGENT_PID=545
SSH_AUTH_SOCK=/tmp/ssh-CjnTqN8e2L0y/agent.544
TERM=xterm-256color
...
so this is very strange!
Is the env var being exported? Can you run "bash" again and in it "env" again?
alex@alex-work ~/s/rtop ((ba5b35e...)) [1]> bash
[alex@alex-work rtop]$ env
...
SSH_AGENT_PID=545
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/alex
...
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/share/java/gradle/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl=
SSH_AUTH_SOCK=/tmp/ssh-CjnTqN8e2L0y/agent.544
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
MAVEN_OPTS=-Xmx512m
:(
also there really is something screwy going on here. I am connecting to a server that knows my public key, it also has a password and I provided that. I just can't connect to that server. Providing repeated correct credentials.
Hmm. Try connecting to another server? Try running rtop from another machine?