How can I make Ubuntu firewall rules ( ufw ) allow all traffic except...?

13,267

I haven't tested this, and am not familiar with ubuntu's ufw but it's a simple interface to iptables and I get the idea looking at ufw commands. And I see you want to change the rule for packets coming in, from a whitelist to a blacklist.

Try ufw default allow in

Use ufw status verbose to check your changes are being made..

more rules listed here https://help.ubuntu.com/community/UFW and http://manpages.ubuntu.com/manpages/lucid/man8/ufw.8.html

and I suppose you can say ufw deny 3000/tcp (though that rule doesn't seem to specify direction)

Share:
13,267

Related videos on Youtube

proquibas
Author by

proquibas

Updated on September 18, 2022

Comments

  • proquibas
    proquibas over 1 year

    I'm new using Ubuntu and ufw command to set firewall rules. I have an apache service running and I'm able to deny the access to the root path using apache2.conf. I have another backend app running on port 3000 which is not using apache so I can't deny access through apache ( and If I'm able to to that, I don't know how ).

    I try then to configure the firewall to deny access ONLY to port 3000, but when I enable the firewall it seems that the fw denies all the traffic.

    What is the best way to do that?

  • proquibas
    proquibas almost 9 years
    Thanks barlop, I use next order: 1- Deny = ufw deny 3000/tcp 2- Allow = sudo ufw allow from IP/Network to any I want only a subnet to acces the port. Now other computers can't acces. Thanks!
  • barlop
    barlop almost 9 years
    @proquibas no problem. By the way, you may be interested to know for future reference, that there is a ubuntu stackexchange askubuntu.com