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

Network policy #9077

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Network policy #9077

wants to merge 7 commits into from

Conversation

lahwaacz
Copy link

@lahwaacz lahwaacz commented Jul 24, 2024

Which issue(s) this PR fixes:

Issue #9067

What this PR does / why we need it:

Current network policies are too open, they should be allow only traffic that is specifically needed for Longhorn functionality and deny the rest.

The policies should also be in line with the documentation: https://longhorn.io/docs/1.6.2/references/networking/

Future work

  • Review instance-manager policy
  • Review backing-image-manager policy
  • Review backing-image-data-source policy
  • Add a configurable list of CIDRs to explicitly allow traffic to the webhooks and recovery backend from all cluster nodes (see [BUG] UI network policy is too open #9067 (comment))
  • Add egress to all policies
  • Add missing network policies (CSI plugin, CSI sidecar, driver deployer, etc.)

I will go offline in the following days and have a busy next week, but I will definitely revisit this later! Maintainers are invited to push to my branch or split the rest to a separate issue if doing it by parts is preferred.

lahwaacz added 5 commits July 24, 2024 09:34
Only pod (not service) ports are applicable.

Signed-off-by: Jakub Klinkovský <1289205+lahwaacz@users.noreply.github.com>
Signed-off-by: Jakub Klinkovský <1289205+lahwaacz@users.noreply.github.com>
Based on the documentation in https://longhorn.io/docs/1.6.2/references/networking/

Signed-off-by: Jakub Klinkovský <1289205+lahwaacz@users.noreply.github.com>
The `examples/network-policy/` directory is outdated, the chart contains
up-to-date network policies.

Signed-off-by: Jakub Klinkovský <1289205+lahwaacz@users.noreply.github.com>
…c port

Signed-off-by: Jakub Klinkovský <1289205+lahwaacz@users.noreply.github.com>
@lahwaacz lahwaacz requested a review from a team as a code owner July 24, 2024 08:10
@lahwaacz
Copy link
Author

lahwaacz commented Jul 24, 2024

The removed examples/network-policies/ directory is linked from the documentation, which should be updated to refer to the policies installed by the chart: https://longhorn.io/docs/1.6.2/references/networking/

Edit: done in longhorn/website#955

@lahwaacz
Copy link
Author

lahwaacz commented Jul 28, 2024

I have some questions about the network policies:

  • In the documentation, Instance Manager expects ingress from "Node in the Cluster" on TCP port 3260. Does this mean one specific node (e.g. the one where the Instance Manager runs) or can all nodes in the cluster connect to any Instance Manager? In any case, which process(es) on the node connect to the Instance Manager?
  • In the documentation, Backing Image Manager specifies egress to Instance Manager, but Instance Manager does not specify ingress from Backing Image Manager. Which is correct?

lahwaacz added 2 commits July 28, 2024 13:12
…c ports

Signed-off-by: Jakub Klinkovský <1289205+lahwaacz@users.noreply.github.com>
…ge-manager according to the documentation

The original policies mixed some ingress and egress rules and did not
specify port numbers.

Signed-off-by: Jakub Klinkovský <1289205+lahwaacz@users.noreply.github.com>
lahwaacz added a commit to lahwaacz/longhorn-website that referenced this pull request Aug 4, 2024
lahwaacz added a commit to lahwaacz/longhorn-website that referenced this pull request Aug 4, 2024
innobead pushed a commit to lahwaacz/longhorn-website that referenced this pull request Aug 5, 2024
innobead pushed a commit to longhorn/website that referenced this pull request Aug 5, 2024
@innobead
Copy link
Member

Assigned to @ChanYiLin to help with this review.

cc @derekbit

Copy link

Choose a reason for hiding this comment

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

These changes might be not sufficient especially when no ingress controller is used. See: #9067 (comment)

Copy link
Author

Choose a reason for hiding this comment

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

You are right, this case is not addressed in this pull request. I was focusing on "simple" improvements that don't depend on any configuration, but the review is taking too long regardless... 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: New Issues
Development

Successfully merging this pull request may close these issues.

4 participants