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

Backport v1.14: ipsec: fixes for key rotation #27586

Merged
merged 2 commits into from Aug 25, 2023

Conversation

jschwinger233
Copy link
Member

@jschwinger233 jschwinger233 commented Aug 18, 2023

Manual backport of #27319

for pr in 27319; do contrib/backporting/set-labels.py $pr done 1.14; done

Signed-off-by: Zhichuan Liang gray.liang@isovalent.com

@maintainer-s-little-helper maintainer-s-little-helper bot added backport/1.14 This PR represents a backport for Cilium 1.14.x of a PR that was merged to main. kind/backports This PR provides functionality previously merged into master. labels Aug 18, 2023
@jschwinger233
Copy link
Member Author

/test

@jschwinger233
Copy link
Member Author

/test-backport-1.14

@jschwinger233 jschwinger233 marked this pull request as ready for review August 18, 2023 13:49
@jschwinger233 jschwinger233 requested a review from a team as a code owner August 18, 2023 13:49
@jschwinger233
Copy link
Member Author

The only failed CI task ConformanceAKS (ci-aks) is not "Required", so I presume it's okay to ship it.

[ upstream commit bba3dfc ]

From: John Fastabend <john.fastabend@gmail.com>

On key update we only update the policy for our local node. But with
latest round of changes we need to update for all nodes in the node
cache. With out this we would rely on the validation interval timer
to sync the nodes policy before we remove the old policy. This
may or may not happen depending on how large the cluster is.

Further I've seen us miss it even on relatively small clusters say
around 30 nodes so seems its not entirely reliable to count on.

Rather than rely on some external to ipsec timer to fire and sync
the policies and to do it hopefully in our time window lets just
force the nodeUpdate() call on all nodes in the cache when we
get the key rotate event.

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Zhichuan Liang <gray.liang@isovalent.com>
[ upstream commit 4f3bc9f ]

From: John Fastabend <john.fastabend@gmail.com>

The cilium_encrypt_map is used to determine what key the datapath should
use. This is done by setting the mark value of the skb and then in the
XFRM policy the mark value is matched to designate what encryption
policy/state to use.

However, on key rotation we have an issue where the map entry with the
key is updated before the xfrm policy is plumbed. The result is its
possible to mark the skb with a value that will have no matching
xfrm policy and result in a policy block error and drop the skb.

To resolve ensure we do setup in the correct order and only set the
min key in the cilium_encrypt_map after the policy has been updated.

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Zhichuan Liang <gray.liang@isovalent.com>
@jschwinger233
Copy link
Member Author

/test-backport-1.14

Copy link
Member

@joestringer joestringer left a comment

Choose a reason for hiding this comment

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

Ack for tophat, I presume @jrfastab already took a closer look.

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Aug 24, 2023
@jrfastab jrfastab merged commit 9271da1 into cilium:v1.14 Aug 25, 2023
56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.14 This PR represents a backport for Cilium 1.14.x of a PR that was merged to main. kind/backports This PR provides functionality previously merged into master. ready-to-merge This PR has passed all tests and received consensus from code owners to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants