-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstaller-permissions.yml
371 lines (371 loc) · 12.4 KB
/
installer-permissions.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
Conditions:
PartitionIsUSGovCloud: !Equals [!Ref AWS::Partition, aws-us-gov]
Resources:
InstallerRole:
Type: AWS::IAM::Role
Properties:
RoleName: HotsockInstallerRole
Path: /hotsock/
Description: Allows CloudFormation to manage Hotsock installations with appropriate permissions.
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- !Sub cloudformation.${AWS::URLSuffix}
ManagedPolicyArns:
- !Ref MaximumPermissionsPolicy
- !Ref IAMPermissionsPolicy
Tags:
- Key: hotsock:service
Value: Hotsock
SupportRole:
Type: AWS::IAM::Role
Properties:
RoleName: HotsockSupportRole
Path: /hotsock/
Description: Allows Hotsock support staff to access your account to triage issues upon your request. Access is denied by default with an expired date condition in the assume role trust relationship, which must be set to a date in the future to grant access.
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
AWS:
!If [
PartitionIsUSGovCloud,
arn:aws-us-gov:iam::282774566237:root,
arn:aws:iam::080825576347:root,
]
Condition:
DateLessThanEquals:
aws:CurrentTime: "2024-01-01T00:00:00Z"
ManagedPolicyArns:
- !Ref MaximumPermissionsPolicy
- !Ref IAMPermissionsPolicy
- !Sub arn:${AWS::Partition}:iam::aws:policy/AWSCloudTrail_ReadOnlyAccess
Tags:
- Key: hotsock:service
Value: Hotsock
LicensingRole:
Type: AWS::IAM::Role
Properties:
RoleName: HotsockLicensingRole
Path: /hotsock/
Description: Allows Hotsock to perform licensing operations and collect usage data for installation metering.
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
AWS:
!If [
PartitionIsUSGovCloud,
arn:aws-us-gov:iam::282774566237:root,
arn:aws:iam::080825576347:root,
]
PermissionsBoundary: !Ref MaximumPermissionsPolicy
Policies:
- PolicyName: DescribeOrganization
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action: organizations:DescribeOrganization
Resource: "*"
- PolicyName: CloudWatchApiGatewayMetrics
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- cloudwatch:GetMetricStatistics
- cloudwatch:GetMetricWidgetImage
Resource: "*"
- PolicyName: CloudWatchPutMetricData
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action: cloudwatch:PutMetricData
Resource: "*"
Condition:
StringLike:
cloudwatch:namespace: Hotsock/*
- PolicyName: LicensingABAC
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action: lambda:InvokeFunction
Resource: "*"
Condition:
StringEquals:
aws:ResourceTag/hotsock:licensing: Allow
- Effect: Allow
Action:
- ssm:GetParameter
- ssm:PutParameter
Resource:
- !Sub arn:${AWS::Partition}:ssm:*:${AWS::AccountId}:parameter/hotsock/*
Condition:
StringEquals:
aws:ResourceTag/hotsock:licensing: Allow
- Effect: Allow
Action:
- dynamodb:GetItem
- dynamodb:DeleteItem
- dynamodb:PutItem
- dynamodb:Query
- dynamodb:UpdateItem
- dynamodb:BatchWriteItem
- dynamodb:BatchGetItem
- dynamodb:ConditionCheckItem
Resource: "*"
Condition:
ForAllValues:StringEquals:
dynamodb:LeadingKeys:
- installation
- licensing
StringEquals:
aws:ResourceTag/hotsock:service: Hotsock
Tags:
- Key: hotsock:service
Value: Hotsock
IAMPermissionsPolicy:
Type: AWS::IAM::ManagedPolicy
Properties:
Description: Grants limited IAM access to Hotsock installer and support roles with path and Permissions Boundary requirement
ManagedPolicyName: HotsockIAMPermissions
Path: /hotsock/
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- iam:GenerateCredentialReport
- iam:GenerateServiceLastAccessedDetails
- iam:Get*
- iam:List*
- iam:SimulateCustomPolicy
- iam:SimulatePrincipalPolicy
Resource: "*"
- Effect: Allow
Action:
- iam:CreatePolicy
- iam:CreatePolicyVersion
- iam:DeletePolicy
- iam:DeletePolicyVersion
- iam:DeleteRole
- iam:DeleteRolePolicy
- iam:AttachRolePolicy
- iam:DetachRolePolicy
- iam:PutRolePolicy
- iam:SetDefaultPolicyVersion
- iam:TagRole
- iam:TagPolicy
- iam:UntagRole
- iam:UntagPolicy
- iam:UpdateAssumeRolePolicy
- iam:UpdateRole
- iam:UpdateRoleDescription
- iam:PassRole
Resource:
- !Sub arn:${AWS::Partition}:iam::*:role/hotsock/*
- !Sub arn:${AWS::Partition}:iam::*:policy/hotsock/*
- Effect: Allow
Action:
- iam:CreateRole
- iam:PutRolePermissionsBoundary
Resource: !Sub arn:${AWS::Partition}:iam::*:role/hotsock/*
Condition:
StringEquals:
iam:PermissionsBoundary: !Ref MaximumPermissionsPolicy
- Effect: Deny
Action: iam:DeleteRolePermissionsBoundary
Resource: "*"
Condition:
StringEquals:
iam:PermissionsBoundary: !Ref MaximumPermissionsPolicy
- Effect: Deny
Action:
- iam:CreatePolicyVersion
- iam:DeletePolicy
- iam:DeletePolicyVersion
- iam:SetDefaultPolicyVersion
Resource: !Ref MaximumPermissionsPolicy
MaximumPermissionsPolicy:
Type: AWS::IAM::ManagedPolicy
Properties:
Description: Grants maximum permissions needed for Hotsock
ManagedPolicyName: HotsockMaximumPermissions
Path: /hotsock/
PolicyDocument:
Version: 2012-10-17
Statement:
- Sid: AllowServicesWildcards
Effect: Allow
Action:
- apigateway:*
- appconfig:*
- application-autoscaling:*
- applicationinsights:*
- athena:*
- autoscaling:*
- cloudformation:*
- cloudfront:*
- cloudfront-keyvaluestore:*
- cloudwatch:*
- dax:*
- dsql:*
- dynamodb:*
- ec2:*
- ec2messages:*
- ecr:*
- ecr-public:*
- ecs:*
- elasticache:*
- elasticfilesystem:*
- elasticloadbalancing:*
- events:*
- evidently:*
- execute-api:*
- firehose:*
- health:*
- kinesis:*
- lambda:*
- logs:*
- memorydb:*
- pipes:*
- s3:*
- s3-object-lambda:*
- scheduler:*
- schemas:*
- serverlessrepo:*
- sns:*
- sqs:*
- ssm:*
- states:*
- sts:*
- tag:*
- vpc-lattice:*
- vpc-lattice-svcs:*
- wafv2:*
- xray:*
Resource: "*"
- Sid: DenyReservationPurchases
Effect: Deny
Action:
- dynamodb:PurchaseReservedCapacityOfferings
- ec2:*Reserved*
- ec2:*Reservation*
- ec2:Purchase*
- ec2:RunInstances
- elasticache:PurchaseReservedCacheNodesOffering
- es:PurchaseReserved*
- memorydb:PurchaseReservedNodesOffering
- rds:PurchaseReservedDBInstancesOffering
- redshift:AcceptReservedNodeExchange
- redshift:PurchaseReservedNodeOffering
- savingsplans:*
Resource: "*"
- Sid: AllowPassingRoles
Effect: Allow
Action: iam:PassRole
Resource: !Sub arn:${AWS::Partition}:iam::*:role/hotsock/*
- Sid: AllowOrgInfo
Effect: Allow
Action: organizations:DescribeOrganization
Resource: "*"
- Sid: AllowKMSReadOnlyActions
Effect: Allow
Action:
- kms:DescribeKey
- kms:GenerateRandom
- kms:List*
Resource: "*"
- Sid: AllowKMSTaggedKeyManagement
Effect: Allow
Action:
- kms:CancelKeyDeletion
- kms:CreateGrant
- kms:Decrypt
- kms:DeriveSharedSecret
- kms:Disable*
- kms:Enable*
- kms:Encrypt
- kms:Generate*
- kms:Get*
- kms:Put*
- kms:ReEncrypt*
- kms:ReplicateKey
- kms:RetireGrant
- kms:RevokeGrant
- kms:RotateKeyOnDemand
- kms:ScheduleKeyDeletion
- kms:Sign
- kms:SynchronizeMultiRegionKey
- kms:UpdateKeyDescription
- kms:UpdatePrimaryRegion
- kms:Verify*
Resource: "*"
Condition:
StringEquals:
aws:ResourceTag/hotsock:service: Hotsock
- Sid: AllowKMSTaggedKeyCreation
Effect: Allow
Action:
- kms:CreateKey
- kms:TagResource
Resource: "*"
Condition:
ForAnyValue:StringEquals:
aws:RequestTag/hotsock:service: Hotsock
- Sid: AllowKMSKeyTaggingOfOwnKeysWithOtherTags
Effect: Allow
Action: kms:TagResource
Resource: "*"
Condition:
StringEquals:
aws:ResourceTag/hotsock:service: Hotsock
- Sid: AllowUntaggingOfOwnKeysWithOtherTags
Effect: Allow
Action: kms:UntagResource
Resource: "*"
Condition:
StringEquals:
aws:ResourceTag/hotsock:service: Hotsock
ForAnyValue:StringNotEquals:
aws:TagKeys: [hotsock:service]
- Sid: DenyKMSKeyTaggingInvalidTagValue
Effect: Deny
Action: kms:TagResource
Resource: "*"
Condition:
StringNotEquals:
aws:ResourceTag/hotsock:service: Hotsock
- Sid: DenyKMSKeyTaggingInvalidChangeValue
Effect: Deny
Action: kms:TagResource
Resource: "*"
Condition:
ForAnyValue:StringNotEquals:
aws:RequestTag/hotsock:service: Hotsock
- Sid: DenyKMSKeyTaggingMissingTag
Effect: Deny
Action: kms:TagResource
Resource: "*"
Condition:
"Null":
aws:ResourceTag/hotsock:service: true
Mappings:
MetaMap:
Global:
Version: "1.0"
Outputs:
Version:
Value: !FindInMap [MetaMap, Global, Version]