-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f07961b
commit 400f636
Showing
3 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
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
37 changes: 37 additions & 0 deletions
37
cloudiscovery/provider/security/resource/commands/CLOUDTRAIL.py
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from provider.security.command import SecurityOptions | ||
|
||
from shared.common import ( | ||
Resource, | ||
ResourceDigest, | ||
SecurityValues, | ||
) | ||
|
||
|
||
class CLOUDTRAIL: | ||
def __init__(self, options: SecurityOptions): | ||
self.options = options | ||
|
||
def cloudtrail_enabled(self, cloudtrail_enabled): | ||
|
||
client = self.options.client("cloudtrail") | ||
|
||
trails = client.list_trails() | ||
|
||
resources_found = [] | ||
|
||
if not trails["Trails"]: | ||
resources_found.append( | ||
Resource( | ||
digest=ResourceDigest(id="cloudtrail", type="cloudtrail_enabled"), | ||
details="CLOUDTRAIL disabled", | ||
name="cloudtrail", | ||
group="cloudtrail_security", | ||
security=SecurityValues( | ||
status="CRITICAL", | ||
parameter="cloudtrail_enabled", | ||
value="False", | ||
), | ||
) | ||
) | ||
|
||
return resources_found |
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