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

Support listening on TLS #2963

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Support listening on TLS #2963

wants to merge 1 commit into from

Conversation

frebib
Copy link
Contributor

@frebib frebib commented Oct 18, 2021

Allows specifying a certificate&key pair by file paths, as well as an
optional CA file. Enforce/allow mutual-TLS handshake behaviour too.

Signed-off-by: Joe Groocock me@frebib.net


I appreciate that this implementation is rather rudimentary, and I don't expect it to be accepted immediately but I figured it was a good start and a discussion point.

@google-cla
Copy link

google-cla bot commented Oct 18, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@k8s-ci-robot
Copy link
Collaborator

Hi @frebib. Thanks for your PR.

I'm waiting for a google 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.

@frebib
Copy link
Contributor Author

frebib commented Oct 18, 2021

@googlebot I signed it!

@google-cla google-cla bot added cla: yes and removed cla: no labels Oct 18, 2021
@frebib frebib force-pushed the feat/tls branch 2 times, most recently from 36ebd6e to 60cd758 Compare November 3, 2021 15:08
@frebib
Copy link
Contributor Author

frebib commented Nov 29, 2021

Bump?

cmd/cadvisor.go Outdated Show resolved Hide resolved
cmd/cadvisor.go Outdated Show resolved Hide resolved
cmd/cadvisor.go Outdated Show resolved Hide resolved
cmd/cadvisor.go Outdated Show resolved Hide resolved
@iwankgb
Copy link
Collaborator

iwankgb commented Jan 9, 2022

/ok-to-test

@frebib
Copy link
Contributor Author

frebib commented Jan 25, 2022

Is there some documentation or help pages I should update to go along with this change?

@frebib
Copy link
Contributor Author

frebib commented Apr 21, 2022

/retest

Test failures seem irrelevant. It was working fine before.
Bump on this

@frebib
Copy link
Contributor Author

frebib commented Apr 21, 2022

🤷🏻 It fails to build locally for me on master- it's not the fault of this PR though.

var tlsCertPath = flag.String("tls_cert_path", "", "TLS certificate file path to serve cadvisor HTTPS with. Must be specified along with -tls_key_path")
var tlsKeyPath = flag.String("tls_key_path", "", "TLS key file path to serve cadvisor HTTPS with. Must be specified along with -tls_cert_path")
var tlsCAPath = flag.String("tls_ca_path", "", "TLS certificate authority file path. Used to verify TLS clients connecting to cadvisor. System CA roots will be used if this is not specified.")
var tlsClientAuth = flag.String("tls_client_auth", "require", "TLS authentication mode, must be one of request, optional, requireany, require or none.")

Choose a reason for hiding this comment

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

Defaulting this flag to require implies TLS to be mandatory. While 346cad4#diff-cec39746c40e86227962aa52ed9ac22cf95c1504cef42cb16c0dd5c16a8cf6caR308 makes it clear that's not the case, I think this is a logic bug.
If this flag is require, the program should terminate if the other required parameters aren't provided (so fail close, not fail open). As such, defaulting this flag to require at the same time as adding the feature is a (imo) bad idea.

@@ -153,6 +160,9 @@ func main() {
klog.Fatalf("Failed to register HTTP handlers: %v", err)
}

// Generate tls.Config if it was requested by flags

Choose a reason for hiding this comment

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

Comment is inaccurate. Implies the existence of a conditional that isn't there. Instead, consider something like:
createTLSConfig returns nil if arguments are empty strings

Copy link
Collaborator

@iwankgb iwankgb left a comment

Choose a reason for hiding this comment

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

Allows specifying a certificate&key pair by file paths, as well as an
optional CA file. Enforce/allow mutual-TLS handshake behaviour too.

Signed-off-by: Joe Groocock <me@frebib.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants