Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
DescriptionDavide F Bragalone
2019-04-01 13:18:56 UTC
Description:
When iptables or firewalld are used, there is a default configuration that allows some common services and deny all the rest. This is not valid for nftables though, as upon activation, all the traffic is allowed.
I quickly tested by deploying a RHEL7.5, disabling firewalld and installing nftables. Then I put ncat in listening on 12345 port and I was able to establish a connection from a remote host. With firewalld/iptables I would have to open the new port which is also good for security purposes (white-list approach).
Customer stated:
================================================================
What I missed most was the default nftables rules file that you can just take in the use like in iptables. In RHEL and Fedora there was this file:
cat /etc/sysconfig/iptables
# sample configuration for iptables service
# you can edit this manually or use system-config-firewall
# please do not ask us to add additional ports/services to this default configuration
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
You just started adding allow rules to it. It was very simple. And that is why I sent you my default nftables template so that there could be some kind of default nftables configuration in RHEL/Fedora that would be secure and works out-of-box. You just need to enable the configuration (for example uncomment a line in /etc/sysconfig/nftables.conf and enable nftables via systemctl) and you are ready to go with secure firewall.
================================================================
Version-Release number of selected component (if applicable):
# rpm -qa | grep nft
libnftnl-1.0.8-1.el7.x86_64
nftables-0.8-10.el7.x86_64
Customer also proposed similar config (nftables.default file):
#! /usr/sbin/nft -f
table ip filter {
chain input {
type filter hook input priority 0;
ct state established,related counter accept
ip protocol icmp counter accept
iif lo accept
ct state invalid counter drop
ct state new tcp dport 22 counter accept
# multicast DNS (mdns)
ct state new ip daddr 224.0.0.251 udp dport 5353 counter accept
limit rate 3 / minute log flags ip options flags tcp options prefix "FW "
counter reject with icmp type host-prohibited
}
chain forward {
type filter hook forward priority 0;
counter reject with icmp type host-prohibited
}
}
table ip6 filter {
chain input {
type filter hook input priority 0;
ct state established,related counter accept
meta l4proto ipv6-icmp counter accept
iif lo accept
ct state invalid counter drop
# dhcpv6-client
ct state new ip6 daddr fe80::/64 udp dport 546 counter accept
# multicast DNS (mdns)
ct state new ip6 daddr ff02::fb udp dport 5353 counter accept
limit rate 3 / minute log flags ip options flags tcp options prefix "FW "
counter reject with icmpv6 type admin-prohibited
}
chain forward {
type filter hook forward priority 0;
counter reject with icmpv6 type admin-prohibited
}
}
This is a change in default behaviour, so I think it is better suited for
RHEL8.
The currently provided config samples are not really useful anyway. If we
decide to replace them with a sensible default config which is also disabled by
default, maybe backporting that to RHEL7 makes sense. What do you think?
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHEA-2020:1774
Description: When iptables or firewalld are used, there is a default configuration that allows some common services and deny all the rest. This is not valid for nftables though, as upon activation, all the traffic is allowed. I quickly tested by deploying a RHEL7.5, disabling firewalld and installing nftables. Then I put ncat in listening on 12345 port and I was able to establish a connection from a remote host. With firewalld/iptables I would have to open the new port which is also good for security purposes (white-list approach). Customer stated: ================================================================ What I missed most was the default nftables rules file that you can just take in the use like in iptables. In RHEL and Fedora there was this file: cat /etc/sysconfig/iptables # sample configuration for iptables service # you can edit this manually or use system-config-firewall # please do not ask us to add additional ports/services to this default configuration *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT You just started adding allow rules to it. It was very simple. And that is why I sent you my default nftables template so that there could be some kind of default nftables configuration in RHEL/Fedora that would be secure and works out-of-box. You just need to enable the configuration (for example uncomment a line in /etc/sysconfig/nftables.conf and enable nftables via systemctl) and you are ready to go with secure firewall. ================================================================ Version-Release number of selected component (if applicable): # rpm -qa | grep nft libnftnl-1.0.8-1.el7.x86_64 nftables-0.8-10.el7.x86_64 Customer also proposed similar config (nftables.default file): #! /usr/sbin/nft -f table ip filter { chain input { type filter hook input priority 0; ct state established,related counter accept ip protocol icmp counter accept iif lo accept ct state invalid counter drop ct state new tcp dport 22 counter accept # multicast DNS (mdns) ct state new ip daddr 224.0.0.251 udp dport 5353 counter accept limit rate 3 / minute log flags ip options flags tcp options prefix "FW " counter reject with icmp type host-prohibited } chain forward { type filter hook forward priority 0; counter reject with icmp type host-prohibited } } table ip6 filter { chain input { type filter hook input priority 0; ct state established,related counter accept meta l4proto ipv6-icmp counter accept iif lo accept ct state invalid counter drop # dhcpv6-client ct state new ip6 daddr fe80::/64 udp dport 546 counter accept # multicast DNS (mdns) ct state new ip6 daddr ff02::fb udp dport 5353 counter accept limit rate 3 / minute log flags ip options flags tcp options prefix "FW " counter reject with icmpv6 type admin-prohibited } chain forward { type filter hook forward priority 0; counter reject with icmpv6 type admin-prohibited } }