Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-4111

SSH keys corrupted after upgrade to 2.9.1 when key contains newline characters

    XMLWordPrintable

Details

    Description

      Database contains:

      mysql> select u.name, substr(s.KEY_TEXT, 1, 32) from AO_FB71B4_SSH_PUBLIC_KEY s JOIN stash_user u ON s.user_id = u.id where s.KEY_TEXT not like 'ssh-%';
      +---------------+----------------------------------+
      | name          | substr(s.KEY_TEXT, 1, 32)        |
      +---------------+----------------------------------+
      | xxxx          | AAAAB3NzaC1yc2EAAAABJQAAAIEArzkz |
      | xxxxxxxxxxxxx | AAAAB3NzaC1yc2EAAAADAQABAAABAQDJ |
      | xxxxxxxxxxxxx | AAAAB3NzaC1yc2EAAAADAQABAAABAQC/ |
      | xxxxx         | sh-rsa AAAAB3NzaC1yc2EAAAABJQAAA |
      | xxxxxxxxx     | AAAAB3NzaC1yc2EAAAABIwAAAQEAur42 |
      +---------------+----------------------------------+
      5 rows in set (0.00 sec)
      

      Some user reported what after upgrade his SSH key from windows system was rejected always.

      $ ssh -vv stash.acme.com
      OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007ows 0
      debug2: ssh_connect: needpriv 0rved 0
      debug1: Connecting to stash.acme.com [xx.xx.xx.xx] port 22.1-sha1
      debug1: Connection established.rsa
      debug1: identity file /c/Users/xxxxxxx/.ssh/identity type -1owfish-cbc
      debug2: key_type_from_name: unknown key type '-----BEGIN',blowfish-cbc
      debug2: key_type_from_name: unknown key type '-----END'96,hmac-sha1-96
      debug2: key_type_from_name: unknown key type '----'md5-96,hmac-sha1-96
      debug2: key_type_from_name: unknown key type 'Comment:'
      debug2: key_type_from_name: unknown key type '----'
      debug1: identity file /c/Users/xxxxxxx/.ssh/id_rsa type -1
      debug1: identity file /c/Users/xxxxxxx/.ssh/id_dsa type -1
      debug1: Remote protocol version 2.0, remote software version SSHD-CORE-0.9.0-ATLASSIAN-1
      debug1: no match: SSHD-CORE-0.9.0-ATLASSIAN-1
      debug1: Enabling compatibility mode for protocol 2.0
      debug1: Local version string SSH-2.0-OpenSSH_4.6none
      debug2: fd 3 setting O_NONBLOCK5
      debug1: SSH2_MSG_KEXINIT sentes128-cbc hmac-md5 none
      debug1: SSH2_MSG_KEXINIT received set: 129/256
      debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1ng SSH2_MSG_KEXDH_INIT
      debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
      debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctrnown_hosts:2
      debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
      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@openssh.com,zlib
      debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
      debug2: kex_parse_kexinit:
      debug2: kex_parse_kexinit: ceived
      debug2: kex_parse_kexinit: first_kex_follows 0
      debug2: kex_parse_kexinit: reserved 0
      debug2: kex_parse_kexinit: diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
      debug2: kex_parse_kexinit: ssh-rsa/identity (0x0)
      debug2: kex_parse_kexinit: aes128-ctr,aes128-cbc,3des-cbc,blowfish-cbc
      debug2: kex_parse_kexinit: aes128-ctr,aes128-cbc,3des-cbc,blowfish-cbc
      debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-md5-96,hmac-sha1-96
      debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-md5-96,hmac-sha1-96
      debug2: kex_parse_kexinit: noneUsers/xxxxxxx/.ssh/identity
      debug2: kex_parse_kexinit: noneUsers/xxxxxxx/.ssh/id_rsa
      debug2: kex_parse_kexinit: y done: type RSA
      debug2: kex_parse_kexinit:  packet, wait for reply
      debug2: kex_parse_kexinit: first_kex_follows 0 ickey
      debug2: kex_parse_kexinit: reserved 0 xxxxxx/.ssh/id_dsa
      debug2: mac_init: found hmac-md5, disable method
      debug1: kex: server->client aes128-cbc hmac-md5 none
      debug2: mac_init: found hmac-md5
      debug1: kex: client->server aes128-cbc hmac-md5 none
      debug2: dh_gen_key: priv key bits set: 144/256wser (my-branch)
      debug2: bits set: 1017/2048
      debug1: sending SSH2_MSG_KEXDH_INIT
      debug1: expecting SSH2_MSG_KEXDH_REPLY
      debug1: Host 'stash.acme.com' is known and matches the RSA host key.
      debug1: Found key in /c/Users/xxxxxxx/.ssh/known_hosts:2
      debug2: bits set: 1051/2048
      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: /c/Users/xxxxxxx/.ssh/identity (0x0)
      debug2: key: /c/Users/xxxxxxx/.ssh/id_rsa (0x0)
      debug2: key: /c/Users/xxxxxxx/.ssh/id_dsa (0x0)
      debug1: Authentications that can continue: publickey
      debug1: Next authentication method: publickey
      debug1: Trying private key: /c/Users/xxxxxxx/.ssh/identity
      debug1: Trying private key: /c/Users/xxxxxxx/.ssh/id_rsa
      debug1: read PEM private key done: type RSA
      debug2: we sent a publickey packet, wait for reply
      debug1: Authentications that can continue: publickey
      debug1: Trying private key: /c/Users/xxxxxxx/.ssh/id_dsa
      debug2: we did not send a packet, disable method
      debug1: No more authentication methods to try.
      Permission denied (publickey).
      

      Attachments

        Issue Links

          Activity

            People

              bplump Brent P
              3652ed9ede2e Alexey Efimov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: