How AWS Security Hub works with IAM
Before you use IAM to manage access to Security Hub, you should understand what IAM features are available to use with Security Hub. To get a high-level view of how Security Hub and other AWS services work with IAM, see AWS Services That Work with IAM in the IAM User Guide.
Topics
Security Hub identity-based policies
With IAM identity-based policies, you can specify allowed or denied actions and resources as well as the conditions under which actions are allowed or denied. Security Hub supports specific actions, resources, and condition keys. To learn about all of the elements that you use in a JSON policy, see IAM JSON Policy Elements Reference in the IAM User Guide.
Actions
Administrators can use AWS JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions.
The Action
element of a JSON policy describes the
actions that you can use to allow or deny access in a policy. Policy
actions usually have the same name as the associated AWS API operation. There are some exceptions, such as permission-only
actions that don't have a matching API operation. There are also some operations that require multiple actions in a policy.
These additional actions are called dependent actions.
Include actions in a policy to grant permissions to perform the associated operation.
Policy actions in Security Hub use the following prefix before the action:
securityhub:
. For example, to grant a user permission to
enable Security Hub using the EnableSecurityHub
API operation, you include the
securityhub:EnableSecurityHub
action in the policy assigned to that
user. Policy statements must include either an Action
or
NotAction
element. Security Hub defines its own set of actions that describe
tasks that you can perform with this service.
To specify multiple actions in a single statement, separate them with commas as follows:
"Action": [ "securityhub:action1", "securityhub:action2"
You can specify multiple actions using wildcards (*). For example, to specify all
actions that begin with the word Get
, include the following
line in your policy:
"Action": "securityhub:Get*"
To see a list of Security Hub actions, see Actions defined by AWS Security Hub in the Service Authorization Reference.
Resources
Administrators can use AWS JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions.
The Resource
JSON policy element specifies the object or objects to which the action applies. Statements must include either a
Resource
or a NotResource
element. As a best practice, specify a resource using its Amazon Resource Name (ARN). You can do this for actions that support a
specific resource type, known as resource-level permissions.
For actions that don't support resource-level permissions, such as listing operations, use a wildcard (*) to indicate that the statement applies to all resources.
"Resource": "*"
For more information about the format of ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces.
To see a list of Security Hub resource types and their ARNs, see Resource types defined by AWS Security Hub in the Service Authorization Reference. To learn with which actions you can specify the ARN of each resource, see Actions defined by AWS Security Hub.
Condition keys
Administrators can use AWS JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions.
The Condition
element (or Condition
block) lets you specify conditions in which a
statement is in effect. The Condition
element is optional. You can create
conditional expressions that use condition
operators, such as equals or less than, to match the condition in the
policy with values in the request.
If you specify multiple Condition
elements in a statement, or
multiple keys in a single Condition
element, AWS evaluates them using
a logical AND
operation. If you specify multiple values for a single
condition key, AWS evaluates the condition using a logical OR
operation. All of the conditions must be met before the statement's permissions are
granted.
You can also use placeholder variables when you specify conditions. For example, you can grant an IAM user permission to access a resource only if it is tagged with their IAM user name. For more information, see IAM policy elements: variables and tags in the IAM User Guide.
AWS supports global condition keys and service-specific condition keys. To see all AWS global condition keys, see AWS global condition context keys in the IAM User Guide.
Security Hub defines its own set of condition keys and also supports using some global condition keys. To see all AWS global condition keys, see AWS Global Condition Context Keys in the IAM User Guide.
Security Hub actions support the securityhub:TargetAccount
condition
key.
To control access to BatchUpdateFindings
, Security Hub supports the
securityhub.ASFFSyntaxPath
condition key. For details about
configuring access to BatchUpdateFindings
, see Configuring access to
BatchUpdateFindings.
To see a list of Security Hub condition keys, see Condition keys for AWS Security Hub in the Service Authorization Reference. To learn with which actions and resources you can use a condition key, see Actions defined by AWS Security Hub.
Security Hub resource-based policies (Not supported)
Security Hub does not support resource-based policies.
Authorization based on Security Hub tags
You can add tags to Security Hub resources or pass tags in a request to Security Hub. To control
access based on tags, you provide tag information in the condition
element of a policy using the
securityhub:ResourceTag/
,
key-name
aws:RequestTag/
, or
key-name
aws:TagKeys
condition keys.
Security Hub IAM roles
An IAM role is an entity within your AWS account that has specific permissions.
Using temporary credentials with Security Hub
You can use temporary credentials to sign in with federation, assume an IAM role, or to assume a cross-account role. You obtain temporary security credentials by calling AWS STS API operations such as AssumeRole or GetFederationToken.
Security Hub supports using temporary credentials.
Service-linked roles
Service-linked roles allow AWS services to access resources in other services to complete an action on your behalf. Service-linked roles appear in your IAM account and are owned by the service. An IAM administrator can view but not edit the permissions for service-linked roles.
Security Hub supports service-linked roles.
Service roles
This feature allows a service to assume a service role on your behalf. This role allows the service to access resources in other services to complete an action on your behalf. Service roles appear in your IAM account and are owned by the account. This means that an IAM administrator can change the permissions for this role. However, doing so might break the functionality of the service.
Security Hub supports service roles.
AWS Security Hub identity-based policy examples
By default, users and roles don't have permission to create or modify Security Hub resources. They also can't perform tasks using the AWS Management Console, AWS CLI, or AWS API. An administrator must create IAM policies that grant users and roles permission to perform specific API operations on the specified resources they need. The administrator must then attach those policies to the users or groups that require those permissions.
To learn how to create an IAM identity-based policy using these example JSON policy documents, see Creating Policies on the JSON Tab in the IAM User Guide.
Topics
Policy best practices
Identity-based policies determine whether someone can create, access, or delete Security Hub resources in your account. These actions can incur costs for your AWS account. When you create or edit identity-based policies, follow these guidelines and recommendations:
-
Get started with AWS managed policies and move toward least-privilege permissions – To get started granting permissions to your users and workloads, use the AWS managed policies that grant permissions for many common use cases. They are available in your AWS account. We recommend that you reduce permissions further by defining AWS customer managed policies that are specific to your use cases. For more information, see AWS managed policies or AWS managed policies for job functions in the IAM User Guide.
-
Apply least-privilege permissions – When you set permissions with IAM policies, grant only the permissions required to perform a task. You do this by defining the actions that can be taken on specific resources under specific conditions, also known as least-privilege permissions. For more information about using IAM to apply permissions, see Policies and permissions in IAM in the IAM User Guide.
-
Use conditions in IAM policies to further restrict access – You can add a condition to your policies to limit access to actions and resources. For example, you can write a policy condition to specify that all requests must be sent using SSL. You can also use conditions to grant access to service actions if they are used through a specific AWS service, such as AWS CloudFormation. For more information, see IAM JSON policy elements: Condition in the IAM User Guide.
-
Use IAM Access Analyzer to validate your IAM policies to ensure secure and functional permissions – IAM Access Analyzer validates new and existing policies so that the policies adhere to the IAM policy language (JSON) and IAM best practices. IAM Access Analyzer provides more than 100 policy checks and actionable recommendations to help you author secure and functional policies. For more information, see IAM Access Analyzer policy validation in the IAM User Guide.
-
Require multi-factor authentication (MFA) – If you have a scenario that requires IAM users or a root user in your AWS account, turn on MFA for additional security. To require MFA when API operations are called, add MFA conditions to your policies. For more information, see Configuring MFA-protected API access in the IAM User Guide.
For more information about best practices in IAM, see Security best practices in IAM in the IAM User Guide.
Using the Security Hub console
To access the AWS Security Hub console, you must have a minimum set of permissions. These permissions must allow you to list and view details about the Security Hub resources in your AWS account. If you create an identity-based policy that is more restrictive than the minimum required permissions, the console won't function as intended for users or roles with that policy.
To ensure that those entities can still use the Security Hub console, also attach the following AWS managed policy to the entities. For more information, see Adding permissions to a user in the IAM User Guide:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "securityhub:*", "Resource": "*" }, { "Effect": "Allow", "Action": "iam:CreateServiceLinkedRole", "Resource": "*", "Condition": { "StringLike": { "iam:AWSServiceName": "securityhub.amazonaws.com" } } } ] }
You don't need to allow minimum console permissions for users that are making calls only to the AWS CLI or the AWS API. Instead, allow access to only the actions that match the API operation that you're trying to perform.
Troubleshooting AWS Security Hub identity and access
Use the following information to help you diagnose and fix common issues that you might encounter when working with Security Hub and IAM.
Topics
I am not authorized to perform an action in Security Hub
If the AWS Management Console tells you that you're not authorized to perform an action, then you must contact your administrator for assistance. Your administrator is the person that provided you with your sign-in credentials.
The following example error occurs when the user mateojackson
tries to use the console to view details about a
widget
but does not have
securityhub:
permissions.GetWidget
User: arn:aws:iam::123456789012:user/mateojackson is not authorized to perform: securityhub:
GetWidget
on resource:my-example-widget
In this case, Mateo asks his administrator to update his policies to allow him
to access the
resource
using the my-example-widget
securityhub:
action.GetWidget
I am not authorized to perform iam:PassRole
If you receive an error that you're not authorized to perform the iam:PassRole
action, your policies must be updated to allow you to pass a role to Security Hub.
Some AWS services allow you to pass an existing role to that service instead of creating a new service role or service-linked role. To do this, you must have permissions to pass the role to the service.
The following example error occurs when an IAM user named marymajor
tries to use the console to perform an action in
Security Hub. However, the action requires the service to have permissions that are granted by a service role. Mary does not have permissions to pass the
role to the service.
User: arn:aws:iam::123456789012:user/
marymajor
is not authorized to perform: iam:PassRole
In this case, Mary's policies must be updated to allow her to perform the iam:PassRole
action.
If you need help, contact your AWS administrator. Your administrator is the person who provided you with your sign-in credentials.
I want programmatic access to Security Hub
Users need programmatic access if they want to interact with AWS outside of the AWS Management Console. The way to grant programmatic access depends on the type of user that's accessing AWS:
-
If you manage identities in IAM Identity Center, the AWS APIs require a profile, and the AWS Command Line Interface requires a profile or an environment variable.
-
If you have IAM users, the AWS APIs and the AWS Command Line Interface require access keys. Whenever possible, create temporary credentials that consist of an access key ID, a secret access key, and a security token that indicates when the credentials expire.
To grant users programmatic access, choose one of the following options.
Which user needs programmatic access? | To | By |
---|---|---|
Workforce identity (Users managed in IAM Identity Center) |
Use short-term credentials to sign programmatic requests to the AWS CLI or AWS APIs (directly or by using the AWS SDKs). |
Following the instructions for the interface that you want to use:
|
IAM | Use short-term credentials to sign programmatic requests to the AWS CLI or AWS APIs (directly or by using the AWS SDKs). | Following the instructions in Using temporary credentials with AWS resources in the IAM User Guide. |
IAM | Use long-term credentials to sign programmatic requests to the AWS CLI or AWS APIs
(directly or by using the AWS SDKs). (Not recommended) |
Following the instructions in Managing access keys for IAM users in the IAM User Guide. |
I'm an administrator and want to allow others to access Security Hub
To provide access, add permissions to your users, groups, or roles:
-
Users and groups in AWS IAM Identity Center (successor to AWS Single Sign-On):
Create a permission set. Follow the instructions in Create a permission set in the AWS IAM Identity Center (successor to AWS Single Sign-On) User Guide.
-
Users managed in IAM through an identity provider:
Create a role for identity federation. Follow the instructions in Creating a role for a third-party identity provider (federation) in the IAM User Guide.
-
IAM users:
-
Create a role that your user can assume. Follow the instructions in Creating a role for an IAM user in the IAM User Guide.
-
(Not recommended) Attach a policy directly to a user or add a user to a user group. Follow the instructions in Adding permissions to a user (console) in the IAM User Guide.
-
I want to allow people outside my AWS account to access my Security Hub resources
You can create a role that users in other accounts or people outside of your organization can use to access your resources. You can specify who is trusted to assume the role. For services that support resource-based policies or access control lists (ACLs), you can use those policies to grant people access to your resources.
To learn more, consult the following:
-
To learn whether Security Hub supports these features, see How AWS Security Hub works with IAM.
-
To learn how to provide access to your resources across AWS accounts that you own, see Providing access to an IAM user in another AWS account that you own in the IAM User Guide.
-
To learn how to provide access to your resources to third-party AWS accounts, see Providing access to AWS accounts owned by third parties in the IAM User Guide.
-
To learn how to provide access through identity federation, see Providing access to externally authenticated users (identity federation) in the IAM User Guide.
-
To learn the difference between using roles and resource-based policies for cross-account access, see How IAM roles differ from resource-based policies in the IAM User Guide.