How to Open Ports for Bitbucket Server on recent Red Hat Linux distributions

Still need help?

The Atlassian Community is here for you.

Ask the community

Note: Information on this page relates to Red Hat Enterprise Linux 7+, CentOS 7+, Oracle Linux 7+, and Fedora 21+ . It has been tested on Oracle Linux/Red Hat Enterprise Linux 7.2.

Purpose

If you are using Bitbucket Server on Red Hat Enterprise Linux 7.2, Oracle Linux 7.2, or similar distributions, the firewall may not be enabled by default. These distributions block non-standard ports – such as the Bitbucket Server SSH port 7999 – unless rules are specifically added to open them. The default firewall has also changed from iptables to firewalld.

Since SSH access is blocked, this may also be related to occurrences of the error "New Access Key is Required but could not be added to bitbucket server" in Bamboo.

Solution

  1. Connect to your Bitbucket Server host
  2. Start FirewallD
    systemctl start firewalld
  3. Add a firewall rule to open the SSH port 7999 in FirewallD
    firewall-cmd --zone=public --add-port=7999/tcp --permanent
  4. Since we've enabled a firewall, we will need to add a firewall rule to open the HTTP port 7990 in FirewallD
    firewall-cmd --zone=public --add-port=7990/tcp --permanent

  5. Reload FirewallD to have changes reflected 
    firewall-cmd --reload

To verify that the firewall rules have been successfully added, you can run iptables-save | grep -E "7999|7990".

The output should show:

-A IN_public_allow -p tcp -m tcp --dport 7990 -m conntrack --ctstate NEW -j ACCEPT 
-A IN_public_allow -p tcp -m tcp --dport 7999 -m conntrack --ctstate NEW -j ACCEPT
Last modified on Sep 2, 2016

Was this helpful?

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