Skip to content

Firewall Setup ​

To secure your server and ensure only NeoProtect IPs can access your services, follow this guide to configure your firewall using UFW, iptables, or the automatic Setup script.

1. Using UFW ​

Step 1: Install UFW ​

bash
sudo apt update
sudo apt install ufw

Step 2: Block all incoming traffic ​

bash
sudo ufw default deny incoming

Step 3: Allow NeoProtect IPs ​

Retrieve the current NeoProtect IP list

Use the following commands for each NeoProtect IP:

bash
sudo ufw allow from <ip>

Step 4: Allow SSH connections ​

bash
sudo ufw allow ssh

Step 5: Enable UFW ​

bash
sudo ufw enable

2. Using iptables ​

Step 1: Block all incoming traffic ​

bash
sudo iptables -P INPUT DROP

Step 2: Allow NeoProtect IPs ​

Retrieve the current NeoProtect IP list

Use the following commands for each NeoProtect IP:

bash
sudo iptables -A INPUT -s <ip> -j ACCEPT

Step 3: Allow SSH connections ​

bash
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT

Step 4: Save iptables Rules ​

bash
sudo iptables-save > /etc/iptables/rules.v4

3. Using NeoProtect Script ​

You can simplify this process by using our automated script. Download and execute the script:

bash
curl -sSf https://neoprotect.net/firewall | bash

This will automatically configure your firewall to allow traffic from NeoProtect IPs.

4. Verify Firewall Settings ​

After setup, verify the rules are active:

  • UFW: Run sudo ufw status
  • iptables: Run sudo iptables -L

Make sure only the NeoProtect IPs have access. And remember to allow your own IP for SSH connections.