|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * rosa_planning/rosa-sts-ocm-role.adoc |
| 4 | +// * rosa_architecture/rosa-sts-about-iam-resources.adoc |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="rosa-sts-aws-requirements-attaching-boundary-policy_{context}"] |
| 7 | += Permission boundaries for the installer role |
| 8 | + |
| 9 | +You can apply a policy as a _permissions boundary_ on an installer role. |
| 10 | +You can use an AWS-managed policy or a customer-managed policy to set the boundary for an Amazon Web Services(AWS) Identity and Access Management (IAM) entity (user or role). The combination of policy and boundary policy limits the maximum permissions for the user or role. ROSA includes a set of three prepared permission boundary policy files, with which you can restrict permissions for the installer role since changing the installer policy itself is not supported. |
| 11 | + |
| 12 | +[NOTE] |
| 13 | +==== |
| 14 | +This feature is only supported on Red Hat OpenShift Service on AWS (classic architecture) clusters. |
| 15 | +==== |
| 16 | + |
| 17 | +The permission boundary policy files are as follows: |
| 18 | + |
| 19 | +* The _Core_ boundary policy file contains the minimum permissions needed for ROSA (classic architecture) installer to install an {product-title} cluster. |
| 20 | +The installer does not have permissions to create a virtual private cloud (VPC) or PrivateLink (PL). A VPC needs to be provided. |
| 21 | +* The _VPC_ boundary policy file contains the minimum permissions needed for ROSA (classic architecture) installer to create/manage the VPC. It does not include permissions for PL or core installation. If you need to install a cluster with enough permissions for the installer to install the cluster and create/manage the VPC, but you do not need to set up PL, then use the core and VPC boundary files together with the installer role. |
| 22 | +* The _PrivateLink (PL)_ boundary policy file contains the minimum permissions needed for ROSA (classic architecture) installer to create the AWS PL with a cluster. It does not include permissions for VPC or core installation. Provide a pre-created VPC for all PL clusters during installation. |
| 23 | +
|
| 24 | +When using the permission boundary policy files, the following combinations apply: |
| 25 | + |
| 26 | +* No permission boundary policies means that the full installer policy permissions apply to your cluster. |
| 27 | +* *Core* only sets the most restricted permissions for the installer role. The VPC and PL permissions are not included in the *Core only* boundary policy. |
| 28 | +** Installer cannot create or manage the VPC or PL. |
| 29 | +** You must have a customer-provided VPC, and PrivateLink (PL) is not available. |
| 30 | +* *Core + VPC* sets the core and VPC permissions for the installer role. |
| 31 | +** Installer cannot create or manage the PL. |
| 32 | +** Assumes you are not using custom/BYO-VPC. |
| 33 | +** Assumes the installer will create and manage the VPC. |
| 34 | +* *Core + PrivateLink (PL)* means the installer can provision the PL infrastructure. |
| 35 | +** You must have a customer-provided VPC. |
| 36 | +** This is for a private cluster with PL. |
| 37 | +
|
| 38 | +This example procedure is applicable for an installer role and policy with the most restriction of permissions, using only the _core_ installer permission boundary policy for ROSA. You can complete this with the AWS console or the AWS CLI. This example uses the AWS CLI and the following policy: |
| 39 | + |
| 40 | +.`sts_installer_core_permission_boundary_policy.json` |
| 41 | +[%collapsible] |
| 42 | +==== |
| 43 | +[source,json] |
| 44 | +---- |
| 45 | +{ |
| 46 | + "Version": "2012-10-17", |
| 47 | + "Statement": [ |
| 48 | + { |
| 49 | + "Effect": "Allow", |
| 50 | + "Action": [ |
| 51 | + "autoscaling:DescribeAutoScalingGroups", |
| 52 | + "ec2:AllocateAddress", |
| 53 | + "ec2:AssociateAddress", |
| 54 | + "ec2:AttachNetworkInterface", |
| 55 | + "ec2:AuthorizeSecurityGroupEgress", |
| 56 | + "ec2:AuthorizeSecurityGroupIngress", |
| 57 | + "ec2:CopyImage", |
| 58 | + "ec2:CreateNetworkInterface", |
| 59 | + "ec2:CreateSecurityGroup", |
| 60 | + "ec2:CreateTags", |
| 61 | + "ec2:CreateVolume", |
| 62 | + "ec2:DeleteNetworkInterface", |
| 63 | + "ec2:DeleteSecurityGroup", |
| 64 | + "ec2:DeleteSnapshot", |
| 65 | + "ec2:DeleteTags", |
| 66 | + "ec2:DeleteVolume", |
| 67 | + "ec2:DeregisterImage", |
| 68 | + "ec2:DescribeAccountAttributes", |
| 69 | + "ec2:DescribeAddresses", |
| 70 | + "ec2:DescribeAvailabilityZones", |
| 71 | + "ec2:DescribeDhcpOptions", |
| 72 | + "ec2:DescribeImages", |
| 73 | + "ec2:DescribeInstanceAttribute", |
| 74 | + "ec2:DescribeInstanceCreditSpecifications", |
| 75 | + "ec2:DescribeInstances", |
| 76 | + "ec2:DescribeInstanceStatus", |
| 77 | + "ec2:DescribeInstanceTypeOfferings", |
| 78 | + "ec2:DescribeInstanceTypes", |
| 79 | + "ec2:DescribeInternetGateways", |
| 80 | + "ec2:DescribeKeyPairs", |
| 81 | + "ec2:DescribeNatGateways", |
| 82 | + "ec2:DescribeNetworkAcls", |
| 83 | + "ec2:DescribeNetworkInterfaces", |
| 84 | + "ec2:DescribePrefixLists", |
| 85 | + "ec2:DescribeRegions", |
| 86 | + "ec2:DescribeReservedInstancesOfferings", |
| 87 | + "ec2:DescribeRouteTables", |
| 88 | + "ec2:DescribeSecurityGroups", |
| 89 | + "ec2:DescribeSecurityGroupRules", |
| 90 | + "ec2:DescribeSubnets", |
| 91 | + "ec2:DescribeTags", |
| 92 | + "ec2:DescribeVolumes", |
| 93 | + "ec2:DescribeVpcAttribute", |
| 94 | + "ec2:DescribeVpcClassicLink", |
| 95 | + "ec2:DescribeVpcClassicLinkDnsSupport", |
| 96 | + "ec2:DescribeVpcEndpoints", |
| 97 | + "ec2:DescribeVpcs", |
| 98 | + "ec2:GetConsoleOutput", |
| 99 | + "ec2:GetEbsDefaultKmsKeyId", |
| 100 | + "ec2:ModifyInstanceAttribute", |
| 101 | + "ec2:ModifyNetworkInterfaceAttribute", |
| 102 | + "ec2:ReleaseAddress", |
| 103 | + "ec2:RevokeSecurityGroupEgress", |
| 104 | + "ec2:RevokeSecurityGroupIngress", |
| 105 | + "ec2:RunInstances", |
| 106 | + "ec2:StartInstances", |
| 107 | + "ec2:StopInstances", |
| 108 | + "ec2:TerminateInstances", |
| 109 | + "elasticloadbalancing:AddTags", |
| 110 | + "elasticloadbalancing:ApplySecurityGroupsToLoadBalancer", |
| 111 | + "elasticloadbalancing:AttachLoadBalancerToSubnets", |
| 112 | + "elasticloadbalancing:ConfigureHealthCheck", |
| 113 | + "elasticloadbalancing:CreateListener", |
| 114 | + "elasticloadbalancing:CreateLoadBalancer", |
| 115 | + "elasticloadbalancing:CreateLoadBalancerListeners", |
| 116 | + "elasticloadbalancing:CreateTargetGroup", |
| 117 | + "elasticloadbalancing:DeleteLoadBalancer", |
| 118 | + "elasticloadbalancing:DeleteTargetGroup", |
| 119 | + "elasticloadbalancing:DeregisterInstancesFromLoadBalancer", |
| 120 | + "elasticloadbalancing:DeregisterTargets", |
| 121 | + "elasticloadbalancing:DescribeInstanceHealth", |
| 122 | + "elasticloadbalancing:DescribeListeners", |
| 123 | + "elasticloadbalancing:DescribeLoadBalancerAttributes", |
| 124 | + "elasticloadbalancing:DescribeLoadBalancers", |
| 125 | + "elasticloadbalancing:DescribeTags", |
| 126 | + "elasticloadbalancing:DescribeTargetGroupAttributes", |
| 127 | + "elasticloadbalancing:DescribeTargetGroups", |
| 128 | + "elasticloadbalancing:DescribeTargetHealth", |
| 129 | + "elasticloadbalancing:ModifyLoadBalancerAttributes", |
| 130 | + "elasticloadbalancing:ModifyTargetGroup", |
| 131 | + "elasticloadbalancing:ModifyTargetGroupAttributes", |
| 132 | + "elasticloadbalancing:RegisterInstancesWithLoadBalancer", |
| 133 | + "elasticloadbalancing:RegisterTargets", |
| 134 | + "elasticloadbalancing:SetLoadBalancerPoliciesOfListener", |
| 135 | + "iam:AddRoleToInstanceProfile", |
| 136 | + "iam:CreateInstanceProfile", |
| 137 | + "iam:DeleteInstanceProfile", |
| 138 | + "iam:GetInstanceProfile", |
| 139 | + "iam:TagInstanceProfile", |
| 140 | + "iam:GetRole", |
| 141 | + "iam:GetRolePolicy", |
| 142 | + "iam:GetUser", |
| 143 | + "iam:ListAttachedRolePolicies", |
| 144 | + "iam:ListInstanceProfiles", |
| 145 | + "iam:ListInstanceProfilesForRole", |
| 146 | + "iam:ListRolePolicies", |
| 147 | + "iam:ListRoles", |
| 148 | + "iam:ListUserPolicies", |
| 149 | + "iam:ListUsers", |
| 150 | + "iam:PassRole", |
| 151 | + "iam:RemoveRoleFromInstanceProfile", |
| 152 | + "iam:SimulatePrincipalPolicy", |
| 153 | + "iam:TagRole", |
| 154 | + "iam:UntagRole", |
| 155 | + "route53:ChangeResourceRecordSets", |
| 156 | + "route53:ChangeTagsForResource", |
| 157 | + "route53:CreateHostedZone", |
| 158 | + "route53:DeleteHostedZone", |
| 159 | + "route53:GetAccountLimit", |
| 160 | + "route53:GetChange", |
| 161 | + "route53:GetHostedZone", |
| 162 | + "route53:ListHostedZones", |
| 163 | + "route53:ListHostedZonesByName", |
| 164 | + "route53:ListResourceRecordSets", |
| 165 | + "route53:ListTagsForResource", |
| 166 | + "route53:UpdateHostedZoneComment", |
| 167 | + "s3:CreateBucket", |
| 168 | + "s3:DeleteBucket", |
| 169 | + "s3:DeleteObject", |
| 170 | + "s3:GetAccelerateConfiguration", |
| 171 | + "s3:GetBucketAcl", |
| 172 | + "s3:GetBucketCORS", |
| 173 | + "s3:GetBucketLocation", |
| 174 | + "s3:GetBucketLogging", |
| 175 | + "s3:GetBucketObjectLockConfiguration", |
| 176 | + "s3:GetBucketPolicy", |
| 177 | + "s3:GetBucketRequestPayment", |
| 178 | + "s3:GetBucketTagging", |
| 179 | + "s3:GetBucketVersioning", |
| 180 | + "s3:GetBucketWebsite", |
| 181 | + "s3:GetEncryptionConfiguration", |
| 182 | + "s3:GetLifecycleConfiguration", |
| 183 | + "s3:GetObject", |
| 184 | + "s3:GetObjectAcl", |
| 185 | + "s3:GetObjectTagging", |
| 186 | + "s3:GetObjectVersion", |
| 187 | + "s3:GetReplicationConfiguration", |
| 188 | + "s3:ListBucket", |
| 189 | + "s3:ListBucketVersions", |
| 190 | + "s3:PutBucketAcl", |
| 191 | + "s3:PutBucketTagging", |
| 192 | + "s3:PutEncryptionConfiguration", |
| 193 | + "s3:PutObject", |
| 194 | + "s3:PutObjectAcl", |
| 195 | + "s3:PutObjectTagging", |
| 196 | + "servicequotas:GetServiceQuota", |
| 197 | + "servicequotas:ListAWSDefaultServiceQuotas", |
| 198 | + "sts:AssumeRole", |
| 199 | + "sts:AssumeRoleWithWebIdentity", |
| 200 | + "sts:GetCallerIdentity", |
| 201 | + "tag:GetResources", |
| 202 | + "tag:UntagResources", |
| 203 | + "kms:DescribeKey", |
| 204 | + "cloudwatch:GetMetricData", |
| 205 | + "ec2:CreateRoute", |
| 206 | + "ec2:DeleteRoute", |
| 207 | + "ec2:CreateVpcEndpoint", |
| 208 | + "ec2:DeleteVpcEndpoints", |
| 209 | + "ec2:CreateVpcEndpointServiceConfiguration", |
| 210 | + "ec2:DeleteVpcEndpointServiceConfigurations", |
| 211 | + "ec2:DescribeVpcEndpointServiceConfigurations", |
| 212 | + "ec2:DescribeVpcEndpointServicePermissions", |
| 213 | + "ec2:DescribeVpcEndpointServices", |
| 214 | + "ec2:ModifyVpcEndpointServicePermissions" |
| 215 | + ], |
| 216 | + "Resource": "*" |
| 217 | + }, |
| 218 | + { |
| 219 | + "Effect": "Allow", |
| 220 | + "Action": [ |
| 221 | + "secretsmanager:GetSecretValue" |
| 222 | + ], |
| 223 | + "Resource": "*", |
| 224 | + "Condition": { |
| 225 | + "StringEquals": { |
| 226 | + "aws:ResourceTag/red-hat-managed": "true" |
| 227 | + } |
| 228 | + } |
| 229 | + } |
| 230 | + ] |
| 231 | +} |
| 232 | +---- |
| 233 | +==== |
| 234 | +
|
| 235 | +[IMPORTANT] |
| 236 | +==== |
| 237 | +To use the permission boundaries, you will need to prepare the permission boundary policy and add it to your relevant installer role in AWS IAM. |
| 238 | +While the ROSA (`rosa`) CLI offers a permission boundary function, it applies to all roles and not just the installer role, which means it does not work with the provided permission boundary policies (which are only for the installer role). |
| 239 | +==== |
| 240 | + |
| 241 | +.Prerequisites |
| 242 | + |
| 243 | +* You have an AWS account. |
| 244 | +* You have the permissions required to administer AWS roles and policies. |
| 245 | +* You have installed and configured the latest AWS (`aws`) and ROSA (`rosa`) CLIs on your workstation. |
| 246 | +* You have already prepared your ROSA account-wide roles, includes the installer role, and the corresponding policies. If these do not exist in your AWS account, see "Creating the account-wide STS roles and policies" in _Additional resources_. |
| 247 | +
|
| 248 | +.Procedure |
| 249 | + |
| 250 | +. Prepare the policy file by entering the following command in the `rosa` CLI: |
| 251 | ++ |
| 252 | +[source,terminal] |
| 253 | +---- |
| 254 | +$ curl -o ./rosa-installer-core.json https://raw.githubusercontent.com/openshift/managed-cluster-config/master/resources/sts/4.16/sts_installer_core_permission_boundary_policy.json |
| 255 | +---- |
| 256 | + |
| 257 | +. Create the policy in AWS and gather its Amazon Resource Name (ARN) by entering the following command: |
| 258 | ++ |
| 259 | +[source,terminal] |
| 260 | +---- |
| 261 | +$ aws iam create-policy \ |
| 262 | +--policy-name rosa-core-permissions-boundary-policy \ |
| 263 | +--policy-document file://./rosa-installer-core.json \ |
| 264 | +--description "ROSA installer core permission boundary policy, the minimum permission set, allows BYO-VPC, disallows PrivateLink" |
| 265 | +---- |
| 266 | ++ |
| 267 | +.Example output |
| 268 | +[source,terminal] |
| 269 | +---- |
| 270 | +{ |
| 271 | + "Policy": { |
| 272 | + "PolicyName": "rosa-core-permissions-boundary-policy", |
| 273 | + "PolicyId": "<Policy ID>", |
| 274 | + "Arn": "arn:aws:iam::<account ID>:policy/rosa-core-permissions-boundary-policy", |
| 275 | + "Path": "/", |
| 276 | + "DefaultVersionId": "v1", |
| 277 | + "AttachmentCount": 0, |
| 278 | + "PermissionsBoundaryUsageCount": 0, |
| 279 | + "IsAttachable": true, |
| 280 | + "CreateDate": "<CreateDate>", |
| 281 | + "UpdateDate": "<UpdateDate>" |
| 282 | + } |
| 283 | +} |
| 284 | +---- |
| 285 | +. Add the permission boundary policy to the installer role you want to restrict by entering the following command: |
| 286 | ++ |
| 287 | +[source,terminal] |
| 288 | +---- |
| 289 | +$ aws iam put-role-permissions-boundary \ |
| 290 | +--role-name ManagedOpenShift-Installer-Role \ |
| 291 | +--permissions-boundary arn:aws:iam::<account ID>:policy/rosa-core-permissions-boundary-policy |
| 292 | +---- |
| 293 | + |
| 294 | +. Display the installer role to validate attached policies (including permissions boundary) by entering the following command in the `rosa` CLI: |
| 295 | ++ |
| 296 | +[source,terminal] |
| 297 | +---- |
| 298 | +$ aws iam get-role --role-name ManagedOpenShift-Installer-Role \ |
| 299 | +--output text | grep PERMISSIONSBOUNDARY |
| 300 | +---- |
| 301 | ++ |
| 302 | +.Example output |
| 303 | +[source,terminal] |
| 304 | +---- |
| 305 | +PERMISSIONSBOUNDARY arn:aws:iam::<account ID>:policy/rosa-core-permissions-boundary-policy Policy |
| 306 | +---- |
| 307 | ++ |
| 308 | +
|
| 309 | ++ |
| 310 | +For more examples of PL and VPC permission boundary policies see: |
| 311 | ++ |
| 312 | +.`sts_installer_privatelink_permission_boundary_policy.json` |
| 313 | +[%collapsible] |
| 314 | +==== |
| 315 | +[source,json] |
| 316 | +---- |
| 317 | +{ |
| 318 | +"Version": "2012-10-17", |
| 319 | + "Statement": [ |
| 320 | + { |
| 321 | + "Effect": "Allow", |
| 322 | + "Action": [ |
| 323 | + "ec2:ModifyVpcEndpointServiceConfiguration", |
| 324 | + "route53:ListHostedZonesByVPC", |
| 325 | + "route53:CreateVPCAssociationAuthorization", |
| 326 | + "route53:AssociateVPCWithHostedZone", |
| 327 | + "route53:DeleteVPCAssociationAuthorization", |
| 328 | + "route53:DisassociateVPCFromHostedZone", |
| 329 | + "route53:ChangeResourceRecordSets" |
| 330 | + ], |
| 331 | + "Resource": "*" |
| 332 | + } |
| 333 | + ] |
| 334 | +} |
| 335 | +---- |
| 336 | +==== |
| 337 | ++ |
| 338 | +.`sts_installer_vpc_permission_boundary_policy.json` |
| 339 | +[%collapsible] |
| 340 | +==== |
| 341 | +[source,json] |
| 342 | +---- |
| 343 | +{ |
| 344 | + "Version": "2012-10-17", |
| 345 | + "Statement": [ |
| 346 | + { |
| 347 | + "Effect": "Allow", |
| 348 | + "Action": [ |
| 349 | + "ec2:AssociateDhcpOptions", |
| 350 | + "ec2:AssociateRouteTable", |
| 351 | + "ec2:AttachInternetGateway", |
| 352 | + "ec2:CreateDhcpOptions", |
| 353 | + "ec2:CreateInternetGateway", |
| 354 | + "ec2:CreateNatGateway", |
| 355 | + "ec2:CreateRouteTable", |
| 356 | + "ec2:CreateSubnet", |
| 357 | + "ec2:CreateVpc", |
| 358 | + "ec2:DeleteDhcpOptions", |
| 359 | + "ec2:DeleteInternetGateway", |
| 360 | + "ec2:DeleteNatGateway", |
| 361 | + "ec2:DeleteRouteTable", |
| 362 | + "ec2:DeleteSubnet", |
| 363 | + "ec2:DeleteVpc", |
| 364 | + "ec2:DetachInternetGateway", |
| 365 | + "ec2:DisassociateRouteTable", |
| 366 | + "ec2:ModifySubnetAttribute", |
| 367 | + "ec2:ModifyVpcAttribute", |
| 368 | + "ec2:ReplaceRouteTableAssociation" |
| 369 | + ], |
| 370 | + "Resource": "*" |
| 371 | + } |
| 372 | + ] |
| 373 | +} |
| 374 | +---- |
| 375 | +==== |
0 commit comments