Skip to content

Add certificates config keys in config-network#648

Merged
knative-prow[bot] merged 4 commits into
knative:mainfrom
nak3:add-cert-config
Apr 12, 2022
Merged

Add certificates config keys in config-network#648
knative-prow[bot] merged 4 commits into
knative:mainfrom
nak3:add-cert-config

Conversation

@nak3
Copy link
Copy Markdown
Contributor

@nak3 nak3 commented Apr 6, 2022

This patch adds the following certificate variables:

  • activator-server-certs
  • queue-proxy-ca
  • queue-proxy-san
  • queue-proxy-server-certs

It is similar to #608.

knative/serving#12815 and knative/serving#12770
verified the change.

/cc @evankanderson

This patch adds the following certificate variables:

- `activator-server-certs`
- `queue-proxy-ca`
- `queue-proxy-san`
- `queue-proxy-server-certs`

It is similar to #608.

knative/serving#12815 and knative/serving#12770
verifeid the change.
@knative-prow knative-prow Bot requested a review from evankanderson April 6, 2022 09:01
@knative-prow knative-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 6, 2022
@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented Apr 6, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nak3

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 6, 2022

Codecov Report

Merging #648 (1e34dd9) into main (a1261cd) will increase coverage by 0.29%.
The diff coverage is 100.00%.

❗ Current head 1e34dd9 differs from pull request most recent head 169e8c0. Consider uploading reports for the commit 169e8c0 to get more accurate results

@@            Coverage Diff             @@
##             main     #648      +/-   ##
==========================================
+ Coverage   94.56%   94.85%   +0.29%     
==========================================
  Files          38       38              
  Lines         810     1245     +435     
==========================================
+ Hits          766     1181     +415     
- Misses         31       52      +21     
+ Partials       13       12       -1     
Impacted Files Coverage Δ
pkg/network.go 89.04% <100.00%> (+3.12%) ⬆️
pkg/prober/prober.go 96.80% <0.00%> (-0.17%) ⬇️
pkg/stats.go 100.00% <0.00%> (ø)
pkg/bufferpool.go 100.00% <0.00%> (ø)
pkg/probe_handler.go 100.00% <0.00%> (ø)
pkg/apis/config/store.go 100.00% <0.00%> (ø)
pkg/testing/status/fake.go 100.00% <0.00%> (ø)
pkg/apis/networking/ports.go 100.00% <0.00%> (ø)
pkg/apis/networking/register.go 0.00% <0.00%> (ø)
pkg/apis/networking/generic_types.go 100.00% <0.00%> (ø)
... and 28 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dde40b0...169e8c0. Read the comment docs.

Copy link
Copy Markdown
Member

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

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

I think we want to have a pattern for queue-proxy SANs which incorporates at least the namespace name, and possibly also the revision name.

I'm less concerned about revision name, but it would be nice if we could use the SAN to prove that we don't "cross the streams" at the networking layer and dispatch a request to a queue-proxy at the wrong namespace.

Comment thread config/config-network.yaml Outdated
Comment on lines +208 to +222
# The SAN (Subject Alt Name) used to validate the activator TLS certificate.
# It must be set when "queue-proxy-ca" is specified.
# Use an empty value to disable the feature (default).
#
# NOTE: This flag is in an alpha state and is mostly here to enable internal testing
# for now. Use with caution.
queue-proxy-san: ""

# The server certificates to serve the TLS traffic from activator to queue-proxy.
# It is specified by the secret name, which has the "tls.crt" and "tls.key" data field.
# Use an empty value to disable the feature (default).
#
# NOTE: This flag is in an alpha state and is mostly here to enable internal testing
# for now. Use with caution.
queue-proxy-server-certs: ""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't queue-proxies in different namespaces get different SANs and Certs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, it should get the different SANs and certs. But for the alpha release, I assumed that:

  • admin deploys secret (server certs) in each application namespace with the name specified in queue-proxy-server-certs.
  • queue-proxy mounts the secret via volume mount.

The different SANs and certs are very difficult to implement and we need to consider about another traffic ingress -> queue-proxy in the future.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems important that a user in one namespace not have access to the cert being used in a different namespace. SANs feel like the way to do that -- we can start with having the admins manually create the certs using something like Cert-Manager or by hand, and eventually enhance Knative to do this before GA.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we need to validate SAN/certs at service creation time. It should be done for GA. For now its ok to test with shared certs I guess.

Comment thread config/config-network.yaml Outdated
Comment on lines +192 to +198
# The server certificates to serve the TLS traffic from ingress to activator.
# It is specified by the secret name, which has the "tls.crt" and "tls.key" data field.
# Use an empty value to disable the feature (default).
#
# NOTE: This flag is in an alpha state and is mostly here to enable internal testing
# for now. Use with caution.
activator-server-certs: ""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about activator-cert-secret if we need this to be configurable? (I'm okay with it being configurable, though I'm not sure how useful that feature might be vs simply having a hard-coded name.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wanted make this configurable as activator can turn on the https serving or not based on the config as:

	if networkConfig.ActivatorServerCert != "" {
              // activator starts serving https.
        }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For the name of activator-cert-secret vs activator-server-certs, we already have the activator ca as activator-ca (without -secert) so it should be consistent?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd thought the activator-ca was the actually CA certificate (which doesn't need to be kept private, because it's a certificate, not keys).

I'd prefer to have the -secret name here, because it provides a clearer clue that this is a value that needs to be kept private as well.

@nak3
Copy link
Copy Markdown
Contributor Author

nak3 commented Apr 7, 2022

For queue-proxy's SANs and certs, it needs to consider about the ingress -> queue-proxy, which we have a plan to implement in the future, right? I think it is difficult to determine/implement it with the namespace level in this alpha release...

@nak3
Copy link
Copy Markdown
Contributor Author

nak3 commented Apr 7, 2022

/cc @skonto @rhuss

@knative-prow knative-prow Bot requested review from rhuss and skonto April 7, 2022 23:50
@evankanderson
Copy link
Copy Markdown
Member

For queue-proxy's SANs and certs, it needs to consider about the ingress -> queue-proxy, which we have a plan to implement in the future, right? I think it is difficult to determine/implement it with the namespace level in this alpha release...

I think the challenge for ingress -> queue-proxy is twofold:

  1. Need some way to teach Ingresses about SANs and CAs associated with particular endpoints (i.e. a mix of activator and queue-proxy pods will have different SANs depending on the endpoint).
  2. Need some way to teach individual Ingresses about per-SLS SANs, which means we probably need to put that information in KIngress, which means a "protocol feature bump" in a way that is harder than activator -> queue-proxy, where we control all the code (which is in Go).

I'd be happy with either hard-coding the SAN as equal to the internal cluster service name, or something like {{namespace}}.knative.

@skonto
Copy link
Copy Markdown
Contributor

skonto commented Apr 11, 2022

I think the challenge for ingress -> queue-proxy is twofold:
...

I would also vote for moving the san/cert info in the ingress part.

I'd be happy with either hard-coding the SAN as equal to the internal cluster service name, or something like {{namespace}}.knative.

SAN can be many things afaik. Could users use the service without the internal name (thinking out loud)?

@skonto
Copy link
Copy Markdown
Contributor

skonto commented Apr 11, 2022

/lgm

@evankanderson
Copy link
Copy Markdown
Member

I think the challenge for ingress -> queue-proxy is twofold:
...

I would also vote for moving the san/cert info in the ingress part.

I'm not sure I understand the comment here. Do you mean move the SAN and Cert info in the KIngress, or into a different phase of the implementation.

I'd be happy with either hard-coding the SAN as equal to the internal cluster service name, or something like {{namespace}}.knative.

SAN can be many things afaik. Could users use the service without the internal name (thinking out loud)?

SAN is a field in the CA certificate; I don't think we need to align those values with specific resolvable DNS addresses. I think I'm suggesting using the dnsNames field here only because that seems to be supported by cert-manager, but I'm imagining that we'd have a custom validator and wouldn't want other systems using the internal name and attempting validation.

@nak3
Copy link
Copy Markdown
Contributor Author

nak3 commented Apr 12, 2022

@skonto @evankanderson Is it possible to merge this into 1.4 😅

@evankanderson
Copy link
Copy Markdown
Member

@skonto @evankanderson Is it possible to merge this into 1.4 😅

I'd like to understand the plan for queue-proxy certs. Is it to copy a shared cert to each namespace for 1.4, and then to replace them (and the related config options) in 1.5?

@nak3
Copy link
Copy Markdown
Contributor Author

nak3 commented Apr 12, 2022

Is it to copy a shared cert to each namespace for 1.4, and then to replace them (and the related config options) in 1.5?

Yes, I assumed that.

@evankanderson
Copy link
Copy Markdown
Member

I think this probably means that the feature will be pre-alpha for 1.4, but as long as we're fine with throwing out some or all of users configuration when we ship 1.5.

/lgtm

@knative-prow knative-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 12, 2022
@knative-prow knative-prow Bot merged commit c173eed into knative:main Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. 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.

3 participants