Allow UDP outbound for allowed endpoints in block mode - #486
Open
hemantkumar-dev wants to merge 1 commit into
Open
Allow UDP outbound for allowed endpoints in block mode#486hemantkumar-dev wants to merge 1 commit into
hemantkumar-dev wants to merge 1 commit into
Conversation
Block mode previously only installed TCP ACCEPT rules, which blocked QUIC/HTTP/3 to allowed endpoints. Install matching UDP ACCEPT rules in addBlockRules and InsertAllowRule.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #220
In block mode, the agent previously installed
ACCEPTrules only for TCP on allowed endpoints, then rejected everything else. That blocked QUIC / HTTP/3 (UDP) traffic to the same allowed hosts even though they were explicitly permitted.This change installs matching UDP
ACCEPTrules alongside TCP for:addBlockRules(used when applying the initial block-mode policy)InsertAllowRule(OUTPUT + DOCKER-USER), via a smallinsertAllowRuleForProtocolhelperUnrelated paths are unchanged (Azure IMDS, metadata, private ranges, audit-mode DNS UDP/53 logging, global blocklist).
Why this matters
Workflows that allow an endpoint under
egress-policy: blockcould still fail for modern clients that negotiate HTTP/3 over UDP/443. Aligning UDP with TCP for allowed endpoints keeps block mode consistent with user intent.Changes
firewall.go: allow TCP + UDP for configured/resolved endpoints in block modefirewall_blocklist_test.go: mock iptables coverage for TCP+UDP allow rules and updatedInsertAllowRuleexpectationsfirewall_test.go: real iptables assertions for TCP+UDP onOUTPUT/DOCKER-USER, plusTest_InsertAllowRule_AddsTCPAndUDPTest plan
TestInsertAllowRule_AllowsWhenBlocklistIsNilexpects 4 rules (tcp+udp x OUTPUT + DOCKER-USER)TestAddBlockRules_AllowsTCPAndUDPForEndpointsverifies TCP and UDP ACCEPT for allowed endpointTestInsertAllowRule_SkipsGlobalBlocklistedIPstill skips allow rules for blocked IPsTest_addAuditRulesasserts TCP+UDP ACCEPT on real iptables (linux)Test_InsertAllowRule_AddsTCPAndUDPasserts TCP+UDP ACCEPT on real iptables (linux)sudo go teston ubuntu-latestegress-policy: blockwith an HTTP/3 endpoint andcurl --http3Notes for reviewers