external-attacher icon indicating copy to clipboard operation
external-attacher copied to clipboard

Add TLS support for diagnostics HTTP server

Open VirrageS opened this issue 3 years ago • 18 comments

What type of PR is this? /kind feature

What this PR does / why we need it: It adds TLS support for diagnostics HTTP server. In our cluster we require the metrics to be exposed as HTTPS. Not having this support stops us from using metrics from external-attacher.

I'm not fully sure about the naming of the flags. I've looked at https://kubernetes.io/docs/setup/best-practices/certificates/ but there isn't seem to be consensus about the flag naming for TLS files.

Special notes for your reviewer: NONE

Does this PR introduce a user-facing change?:

Add TLS support for diagnostics/metrics/leader election health status HTTP server by adding new flags: `--http-endpoint-key-file` and `--http-endpoint-cert-file`.

VirrageS avatar Nov 04 '21 14:11 VirrageS

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please sign in with your organization's credentials at https://identity.linuxfoundation.org/projects/cncf to be authorized.
  • If you have done the above and are still having issues with the CLA being reported as unsigned, please log a ticket with the Linux Foundation Helpdesk: https://support.linuxfoundation.org/
  • Should you encounter any issues with the Linux Foundation Helpdesk, send a message to the backup e-mail support address at: [email protected]

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. I understand the commands that are listed here.

k8s-ci-robot avatar Nov 04 '21 14:11 k8s-ci-robot

Welcome @VirrageS!

It looks like this is your first PR to kubernetes-csi/external-attacher 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-csi/external-attacher has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot avatar Nov 04 '21 14:11 k8s-ci-robot

Hi @VirrageS. Thanks for your PR.

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

k8s-ci-robot avatar Nov 04 '21 14:11 k8s-ci-robot

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: VirrageS To complete the pull request process, please assign saad-ali after the PR has been reviewed. You can assign the PR to them by writing /assign @saad-ali in a comment when ready.

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

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

k8s-ci-robot avatar Nov 04 '21 14:11 k8s-ci-robot

I signed it

VirrageS avatar Nov 08 '21 11:11 VirrageS

What people in my social bubble use is kube-rbac-proxy. I.e. the attacher (and other sidecars) listen on http on loopback only and another sidecar listens on a public https port and does https -> http proxying + authentication + authorization (not everyone can read metrics, right?)

It leads to yet another explosion of sidecars - now each sidecar needs its own kube-rbac-proxy container, maybe there is some room for improvement. But I personally don't like adding random https support to CSI sidecars. With this PR we get confidentiality and authentication (both metrics client and the attacher can trust each other who they are), but it does not add any authorization nor audit.

jsafrane avatar Nov 10 '21 10:11 jsafrane

The problem is that we decided to move away from kube-rbac-proxy. I don't know the details but it's just not feasible solution for us.

Therefore, the way to go is to allow exposing the HTTPS for the metrics.

But I personally don't like adding random https support to CSI sidecars.

Could you explain how this is random?

With this PR we get confidentiality and authentication (both metrics client and the attacher can trust each other who they are), but it does not add any authorization nor audit.

Yes but I don't see what's the problem with that. It solves one problem. The authorization can be done independently.

VirrageS avatar Nov 10 '21 11:11 VirrageS

both metrics client and the attacher can trust each other who they are

I think this is only server side verification, i.e., only client trust this is the right server. But we did not add client-side verification in this PR which let the server to trust the client that tries to connect to the HTTPs server

Jiawei0227 avatar Nov 10 '21 12:11 Jiawei0227

The problem is that we decided to move away from kube-rbac-proxy. I don't know the details but it's just not feasible solution for us.

Can you please check what is wrong with kube-rbac-proxy? Maybe it could be fixed there.

But I personally don't like adding random https support to CSI sidecars.

Could you explain how this is random?

It implements only part of TLS, (server) authentication and confidentiality. It leaves authorization and audit open. Why do you want to encrypt the metrics if anyone can get them anyway because of no client authn+authz?

Yes but I don't see what's the problem with that. It solves one problem. The authorization can be done independently.

How can be authorization added later? With my downstream hat on, it's part of security, not afterthought. Maybe I am too paranoid.

jsafrane avatar Nov 10 '21 19:11 jsafrane

Yes but I don't see what's the problem with that. It solves one problem. The authorization can be done independently.

How can be authorization added later? With my downstream hat on, it's part of security, not afterthought. Maybe I am too paranoid.

You aren't. I myself am more worried about unauthorized access to metrics data (not addressed by this PR) than I am about a man-in-the-middle attack where someone fakes metrics data (addressed by this PR via authentication of the HTTPS server and encryption).

pohly avatar Nov 11 '21 07:11 pohly

Can you please check what is wrong with kube-rbac-proxy? Maybe it could be fixed there.

I don't think there is anything wrong with the kube-rbac-proxy. It's just we don't want to use another sidecar if we can do it natively (it saves memory and CPU).

It implements only part of TLS, (server) authentication and confidentiality. It leaves authorization and audit open. Why do you want to encrypt the metrics if anyone can get them anyway because of no client authn+authz?

Because in our use-case we can ensure that the client is authorized but we still want authentication.

How can be authorization added later? With my downstream hat on, it's part of security, not afterthought. Maybe I am too paranoid.

Hm, maybe I'm missing something but why cannot we? For me, adding authz is just work for another MR.

Authn and authz feel like the two separate use-cases. I agree that ideally we could have support for both of them. But at the same time I don't see a reason why cannot it be added later. If someone would like to have this feature (authz) then I think there will be another MR.

You aren't. I myself am more worried about unauthorized access to metrics data (not addressed by this PR) than I am about a man-in-the-middle attack where someone fakes metrics data (addressed by this PR via authentication of the HTTPS server and encryption).

Feel free to do MR follow up :))

VirrageS avatar Nov 15 '21 15:11 VirrageS

Any update on if it's going to be merged?

VirrageS avatar Dec 09 '21 11:12 VirrageS

Bump

VirrageS avatar Dec 16 '21 09:12 VirrageS

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Mar 16 '22 10:03 k8s-triage-robot

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jun 14 '22 11:06 k8s-triage-robot

/remove-lifecycle stale

VirrageS avatar Jun 14 '22 11:06 VirrageS

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Sep 12 '22 12:09 k8s-triage-robot

/remove-lifecycle stale

VirrageS avatar Sep 13 '22 14:09 VirrageS

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Dec 12 '22 15:12 k8s-triage-robot

/remove-lifecycle stale

VirrageS avatar Dec 12 '22 16:12 VirrageS

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Mar 12 '23 18:03 k8s-triage-robot

@jsafrane @xing-yang is there anything that can be done here to make this mergable?

VirrageS avatar May 18 '23 14:05 VirrageS

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jan 19 '24 06:01 k8s-triage-robot

is there anything that can be done here to make this mergable?

We're not going to merge half baked TLS without proper authorization support. It protects metrics from MITM attacks, but the man in the middle can scrape the metrics by themeselves by themselves, so the encryption does not help in any way.

jsafrane avatar Jan 19 '24 16:01 jsafrane

The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle rotten
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Feb 18 '24 17:02 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

k8s-triage-robot avatar Mar 19 '24 17:03 k8s-triage-robot

@k8s-triage-robot: Closed this PR.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

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.

k8s-ci-robot avatar Mar 19 '24 17:03 k8s-ci-robot