4

I have setup a UFW to allow all incoming and outgoing traffic by default. I wish to limit a few ports (in this case, 9200 and 5601). When I have the following configuration:

> sudo ufw status verbose
Status: active
Logging: on (low)
Default: allow (incoming), allow (outgoing), deny (routed)
New profiles: skip

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW IN    Anywhere
9200                       DENY IN     Anywhere
5601                       DENY IN     Anywhere
22/tcp (v6)                ALLOW IN    Anywhere (v6)
9200 (v6)                  DENY IN     Anywhere (v6)
5601 (v6)                  DENY IN     Anywhere (v6)

I still seem to be able to access ports 9200 and 5601 from the outside world. What's going on?

2 Answers2

2

This might be helpful for you. Follow the instruction

Start and enable UFWs systemd unit:

sudo systemctl start ufw
sudo systemctl enable ufw

Deny Incoming in 9200 and 5601

sudo ufw deny in 9200 | sudo ufw deny in 9200/tcp | sudo ufw deny in 9200/udp
sudo ufw deny in 5601 | sudo ufw deny in 5601/tcp | sudo ufw deny in 5601/udp

If you want to turn off UFW completely and delete all the rules, you can use reset command:

ufw reset
1

Check the config file with nano or vi

sudo nano /etc/default/ufw

make sure IPV6 is set to yes

IPV6=yes

restart ufw

sudo ufw disable
sudo ufw enable

I hope that helps.

Dan
  • 13,119
Alex
  • 65