-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AWS: IAM: Add access keys last used data, cleanup unattached nodes (#…
…1169) Redo of #1101 1. Add access keys last used data 2. cleanup unattached AccessKey nodes. This happens when the associated User no longer exists. ### Testing No unit tests, but I did test manually.
- Loading branch information
1 parent
afd3e7d
commit f1b4948
Showing
3 changed files
with
35 additions
and
6 deletions.
There are no files selected for viewing
19 changes: 14 additions & 5 deletions
19
cartography/data/jobs/cleanup/aws_import_account_access_key_cleanup.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
{ | ||
"statements": [{ | ||
"query": "MATCH (n:AccountAccessKey)<-[:AWS_ACCESS_KEY]-(:AWSUser)<-[:RESOURCE]-(:AWSAccount{id: $AWS_ID}) WHERE n.lastupdated <> $UPDATE_TAG WITH n LIMIT $LIMIT_SIZE DETACH DELETE (n)", | ||
"iterative": true, | ||
"iterationsize": 100 | ||
}], | ||
"statements": [ | ||
{ | ||
"query": "MATCH (n:AccountAccessKey)<-[:AWS_ACCESS_KEY]-(:AWSUser)<-[:RESOURCE]-(:AWSAccount{id: $AWS_ID}) WHERE n.lastupdated <> $UPDATE_TAG WITH n LIMIT $LIMIT_SIZE DETACH DELETE (n)", | ||
"iterative": true, | ||
"iterationsize": 100, | ||
"__comment__": "cleanup access keys that are attached to users" | ||
}, | ||
{ | ||
"query": "MATCH (n:AccountAccessKey) WHERE NOT (n)<-[:AWS_ACCESS_KEY]-(:AWSUser) AND n.lastupdated <> $UPDATE_TAG WITH n LIMIT $LIMIT_SIZE DETACH DELETE (n)", | ||
"iterative": true, | ||
"iterationsize": 100, | ||
"__comment__": "cleanup access keys that no longer attached to users, such as when a user no longer exists" | ||
} | ||
], | ||
"name": "cleanup AccountAccessKey" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters