Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] UFW firewall rules. #336

Closed
Xavantex opened this issue Oct 29, 2023 · 1 comment
Closed

[Question] UFW firewall rules. #336

Xavantex opened this issue Oct 29, 2023 · 1 comment
Assignees

Comments

@Xavantex
Copy link

Xavantex commented Oct 29, 2023

The following code is used in the ufw script:

sed -i '/^COMMIT/i -A ufw-before-output -p icmp -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT' /etc/ufw/before.rules
sed -i '/^COMMIT/i -A ufw-before-output -p icmp -m state --state ESTABLISHED,RELATED -j ACCEPT' /etc/ufw/before.rules
sed -i '/^COMMIT/i -A ufw6-before-output -p icmpv6 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT' /etc/ufw/before6.rules
sed -i '/^COMMIT/i -A ufw6-before-output -p icmpv6 -m state --state ESTABLISHED,RELATED -j ACCEPT' /etc/ufw/before6.rules

Would the first rule for ipv4 and 6 not cover both cases, with established and related already included?
Am I missing something?

Another thing why explicitly deny 127.0.0.0/8 if default is deny?

ufw allow in on lo
ufw allow out on lo
ufw deny in from 127.0.0.0/8
ufw deny in from ::1

ufw default deny incoming

I feel like there is something I am missing here.

@konstruktoid
Copy link
Owner

Hi @Xavantex, you are corrrect. Setting default deny does deny it as well, but it's to make sure (you might not want to deny by default) we configure the loopback interface to accept traffic and configure all other interfaces to deny traffic to the loopback networks.

This is also an requirement for the CIS Ubuntu benchmark (3.4.1.4).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants