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: support TLS connection in flagd provider #48

Merged
merged 3 commits into from
Apr 4, 2023

Conversation

odubajDT
Copy link
Contributor

@odubajDT odubajDT commented Mar 27, 2023

Related Issues

Fixes #36

@odubajDT odubajDT force-pushed the feat/36/support-tls branch 10 times, most recently from 60a77dc to dea30dc Compare March 29, 2023 12:03
@odubajDT odubajDT marked this pull request as ready for review March 29, 2023 13:11
@odubajDT odubajDT requested a review from a team as a code owner March 29, 2023 13:11
@toddbaert
Copy link
Member

Let me do a manual test with this (unless you already have)

@odubajDT
Copy link
Contributor Author

odubajDT commented Mar 30, 2023

Let me do a manual test with this (unless you already have)

I did, but I would really appreciate that. Thank you!

I already have a testing mechanism/code that I can share with you, or do you want to do it completely independent ?

@toddbaert toddbaert changed the title feat: support TLS connection in flagD provider feat: support TLS connection in flagd provider Mar 30, 2023
@toddbaert
Copy link
Member

toddbaert commented Mar 30, 2023

Despite my efforts, I was not able to get this to work, though I can't see anything wrong with your code. I generated a keys/certs like so:

  openssl ecparam -name prime256v1 -genkey -noout -out ca.key
  openssl req -new -x509 -sha256 -key ca.key -out ca.crt
  openssl ecparam -name prime256v1 -genkey -noout -out server.key
  openssl req -new -sha256 -subj "/C=US/ST=Oregon/L=Portland/O=Company Name/OU=Org/CN=localhost" -key server.key -out server.csr
  openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key  -out server.crt -days 1000 -sha256

Then I started flagd like:

./bin/flagd start --uri file://flags.json --server-key-path '/server.key' --server-cert-path '/server.crt'

When I set the env vars (FLAGD_SERVER_CERT_PATH=/ca.crt and FLAGD_TLS=true) in dotnet code, I got these sorts of errors from the provider:

HttpRequestException: The SSL connection could not be established, see inner exception. AuthenticationException: The remote certificate is invalid because of errors in the certificate chain: PartialChain"

I think flagd is configured correctly, because my curl to it works:

curl -X POST "https://localhost:8013/schema.v1.Service/ResolveFloat" -d '{"flagKey":"myIntFlag","context":{}}' -H "Content-Type: application/json" --cacert '/ca.crt'

@odubajDT odubajDT marked this pull request as draft March 31, 2023 05:12
@toddbaert
Copy link
Member

@odubajDT Please take a look at my PR to your fork. I was able to get the TLS test I had locally working with this. I hope it explains things.

@odubajDT odubajDT marked this pull request as ready for review April 1, 2023 10:00
Signed-off-by: odubajDT <[email protected]>
@toddbaert toddbaert merged commit 49e775a into open-feature:main Apr 4, 2023
@github-actions github-actions bot mentioned this pull request Apr 4, 2023
vpetrusevici pushed a commit to vpetrusevici/open-feature-dotnet-sdk-contrib that referenced this pull request Oct 18, 2023
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.

[flagd-provider] Implement TLS connection
3 participants