Skip to content

Commit

Permalink
docs: Fix keyid derivation in IPsec docs
Browse files Browse the repository at this point in the history
[ upstream commit b26d9be ]

Previously, when determing a keyid before the rotation, the doc suggested to
run "cut -c 1". This returns only the first digit (e.g., if keyid is "15",
then "1" is returned). This breaks the rotation 15=>1.

Fixes: 42ef7f3 ("docs: Update IPsec key rotation command")
Reported-by: Paul Chaignon <paul.chaignon@gmail.com>
Signed-off-by: Martynas Pumputis <m@lambda.lt>
Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
  • Loading branch information
brb authored and julianwiedmann committed Jan 4, 2024
1 parent c75d324 commit 30485f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Documentation/gettingstarted/encryption-ipsec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ To replace cilium-ipsec-keys secret with a new key:

.. code-block:: shell-session
KEYID=$(kubectl get secret -n kube-system cilium-ipsec-keys -o go-template --template={{.data.keys}} | base64 -d | cut -c 1)
KEYID=$(kubectl get secret -n kube-system cilium-ipsec-keys -o go-template --template={{.data.keys}} | base64 -d | cut -d' ' -f1)
if [[ $KEYID -ge 15 ]]; then KEYID=0; fi
data=$(echo "{\"stringData\":{\"keys\":\"$((($KEYID+1))) "rfc4106\(gcm\(aes\)\)" $(echo $(dd if=/dev/urandom count=20 bs=1 2> /dev/null| xxd -p -c 64)) 128\"}}")
kubectl patch secret -n kube-system cilium-ipsec-keys -p="${data}" -v=1
Expand Down

0 comments on commit 30485f9

Please sign in to comment.