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

fix : make ambient work with intermidiary certs #680

Merged
merged 3 commits into from
Sep 15, 2023

Conversation

yuval-k
Copy link
Contributor

@yuval-k yuval-k commented Sep 14, 2023

make the test certs logic resemble more what the control plane does, and add a test that the certs loaded correctly.

This solves two problems:

  • If the cert-chain has multiple certs. using stack_from_pem instead of from_pem solves that.
  • Sometimes the user might add the root cert to the chain as well. While technically a user error , we should be forgiving, to prevent user frustration. So I added dedup_by that removes to adjacent certs that are the same.

Fixes istio/istio#46995.

make the test certs logic resemble more what the control plane does, and add a test that the certs loaded correctly.
@yuval-k yuval-k requested a review from a team as a code owner September 14, 2023 22:31
@istio-policy-bot
Copy link

😊 Welcome @yuval-k! This is either your first contribution to the Istio ztunnel repo, or it's been
a while since you've been here.

You can learn more about the Istio working groups, Code of Conduct, and contribution guidelines
by referring to Contributing to Istio.

Thanks for contributing!

Courtesy of your friendly welcome wagon.

@istio-testing istio-testing added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test labels Sep 14, 2023
@istio-testing
Copy link
Contributor

Hi @yuval-k. Thanks for your PR.

I'm waiting for a istio member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@linsun
Copy link
Member

linsun commented Sep 14, 2023

/ok-to-test

@istio-testing istio-testing added ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. and removed needs-ok-to-test labels Sep 14, 2023
x.digest(MessageDigest::sha256()),
y.digest(MessageDigest::sha256()),
) {
(Ok(x), Ok(y)) => x.as_ref() == y.as_ref(),
Copy link
Member

Choose a reason for hiding this comment

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

do we need to dedup, when can this happen

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mentioned that in the PR description

Sometimes the user might add the root cert to the chain as well. While technically a user error , we should be forgiving, to prevent user frustration. So I added dedup_by that removes to adjacent certs that are the same.

Copy link
Contributor Author

@yuval-k yuval-k Sep 15, 2023

Choose a reason for hiding this comment

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

note that if you don't dedupe them you get this error:

tls error: invalid operation: ErrorStack([Error { code: 184549481, library: "X.509 certificate routines", function: "OPENSSL_internal", reason: "CERT_ALREADY_IN_HASH_TABLE", file: "../crypto/x509/x509_lu.c", line: 356 }])

@istio-testing istio-testing merged commit be1ccac into istio:master Sep 15, 2023
@dhawton dhawton added the cherrypick/release-1.19 Set this label on a PR to auto-merge it to the release-1.19 branch label Sep 20, 2023
@dhawton
Copy link
Member

dhawton commented Sep 20, 2023

/cherry-pick release-1.19

@istio-testing
Copy link
Contributor

@dhawton: #680 failed to apply on top of branch "release-1.19":

Applying: fix istio/istio#46995 - work with intermidiary certs
Using index info to reconstruct a base tree...
M	src/tls/boring.rs
Falling back to patching base and 3-way merge...
Auto-merging src/tls/boring.rs
CONFLICT (content): Merge conflict in src/tls/boring.rs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 fix istio/istio#46995 - work with intermidiary certs
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-1.19

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@istio-testing
Copy link
Contributor

@dhawton: new issue created for failed cherrypick: #687

In response to this:

/cherry-pick release-1.19

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

dhawton added a commit to dhawton/istio-ztunnel that referenced this pull request Sep 20, 2023
Backports istio#680

Signed-off-by: Daniel Hawton <daniel@hawton.org>
dhawton added a commit to dhawton/istio-ztunnel that referenced this pull request Sep 20, 2023
Backports istio#680

Signed-off-by: Daniel Hawton <daniel@hawton.org>
istio-testing pushed a commit that referenced this pull request Sep 21, 2023
Backports #680

Signed-off-by: Daniel Hawton <daniel@hawton.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherrypick/release-1.19 Set this label on a PR to auto-merge it to the release-1.19 branch ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ambient: Istio with intermidiary cert doesn't work
7 participants