Skip to content

Commit ddd99a5

Browse files
authored
Merge pull request #21 from Keyfactor/release-2.0
Release 2.0.2
2 parents 3858004 + eb751f6 commit ddd99a5

File tree

6 files changed

+40
-25
lines changed

6 files changed

+40
-25
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2.0.2
2+
* Return parity to original AWS store type organization - differentiating based on AWS Account ID
3+
14
2.0.1
25
* Remove logging of sensitive data
36
* Update Private Key to required for certificates in this store in docs and store definition

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Options for authenticating:
131131
2. IAM User Auth configuration (refer to `AwsCerManA` below)
132132
3. EC2 Role Auth or other default method supported by the [AWS SDK](https://docs.aws.amazon.com/sdk-for-net/v3/developer-guide/creds-assign.html)
133133

134-
As one option for #3, to set up Role Auth for an EC2 instance, follow the steps below. Note, this applies specifically __when the orchestrator is running `ACM-AWS` inside of an EC2 instance__.
134+
As one option for #3, to set up Role Auth for an EC2 instance, follow the steps below. Note, this applies specifically __when the orchestrator is running `ACM-AWS` inside of an EC2 instance__. Additionally, the EC2 credentials do not use the AWS Account ID specified in the certificate store and only use the single account/role indicated by the EC2 settings.
135135
1. Assign or note the existing IAM Role assigned to the EC2 instance running
136136
2. Make sure that role has access to ACM
137137
3. When configuring the `AWS-ACM` store, do not select either IAM or OAuth methods in the store's settings. This will make it use the AWS SDK to lookup EC2 credentials.
@@ -178,8 +178,8 @@ UseIAM | Use IAM User Auth | boolean | False | N/A | Yes | A switch to enable th
178178
OAuthScope | OAuth Scope | string | N/A | Use OAuth 2.0 Provider | No | This is the OAuth Scope needed for Okta OAuth, defined in Okta
179179
OAuthGrantType | OAuth Grant Type | string | client_credentials | Use OAuth 2.0 Provider | No | In OAuth 2.0, the term “grant type” refers to the way an application gets an access token. In Okta this is `client_credentials`
180180
OAuthUrl | OAuth URL | string | https://***/oauth2/default/v1/token | Use OAuth 2.0 Provider | No | The URL to request a token from your OAuth Provider. Fill this out with the correct URL.
181-
OAuthAccountId | OAuth AWS Account Id | string | N/A | Use OAuth 2.0 Provider | No | The AWS account ID to use after getting an OAuth token to assume the associated Role.
182-
IamAccountId | IAM AWS Account ID | string | N/A | Use IAM User Auth | No | The AWS account ID to use when assuming a role as the IAM User.
181+
OAuthAssumeRole | AWS Role to Assume (OAuth) | string | N/A | Use OAuth 2.0 Provider | No | The AWS Role to assume after getting an OAuth token.
182+
IAMAssumeRole | AWS Role to Assume (IAM) | string | N/A | Use IAM User Auth | No | The AWS Role to assume as the IAM User.
183183

184184

185185
**Entry Parameters:**
@@ -200,7 +200,7 @@ Cert Store Settings
200200
===============
201201
| Name | Value | Description |
202202
| ----------- | ----------- | ----------- |
203-
| Client Machine | AWS Role | This is the AWS Role that will be used for access. This role will be assumed and its permissions will apply to all actions taken by the orchestrator. |
203+
| Client Machine | AWS Account ID | This is the AWS Account ID that will be used for access. This will dictate what certificates are usable by the orchestrator. Note: this does not have any effect on EC2 inferred credentials, which are limited to a specific role/account. |
204204
| User Name | See Below | See Below |
205205
| Password | See Below | See Below |
206206
| Store Path | us-east-1,us-east-2,...,etc. | The AWS Region, or a comma-separated list of multiple regions, the store will operate in. |
@@ -209,8 +209,8 @@ Cert Store Settings
209209
| OAuth Scope | Look in OAuth provider for Scope | Displayed and required when using OAuth 2.0 Provider. OAuth scope setup in the Okta Application or other OAuth provider |
210210
| OAuth Grant Type | client_credentials | Displayed and required when using OAuth 2.0 Provider. This may vary depending on Okta setup but will most likely be this value. |
211211
| OAuth URL | https://***/oauth2/default/v1/token | Displayed and required when using OAuth 2.0 Provider. URL to request token from OAuth provider. Example given is for an Okta token. |
212-
| OAuth AWS Account Id | AWS account ID number | Displayed and required when using OAuth 2.0 Provider. This account ID is used in conjunction with the OAuth token to assume a role (set in the Client Machine parameter) |
213-
| IAM AWS Account Id | AWS account ID number | Displayed and required when using IAM User Auth. This account ID is used to assume a role (set in the Client Machine parameter) |
212+
| AWS Role to Assume (OAuth) | AWS Role | Displayed and required when using OAuth 2.0 Provider. This Role is assumed after getting an OAuth token. |
213+
| AWS Role to Assume (IAM) | AWS Role | Displayed and required when using IAM User Auth. This Role is assumed with the IAM credentials. |
214214

215215
The User Name and Password fields are used differently based on the auth method you intend to use. The three options for auth are IAM User, OAuth, or default auth.
216216

aws-orchestrator-core/AuthUtilities.cs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,26 @@ public Credentials GetCredentials(ACMCustomFields customFields, JobConfiguration
4545
{
4646
_logger.MethodEntry();
4747
_logger.LogDebug("Selecting credential method.");
48-
string awsRole = certStore.ClientMachine;
49-
_logger.LogDebug($"Using AWS Role - {awsRole} - from the ClientMachine field");
48+
49+
string awsAccountId = certStore.ClientMachine;
50+
5051
if (customFields.UseIAM)
5152
{
5253
_logger.LogInformation("Using IAM User authentication method for creating AWS Credentials.");
5354
var accessKey = ResolvePamField(jobConfiguration.ServerUsername, "ServerUsername (IAM AccessKey)");
5455
var accessSecret = ResolvePamField(jobConfiguration.ServerPassword, "ServerPassword (IAM AccessSecret)");
5556

57+
string awsRole = customFields.IAMAssumeRole;
58+
_logger.LogDebug($"Assuming AWS Role - {awsRole}");
59+
60+
_logger.LogDebug($"Using AWS Account ID - {awsAccountId} - from the ClientMachine field");
61+
5662
_logger.LogTrace("Attempting to authenticate with AWS using IAM access credentials.");
57-
return AwsAuthenticate(accessKey, accessSecret, customFields.IamAccountId, awsRole);
63+
return AwsAuthenticate(accessKey, accessSecret, awsAccountId, awsRole);
5864
}
5965
else if (customFields.UseOAuth)
6066
{
61-
_logger.LogInformation("Using OAuth authenticaiton method for creating AWS Credentials.");
67+
_logger.LogInformation("Using OAuth authentication method for creating AWS Credentials.");
6268
var clientId = ResolvePamField(jobConfiguration.ServerUsername, "ServerUsername (OAuth Client ID)");
6369
var clientSecret = ResolvePamField(jobConfiguration.ServerPassword, "ServerPassword (OAuth Client Secret)");
6470
OAuthParameters oauthParams = new OAuthParameters()
@@ -74,12 +80,18 @@ public Credentials GetCredentials(ACMCustomFields customFields, JobConfiguration
7480
OAuthResponse authResponse = OAuthAuthenticate(oauthParams);
7581
_logger.LogTrace("Received OAuth response.");
7682

83+
string awsRole = customFields.OAuthAssumeRole;
84+
_logger.LogDebug($"Assuming AWS Role - {awsRole}");
85+
86+
_logger.LogDebug($"Using AWS Account ID - {awsAccountId} - from the ClientMachine field");
87+
7788
_logger.LogTrace("Attempting to authenticate with AWS using OAuth response.");
78-
return AwsAuthenticateWithWebIdentity(authResponse, customFields.OAuthAccountId, awsRole);
89+
return AwsAuthenticateWithWebIdentity(authResponse, awsAccountId, awsRole);
7990
}
8091
else // use default SDK credential resolution
8192
{
8293
_logger.LogInformation("Using default AWS SDK credential resolution for creating AWS Credentials.");
94+
_logger.LogDebug($"Default Role and Account ID will be used. Specified AWS Account ID - {awsAccountId} - will not be used.");
8395
return null;
8496
}
8597
}

aws-orchestrator-core/CustomFields.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ public class ACMCustomFields
5757
[DefaultValue(false)]
5858
public bool UseIAM { get; set; }
5959

60-
[JsonProperty("OAuthAccountId")]
61-
public string OAuthAccountId { get; set; }
60+
[JsonProperty("OAuthAssumeRole")]
61+
public string OAuthAssumeRole { get; set; }
6262

6363
[JsonProperty("OAuthScope")]
6464
public string OAuthScope { get; set; }
@@ -69,7 +69,7 @@ public class ACMCustomFields
6969
[JsonProperty("OAuthUrl")]
7070
public string OAuthUrl { get; set; }
7171

72-
[JsonProperty("IamAccountId")]
73-
public string IamAccountId { get; set; }
72+
[JsonProperty("IAMAssumeRole")]
73+
public string IAMAssumeRole { get; set; }
7474
}
7575
}

integration-manifest.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,16 @@
8686
"Required": false
8787
},
8888
{
89-
"Name": "IamAccountId",
90-
"DisplayName": "IAM AWS Account ID",
89+
"Name": "IAMAssumeRole",
90+
"DisplayName": "AWS Role to Assume (IAM)",
9191
"Type": "String",
9292
"DependsOn": "UseIAM",
9393
"DefaultValue": null,
9494
"Required": false
9595
},
9696
{
97-
"Name": "OAuthAccountId",
98-
"DisplayName": "OAuth AWS Account ID",
97+
"Name": "OAuthAssumeRole",
98+
"DisplayName": "AWS Role to Assume (OAuth)",
9999
"Type": "String",
100100
"DependsOn": "UseOAuth",
101101
"DefaultValue": null,

readme_source.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Options for authenticating:
3232
2. IAM User Auth configuration (refer to `AwsCerManA` below)
3333
3. EC2 Role Auth or other default method supported by the [AWS SDK](https://docs.aws.amazon.com/sdk-for-net/v3/developer-guide/creds-assign.html)
3434

35-
As one option for #3, to set up Role Auth for an EC2 instance, follow the steps below. Note, this applies specifically __when the orchestrator is running `ACM-AWS` inside of an EC2 instance__.
35+
As one option for #3, to set up Role Auth for an EC2 instance, follow the steps below. Note, this applies specifically __when the orchestrator is running `ACM-AWS` inside of an EC2 instance__. Additionally, the EC2 credentials do not use the AWS Account ID specified in the certificate store and only use the single account/role indicated by the EC2 settings.
3636
1. Assign or note the existing IAM Role assigned to the EC2 instance running
3737
2. Make sure that role has access to ACM
3838
3. When configuring the `AWS-ACM` store, do not select either IAM or OAuth methods in the store's settings. This will make it use the AWS SDK to lookup EC2 credentials.
@@ -79,8 +79,8 @@ UseIAM | Use IAM User Auth | boolean | False | N/A | Yes | A switch to enable th
7979
OAuthScope | OAuth Scope | string | N/A | Use OAuth 2.0 Provider | No | This is the OAuth Scope needed for Okta OAuth, defined in Okta
8080
OAuthGrantType | OAuth Grant Type | string | client_credentials | Use OAuth 2.0 Provider | No | In OAuth 2.0, the term “grant type” refers to the way an application gets an access token. In Okta this is `client_credentials`
8181
OAuthUrl | OAuth URL | string | https://***/oauth2/default/v1/token | Use OAuth 2.0 Provider | No | The URL to request a token from your OAuth Provider. Fill this out with the correct URL.
82-
OAuthAccountId | OAuth AWS Account Id | string | N/A | Use OAuth 2.0 Provider | No | The AWS account ID to use after getting an OAuth token to assume the associated Role.
83-
IamAccountId | IAM AWS Account ID | string | N/A | Use IAM User Auth | No | The AWS account ID to use when assuming a role as the IAM User.
82+
OAuthAssumeRole | AWS Role to Assume (OAuth) | string | N/A | Use OAuth 2.0 Provider | No | The AWS Role to assume after getting an OAuth token.
83+
IAMAssumeRole | AWS Role to Assume (IAM) | string | N/A | Use IAM User Auth | No | The AWS Role to assume as the IAM User.
8484

8585

8686
**Entry Parameters:**
@@ -101,7 +101,7 @@ Cert Store Settings
101101
===============
102102
| Name | Value | Description |
103103
| ----------- | ----------- | ----------- |
104-
| Client Machine | AWS Role | This is the AWS Role that will be used for access. This role will be assumed and its permissions will apply to all actions taken by the orchestrator. |
104+
| Client Machine | AWS Account ID | This is the AWS Account ID that will be used for access. This will dictate what certificates are usable by the orchestrator. Note: this does not have any effect on EC2 inferred credentials, which are limited to a specific role/account. |
105105
| User Name | See Below | See Below |
106106
| Password | See Below | See Below |
107107
| Store Path | us-east-1,us-east-2,...,etc. | The AWS Region, or a comma-separated list of multiple regions, the store will operate in. |
@@ -110,8 +110,8 @@ Cert Store Settings
110110
| OAuth Scope | Look in OAuth provider for Scope | Displayed and required when using OAuth 2.0 Provider. OAuth scope setup in the Okta Application or other OAuth provider |
111111
| OAuth Grant Type | client_credentials | Displayed and required when using OAuth 2.0 Provider. This may vary depending on Okta setup but will most likely be this value. |
112112
| OAuth URL | https://***/oauth2/default/v1/token | Displayed and required when using OAuth 2.0 Provider. URL to request token from OAuth provider. Example given is for an Okta token. |
113-
| OAuth AWS Account Id | AWS account ID number | Displayed and required when using OAuth 2.0 Provider. This account ID is used in conjunction with the OAuth token to assume a role (set in the Client Machine parameter) |
114-
| IAM AWS Account Id | AWS account ID number | Displayed and required when using IAM User Auth. This account ID is used to assume a role (set in the Client Machine parameter) |
113+
| AWS Role to Assume (OAuth) | AWS Role | Displayed and required when using OAuth 2.0 Provider. This Role is assumed after getting an OAuth token. |
114+
| AWS Role to Assume (IAM) | AWS Role | Displayed and required when using IAM User Auth. This Role is assumed with the IAM credentials. |
115115

116116
The User Name and Password fields are used differently based on the auth method you intend to use. The three options for auth are IAM User, OAuth, or default auth.
117117

0 commit comments

Comments
 (0)