# Setup the Firewall

{% hint style="info" %}
In order to protect your server against common attacks, it is recommended that you setup a firewall. The following instructions assume that you have installed firewalld.
{% endhint %}

```
$ vi /etc/firewalld/zones/public.xml
```

Insert the following lines between the \<zone> and \</zone> tags:

```
  <port protocol="tcp" port="10000"/>
  <port protocol="tcp" port="80"/>
  <port protocol="tcp" port="8080"/>
  <port protocol="tcp" port="25"/>
  <port protocol="tcp" port="465"/>
  <port protocol="tcp" port="443"/>
  <forward-port to-port="8080" protocol="tcp" port="80"/>
  <forward-port to-port="8443" protocol="tcp" port="443"/>
```

Save and exit with :x&#x20;

```
$ vi /etc/firewalld/direct.xml
```

This file should contain the following:

```
<?xml version="1.0" encoding="utf-8"?>
<direct>
  <rule priority="0" table="filter" ipv="ipv4" chain="OUTPUT">-p tcp -m tcp --dport=25 -j ACCEPT</rule>
  <rule priority="0" table="filter" ipv="ipv4" chain="OUTPUT">-p tcp -m tcp --dport=23 -j ACCEPT</rule>
  <rule priority="0" table="filter" ipv="ipv4" chain="OUTPUT">-p tcp -m tcp --dport=80 -j ACCEPT</rule>
  <rule priority="0" table="nat" ipv="ipv4" chain="OUTPUT">-p tcp -o lo --dport 80 -j REDIRECT --to-ports 8080</rule>
</direct>
```

Save and exit with :x&#x20;

After completing the above edits, reload the firewall configuration:

```
$ firewall-cmd --reload
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://miftycoin.gitbook.io/miftycoin-broker-node-configuration/setup/setup-the-firewall.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
