|
1 | 1 | ---
|
2 | 2 | title: "Firewall"
|
3 |
| -description: "A list of ports that need to be open on your firewall for Coolify to work properly." |
| 3 | +description: "Learn which network ports need to be open for Coolify to work properly in self-hosted or cloud environments, including firewall setup tips and GitHub integration requirements." |
4 | 4 | ---
|
5 | 5 |
|
6 | 6 | # Firewall
|
7 |
| -## Self-hosted version |
| 7 | +Coolify requires specific network ports to be open in order to function properly across various environments. These ports enable web access, SSH connections, terminal sessions, and real-time communication. |
8 | 8 |
|
9 |
| -For self-hosting Coolify, you need to allow some ports on your firewall. |
| 9 | +The required ports may vary slightly depending on whether you're using a self-hosted setup or the managed version ([Coolify Cloud](https://coolify.io/pricing/)). |
10 | 10 |
|
11 |
| -- For Coolify: `8000` (http), `6001` (websocket), `6002` (terminal), and `22` (SSH, or a custom port) (required) |
| 11 | + |
| 12 | +## Coolify Self-hosted |
| 13 | +To ensure proper functionality when self-hosting Coolify, the following ports should be opened: |
| 14 | + |
| 15 | +* **8000** – HTTP access to the Coolify dashboard |
| 16 | +* **6001** – Real-time communications |
| 17 | +* **6002** – Terminal access (Required for Coolify version 4.0.0-beta.336 and above) |
| 18 | +* **22** – SSH access (or your custom SSH port) |
| 19 | +* **80** – SSL certificate generation via reverse proxy (Traefik or Caddy) |
| 20 | +* **443** – HTTPS traffic |
| 21 | + |
| 22 | +These ports are required if you're accessing Coolify directly using your server’s IP address (e.g., `http://<SERVER_IP>:8000`). |
12 | 23 |
|
13 | 24 | ::: success Tip
|
14 |
| - 8000, 6001, 6002 can be closed when accessing Coolify through a domain and using the integrated reverse proxy (Traefik or Caddy). |
| 25 | +If you're using a custom domain with Coolify’s integrated reverse proxy (Traefik or Caddy), you can safely close ports **8000**, **6001**, and **6002** after accesing the dashboard from your custom domain. |
15 | 26 | :::
|
16 | 27 |
|
17 |
| -- Reverse Proxy: `80, 443` (optional) |
18 |
| - |
19 | 28 | ::: warning Caution
|
20 | 29 | If you are using `Oracle Cloud Free ARM Server`, you need to allow these ports
|
21 | 30 | inside Oracle's Dashboard, otherwise you cannot reach your instance from the
|
22 | 31 | internet after installation.
|
23 | 32 | :::
|
24 | 33 |
|
25 |
| -### How to block ports 8000, 6000, 6001 |
26 | 34 |
|
27 |
| -As long as you have access outside of http port 8000, uou can add the following `/data/coolify/source/docker-compose.custom.yml`: |
| 35 | +## Coolify Cloud |
| 36 | +For Servers connected to Coolify Cloud, the following ports must be open: |
28 | 37 |
|
29 |
| -``` |
30 |
| -services: |
31 |
| - coolify: # blocks external 8000 |
32 |
| - ports: !reset [] |
33 |
| - soketi: # blocks external 6001, 6002 |
34 |
| - ports: !reset [] |
35 |
| -``` |
| 38 | +* **22** – SSH access (or your custom SSH port) |
| 39 | +* **80** – SSL certificate generation via reverse proxy (Traefik or Caddy) |
| 40 | +* **443** – HTTPS traffic |
36 | 41 |
|
37 |
| -Then run [installation](https://coolify.io/docs/get-started/installation) again. You can check these ports with nmap from your local machine to be sure they're closed. |
| 42 | +These are the only required ports, as all other services are managed for you by Coolify Cloud. |
38 | 43 |
|
39 |
| -``` |
40 |
| -nmap -Pn -p 8000,6001,6002 <your coolify IP> |
41 |
| -``` |
42 | 44 |
|
43 |
| -### Other options |
44 |
| -You can use your vendor firewall (ex. Digital Ocean etc) as another layer of protection, because Docker apps sometimes break through. UFW unbeknownst to you. If you don't want to use vendor firewall, you can also try [ufw-docker](https://github.com/chaifeng/ufw-docker). |
45 | 45 |
|
| 46 | +## Closing Ports Using a Firewall |
| 47 | +Coolify runs on Docker, which uses NAT-based iptables rules that can bypass traditional Linux firewalls like UFW. As a result, blocking ports using UFW alone will not be effective. |
46 | 48 |
|
47 |
| -### GitHub integration |
48 |
| -- [Detailed Guide](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-githubs-ip-addresses). |
| 49 | +### Recommended Approach |
| 50 | +Most cloud providers offer integrated firewalls through their dashboards. If your provider supports this, **it is highly recommended to use their firewall settings** to manage open ports instead of relying on local tools like UFW. |
49 | 51 |
|
50 |
| -#### Webhooks |
51 |
| -You need to allow TCP port `80` and `443` for GitHub webhooks. |
| 52 | +If your provider does not offer firewall functionality, you can use one of the following advanced methods: |
52 | 53 |
|
53 |
| -To specify the IP addresses (optional), you can use the following API endpoint to get them: |
| 54 | +### Coolify Self-hosted |
| 55 | +::: danger CAUTION!! |
| 56 | + Modifying firewall settings incorrectly may lead to access issues that are difficult to recover from. |
| 57 | + |
| 58 | + Proceed with the following steps **only if necessary**, and if you fully understand the implications. |
| 59 | +::: |
54 | 60 |
|
55 |
| -- https://api.github.com/meta - Check `hooks` section. |
56 | 61 |
|
57 |
| -### Terminal |
| 62 | +#### Option 1: Use `ufw-docker` |
| 63 | +[ufw-docker](https://github.com/chaifeng/ufw-docker) is a community-maintained tool that helps bridge UFW and Docker by allowing you to block specific ports effectively. Refer to the [GitHub repository](https://github.com/chaifeng/ufw-docker) for complete setup instructions |
58 | 64 |
|
59 |
| -Since 4.0.0-beta.336, you need to allow TCP port `6002` for terminal access on `/terminal` endpoint. |
| 65 | +#### Option 2: Prevent Coolify From Listening on External Ports |
| 66 | +You can stop Coolify from exposing ports by editing the `docker-compose.custom.yml` file: |
60 | 67 |
|
61 |
| -::: success Tip |
62 |
| - If you are using the integrated reverse proxy (Traefik or Caddy), the terminal is accessible on `https://your-domain.com/terminal` with dynamic proxy configuration. |
63 |
| -::: |
| 68 | +```yaml |
| 69 | +services: |
| 70 | + coolify: # disables external access to port 8000 |
| 71 | + ports: !reset [] |
| 72 | + soketi: # disables external access to ports 6001 and 6002 |
| 73 | + ports: !reset [] |
| 74 | +``` |
| 75 | +
|
| 76 | +After making these changes, re-run the [Coolify install script](https://coolify.io/docs/get-started/installation) to apply the updated configuration. |
| 77 | +
|
| 78 | +You can verify that the ports are closed using `nmap` from your local machine: |
| 79 | + |
| 80 | +```bash |
| 81 | +nmap -Pn -p 8000,6001,6002 <SERVER_IP> |
| 82 | +``` |
| 83 | + |
| 84 | +--- |
| 85 | + |
| 86 | +### Coolify Cloud |
| 87 | +For servers connected to Coolify Cloud, only the SSH port (typically **22**) needs to be open for remote management. |
| 88 | + |
| 89 | +If you wish to restrict access based on IP address, we have a list of public IPs used by Coolify Cloud: |
| 90 | + |
| 91 | +* [IPv4 addresses](https://coolify.io/ipv4.txt) |
| 92 | +* [IPv6 addresses](https://coolify.io/ipv6.txt) |
64 | 93 |
|
| 94 | +Coolify Cloud’s IPs rarely change, but users will be notified by email if updates occur. |
65 | 95 |
|
66 |
| -## Cloud version |
67 | 96 |
|
68 |
| -If you need the public facing IPs to allow inbound connections to your servers, here is an up-to-date list of IPs that you can use to whitelist: |
| 97 | +### GitHub Integration |
| 98 | +GitHub uses webhooks to communicate with Coolify. For this to work correctly: |
| 99 | +* Ensure **TCP ports 80 and 443** are open. |
| 100 | +* (Optional) To restrict webhook access by IP, you can get the current list of GitHub’s outbound IPs from: https://api.github.com/meta (Check the `hooks` section) |
69 | 101 |
|
70 |
| -- https://coolify.io/ipv4.txt |
71 |
| -- https://coolify.io/ipv6.txt |
| 102 | +For more details, refer to their [documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-githubs-ip-addresses) |
0 commit comments