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

tcp_proxy: extend tunneling_config with auto_sni #20230

Closed

Conversation

jewertow
Copy link
Contributor

@jewertow jewertow commented Mar 5, 2022

Signed-off-by: Jacek Ewertowski jacek.ewertowski1@gmail.com

This pull request is not yet ready for code review.

Commit Message: Extend tcp_proxy.tunneling_config with auto_sni
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Fixes #19612]

@repokitteh-read-only
Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #20230 was opened by jewertow.

see: more, trace.

@repokitteh-read-only
Copy link

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

🐱

Caused by: #20230 was opened by jewertow.

see: more, trace.

option (validate.required) = true;

// Static hostname used in request-target of CONNECT request
string hostname = 1;
Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately we can't upgrade an existing field to oneof per https://github.com/envoyproxy/envoy/blob/main/api/API_VERSIONING.md

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I understand. So the only way is to deprecate existing field hostname and add another one, let's say static_hostname, and wrap it together with auto_sni in oneof? Take a look at this comment.
Then the schema would be:

message TunnelingConfig {
  string hostname = 1 [deprecated = true];

  oneof hostname_config {
    string static_hostname = 4;
    AutoSni auto_sni = 5;
  }
}

Copy link
Member

Choose a reason for hiding this comment

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

We could also go with the relaxed validation and mutual exclusion in the second part of #19612 (comment). Either of these is valid.

Copy link
Contributor

Choose a reason for hiding this comment

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

sni is indeed a reasonable source of host name header.

Can we relax the hostname value to %EXPR%?
I have the use case that populating the value from %FILTER_STATE(KEY:F):Z% and %DYNAMIC_METADATA(NAMESPACE:KEY*):Z%
It could be done in another PR but I'd like to point out SNI is not only source of required value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At the beginning I suggested a similar idea, but we decided to add another config option to the API. For more context please read the discussion in the issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

This api schema enables the original proposal and I like to invest after auto_sni.
Could you update the PR to move "hostname =1" out of one_of per Harvey's comment?
I can reference the new schema in the issue

Copy link
Contributor Author

@jewertow jewertow Mar 16, 2022

Choose a reason for hiding this comment

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

Could you update the PR to move "hostname =1" out of one_of

Done

message AutoSni {
// Optional port used to create the request-target for all CONNECT request, i.e. CONNECT <hostname_from_sni>:<default_port>
// If default_port is not specified, 443 is used.
uint32 port = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

uint32 is not an optional type. Do you want to use Uint32 or clarify the default_port means value 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you're right. I used uint32 intentionally and by "optional" I meant that 0 value will be handled as 443. I will fix this description.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

option (validate.required) = true;

// Static hostname used in request-target of CONNECT request
string hostname = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

This api schema enables the original proposal and I like to invest after auto_sni.
Could you update the PR to move "hostname =1" out of one_of per Harvey's comment?
I can reference the new schema in the issue

@github-actions
Copy link

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 Apr 15, 2022
@jewertow jewertow force-pushed the tcp-proxy-tunneling-config-auto-sni branch from ea377fb to a4d4f7c Compare April 20, 2022 21:23
Signed-off-by: Jacek Ewertowski <jacek.ewertowski1@gmail.com>
Signed-off-by: Jacek Ewertowski <jacek.ewertowski1@gmail.com>
Signed-off-by: Jacek Ewertowski <jacek.ewertowski1@gmail.com>
Signed-off-by: Jacek Ewertowski <jacek.ewertowski1@gmail.com>
@jewertow
Copy link
Contributor Author

Don't close this PR, I work on it.

@github-actions github-actions bot removed the stale stalebot believes this issue/PR has not been touched recently label Apr 22, 2022
@jewertow
Copy link
Contributor Author

I am not convinced about this API though, since we can't wrap hostname and auto_sni in oneof. Without oneof the API will not be intuitive. I decided to open an alternative PR: #21067, which allows to interpolate %REQUESTED_SERVER_NAME% in the tunneling_config.hostname. I think it's better than overwriting headers and more flexible than aut_sni, because allows to support also other values in the future.

@htuch
Copy link
Member

htuch commented May 2, 2022

The alternative looks quite reasonable to me.

@github-actions
Copy link

github-actions bot commented Jun 1, 2022

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 Jun 1, 2022
@github-actions
Copy link

github-actions bot commented Jun 8, 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 Jun 8, 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.

Dynamic setting value of TcpProxy.tunneling_config.hostname
3 participants