SettingsForRoleArn
Configuration for role_arn parameter in the cloudwatch_logs input plug-in
For input plug-ins like cloudwatch_logs, the AWS credentials are required to access the AWS endpoint for cloudwatch_logs log_group. However, instead of using the AWS access_key and secret_key, using the role_arn setting can be preferable.
Note:
These settings can be used only when the Guardium Data Protection is hosted on AWS.
Configuration for IAM Role when the Guardium Data Protection and the Database to be monitored are in the same AWS account
Configuration:
- Log in to your IAM console (https://console.aws.amazon.com/iam/)
- Click the
Rolestab underAccess Management - Click the
Create Rolebutton - For
Trusted Entity Type, select AWS Service - For
Use case, select EC2 - Click
Next - Steps to set the Permissions Policies
- Search CloudWatchLogsReadOnlyAccess and select it
- Click
Next - Enter the role name
- Click
Create Role - Search for the created role and open it
- In the
Permissionstab, click theAdd Permissionsbutton and selectCreate Inline Policy - On the
Create Policypage, select JSON editor and add the below policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": [
"arn:aws:iam::<AWS Account>:role/<Role Name>/*",
"arn:aws:iam::<AWS Account>:role/<Role Name>",
"arn:aws:sts::<AWS Account>:assumed-role/<Role Name>/*",
"arn:aws:sts::<AWS Account>:assumed-role/<Role Name>/<EC2 Instance Id>"
]
}]
}
- Click
Review Policy - Enter the policy Name and click
Create Policy - In order to restrict access to a particular log group only, perform below steps else move to Step 21
- In the
Permissionstab, click theAdd Permissionsbutton and selectCreate Inline Policy - On the
Create Policypage, select JSON editor and add the below policy
{
"Version": "2012-10-17",
"Statement": {
"Effect": "Deny",
"NotAction": "logs:DescribeLogGroups",
"NotResource": [
"arn:aws:logs:<AWS log group Region>:<AWS Account>:log-group:<log_group name>:*"
]
}
}
- Click
Review Policy - Enter the policy Name and click
Create Policy - Select the role created above
- Click the
Trust relationshipstab and clickEdit trust policy - Add the below statement in the trust policy and click
Update Policy
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<AWS Account>:role/<Role Name>"
},
"Action": "sts:AssumeRole"
}
- Set the role to the EC2 machine hosting Guardium
- Go to the EC2 machine hosting Guardium
- Right click on the EC2 instance, select the Security Option, and modify the IAM role
- Set the role that was created above
Configuration for IAM Role when the Guardium Data Protection and the Database to be monitored are in different AWS accounts
Prerequisites:
- AWS Account1 where IBM Guardium is hosted on EC2 instance. For simplicity consider this as Account with Account ID 111111
- AWS Account2 where RDS is present. For simplicity consider this as Account with Account ID 222222
- Log group in the Account2 where RDS logs are logged. For simplicity consider test-log-group is the log group that is logging the logs in the region us-east-1
Steps to create Roles:
- Log in to your IAM console (https://console.aws.amazon.com/iam/) of first AWS Account where IBM Guardium is hosted for e.g., with Account ID 111111
- Click the
Rolestab underAccess Management - Click the
Create Rolebutton - For
Trusted Entity Type, select AWS Service - For
Use case, select EC2 - Click
Next - Enter the role name e.g., role_on_111111
- Click
Create Role - Repeat steps fom 1 to 10 on second AWS Account i.e., with Account ID 222222 and create a role with name for e.g., role_on_222222
Steps to add Permissions and Policies to the Role created on the Account that has Guardium EC2:
- Log in back to the first AWS Account.
- Search for the created role i.e., role_on_111111 and open it
- In the
Permissionstab, click theAdd Permissionsbutton and selectCreate Inline Policy - On the
Create Policypage, select JSON editor and add the below policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": ["arn:aws:iam::<AccountID_of_RDS>:role/<Role_In_Second_Account>"]
}
]
}
e.g.,
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": [
"arn:aws:iam::222222:role/role_on_222222"
]
}]
}
- Click
Review Policy - Enter the policy Name and click
Create Policy - The role named role_on_111111 is edited with the above inline policy.
Steps to add Permissions and Policies to the Role created on the Account that has the RDS:
- Log in to the Second AWS Account with account id 222222
- Search for the created role i.e., role_on_222222 and open it
- Steps to set the Permissions Policies, to allow read permissions to CloudWatchLogs
- Search CloudWatchLogsReadOnlyAccess and select it
- In the
Permissionstab, click theAdd Permissionsbutton and selectCreate Inline Policy - Here you can add policy to eliminate access except for the one log group e.g., test-log-group.
- On the
Create Policypage, select JSON editor and add the below policy
Inline policy –
{
"Version": "2012-10-17",
"Statement": {
"Effect": "Deny",
"NotAction": "logs:DescribeLogGroups",
"NotResource": [
"arn:aws:logs:<Region_of_Database>:<Account_Id_Of_RDS>:log-group:<log_group_to_be_monitored>:*"]
}
}
e.g., Inline policy –
{
"Version": "2012-10-17",
"Statement": {
"Effect": "Deny",
"NotAction": "logs:DescribeLogGroups",
"NotResource": [
"arn:aws:logs:us-east-1:222222:log-group:test-log-group:*"
]
}
}
- Select the role created above
- Click the
Trust relationshipstab and clickEdit trust policy - Add the below statement in the trust policy and click
Update Policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<Account_Id_of_Guardium_EC2>:role/<Role_In_First_Account>"
},
"Action": "sts:AssumeRole"
}]
}
e.g.,
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111111:role/role_on_111111"
},
"Action": "sts:AssumeRole"
}]
}
- Set the role created on first AWS Account i.e., role_on_111111 to the EC2 machine hosting Guardium
- Go to the EC2 machine hosting Guardium
- Right click on the EC2 instance, select the Security Option, and modify the IAM role
- Set the role that was created above
Configuring input plugin on Guardium:
Configuration:
Update the input section to add the details from the corresponding file's input part, omitting the keyword "input{" at the beginning and its corresponding "}" at the end.
The sample configuration looks like:
input {
cloudwatch_logs {
#Mandatory arguments:
#Insert the log group that is created for the data instance
#Example of log group for AWS postgres RDS, /aws/rds/instance/<instance_name>/postgresql i.e., ["/aws/rds/instance/database-1/postgresql"]
#Example of log group for Aurora Postgres, /aws/rds/cluster/<instance_name>/postgresql i.e., ["/aws/rds/cluster/aurorapostgres/postgresql"]
log_group => ["<LOG_GROUP>"] #e.g., ["/aws/rds/instance/database-1/postgresql"]
start_position => "end"
#Insert the role_arn of the role that is created in RDS account.
role_arn => "<ROLE_ARN_ON_RDS_ACCOUNT>" #e.g., "arn:aws:iam::222222:role/role_on_222222"
region => "<REGION>" #Region that has the DB, Default value: us-east-1
interval => 2
event_filter => ""
type => "<TYPE>" #e.g., Postgres
#Insert the account id of the AWS account
add_field => {"account_id" => "<ACCOUNT_ID>"}
#Add the below parameter with default value logstash
role_session_name => "logstash"
}
}