How to disable default SSH algorithms in Bitbucket Data Center

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Network administrators may wish to disable certain algorithms (ciphers, macs, key exchanges, signatures) for their SSH traffic. 

Since the client selects the algorithms after a negotiation phase the only way to disable certain algorithms is to completely exclude them from the available algorithms list on the server side.

Environment

Bitbucket Data Center

Solution

  • Enable debug logging of the available ciphers, exchanges, and MACs on startup by adding the following to your bitbucket.properties file and restarting Bitbucket Data Center. More information about debug logging

    logging.logger.com.atlassian.bitbucket.internal.ssh.server=DEBUG
  • Find the available algorithm names in the atlassian-bitbucket.log file by looking for messages of the form:

    INFO  [spring-startup]  c.a.b.internal.ssh.server.SshServer Starting SSH server on port 7999...
    DEBUG [spring-startup]  c.a.b.i.s.s.DefaultNamedFactoryFilter Available SSH SIGNATURE: [ecdsa-sha2-nistp256-cert-v01@openssh.com, ecdsa-sha2-nistp384-cert-v01@openssh.com, ecdsa-sha2-nistp521-cert-v01@openssh.com, ssh-ed25519-cert-v01@openssh.com, rsa-sha2-512-cert-v01@openssh.com, rsa-sha2-256-cert-v01@openssh.com, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521, ssh-ed25519, sk-ecdsa-sha2-nistp256@openssh.com, sk-ssh-ed25519@openssh.com, rsa-sha2-512, rsa-sha2-256, ssh-rsa, ssh-rsa-cert-v01@openssh.com, ssh-dss, ssh-dss-cert-v01@openssh.com]
    DEBUG [spring-startup]  c.a.b.i.s.s.DefaultNamedFactoryFilter Available SSH CIPHER: [chacha20-poly1305@openssh.com, aes128-ctr, aes192-ctr, aes256-ctr, aes128-gcm@openssh.com, aes256-gcm@openssh.com]
    DEBUG [spring-startup]  c.a.b.i.s.s.DefaultNamedFactoryFilter Available SSH KEY_EXCHANGE: [curve25519-sha256, curve25519-sha256@libssh.org, curve448-sha512, ecdh-sha2-nistp521, ecdh-sha2-nistp384, ecdh-sha2-nistp256, diffie-hellman-group-exchange-sha256, diffie-hellman-group18-sha512, diffie-hellman-group17-sha512, diffie-hellman-group16-sha512, diffie-hellman-group15-sha512, diffie-hellman-group14-sha256]
    DEBUG [spring-startup]  c.a.b.i.s.s.DefaultNamedFactoryFilter Available SSH MAC: [hmac-sha2-256-etm@openssh.com, hmac-sha2-512-etm@openssh.com, hmac-sha1-etm@openssh.com, hmac-sha2-256, hmac-sha2-512, hmac-sha1]
    INFO  [spring-startup]  c.a.b.internal.ssh.server.SshServer Started SSH server successfully.
  • Add the algorithm names you wish to disable using the properties listed below as specified in Configuration properties, and restart Bitbucket Server.
  • Note that as of Bitbucket Data Center 5.4, some algorithms are already disabled. You will need to explicitly re-list them in your override to avoid them being re-enabled by your override of this property. Check out SSH Security properties to see the default values for these properties.
  • The following ciphers are disabled by default since Bitbucket Data Center 5.4
    • arcfour128
    • arcfour256
    • aes128-cbc
    • aes192-cbc
    • aes256-cbc
    • 3des-cbc
    • blowfish-cbc
  • You can verify the algorithms used by executing a remote SSH command and reading the available and negotiated algorithms in the verbose output. However if you do not see the results you expect you should confirm that the cipher is disabled by explicitly setting it in your git config and attempting a git operation
    • SSH CIPHER

      # Available algorithms
      ssh -vvv -p <bitbucket ssh port> git@<bitbucket host> whoami 2>&1 | grep "debug2: ciphers"
      
      # Negotiated result. Look for "cipher:"
      ssh -vvv -p <bitbucket ssh port> git@<bitbucket host> whoami 2>&1 | grep server-\>client
    • SSH KEY_EXCHANGE

      # Available algorithms
      ssh -vvv -p <bitbucket ssh port> git@<bitbucket host> whoami 2>&1 | grep "debug2: KEX algorithms"
      
      
      # Negotiated result
      ssh -vvv -p <bitbucket ssh port> git@<bitbucket host> whoami 2>&1 | grep "debug1: kex: algorithm"
    • SSH MAC

      # Available algorithms
      ssh -vvv -p <bitbucket ssh port> git@<bitbucket host> whoami 2>&1 | grep "debug2: MACs"
      
      # Negotiated result. Look for "MAC:"
      ssh -vvv -p <bitbucket ssh port> git@<bitbucket host> whoami 2>&1 | grep server-\>client
    • SSH SIGNATURE
      # Available algorithms
      ssh -vvv -p <bitbucket ssh port> git@<bitbucket host> whoami 2>&1 | grep "debug2: host key algorithms"
      
      # Negotiated result
      ssh -vvv -p <bitbucket ssh port> git@<bitbucket host> whoami 2>&1 | grep "kex: host key algorithm"


  • To enable additional stronger algorithms see List ciphers used by JVM to install Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files.

Last modified on Oct 11, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.