Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Define Request From Local Cerificate #18

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

HorizonSecuritySRL
Copy link

@HorizonSecuritySRL HorizonSecuritySRL commented Apr 26, 2018

In my use case I need to validate a certificate that resides in the local machine in order to ensure the correct communication with Vault placed on a host machine reachable on https.

To do this I introduced a new property in the VaultOptions that will be started with the path of the certified.

Within the VaultHttpClient class I inserted a method that initializes HttpClient with the result of the HttpClientinitialization () method which, in case the property is populated, passes the hundler parameter to HttpClient, thus specifying the certificate to be used with X509Certificate2. Otherwise the behavior of the plugin will remain unchanged.

I report the scenario with which the test was conducted:

public static async Task<Dictionary<string, string>> VaultAsync(string secretPath)
{
VaultOptions.Default.CertPath = new DirectoryInfo(
Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"...." + "AppData\cert.crt"))
).ToString();

var vaultClient = new VaultClient();
vaultClient.Address = new System.Uri("https://vault.personal.domain.com:8200");
vaultClient.Token = "token";

var secret = await vaultClient.Secret.Read<Dictionary<string, string>>(secretPath);

return secret.Data;

}

Copy link
Contributor

@chrishoffman chrishoffman left a comment

Choose a reason for hiding this comment

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

Can you please describe your use case in the pull requests description and how this will solve it?

README.md Outdated
@@ -1,98 +1,29 @@
# Vault.NET [![Build status](https://ci.appveyor.com/api/projects/status/784hg5j70vcnumeb/branch/master?svg=true)](https://ci.appveyor.com/project/chatham/vault-net/branch/master)
# Vault.NET Local Certificate
Copy link
Contributor

Choose a reason for hiding this comment

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

Please provide the description of the change in the description of the pull request. This is the main README for the repository.

</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net45'">
Copy link
Contributor

Choose a reason for hiding this comment

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

We are moving away from support specific .NET runtimes to ensure compatibility. Please target .NET Standard 1.1. There is another pull request already that removes .NET 4.5 specific support.

Validation custom certificate for Vault Callback Request
Add System.Net.Http.WebRequest for TargetFramework net45
Add Custom Certificate for NET45 with WebRequestHandler
Set the visibility method
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants