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

feat: OBS-435 - diode-sdk-python: tls_verify + grpc client call interceptor #75

Merged
merged 6 commits into from
May 9, 2024

Conversation

mfiedorowicz
Copy link
Member

@mfiedorowicz mfiedorowicz commented May 9, 2024

  • use OS root CAs for grpc secure channel and add configurable tls_verify
  • intercept grpc calls to prefix original service method with path provided in the target, /diode.v1.IngesterService/Ingest -> /2932546d/diode/diode.v1.IngesterService/Ingest
  • add metadata about platform and python version, i.e.
platform = macOS-14.4.1-arm64-arm-64bit
python-version = 3.10.13

Usage of SDK:

DiodeClient(
        target="localhost:80/xyz/diode/",
        app_name="pusher",
        app_version="0.0.1",
        tls_verify=False,
) 

nginx logs:

2024/05/09 19:35:06 [notice] 28#28: *6 "/xyz/diode/(.*)" matches "/xyz/diode/diode.v1.IngesterService/Ingest", client: 192.168.65.1, server: localhost, request: "POST /xyz/diode/diode.v1.IngesterService/Ingest HTTP/2.0", host: "localhost:80"
2024/05/09 19:35:06 [notice] 28#28: *6 rewritten data: "/diode.v1.IngesterService/Ingest", args: "", client: 192.168.65.1, server: localhost, request: "POST /xyz/diode/diode.v1.IngesterService/Ingest HTTP/2.0", host: "localhost:80"
192.168.65.1 - - [09/May/2024:19:35:06 +0000] "POST /xyz/diode/diode.v1.IngesterService/Ingest HTTP/2.0" 200 5 "-" "grpc-python/1.62.1 grpc-c/39.0.0 (osx; chttp2)" "-"

…l and add configurable tls_verify

also add metadata about platform and python version

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
@mfiedorowicz mfiedorowicz self-assigned this May 9, 2024
Copy link

linear bot commented May 9, 2024

OBS-435 SDK (python + go) to use system certs for server TLS verification

gRPC client libraries require certificates for diode server TLS verification, regardless of setting insecure connection explicitly 🤷‍♂️

Both python and go diode SDKs should load system available certificates:

  • python to use certifi package with certifi.where()
Certifi provides Mozilla’s carefully curated collection of Root Certificates for validating the 
trustworthiness of SSL certificates while verifying the identity of TLS hosts. 
It has been extracted from the Requests project.
  • go to use x509.SystemCertPool()

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
…fixing grpc methods with paths provided in the target

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
@mfiedorowicz mfiedorowicz changed the title feat: OBS-435 - diode-sdk-python: tls_verify feat: OBS-435 - diode-sdk-python: tls_verify + grpc client call interceptor May 9, 2024
Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
@mfiedorowicz mfiedorowicz marked this pull request as ready for review May 9, 2024 19:32
@mfiedorowicz mfiedorowicz requested a review from natm as a code owner May 9, 2024 19:32
@mfiedorowicz mfiedorowicz merged commit 1e08155 into develop May 9, 2024
9 checks passed
@mfiedorowicz mfiedorowicz deleted the feat/OBS-435-diode-sdk-tls-root-ca branch May 9, 2024 19:37
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.

1 participant