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

oidc provider for prod users #10078

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified DataConnectors/AWS-S3/ConfigAwsS3DataConnectorScripts.zip
Binary file not shown.
Binary file modified DataConnectors/AWS-S3/ConfigAwsS3DataConnectorScriptsGov.zip
Binary file not shown.
4 changes: 1 addition & 3 deletions DataConnectors/AWS-S3/ConfigCloudTrailDataConnector.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,7 @@ Write-Log -Message "This script creates an Assume Role with minimal permissions
Write-ScriptNotes

# Add an Identity Provider
if($CloudEnv -eq "Gov"){
New-OidcProvider
}
New-OidcProvider
New-ArnRole

Write-Log -Message "Executing: aws iam get-role --role-name $roleName" -LogFileName $LogFileName -Severity Verbose
Expand Down
4 changes: 1 addition & 3 deletions DataConnectors/AWS-S3/ConfigCloudWatchDataConnector.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ Write-Log -Message "This script creates an Assume Role with minimal permissions
Write-ScriptNotes

# Add an Identity Provider
if($CloudEnv -eq "Gov"){
New-OidcProvider
}
New-OidcProvider
New-ArnRole
Write-Log -Message "Executing: aws iam get-role --role-name $roleName" -LogFileName $LogFileName -Severity Verbose
$roleArnObject = aws iam get-role --role-name $roleName
Expand Down
4 changes: 1 addition & 3 deletions DataConnectors/AWS-S3/ConfigCustomLogDataConnector.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ Write-Log -Message "This script creates an Assume Role with minimal permissions
Write-ScriptNotes

# Add an Identity Provider
if($CloudEnv -eq "Gov"){
New-OidcProvider
}
New-OidcProvider
New-ArnRole
Write-Log -Message "Executing: aws iam get-role --role-name $roleName" -LogFileName $LogFileName -Severity Verbose
$roleArnObject = aws iam get-role --role-name $roleName
Expand Down
4 changes: 1 addition & 3 deletions DataConnectors/AWS-S3/ConfigGuardDutyDataConnector.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,7 @@ Write-Log -Message "This script creates an Assume Role with minimal permissions
Write-ScriptNotes

# Add an Identity Provider
if($CloudEnv -eq "Gov"){
New-OidcProvider
}
New-OidcProvider
New-ArnRole
Write-Log -Message "Executing: aws iam get-role --role-name $roleName" -LogFileName $LogFileName -Severity Verbose
$roleArnObject = aws iam get-role --role-name $roleName
Expand Down
4 changes: 1 addition & 3 deletions DataConnectors/AWS-S3/ConfigVpcFlowDataConnector.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ Write-Log -Message "This script creates an Assume Role with minimal permissions
Write-ScriptNotes

# Add an Identity Provider
if($CloudEnv -eq "Gov"){
New-OidcProvider
}
New-OidcProvider
# Create new Arn Role
New-ArnRole
Write-Log -Message "Executing: aws iam get-role --role-name $roleName" -LogFileName $LogFileName -Severity Verbose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#$script:AwsCloudResource = 'arn:aws-us-gov'


$script:SentinelClientId = 'api://21f935c0-8092-4b62-a772-5a2afd714569'
$script:SentinelClientId = 'api://1462b192-27f7-4cb9-8523-0f4ecb54b47e'
$script:SentinelTenantId = '33e01921-4d64-4f8c-a055-5bdaffd5e33d'
$script:CloudEnv = 'Com'
$script:AwsCloudResource = 'arn:aws'
16 changes: 5 additions & 11 deletions DataConnectors/AWS-S3/Utils/AwsResourceCreator.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ function New-ArnRole
Set-RetryAction({

$script:roleName = Read-ValidatedHost -Prompt 'Please enter role name. If you have already configured an assume role for Azure Sentinel, use the same role name'
Write-Log -Message "Using role name: $roleName" -LogFileName $LogFileName -Severity Information -Indent 2
$script:roleName = "OIDC_$roleName"
Write-Log -Message "Using role name: $roleName with OIDC prefix because OpenID Connect authentication is being used." -LogFileName $LogFileName -Severity Information -Indent 2

# Determine if this role already exists before continuing
Write-Log "Executing: aws iam get-role --role-name $roleName 2>&1| Out-Null" -LogFileName $LogFileName -Severity Verbose
Expand All @@ -96,16 +97,9 @@ function New-ArnRole
$workspaceId = Read-ValidatedHost -Prompt "Please enter your Azure Sentinel External ID (Workspace ID)"
Write-Log "Using Azure Sentinel Workspace ID: $workspaceId" -LogFileName $LogFileName -Severity Information -Indent 2

if($CloudEnv -eq "Gov")
{

$CustomerAWSAccountId = aws sts get-caller-identity --query "Account" --output text
$rolePolicy = Get-OIDCRoleArnPolicy -WorkspaceId $workspaceId -CustomerAWSAccountId $CustomerAWSAccountId
}
else
{
$rolePolicy = Get-RoleArnPolicy -WorkspaceId $workspaceId
}
$CustomerAWSAccountId = aws sts get-caller-identity --query "Account" --output text
$rolePolicy = Get-OIDCRoleArnPolicy -WorkspaceId $workspaceId -CustomerAWSAccountId $CustomerAWSAccountId
# $rolePolicy = Get-RoleArnPolicy -WorkspaceId $workspaceId

Write-Log "Executing: aws iam create-role --role-name $roleName --assume-role-policy-document $rolePolicy --tags $(Get-SentinelTagInJsonFormat) 2>&1" -LogFileName $LogFileName -Severity Verbose
$tempForOutput = aws iam create-role --role-name $roleName --assume-role-policy-document $rolePolicy --tags [$(Get-SentinelTagInJsonFormat)] 2>&1
Expand Down
Loading