C# Lambda with AWS IAM Auth method error in certificate #359
Replies: 2 comments
About the error you're getting:
|
0 replies
|
@selvaesakkirajan This is outside of VaultSharp and @konidev20 has suggested the solution correctly. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I am creating C# lambda
// setup the AWS-IAM based auth to get the right token.
var amazonSecurityTokenServiceConfig = new AmazonSecurityTokenServiceConfig();
var iamRequest = GetCallerIdentityRequestMarshaller.Instance.Marshall(new GetCallerIdentityRequest());
iamRequest.Endpoint = new Uri(amazonSecurityTokenServiceConfig.DetermineServiceURL());
iamRequest.ResourcePath = "/";
iamRequest.Headers.Add("User-Agent", httpvaultaddress);
iamRequest.Headers.Add("X-Amz-Security-Token", AWS_SESSION_TOKEN);
iamRequest.Headers.Add("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
new AWS4Signer().Sign(iamRequest, amazonSecurityTokenServiceConfig, new RequestMetrics(), AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY);
var iamSTSRequestHeaders = iamRequest.Headers;
var base64EncodedIamRequestHeaders = Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(iamSTSRequestHeaders)));
IAuthMethodInfo authMethod = new IAMAWSAuthMethodInfo(nonce: System.Guid.NewGuid().ToString(), roleName: roleName, requestHeaders: base64EncodedIamRequestHeaders);
var vaultClientSettings = new VaultClientSettings(httpVaultAddress, authMethod);
IVaultClient vaultClient = new VaultClient(vaultClientSettings);
vaultClient.V1.Auth.PerformImmediateLogin();
Above login throws an error:
The SSL connection could not be established, see inner exception.
The remote certificate is invalid because of errors in the certificate chain:UntrustedRoot
Can you help in fixing this
All reactions