1829013 Members
2329 Online
109986 Solutions
New Discussion

OpenSSH

 
Allison Fisher
Advisor

OpenSSH

I've installed the HP-UX Secure Shell -A.04.10.002. I've generated a DSA key pair via (ssh-keygen -b 2048 -t dsa) and left the passphrase blank. The public key has been copied to the remote server. When I attempt to connect sftp, here's the output:

Connecting to (remote server)...
OpenSSH_4.1, OpenSSL 0.9.7e 25 Oct 2004
HP-UX Secure Shell-A.04.10.002, HP-UX Secure Shell version
debug1: Reading configuration data /opt/ssh/etc/ssh_config
debug3: Seeding PRNG from /opt/ssh/libexec/ssh-rand-helper
debug2: ssh_connect: needpriv 0
debug1: Connecting to (remote server name)
[remote server ip] port 22.
debug1: Connection established.
debug1: identity file /home/clientst/.ssh/id_rsa type -1
debug3: Not a RSA1 key file /home/clientst/.ssh/id_dsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /home/clientst/.ssh/id_dsa type 2
ssh_exchange_identification: Connection closed by remote host
Connection closed

So then I deleted all keys to test password authentication, and I get this output:

Connecting to (remote server)
OpenSSH_4.1, OpenSSL 0.9.7e 25 Oct 2004
HP-UX Secure Shell-A.04.10.002, HP-UX Secure Shell version
debug1: Reading configuration data /opt/ssh/etc/ssh_config
debug3: Seeding PRNG from /opt/ssh/libexec/ssh-rand-helper
debug2: ssh_connect: needpriv 0
debug1: Connecting to (remote server)
[remote server ip] port 22.
debug1: Connection established.
debug1: identity file /home/clientst/.ssh/id_rsa type -1
debug1: identity file /home/clientst/.ssh/id_dsa type -1
ssh_exchange_identification: Connection closed by remote host
Connection closed

Why is it still trying to find an id_rsa type -1 first?
12 REPLIES 12
Con O'Kelly
Honored Contributor

Re: OpenSSH

Hi Allison

The following links may help to resolve your problem.

http://www.snailbook.com/faq/libwrap-oops.auto.html

http://www.snailbook.com/faq/

Cheers
Con
Allison Fisher
Advisor

Re: OpenSSH

Thanks, but there's nothing new out there. Did you see somthing specific on Snailbook that you thought was a solution? Why would sftp be looking for an identity file of id_rsa type -1? I've even gone as far as modifying the config files to point to an absolute path/filename for the id_dsa type -2 file. But the big clue is that after I deleted all keys, I should've been prompted for a password. I never get that far.
Greg Vaidman
Respected Contributor

Re: OpenSSH

what files did you delete? the authorized_keys file on the remote? you may want to delete the id_rsa on your local system as well.

the debug info you list is only from the client side. if you stop the remote server (/sbin/init.d/secsh stop), and run sshd with a "-ddd" option, you can debug info from the server side - that would likely tell you why the connection was closed. you'll need to restart sshd (/sbin/init.d/secsh start) when you're done.
Allison Fisher
Advisor

Re: OpenSSH

Greg - The remote server belongs to an external client, so I have no control there. Problem is, their admin (supposedly more experienced than me) swears the problem is on my side. When I delete all the keys, I think I should be promted for password. Instead, here is the output.

Connecting to (remote server)...
OpenSSH_4.1, OpenSSL 0.9.7e 25 Oct 2004
HP-UX Secure Shell-A.04.10.002, HP-UX Secure Shell version
debug1: Reading configuration data /opt/ssh/etc/ssh_config
debug3: Seeding PRNG from /opt/ssh/libexec/ssh-rand-helper
debug2: ssh_connect: needpriv 0
debug1: Connecting to (remote server] port 22.
debug1: Connection established.
debug1: identity file /home/clientst/.ssh/id_rsa type -1
debug1: identity file /home/clientst/.ssh/id_dsa type -1
ssh_exchange_identification: Connection closed by remote host
Connection closed

There are no id_dsa or id_rsa files in the /home/clientst/.ssh directory. What does this output mean? Is it really a problem on my client side? Remote server admin says that I never actually connect and that the debug output "Connection established" is erroneous. Arghhh!
Sanjay_6
Honored Contributor

Re: OpenSSH

Hi,

I think what con was trying to point out was that if the remote server has sshd compiled using tcp_wrapper or if the remote server is using tcp wrappers to control the incoming access, if you are not allowed through the /etc/hosts.allow file (either specifically or globally) then the server will not even prompt you for a password but will close your connection.

Hope this helps.

regds


Sanjay_6
Honored Contributor

Re: OpenSSH

Hi,

Another thing you can check for is if your ssh_config file has this entry,

StrictHostKeyChecking yes

If so, can you change it is no and try. If it works, you can reset it back to yes after that.

A Sample explanation of the parameter in the ssh_config file.

http://www.faqs.org/docs/securing/chap15sec121.html

do not look at what this link is for, just look at the parameter explanations. On your server the ssh_config file could be in /usr/local/etc

Hope this helps.

regds
Shameer.V.A
Respected Contributor

Re: OpenSSH

Hi,
Can any one explain me how to install secure shell on hp ux 11.11. and what is the minimum patch level required for installation?? .
Thanks,

Shameer
.... See invisible, feel intangible and achieve impossible as everything is possible ....
Allison Fisher
Advisor

Re: OpenSSH

I discovered by accident that the fix was to first ssh into the remote server. It then prompted me to accept the RSA key. Now I can sftp to the remote host. HOWEVER - public key authentication is not working. I created the key pair with an empty passphrase. The public key is in place on the remote host. Can someone make sense of the following output and tell me why public key authentication is failing? Password authentication works fine. Here's what I get:

client_user.d$ sftp -vvv user@[remote hot]
Connecting to [remote host]...
OpenSSH_4.1, OpenSSL 0.9.7e 25 Oct 2004
HP-UX Secure Shell-A.04.10.002, HP-UX Secure Shell version
debug1: Reading configuration data /opt/ssh/etc/ssh_config
debug3: Seeding PRNG from /opt/ssh/libexec/ssh-rand-helper
debug2: ssh_connect: needpriv 0
debug1: Connecting to [remote host][xxx.xx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /home/client_user/.ssh/id_rsa type -1
debug3: Not a RSA1 key file /home/client_user/.ssh/id_dsa.
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug1: identity file /home/client_user/.ssh/id_dsa type 2
debug1: Remote protocol version 1.99, remote software version OpenSSH_3.9p1
debug1: match: OpenSSH_3.9p1 pat OpenSSH_3.*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.1
debug2: fd 4 setting O_NONBLOCK
debug3: RNG is ready, skipping seeding
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,ar
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,ar
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,ar
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,ar
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_init: found hmac-md5
debug1: kex: server->client aes128-cbc hmac-md5 none
debug2: mac_init: found hmac-md5
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug2: dh_gen_key: priv key bits set: 137/256
debug2: bits set: 514/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug3: check_host_in_hostfile: filename /home/client_user/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 1
debug3: check_host_in_hostfile: filename /home/client_user/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 2
debug1: Host â [remote host]â is known and matches the RSA host key.
debug1: Found key in /home/client_user/.ssh/known_hosts:1
debug2: bits set: 520/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/client_user/.ssh/id_rsa (00000000)
debug2: key: /home/client_user/.ssh/id_dsa (400309b8)
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: start over, passed a different list publickey,password,keyboard-interactive
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/client_user/.ssh/id_rsa
debug3: no such identity: /home/client_user/.ssh/id_rsa
debug1: Offering public key: /home/client_user/.ssh/id_dsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-dss blen 817
debug2: input_userauth_pk_ok: fp 5c:8b:74:60:75:0e:07:e8:4c:c0:bc:23:e0:0a:2e:22
debug3: sign_and_send_pubkey
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type
Enter passphrase for key '/home/client_user/.ssh/id_dsa':
debug2: no passphrase given, try next key
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug2: we sent a keyboard-interactive packet, wait for reply
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: userauth_kbdint: disable: no info_req_seen
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred:
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
client@[remote host]'s password:
debug3: packet_send2: adding 64 (len 57 padlen 7 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: Authentication succeeded (password).
debug2: fd 5 setting O_NONBLOCK
debug2: fd 8 setting O_NONBLOCK
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Entering interactive session.
debug2: callback start
debug2: client_session2_setup: id 0
debug1: Sending subsystem: sftp
debug2: channel 0: request subsystem confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 131072
debug2: Remote version: 3
debug3: Sent message fd 8 T:16 I:1
debug3: SSH_FXP_REALPATH . -> /home/10103/client_user
sftp>
Doug O'Leary
Honored Contributor

Re: OpenSSH

Hey;

Only looking at your first set of error messages, I believe you sent the wrong key to the remote system.

openssh public keys do not have a --begin line in them as indicated by your output above...

>> debug2: key_type_from_name: unknown key type '-----BEGIN'

but the private keys do. The public keys look like:

$ cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAqMDG2gY8HxhkV2K4Pczf4GLdlL8tbvjx7F7nXdKDgTri+2FYBQdAnKrdwhzOnIhtp7CjerJoAVidx5TZGQ6lpJdqPJAcn0A8tfJJ7cAOH8q/6lH1MHni4kuMLMFBkNMPPyw6rAcyFxoW6DX3f61tDd7vaHswlHJhjZSIfXJz+tU= dkoleary@linux

The private key looks like:

-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,4CC7F136CE62D514

[[ sensitive bits snipped ]]

-----END RSA PRIVATE KEY-----

On the system you want to ssh from, regenerate your keys - and use a passphrase! You've circumvented 90% of ssh's protection by not using the passphrase! If you need to use automated ssh scripts then generate an alternate identity. You can send me an email directly @ dkoleary@olearycomputers.com if you'd like detailed instructions on doing that.

scp the public key to the remote system and append it to ~/.ssh/authorized_keys.

HTH;

Doug O'Leary

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
Allison Fisher
Advisor

Re: OpenSSH

Thanks Doug, but I did send the correct key. Even when I use ssh between my 2 servers here running same version HPUX, ssh complains about the ----BEGIN line. I have to remove the begin and end line in order for it to work.

But the keys still don't work on the remote system which is running a portable version of ssh (3.9 I believe) on Solaris. Any experience with the HP version of ssh not playing nice with others?
Doug O'Leary
Honored Contributor

Re: OpenSSH

Hey;

No, no experience w/openssh not playing well between OS. In fact, just the opposite. I use PKA via openssh between Linux, Solaris, and HPUX routinely.

About the only thing I can suggest backing all the way out and starting over. Take everything out so your systems aren't looking for public keys - only password authentication. Then, start over from scratch.

It might help if all the openssh were at the same level or reasonably close. I seem to remember there being some nasty security issues w/openssh < 3.9(?)

Sorry I couldn't be of more help.

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
Allison Fisher
Advisor

Re: OpenSSH

Problem partially solved. Will open new thread to address remaining problems.