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

[ID] httpapi: add https and mTLS support to ingest server #913

Merged
merged 17 commits into from
Mar 8, 2022

Conversation

roobre
Copy link
Contributor

@roobre roobre commented Jan 21, 2022

i-day PR

This PR adds support for TLS on the Ingest server from the httpapi package. Server can be configured to listen in three modes:

  1. Plain HTTP, exaclty as it did before this PR
  2. HTTPs using specified certificates
  3. HTTPs with client validation using a specified CA file

This feature, provided specific configuration, could allow to safely expose the infra-agent HTTP ingest endpoint in less trusted networks, such as a Kubernetes cluster.

Reviewing

As multiple files have been changed to make this feature available, I suggest to review commit by commit.

@roobre roobre changed the title httpapi: add mTLS support httpapi: add https and mTLS support to ingest server Jan 21, 2022
@roobre roobre marked this pull request as ready for review February 10, 2022 13:12
Copy link
Contributor

@rubenruizdegauna rubenruizdegauna left a comment

Choose a reason for hiding this comment

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

nice refactor along the way! thanks ;-)

@brushknight brushknight changed the title httpapi: add https and mTLS support to ingest server [ID] httpapi: add https and mTLS support to ingest server Feb 22, 2022
@roobre roobre force-pushed the ingest-mtls branch 2 times, most recently from ddf1ebd to f77bed5 Compare February 22, 2022 14:53
@roobre
Copy link
Contributor Author

roobre commented Feb 22, 2022

Some updates to this PR:

  • I did not fully like httpapi.Config so I banished it from existence. Now stuff is enabled by interacting with the server directly (31c0a6a)
  • Added some tests to mTLS serving: 9ba85c4
  • Issuing "readiness probes" when client validation is enforced is tricky, so I needed to skip the probe in that case: f85da92

@@ -28,60 +31,73 @@ const (
statusAPIPathReady = "/v1/status/ready"
ingestAPIPath = "/v1/data"
ingestAPIPathReady = "/v1/data/ready"
readinessProbeRetryBackoff = 10 * time.Millisecond
readinessProbeRetryBackoff = 100 * time.Millisecond
Copy link
Contributor

Choose a reason for hiding this comment

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

out of curiosity, why increase it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was a bit of a sneaky change, sorry about that! The main motivation was that during tests, the probing mechanism was consuming quite a bunch of CPU. Since we're waiting for network requests to succeed, the 100ms backoff did not seem that much. I can always revert it back to 10ms if you prefer it :)

Copy link
Contributor

@rubenruizdegauna rubenruizdegauna left a comment

Choose a reason for hiding this comment

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

LGTM just a few typos and 🔥

Copy link
Contributor

@rubenruizdegauna rubenruizdegauna left a comment

Choose a reason for hiding this comment

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

LGTM 💪

@roobre
Copy link
Contributor Author

roobre commented Mar 3, 2022

Tests seem to be entering into some sort of deadlock and timing out :(
I'll take a look into that as soon as I have some time.

Copy link
Contributor

@rubenruizdegauna rubenruizdegauna left a comment

Choose a reason for hiding this comment

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

LGTM! 💪

@rubenruizdegauna rubenruizdegauna merged commit 31bf065 into master Mar 8, 2022
@rubenruizdegauna rubenruizdegauna deleted the ingest-mtls branch March 8, 2022 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants