Skip to content

WIP: Local cert provider#23063

Closed
liverbirdkte wants to merge 22 commits intoenvoyproxy:mainfrom
liverbirdkte:local_cert_provider
Closed

WIP: Local cert provider#23063
liverbirdkte wants to merge 22 commits intoenvoyproxy:mainfrom
liverbirdkte:local_cert_provider

Conversation

@liverbirdkte
Copy link
Copy Markdown

Local certificate provider instance

A certificate provider instance to generate certificates locally. It's based on the certificate provider framework and bumping filter could use this instance for testing.

Commit Message:
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

Luyao Zhong and others added 21 commits February 15, 2022 13:33
Introduce a CertificateProviderManager to parse the certificate_provider_instances
config and instantiate certificate providers.

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
* rename default_cert_provider to static_cert_provider
* nest struct Certpair inside of the CertificateProvider class
* avoid the copy of certificate provider config
* update CertificateProvider interfaces
* fix format_pre CI failure

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
StaticCertificateProvider supports generating identity certificates,
it is supposed to be renamed later.

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
DefaultCertificateProvider supports generating certificates
for handshake which shows how CertificateProvider
asynchronous interfaces work.

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
…r-instances

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
…allbacks

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
…r-instances

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
…r-instances

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
implement ca_certificate_provider_instance in CertificateValidationContext
implement tls_certificate_provider_instance in CommonTlsContext

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
…r-instances

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
consider current implementation for tls certificate config loading,
certificate provider shoule provide at least one tls certificate,
otherwise the Envoy will complain when loading the config.

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Signed-off-by: LeiZhang <lei.a.zhang@intel.com>
@repokitteh-read-only
Copy link
Copy Markdown

Hi @liverbirdkte, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

🐱

Caused by: #23063 was opened by liverbirdkte.

see: more, trace.

@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @adisuissa
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #23063 was opened by liverbirdkte.

see: more, trace.

@liverbirdkte liverbirdkte marked this pull request as draft September 11, 2022 13:24
Signed-off-by: lei zhang <lei.a.zhang@intel.com>
@vermajit
Copy link
Copy Markdown

vermajit commented Sep 15, 2022

Hi @liverbirdkte Would you be able to share a sample envoy config that I could use to try this out locally ?

I tried out the following

certificate_provider_instances:
  local_certificate_provider:
    name: envoy.certificate_providers.local_certificate
    typed_config:
      "@type": type.googleapis.com/envoy.extensions.certificate_providers.local_certificate.v3.LocalCertificate
      rootca_cert: {"filename": "./root-ca.pem"}
      rootca_key: {"filename": "./root-ca.key"}
static_resources:
  listeners:
  - name: https_listener
... rest of config ...

But envoy fails to start with following error

[2022-09-14 17:39:52.884][31771][debug][config] [source/server/configuration_impl.cc:99] add certificate provider: local_certificate_provider
[2022-09-14 17:39:52.884][31771][critical][main] [source/server/server.cc:117] error initializing configuration 'config.yaml': Didn't find a registered implementation for 'envoy.certificate_providers.local_certificate' with type URL: 'envoy.extensions.certificate_providers.local_certificate.v3.LocalCertificate'
[2022-09-14 17:39:52.884][31771][info][main] [source/server/server.cc:966] exiting
Didn't find a registered implementation for 'envoy.certificate_providers.local_certificate' with type URL: 'envoy.extensions.certificate_providers.local_certificate.v3.LocalCertificate'

@vermajit
Copy link
Copy Markdown

Hi @liverbirdkte Would you be able to share a sample envoy config that I could use to try this out locally ?

I tried out the following

certificate_provider_instances:
  local_certificate_provider:
    name: envoy.certificate_providers.local_certificate
    typed_config:
      "@type": type.googleapis.com/envoy.extensions.certificate_providers.local_certificate.v3.LocalCertificate
      rootca_cert: {"filename": "./root-ca.pem"}
      rootca_key: {"filename": "./root-ca.key"}
static_resources:
  listeners:
  - name: https_listener
... rest of config ...

But envoy fails to start with following error

[2022-09-14 17:39:52.884][31771][debug][config] [source/server/configuration_impl.cc:99] add certificate provider: local_certificate_provider
[2022-09-14 17:39:52.884][31771][critical][main] [source/server/server.cc:117] error initializing configuration 'config.yaml': Didn't find a registered implementation for 'envoy.certificate_providers.local_certificate' with type URL: 'envoy.extensions.certificate_providers.local_certificate.v3.LocalCertificate'
[2022-09-14 17:39:52.884][31771][info][main] [source/server/server.cc:966] exiting
Didn't find a registered implementation for 'envoy.certificate_providers.local_certificate' with type URL: 'envoy.extensions.certificate_providers.local_certificate.v3.LocalCertificate'

Found the issue. I was able to load the extension successfully after adding the missing REGISTER_FACTORY(LocalCertificateFactory, CertificateProvider::CertificateProviderFactory); in source/extensions/certificate_providers/local_certificate/config.cc

@liverbirdkte
Copy link
Copy Markdown
Author

Hi @liverbirdkte Would you be able to share a sample envoy config that I could use to try this out locally ?
I tried out the following

certificate_provider_instances:
  local_certificate_provider:
    name: envoy.certificate_providers.local_certificate
    typed_config:
      "@type": type.googleapis.com/envoy.extensions.certificate_providers.local_certificate.v3.LocalCertificate
      rootca_cert: {"filename": "./root-ca.pem"}
      rootca_key: {"filename": "./root-ca.key"}
static_resources:
  listeners:
  - name: https_listener
... rest of config ...

But envoy fails to start with following error

[2022-09-14 17:39:52.884][31771][debug][config] [source/server/configuration_impl.cc:99] add certificate provider: local_certificate_provider
[2022-09-14 17:39:52.884][31771][critical][main] [source/server/server.cc:117] error initializing configuration 'config.yaml': Didn't find a registered implementation for 'envoy.certificate_providers.local_certificate' with type URL: 'envoy.extensions.certificate_providers.local_certificate.v3.LocalCertificate'
[2022-09-14 17:39:52.884][31771][info][main] [source/server/server.cc:966] exiting
Didn't find a registered implementation for 'envoy.certificate_providers.local_certificate' with type URL: 'envoy.extensions.certificate_providers.local_certificate.v3.LocalCertificate'

Found the issue. I was able to load the extension successfully after adding the missing REGISTER_FACTORY(LocalCertificateFactory, CertificateProvider::CertificateProviderFactory); in source/extensions/certificate_providers/local_certificate/config.cc

Hi vermajit,

Sorry for not seeing this in time, this is a draft of local cert provider instance and not totally ready. You have to integrate with other patches to make it work. We are going to submit a PR to include all the related patches together for testing. I'll ping you when the code is ready. Thanks.

@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@github-actions github-actions bot added the stale stalebot believes this issue/PR has not been touched recently label Oct 21, 2022
@liverbirdkte
Copy link
Copy Markdown
Author

Hi @vermajit, we have an integration patch to demo TLS bumping scenario, #23192. You could try it out locally. Any feedback is welcome.

@github-actions github-actions bot removed the stale stalebot believes this issue/PR has not been touched recently label Oct 28, 2022
@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@github-actions github-actions bot added the stale stalebot believes this issue/PR has not been touched recently label Nov 27, 2022
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 4, 2022

This pull request has been automatically closed because it has not had activity in the last 37 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@github-actions github-actions bot closed this Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api stale stalebot believes this issue/PR has not been touched recently

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants