Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bitbucket Server SSH with Plesk

Fabrizio Cocco November 26, 2019

Hi

I'm trying for days and Playing around with key to get a chance to pull git repositories from bitbucket server to plesk 18. 

Google doens't help realy much, so i hope i will find a solution to post it here and help others. 

On this stage i'm here: When you wan't to use the plesk build in git plugin we got an error like this:

Server at 'bitbucket.supsign.tech:7999' is seen for the first time.
Adding its public key to the list of known hosts in '/var/www/vhosts/supsign.info/.ssh/git_known_hosts_with_port_7999'.
# bitbucket.supsign.tech:7999 SSH-2.0-APACHE-SSHD-2.3.0
# bitbucket.supsign.tech:7999 SSH-2.0-APACHE-SSHD-2.3.0
# bitbucket.supsign.tech:7999 SSH-2.0-APACHE-SSHD-2.3.0
No RSA host key is known for [bitbucket.supsign.tech]:7999 and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

So i figure out to test the ssh first before blaming plesk.

Created a new key on the macbook, publich on bitbucket and connect, with sourcetree and it is working.  

Next test was an ssh -Tv git@bitbucket.supsign.tech -p 7999

OpenSSH_7.9p1, LibreSSL 2.7.3

debug1: Reading configuration data /Users/fcocco/.ssh/config

debug1: /Users/fcocco/.ssh/config line 1: Applying options for *

debug1: Reading configuration data /etc/ssh/ssh_config

debug1: /etc/ssh/ssh_config line 48: Applying options for *

debug1: Connecting to bitbucket.supsign.tech [178.174.59.85] port 7999.

debug1: Connection established.

debug1: identity file /Users/fcocco/.ssh/id_rsa type 0

debug1: identity file /Users/fcocco/.ssh/id_rsa-cert type -1

debug1: identity file /Users/fcocco/.ssh/id_dsa type -1

debug1: identity file /Users/fcocco/.ssh/id_dsa-cert type -1

debug1: identity file /Users/fcocco/.ssh/id_ecdsa type -1

debug1: identity file /Users/fcocco/.ssh/id_ecdsa-cert type -1

debug1: identity file /Users/fcocco/.ssh/id_ed25519 type -1

debug1: identity file /Users/fcocco/.ssh/id_ed25519-cert type -1

debug1: identity file /Users/fcocco/.ssh/id_xmss type -1

debug1: identity file /Users/fcocco/.ssh/id_xmss-cert type -1

debug1: Local version string SSH-2.0-OpenSSH_7.9

debug1: Remote protocol version 2.0, remote software version APACHE-SSHD-2.3.0

debug1: no match: APACHE-SSHD-2.3.0

debug1: Authenticating to bitbucket.supsign.tech:7999 as 'git'

debug1: SSH2_MSG_KEXINIT sent

debug1: SSH2_MSG_KEXINIT received

debug1: kex: algorithm: ecdh-sha2-nistp256

debug1: kex: host key algorithm: rsa-sha2-512

debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none

debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none

debug1: sending SSH2_MSG_KEX_ECDH_INIT

debug1: expecting SSH2_MSG_KEX_ECDH_REPLY

debug1: Server host key: ssh-rsa SHA256:c48gkmF6AdqUDSqwCzQQB3OxPQFyXz5VG18Fk4OHjvk

debug1: Host '[bitbucket.supsign.tech]:7999' is known and matches the RSA host key.

debug1: Found key in /Users/fcocco/.ssh/known_hosts:2

debug1: rekey after 4294967296 blocks

debug1: SSH2_MSG_NEWKEYS sent

debug1: expecting SSH2_MSG_NEWKEYS

debug1: SSH2_MSG_NEWKEYS received

debug1: rekey after 4294967296 blocks

debug1: Will attempt key: /Users/fcocco/.ssh/id_rsa RSA SHA256:X9ZNtLjUZ3FQrjR2mek7I1iGa6/UhVBlRjkBmdU5sUI

debug1: Will attempt key: /Users/fcocco/.ssh/id_dsa

debug1: Will attempt key: /Users/fcocco/.ssh/id_ecdsa

debug1: Will attempt key: /Users/fcocco/.ssh/id_ed25519

debug1: Will attempt key: /Users/fcocco/.ssh/id_xmss

debug1: SSH2_MSG_SERVICE_ACCEPT received

debug1: Authentications that can continue: publickey

debug1: Next authentication method: publickey

debug1: Offering public key: /Users/fcocco/.ssh/id_rsa RSA SHA256:X9ZNtLjUZ3FQrjR2mek7I1iGa6/UhVBlRjkBmdU5sUI

debug1: Server accepts key: /Users/fcocco/.ssh/id_rsa RSA SHA256:X9ZNtLjUZ3FQrjR2mek7I1iGa6/UhVBlRjkBmdU5sUI

debug1: Authentication succeeded (publickey).

Authenticated to bitbucket.supsign.tech ([178.174.59.85]:7999).

debug1: channel 0: new [client-session]

debug1: Entering interactive session.

debug1: pledge: network

debug1: Sending environment.

debug1: Sending env LANG = de_CH.UTF-8

shell request failed on channel 0

So what i See is that the auth is working, but there have to be some wrong setting that the session dies. Maybe this is a part of the problem with plesk or not. 

I'm happy about every help, because i'm realy stuck

PS: Pulling over https is working too, but it isn't an option, because plesk only allows https without auth.

1 answer

0 votes
Giuliano Schindler January 11, 2020

Hi,
i solve this problem with this solution:

At the frist step i login to this server with my root-account and login into the account from the customer or webhosting project:

[root@www2 customer-site.net]# su -m customer123123
bash: /root/.bashrc: Keine Berechtigung
bash-4.2$ pwd
/var/www/vhosts/customer123123.www2.netzfabrik.eu/customer-site.net

Now, i change the directory to "/tmp" to test clone the repo from bitbucket server:

bash-4.2$ cd /tmp
bash-4.2$ git clone ssh://git@bitbucket.netzfabrik.com:7999/cst/www.customer-site.net.git
Klone nach 'www.customer-site.net'...
The authenticity of host '[bitbucket.netzfabrik.com]:7999 ([2a07:6fc0:5:0:5:1:64:7]:7999)' can't be established.
RSA key fingerprint is SHA256:O/N7iWnpLsXmzUgfKCk5u6mHeWXrLfZ/FNvAOFd+Wro.
RSA key fingerprint is MD5:68:a2:71:bb:64:ef:27:61:b2:e5:0e:69:c4:02:fb:91.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[bitbucket.netzfabrik.com]:7999,[2a07:6fc0:5:0:5:1:64:7]:7999' (RSA) to the list of known hosts.
remote: Enumerating objects: 4736, done.
remote: Counting objects: 100% (4736/4736), done.
remote: Compressing objects: 100% (3980/3980), done.
remote: Total 4736 (delta 733), reused 4552 (delta 627)
Empfange Objekte: 100% (4736/4736), 77.71 MiB | 13.03 MiB/s, done.
Löse Unterschiede auf: 100% (733/733), done.
warning: konnte nicht auf '/root/.config/git/attributes' zugreifen: Keine Berechtigung
bash-4.2$

In the last step i replace the file "git_known_hosts_with_port_7999" with the content from known_hosts of the webhosting user/project:

bash-4.2$ cat /var/www/vhosts/customer123123.www2.netzfabrik.eu/.ssh/known_hosts > /var/www/vhosts/customer123123.www2.netzfabrik.eu/.ssh/git_known_hosts_with_port_7999

After this, i can clone the repo via webinterface perfectly. I tested this solution on my Plesk Server with CentOS 7 and Plesk Obsidian.

Best
Giuliano

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events