generated from blue-build/template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# # Sample configuration for nftables service. | ||
# # Load this by calling 'nft -f /etc/nftables/main.nft'. | ||
# | ||
# # Note about base chain priorities: | ||
# # The priority values used in these sample configs are | ||
# # offset by 20 in order to avoid ambiguity when firewalld | ||
# # is also running which uses an offset of 10. This means | ||
# # that packets will traverse firewalld first and if not | ||
# # dropped/rejected there will hit the chains defined here. | ||
# # Chains created by iptables, ebtables and arptables tools | ||
# # do not use an offset, so those chains are traversed first | ||
# # in any case. | ||
# | ||
# # drop any existing nftables ruleset | ||
# flush ruleset | ||
# | ||
# # a common table for both IPv4 and IPv6 | ||
# table inet nftables_svc { | ||
# | ||
# # protocols to allow | ||
# set allowed_protocols { | ||
# type inet_proto | ||
# elements = { icmp, icmpv6 } | ||
# } | ||
# | ||
# # interfaces to accept any traffic on | ||
# set allowed_interfaces { | ||
# type ifname | ||
# elements = { "lo" } | ||
# } | ||
# | ||
# # services to allow | ||
# set allowed_tcp_dports { | ||
# type inet_service | ||
# elements = { ssh, 9090 } | ||
# } | ||
# | ||
# # this chain gathers all accept conditions | ||
# chain allow { | ||
# ct state established,related accept | ||
# | ||
# meta l4proto @allowed_protocols accept | ||
# iifname @allowed_interfaces accept | ||
# tcp dport @allowed_tcp_dports accept | ||
# } | ||
# | ||
# # base-chain for traffic to this host | ||
# chain INPUT { | ||
# type filter hook input priority filter + 20 | ||
# policy accept | ||
# | ||
# jump allow | ||
# reject with icmpx type port-unreachable | ||
# } | ||
# } | ||
# | ||
# # By default, any forwarding traffic is allowed. | ||
# # Uncomment the following line to filter it based | ||
# # on the same criteria as input traffic. | ||
# #include "/etc/nftables/router.nft" | ||
# | ||
# # Uncomment the following line to enable masquerading of | ||
# # forwarded traffic. May be used with or without router.nft. | ||
# #include "/etc/nftables/nat.nft" | ||
|
||
# --- --- --- | ||
|
||
# Flush the ruleset | ||
flush ruleset | ||
|
||
# Define a table for our firewall rules | ||
table ip firewall { | ||
# Define a chain for outbound traffic | ||
chain output { | ||
type filter hook output priority 0; | ||
|
||
# Set default policy to DROP | ||
policy drop; | ||
|
||
# Allow localhost traffic | ||
ip daddr 127.0.0.1 accept | ||
|
||
# Allow DHCPv4 broadcast | ||
ip daddr 255.255.255.255 accept | ||
|
||
# Allow traffic to local network (assuming 192.168.0.0/16, adjust if needed) | ||
ip daddr 192.168.0.0/16 accept | ||
} | ||
} | ||
|
||
# IPv6 table | ||
table ip6 firewall { | ||
chain output { | ||
type filter hook output priority 0; | ||
policy drop; | ||
|
||
# Allow DHCPv6 multicast | ||
ip6 daddr ff02::1:2 accept | ||
|
||
# Allow localhost traffic | ||
ip6 daddr ::1 accept | ||
|
||
# Allow traffic to local network (assuming fd00::/8 for unique local addresses, adjust if needed) | ||
ip6 daddr fd00::/8 accept | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters