1

I need to unlock only outgoing 443 and 80 port, only for navigate through internet, actually im using the rules:

ufw default deny incoming
ufw default deny outgoing
ufw allow out from any to any port 443 proto tcp
ufw allow out from any to any port 80 proto tcp
ufw enable

But unfortunally ufw blocks all internet, and the pages does not load. Do you have any solution to my problem or another alternative?

Note: With CSF config server firewall, is not necessary the incoming traffic in the 443 and 80 ports for connect to internet only the outgoing 443 and 80, but in ufw how i can do it?

2
  • You probably mean outgoing to those ports,
    – vonbrand
    Commented Aug 11, 2019 at 20:27
  • exactly, that's is i need vonbrand!
    – xixuhuw
    Commented Aug 11, 2019 at 20:29

2 Answers 2

0
$ sudo ufw enable
$ sudo ufw status numbered
$ sudo ufw delete #<- (insert the line number you want to delete here)
$ sudo ufw default deny incoming
$ sudo ufw default deny outgoing
$ sudo ufw allow out on eno1 to any port 443
$ sudo ufw allow out on eno1 to any port 80
$ sudo ufw allow out on eno1 to any port 53
$ sudo ufw allow out on wlp3s0 to any port 53
  • replace eno1 with your own ethernet name
  • replace wlp3s0 with your own wifi name
  • the command ifconfig will show you the names of your own devices
-1

Remove All Ports one by one by typing:

sudo ufw delete allow 'PORTNUMBER'

Then allow port 80 and 443 by typing:

sudo ufw allow '80'
sudo ufw allow '443'
2
  • can i disable all ports using wildcards? ufw delete allow '*'
    – xixuhuw
    Commented Aug 11, 2019 at 20:17
  • sudo ufw allow '80' it specify outgoing only, or is for both in and out?
    – xixuhuw
    Commented Aug 11, 2019 at 20:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .