File tree 2 files changed +26
-10
lines changed
2 files changed +26
-10
lines changed Original file line number Diff line number Diff line change 42
42
value :
43
43
name : aws-iam-check-keys
44
44
rules :
45
- - alert : AWSIAMCheckKeys
46
- expr : stale_key_num > 0
45
+ - alert : OperatorsStaleKeyWarning
46
+ expr : last_rotated_days{user_type="Operator"} >= 75 and last_rotated_days{user_type="Operator"} < 90
47
47
labels :
48
48
service : aws-iam
49
49
severity : warning
50
50
annotations :
51
- summary : AWS IAM user {{$labels.user}} has stale IAM Key(s)
52
- description : Look up the procedures for rotating the access keys
51
+ summary : IAM key for {$labels.user} will be expired within the next 15 days
52
+ description : " For Operators if the expiration is within 15 days\n "
53
+ - alert : PlatformApplicationStaleKeyWarning
54
+ expr : last_rotated_days{user_type="Platform"} >= 80 and last_rotated_days{user_type="Platform"} < 165 or last_rotated_days{user_type="Application"} >= 80 and last_rotated_days{user_type="Application"} < 165
55
+ labels :
56
+ severity : warning
57
+ annotations :
58
+ summary : IAM key for Platform or Application {$labels.user} will be expired within the next 15 days
59
+ description : " For Platform or Applications if the expiration is within 85 days\n "
60
+ - alert : OperatorsStaleKeyViolation
61
+ expr : last_rotated_days{user_type="Operator"} >= 90
62
+ labels :
63
+ severity : critical
64
+ annotations :
65
+ summary : IAM key for {$labels.user} is now expired
66
+ description : " For Operators if the key is expired\n "
67
+ - alert : PlatformApplicationStaleKeyViolation
68
+ expr : last_rotated_days{user_type="Platform"} >= 165 or last_rotated_days{user_type="Application"} >= 165
69
+ labels :
70
+ severity : critical
71
+ annotations :
72
+ summary : IAM key for {$labels.user} is now expired
73
+ description : " For Platform or Applications if the key is expired\n "
53
74
54
75
# CloudWatch logs alerts
55
76
- type : replace
Original file line number Diff line number Diff line change @@ -289,7 +289,6 @@ def del_key(key_dict: dict):
289
289
are stale
290
290
"""
291
291
gateway = f'{ env .str ("GATEWAY_HOST" )} :{ env .int ("GATEWAY_PORT" , 9091 )} '
292
- print (f'gateway in del_key is: { gateway } ' )
293
292
del key_dict ["days_since_rotation" ]
294
293
del key_dict ["last_rotated" ]
295
294
del key_dict ["key_num" ]
@@ -304,13 +303,9 @@ def send_key(key_dict: dict, severity: str):
304
303
Send the key(s) to the pushgateway client to let it determine if they
305
304
are stale
306
305
"""
307
- gateway = f"{ env .str ('GATEWAY_HOST' )} :9091"
308
- #print(gateway_test)
309
- #gateway = f"{env.str('GATEWAY_HOST')}:{env.int('GATEWAY_PORT', 9091)}"
310
- print (f"gateway in send_key: { gateway } " )
306
+ gateway = f"{ env .str ('GATEWAY_HOST' )} :{ env .int ('GATEWAY_PORT' , 9091 )} "
311
307
registry = CollectorRegistry ()
312
308
days_since_rotation = key_dict ["days_since_rotation" ]
313
- # user_type = key_dict["user_type"]
314
309
del key_dict ["days_since_rotation" ]
315
310
316
311
key_info = Gauge (
You can’t perform that action at this time.
0 commit comments