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

nflog the packet that will be dropped by network policy enforcement #889

Merged
merged 2 commits into from
May 2, 2020

Conversation

murali-reddy
Copy link
Member

@murali-reddy murali-reddy commented Apr 26, 2020

logged packets can be further by read by ulogd

Fix only works with kernel > 4.11 please see #505 (comment)

Fixes #505

@@ -817,6 +817,14 @@ func (npc *NetworkPolicyController) syncPodFirewallChains(version string) (map[s
}
}

// add rule to log the packets that will be droopped due to network policy enforcement
comment = "rule to log dropped traffic POD name:" + pod.name + " namespace: " + pod.namespace
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
comment = "rule to log dropped traffic POD name:" + pod.name + " namespace: " + pod.namespace
comment = "rule to log dropped traffic to POD name:" + pod.name + " namespace: " + pod.namespace

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrueg thanks for the review. I started with same but actually a only a single IPtable rule gets created so unfortunaltye can not add to/from. Resolved other comment

@@ -933,6 +941,14 @@ func (npc *NetworkPolicyController) syncPodFirewallChains(version string) (map[s
}
}

// add rule to log the packets that will be droopped due to network policy enforcement
comment = "rule to log dropped traffic POD name:" + pod.name + " namespace: " + pod.namespace
Copy link
Collaborator

@mrueg mrueg Apr 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
comment = "rule to log dropped traffic POD name:" + pod.name + " namespace: " + pod.namespace
comment = "rule to log dropped traffic from POD name:" + pod.name + " namespace: " + pod.namespace

Copy link
Collaborator

@aauren aauren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall good direction. Do you have any thoughts on how users can best run ulogd? Maybe a ulogd container (I'm assuming it can be run from within a container) with example config snippet?

pkg/controllers/netpol/network_policy_controller.go Outdated Show resolved Hide resolved
pkg/controllers/netpol/network_policy_controller.go Outdated Show resolved Hide resolved
@murali-reddy
Copy link
Member Author

Do you have any thoughts on how users can best run ulogd? Maybe a ulogd container (I'm assuming it can be run from within a container) with example config snippet?

@aauren Thank for the review. I will add an e.g in usage guide on how to enable loggiging.

For more convenience we can log in kube-router logs as well by doing like this

@murali-reddy murali-reddy merged commit 1af329c into master May 2, 2020
mrueg pushed a commit to mrueg/kube-router that referenced this pull request May 10, 2020
…loudnativelabs#889)

* nflog the packet that will be dropped by network policy enforcement
that can be further by read by ulogd

Fixes cloudnativelabs#505

* addressing review comments
FabienZouaoui pushed a commit to SirDataFR/kube-router that referenced this pull request May 11, 2020
…loudnativelabs#889)

* nflog the packet that will be dropped by network policy enforcement
that can be further by read by ulogd

Fixes cloudnativelabs#505

* addressing review comments
@aauren aauren deleted the nflog branch September 4, 2023 15:23
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

Successfully merging this pull request may close these issues.

Firewall Observability
3 participants