如何让 Ubuntu 防火墙规则(ufw)允许除...之外的所有流量?

如何让 Ubuntu 防火墙规则(ufw)允许除...之外的所有流量?

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?

答案1

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

用于ufw status verbose检查您的更改是否正在进行。

更多规则请见此处 https://help.ubuntu.com/community/UFWhttp://manpages.ubuntu.com/manpages/lucid/man8/ufw.8.html

我想你可以说ufw deny 3000/tcp(尽管这条规则似乎没有指定方向)

相关内容