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

Enable Cilium node-to-node strict encryption #2462

Merged
merged 9 commits into from
Nov 15, 2023

Conversation

3u13r
Copy link
Member

@3u13r 3u13r commented Oct 16, 2023

Context

Proposed change(s)

Additional info

Minicon: https://github.com/edgelesssys/constellation/actions/runs/6864239262 (This fails due to the main nightly image still setting up konnectivity, when using the image from this branch the test works: ref/feat-cilium-strict-node-to-node/stream/nightly/v2.13.0-pre.0.20231114141207-0d4d3c3d8386)
e2e, azure, lb: https://github.com/edgelesssys/constellation/actions/runs/6864247842
e2e, gcp, verify: https://github.com/edgelesssys/constellation/actions/runs/6864253985
e2e, aws, autoscaling: https://github.com/edgelesssys/constellation/actions/runs/6864259968
e2e, upgrade, gcp 3:2, from v2.12.0: https://github.com/edgelesssys/constellation/actions/runs/6877667384

Again:
e2e, azure, lb: https://github.com/edgelesssys/constellation/actions/runs/6878967924
e2e, gcp, verify: https://github.com/edgelesssys/constellation/actions/runs/6878976138
e2e, aws, autoscaling: https://github.com/edgelesssys/constellation/actions/runs/6878980995
e2e, upgrade, gcp 3:2, from v2.12.0: https://github.com/edgelesssys/constellation/actions/runs/6878954935

Checklist

  • Add labels (e.g., for changelog category)
  • Is PR title adequate for changelog?
  • Link to Milestone

@netlify
Copy link

netlify bot commented Oct 16, 2023

Deploy Preview for constellation-docs canceled.

Name Link
🔨 Latest commit d5a9f9f
🔍 Latest deploy log https://app.netlify.com/sites/constellation-docs/deploys/6554db31ca7aed00083f91bc

@3u13r 3u13r force-pushed the feat/cilium/strict-node-to-node branch 2 times, most recently from 8fb4d36 to e80aa81 Compare October 19, 2023 11:27
@3u13r 3u13r added this to the v2.13.0 milestone Oct 19, 2023
@3u13r 3u13r added the feature This introduces new functionality label Oct 19, 2023
@3u13r 3u13r changed the title Feat/cilium/strict node to node Enable Cilium node-to-node strict encryption Oct 19, 2023
@3u13r 3u13r force-pushed the feat/cilium/strict-node-to-node branch 5 times, most recently from 5462998 to 8618331 Compare October 23, 2023 14:34
@3u13r 3u13r force-pushed the feat/cilium/strict-node-to-node branch from 8618331 to 2aae003 Compare October 24, 2023 13:37
@3u13r 3u13r force-pushed the feat/cilium/strict-node-to-node branch from 2aae003 to 77fe878 Compare October 25, 2023 11:57
@3u13r 3u13r force-pushed the feat/cilium/strict-node-to-node branch 2 times, most recently from 7b27ee4 to 2565c8c Compare November 3, 2023 19:47
@3u13r 3u13r force-pushed the feat/cilium/strict-node-to-node branch 4 times, most recently from 2db3cdb to 0d4d3c3 Compare November 14, 2023 13:12
@3u13r 3u13r marked this pull request as ready for review November 14, 2023 19:44
@3u13r 3u13r requested a review from derpsteb as a code owner November 14, 2023 19:44
Copy link
Member

@daniel-weisse daniel-weisse left a comment

Choose a reason for hiding this comment

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

Can't really comment on most of the helm chart changes
Rest looks good to me

bootstrapper/internal/kubernetes/k8sapi/k8sutil.go Outdated Show resolved Hide resolved
@3u13r 3u13r force-pushed the feat/cilium/strict-node-to-node branch from 2e620a1 to 9d1de1e Compare November 15, 2023 09:26
Copy link
Member

@derpsteb derpsteb left a comment

Choose a reason for hiding this comment

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

helm changes lgtm.

@3u13r 3u13r marked this pull request as draft November 15, 2023 11:39
@3u13r
Copy link
Member Author

3u13r commented Nov 15, 2023

Reverting back to draft to figure out migration off of konnectivity. See broken upgrade test.

@3u13r 3u13r force-pushed the feat/cilium/strict-node-to-node branch 3 times, most recently from 707e16c to 1da5bc4 Compare November 15, 2023 13:01
Bumping Cilium to also enable node-to-node encryption and
node-to-node strict mode. Since the second is not upstream
we use our fork.
When enabling node-to-node encryption, Cilium does not
encrypt control-plane to control-plane traffic by
default since they say that they cannot gurantee that
the generated private key for a node is persisted across
reboots.

In Constellation we use stateful VMs which when rebooted
still have the cilium_wg0 interface containing the
private key.

Therefore, we can enable this type of encryption.
For the strict modes we need to dynamically use
the CIDR used in the Terraform files. Therefore,
we write them to our statefile and use them when
installing Cilium.
The token given out by control-planes contains the node IP
as an endpoint. Since during this stage the joining node is
not connected to the WireGuard network, we cannot
communicate node-to-node. Therefore, we need to hop over the
load balancer again to have a src IP outside of the strict
range.
Use the local variable instead of inlining the
node CIDR value.
The Cilium strict mode has a special mode which
loosens the security a slight bit. For compatability this
mode is enabled by default. But we don't need it for strict
node-to-node encryption. Therefore, we disable it.
Tests concluded that restating the Cilium agent after the
first boot is not needed anymore to regain connectivity for
pods.
This is the first step in our migration off of
konnectivity. Before node-to-node encryption
we used konnectivity to route some KubeAPI
to kubelet traffic over the pod network which then
would be encrypted.

Since we enabled node-to-node encryption this has no
security upsides anymore. Note that we still deploy
the konnectivity agents via helm and still have the
load balancer for konnectivity.

In the following releases we will remove both.
@3u13r 3u13r force-pushed the feat/cilium/strict-node-to-node branch from 576e22f to d5a9f9f Compare November 15, 2023 14:52
@3u13r 3u13r marked this pull request as ready for review November 15, 2023 15:06
Copy link
Contributor

Coverage report

Package Old New Trend
bootstrapper/cmd/bootstrapper [no test files] [no test files] 🚧
bootstrapper/internal/kubernetes 70.70% 74.60% ↗️
bootstrapper/internal/kubernetes/k8sapi 8.90% 13.60% ↗️
bootstrapper/internal/kubernetes/k8sapi/resources 22.20% 100.00% ↗️
cli/internal/helm 49.50% 54.30% ↗️
internal/constants [no test files] [no test files] 🚧

@3u13r 3u13r merged commit cb88c7a into main Nov 15, 2023
20 checks passed
@3u13r 3u13r deleted the feat/cilium/strict-node-to-node branch November 15, 2023 18:27
@3u13r 3u13r modified the milestones: v2.13.0, v2.14.0 Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This introduces new functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants