Skip to content

Commit f6e71c1

Browse files
feat: add UDP NFLOG rule for blocked traffic logging
(cherry picked from commit f9bac98)
1 parent 2293144 commit f6e71c1

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

firewall.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,13 @@ func addBlockRules(firewall *Firewall, endpoints []ipAddressEndpoint, chain, net
152152
return errors.Wrap(err, "failed to add rule")
153153
}
154154

155+
// Log blocked traffic - UDP packets
156+
err = ipt.Append(filterTable, chain, direction, netInterface, protocol, "udp", "-j", "NFLOG", "--nflog-group", "100")
157+
158+
if err != nil {
159+
return errors.Wrap(err, "failed to add UDP NFLOG rule")
160+
}
161+
155162
// Block all other traffic
156163
err = ipt.Append(filterTable, chain, direction, netInterface, protocol, allProtocols, target, reject)
157164

0 commit comments

Comments
 (0)