sraverify 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sraverify-0.1.0/LICENSE +175 -0
- sraverify-0.1.0/NOTICE +1 -0
- sraverify-0.1.0/PKG-INFO +516 -0
- sraverify-0.1.0/README.md +499 -0
- sraverify-0.1.0/setup.cfg +4 -0
- sraverify-0.1.0/setup.py +34 -0
- sraverify-0.1.0/sraverify/__init__.py +36 -0
- sraverify-0.1.0/sraverify/core/__init__.py +3 -0
- sraverify-0.1.0/sraverify/core/check.py +227 -0
- sraverify-0.1.0/sraverify/core/logging.py +37 -0
- sraverify-0.1.0/sraverify/core/session.py +47 -0
- sraverify-0.1.0/sraverify/main.py +350 -0
- sraverify-0.1.0/sraverify/services/__init__.py +3 -0
- sraverify-0.1.0/sraverify/services/accessanalyzer/__init__.py +15 -0
- sraverify-0.1.0/sraverify/services/accessanalyzer/base.py +123 -0
- sraverify-0.1.0/sraverify/services/accessanalyzer/checks/__init__.py +3 -0
- sraverify-0.1.0/sraverify/services/accessanalyzer/checks/sra_accessanalyzer_01.py +82 -0
- sraverify-0.1.0/sraverify/services/accessanalyzer/checks/sra_accessanalyzer_02.py +82 -0
- sraverify-0.1.0/sraverify/services/accessanalyzer/checks/sra_accessanalyzer_03.py +103 -0
- sraverify-0.1.0/sraverify/services/accessanalyzer/checks/sra_accessanalyzer_04.py +139 -0
- sraverify-0.1.0/sraverify/services/accessanalyzer/client.py +123 -0
- sraverify-0.1.0/sraverify/services/account/__init__.py +9 -0
- sraverify-0.1.0/sraverify/services/account/base.py +56 -0
- sraverify-0.1.0/sraverify/services/account/checks/__init__.py +1 -0
- sraverify-0.1.0/sraverify/services/account/checks/sra_account_01.py +65 -0
- sraverify-0.1.0/sraverify/services/account/checks/sra_account_02.py +63 -0
- sraverify-0.1.0/sraverify/services/account/checks/sra_account_03.py +63 -0
- sraverify-0.1.0/sraverify/services/account/client.py +51 -0
- sraverify-0.1.0/sraverify/services/auditmanager/__init__.py +10 -0
- sraverify-0.1.0/sraverify/services/auditmanager/base.py +72 -0
- sraverify-0.1.0/sraverify/services/auditmanager/checks/__init__.py +1 -0
- sraverify-0.1.0/sraverify/services/auditmanager/checks/sra_auditmanager_01.py +58 -0
- sraverify-0.1.0/sraverify/services/auditmanager/checks/sra_auditmanager_02.py +80 -0
- sraverify-0.1.0/sraverify/services/auditmanager/client.py +58 -0
- sraverify-0.1.0/sraverify/services/cloudtrail/__init__.py +33 -0
- sraverify-0.1.0/sraverify/services/cloudtrail/base.py +167 -0
- sraverify-0.1.0/sraverify/services/cloudtrail/checks/__init__.py +1 -0
- sraverify-0.1.0/sraverify/services/cloudtrail/checks/sra_cloudtrail_01.py +83 -0
- sraverify-0.1.0/sraverify/services/cloudtrail/checks/sra_cloudtrail_02.py +99 -0
- sraverify-0.1.0/sraverify/services/cloudtrail/checks/sra_cloudtrail_03.py +94 -0
- sraverify-0.1.0/sraverify/services/cloudtrail/checks/sra_cloudtrail_04.py +92 -0
- sraverify-0.1.0/sraverify/services/cloudtrail/checks/sra_cloudtrail_05.py +106 -0
- sraverify-0.1.0/sraverify/services/cloudtrail/checks/sra_cloudtrail_06.py +93 -0
- sraverify-0.1.0/sraverify/services/cloudtrail/checks/sra_cloudtrail_07.py +96 -0
- sraverify-0.1.0/sraverify/services/cloudtrail/checks/sra_cloudtrail_08.py +145 -0
- sraverify-0.1.0/sraverify/services/cloudtrail/checks/sra_cloudtrail_09.py +167 -0
- sraverify-0.1.0/sraverify/services/cloudtrail/checks/sra_cloudtrail_10.py +162 -0
- sraverify-0.1.0/sraverify/services/cloudtrail/checks/sra_cloudtrail_11.py +178 -0
- sraverify-0.1.0/sraverify/services/cloudtrail/checks/sra_cloudtrail_12.py +77 -0
- sraverify-0.1.0/sraverify/services/cloudtrail/checks/sra_cloudtrail_13.py +120 -0
- sraverify-0.1.0/sraverify/services/cloudtrail/client.py +118 -0
- sraverify-0.1.0/sraverify/services/config/__init__.py +25 -0
- sraverify-0.1.0/sraverify/services/config/base.py +249 -0
- sraverify-0.1.0/sraverify/services/config/checks/__init__.py +1 -0
- sraverify-0.1.0/sraverify/services/config/checks/sra_config_01.py +123 -0
- sraverify-0.1.0/sraverify/services/config/checks/sra_config_02.py +156 -0
- sraverify-0.1.0/sraverify/services/config/checks/sra_config_03.py +149 -0
- sraverify-0.1.0/sraverify/services/config/checks/sra_config_04.py +104 -0
- sraverify-0.1.0/sraverify/services/config/checks/sra_config_05.py +104 -0
- sraverify-0.1.0/sraverify/services/config/checks/sra_config_06.py +194 -0
- sraverify-0.1.0/sraverify/services/config/checks/sra_config_07.py +162 -0
- sraverify-0.1.0/sraverify/services/config/checks/sra_config_08.py +185 -0
- sraverify-0.1.0/sraverify/services/config/checks/sra_config_09.py +177 -0
- sraverify-0.1.0/sraverify/services/config/client.py +264 -0
- sraverify-0.1.0/sraverify/services/ec2/__init__.py +8 -0
- sraverify-0.1.0/sraverify/services/ec2/base.py +75 -0
- sraverify-0.1.0/sraverify/services/ec2/checks/__init__.py +1 -0
- sraverify-0.1.0/sraverify/services/ec2/checks/sra_ec2_01.py +83 -0
- sraverify-0.1.0/sraverify/services/ec2/client.py +63 -0
- sraverify-0.1.0/sraverify/services/firewallmanager/__init__.py +23 -0
- sraverify-0.1.0/sraverify/services/firewallmanager/base.py +48 -0
- sraverify-0.1.0/sraverify/services/firewallmanager/checks/__init__.py +1 -0
- sraverify-0.1.0/sraverify/services/firewallmanager/checks/sra_firewallmanager_01.py +75 -0
- sraverify-0.1.0/sraverify/services/firewallmanager/checks/sra_firewallmanager_02.py +57 -0
- sraverify-0.1.0/sraverify/services/firewallmanager/checks/sra_firewallmanager_03.py +51 -0
- sraverify-0.1.0/sraverify/services/firewallmanager/checks/sra_firewallmanager_04.py +51 -0
- sraverify-0.1.0/sraverify/services/firewallmanager/checks/sra_firewallmanager_05.py +51 -0
- sraverify-0.1.0/sraverify/services/firewallmanager/checks/sra_firewallmanager_06.py +51 -0
- sraverify-0.1.0/sraverify/services/firewallmanager/checks/sra_firewallmanager_07.py +51 -0
- sraverify-0.1.0/sraverify/services/firewallmanager/checks/sra_firewallmanager_08.py +61 -0
- sraverify-0.1.0/sraverify/services/firewallmanager/checks/sra_firewallmanager_09.py +61 -0
- sraverify-0.1.0/sraverify/services/firewallmanager/checks/sra_firewallmanager_10.py +71 -0
- sraverify-0.1.0/sraverify/services/firewallmanager/client.py +40 -0
- sraverify-0.1.0/sraverify/services/guardduty/__init__.py +58 -0
- sraverify-0.1.0/sraverify/services/guardduty/base.py +207 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/__init__.py +3 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_01.py +51 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_02.py +80 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_03.py +77 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_04.py +84 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_05.py +84 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_06.py +84 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_07.py +85 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_08.py +83 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_09.py +84 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_10.py +83 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_11.py +93 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_12.py +83 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_13.py +90 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_14.py +136 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_15.py +94 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_16.py +94 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_17.py +91 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_18.py +91 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_19.py +91 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_20.py +111 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_21.py +112 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_22.py +111 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_23.py +154 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_24.py +111 -0
- sraverify-0.1.0/sraverify/services/guardduty/checks/sra_guardduty_25.py +111 -0
- sraverify-0.1.0/sraverify/services/guardduty/client.py +107 -0
- sraverify-0.1.0/sraverify/services/inspector/__init__.py +29 -0
- sraverify-0.1.0/sraverify/services/inspector/base.py +233 -0
- sraverify-0.1.0/sraverify/services/inspector/checks/__init__.py +3 -0
- sraverify-0.1.0/sraverify/services/inspector/checks/sra_inspector_01.py +69 -0
- sraverify-0.1.0/sraverify/services/inspector/checks/sra_inspector_02.py +68 -0
- sraverify-0.1.0/sraverify/services/inspector/checks/sra_inspector_03.py +68 -0
- sraverify-0.1.0/sraverify/services/inspector/checks/sra_inspector_04.py +70 -0
- sraverify-0.1.0/sraverify/services/inspector/checks/sra_inspector_05.py +69 -0
- sraverify-0.1.0/sraverify/services/inspector/checks/sra_inspector_06.py +115 -0
- sraverify-0.1.0/sraverify/services/inspector/checks/sra_inspector_07.py +109 -0
- sraverify-0.1.0/sraverify/services/inspector/checks/sra_inspector_08.py +69 -0
- sraverify-0.1.0/sraverify/services/inspector/checks/sra_inspector_09.py +69 -0
- sraverify-0.1.0/sraverify/services/inspector/checks/sra_inspector_10.py +69 -0
- sraverify-0.1.0/sraverify/services/inspector/checks/sra_inspector_11.py +69 -0
- sraverify-0.1.0/sraverify/services/inspector/client.py +99 -0
- sraverify-0.1.0/sraverify/services/macie/__init__.py +27 -0
- sraverify-0.1.0/sraverify/services/macie/base.py +271 -0
- sraverify-0.1.0/sraverify/services/macie/checks/__init__.py +1 -0
- sraverify-0.1.0/sraverify/services/macie/checks/sra_macie_01.py +100 -0
- sraverify-0.1.0/sraverify/services/macie/checks/sra_macie_02.py +102 -0
- sraverify-0.1.0/sraverify/services/macie/checks/sra_macie_03.py +152 -0
- sraverify-0.1.0/sraverify/services/macie/checks/sra_macie_04.py +120 -0
- sraverify-0.1.0/sraverify/services/macie/checks/sra_macie_05.py +85 -0
- sraverify-0.1.0/sraverify/services/macie/checks/sra_macie_06.py +124 -0
- sraverify-0.1.0/sraverify/services/macie/checks/sra_macie_07.py +138 -0
- sraverify-0.1.0/sraverify/services/macie/checks/sra_macie_08.py +82 -0
- sraverify-0.1.0/sraverify/services/macie/checks/sra_macie_09.py +103 -0
- sraverify-0.1.0/sraverify/services/macie/checks/sra_macie_10.py +81 -0
- sraverify-0.1.0/sraverify/services/macie/client.py +220 -0
- sraverify-0.1.0/sraverify/services/s3/__init__.py +16 -0
- sraverify-0.1.0/sraverify/services/s3/base.py +69 -0
- sraverify-0.1.0/sraverify/services/s3/checks/__init__.py +1 -0
- sraverify-0.1.0/sraverify/services/s3/checks/sra_s3_01.py +89 -0
- sraverify-0.1.0/sraverify/services/s3/checks/sra_s3_02.py +89 -0
- sraverify-0.1.0/sraverify/services/s3/checks/sra_s3_03.py +88 -0
- sraverify-0.1.0/sraverify/services/s3/checks/sra_s3_04.py +88 -0
- sraverify-0.1.0/sraverify/services/s3/client.py +52 -0
- sraverify-0.1.0/sraverify/services/securityhub/__init__.py +27 -0
- sraverify-0.1.0/sraverify/services/securityhub/base.py +349 -0
- sraverify-0.1.0/sraverify/services/securityhub/checks/__init__.py +1 -0
- sraverify-0.1.0/sraverify/services/securityhub/checks/sra_securityhub_01.py +115 -0
- sraverify-0.1.0/sraverify/services/securityhub/checks/sra_securityhub_02.py +114 -0
- sraverify-0.1.0/sraverify/services/securityhub/checks/sra_securityhub_03.py +136 -0
- sraverify-0.1.0/sraverify/services/securityhub/checks/sra_securityhub_04.py +75 -0
- sraverify-0.1.0/sraverify/services/securityhub/checks/sra_securityhub_05.py +102 -0
- sraverify-0.1.0/sraverify/services/securityhub/checks/sra_securityhub_06.py +113 -0
- sraverify-0.1.0/sraverify/services/securityhub/checks/sra_securityhub_07.py +121 -0
- sraverify-0.1.0/sraverify/services/securityhub/checks/sra_securityhub_08.py +113 -0
- sraverify-0.1.0/sraverify/services/securityhub/checks/sra_securityhub_09.py +100 -0
- sraverify-0.1.0/sraverify/services/securityhub/checks/sra_securityhub_10.py +94 -0
- sraverify-0.1.0/sraverify/services/securityhub/checks/sra_securityhub_11.py +73 -0
- sraverify-0.1.0/sraverify/services/securityhub/client.py +249 -0
- sraverify-0.1.0/sraverify/services/securityincidentresponse/__init__.py +13 -0
- sraverify-0.1.0/sraverify/services/securityincidentresponse/base.py +95 -0
- sraverify-0.1.0/sraverify/services/securityincidentresponse/checks/__init__.py +1 -0
- sraverify-0.1.0/sraverify/services/securityincidentresponse/checks/sra_securityincidentresponse_01.py +77 -0
- sraverify-0.1.0/sraverify/services/securityincidentresponse/checks/sra_securityincidentresponse_02.py +72 -0
- sraverify-0.1.0/sraverify/services/securityincidentresponse/checks/sra_securityincidentresponse_03.py +86 -0
- sraverify-0.1.0/sraverify/services/securityincidentresponse/checks/sra_securityincidentresponse_04.py +117 -0
- sraverify-0.1.0/sraverify/services/securityincidentresponse/checks/sra_securityincidentresponse_05.py +55 -0
- sraverify-0.1.0/sraverify/services/securityincidentresponse/client.py +71 -0
- sraverify-0.1.0/sraverify/services/securitylake/__init__.py +39 -0
- sraverify-0.1.0/sraverify/services/securitylake/base.py +461 -0
- sraverify-0.1.0/sraverify/services/securitylake/checks/__init__.py +1 -0
- sraverify-0.1.0/sraverify/services/securitylake/checks/sra_securitylake_01.py +98 -0
- sraverify-0.1.0/sraverify/services/securitylake/checks/sra_securitylake_02.py +133 -0
- sraverify-0.1.0/sraverify/services/securitylake/checks/sra_securitylake_03.py +116 -0
- sraverify-0.1.0/sraverify/services/securitylake/checks/sra_securitylake_04.py +72 -0
- sraverify-0.1.0/sraverify/services/securitylake/checks/sra_securitylake_05.py +116 -0
- sraverify-0.1.0/sraverify/services/securitylake/checks/sra_securitylake_06.py +104 -0
- sraverify-0.1.0/sraverify/services/securitylake/checks/sra_securitylake_07.py +108 -0
- sraverify-0.1.0/sraverify/services/securitylake/checks/sra_securitylake_08.py +107 -0
- sraverify-0.1.0/sraverify/services/securitylake/checks/sra_securitylake_09.py +107 -0
- sraverify-0.1.0/sraverify/services/securitylake/checks/sra_securitylake_10.py +106 -0
- sraverify-0.1.0/sraverify/services/securitylake/checks/sra_securitylake_11.py +109 -0
- sraverify-0.1.0/sraverify/services/securitylake/checks/sra_securitylake_12.py +108 -0
- sraverify-0.1.0/sraverify/services/securitylake/checks/sra_securitylake_13.py +108 -0
- sraverify-0.1.0/sraverify/services/securitylake/checks/sra_securitylake_14.py +72 -0
- sraverify-0.1.0/sraverify/services/securitylake/checks/sra_securitylake_15.py +120 -0
- sraverify-0.1.0/sraverify/services/securitylake/checks/sra_securitylake_16.py +104 -0
- sraverify-0.1.0/sraverify/services/securitylake/checks/sra_securitylake_17.py +103 -0
- sraverify-0.1.0/sraverify/services/securitylake/client.py +247 -0
- sraverify-0.1.0/sraverify/services/shield/__init__.py +33 -0
- sraverify-0.1.0/sraverify/services/shield/base.py +199 -0
- sraverify-0.1.0/sraverify/services/shield/checks/__init__.py +1 -0
- sraverify-0.1.0/sraverify/services/shield/checks/sra_shield_01.py +68 -0
- sraverify-0.1.0/sraverify/services/shield/checks/sra_shield_02.py +77 -0
- sraverify-0.1.0/sraverify/services/shield/checks/sra_shield_03.py +84 -0
- sraverify-0.1.0/sraverify/services/shield/checks/sra_shield_04.py +84 -0
- sraverify-0.1.0/sraverify/services/shield/checks/sra_shield_05.py +84 -0
- sraverify-0.1.0/sraverify/services/shield/checks/sra_shield_06.py +84 -0
- sraverify-0.1.0/sraverify/services/shield/checks/sra_shield_07.py +84 -0
- sraverify-0.1.0/sraverify/services/shield/checks/sra_shield_08.py +69 -0
- sraverify-0.1.0/sraverify/services/shield/checks/sra_shield_09.py +86 -0
- sraverify-0.1.0/sraverify/services/shield/checks/sra_shield_10.py +100 -0
- sraverify-0.1.0/sraverify/services/shield/checks/sra_shield_11.py +71 -0
- sraverify-0.1.0/sraverify/services/shield/checks/sra_shield_12.py +130 -0
- sraverify-0.1.0/sraverify/services/shield/checks/sra_shield_13.py +112 -0
- sraverify-0.1.0/sraverify/services/shield/checks/sra_shield_14.py +111 -0
- sraverify-0.1.0/sraverify/services/shield/client.py +214 -0
- sraverify-0.1.0/sraverify/services/waf/__init__.py +21 -0
- sraverify-0.1.0/sraverify/services/waf/base.py +100 -0
- sraverify-0.1.0/sraverify/services/waf/checks/__init__.py +1 -0
- sraverify-0.1.0/sraverify/services/waf/checks/sra_waf_01.py +63 -0
- sraverify-0.1.0/sraverify/services/waf/checks/sra_waf_02.py +82 -0
- sraverify-0.1.0/sraverify/services/waf/checks/sra_waf_03.py +123 -0
- sraverify-0.1.0/sraverify/services/waf/checks/sra_waf_04.py +94 -0
- sraverify-0.1.0/sraverify/services/waf/checks/sra_waf_05.py +94 -0
- sraverify-0.1.0/sraverify/services/waf/checks/sra_waf_06.py +91 -0
- sraverify-0.1.0/sraverify/services/waf/checks/sra_waf_07.py +94 -0
- sraverify-0.1.0/sraverify/services/waf/checks/sra_waf_08.py +66 -0
- sraverify-0.1.0/sraverify/services/waf/checks/sra_waf_09.py +95 -0
- sraverify-0.1.0/sraverify/services/waf/client.py +109 -0
- sraverify-0.1.0/sraverify/utils/__init__.py +3 -0
- sraverify-0.1.0/sraverify/utils/banner.py +65 -0
- sraverify-0.1.0/sraverify/utils/outputs.py +57 -0
- sraverify-0.1.0/sraverify/utils/progress.py +97 -0
- sraverify-0.1.0/sraverify.egg-info/PKG-INFO +516 -0
- sraverify-0.1.0/sraverify.egg-info/SOURCES.txt +233 -0
- sraverify-0.1.0/sraverify.egg-info/dependency_links.txt +1 -0
- sraverify-0.1.0/sraverify.egg-info/entry_points.txt +2 -0
- sraverify-0.1.0/sraverify.egg-info/requires.txt +2 -0
- sraverify-0.1.0/sraverify.egg-info/top_level.txt +1 -0
sraverify-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
sraverify-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
sraverify-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: sraverify
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: AWS Security Reference Architecture Verification Tool
|
|
5
|
+
Home-page: https://github.com/awslabs/sra-verify
|
|
6
|
+
Author: SRA Verify team
|
|
7
|
+
Author-email: schiefj@amazon.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
License-File: NOTICE
|
|
15
|
+
Requires-Dist: boto3>=1.26.0
|
|
16
|
+
Requires-Dist: colorama>=0.4.4
|
|
17
|
+
|
|
18
|
+
# SRA Verify
|
|
19
|
+
|
|
20
|
+
SRA Verify is a Python-based security auditing tool designed to assess AWS infrastructure configurations against the AWS
|
|
21
|
+
Security Reference Architecture (SRA). It helps identify security gaps and provides remediation guidance.
|
|
22
|
+
|
|
23
|
+
## Project Structure
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
sra-verify/
|
|
27
|
+
├── README.md
|
|
28
|
+
├── 1-sraverify-member-roles.yaml # CloudFormation template for member roles
|
|
29
|
+
├── 2-sraverify-codebuild-deploy.yaml # CloudFormation template for CodeBuild
|
|
30
|
+
├── s3_sync_command.sh # Script to sync files to S3
|
|
31
|
+
├── sraverify/ # Main package directory
|
|
32
|
+
│ ├── setup.py # Package setup configuration
|
|
33
|
+
│ ├── requirements.txt # Dependencies
|
|
34
|
+
│ ├── sraverify/ # Core code
|
|
35
|
+
│ │ ├── main.py # Entry point
|
|
36
|
+
│ │ ├── core/ # Core functionality
|
|
37
|
+
│ │ │ ├── check.py # Base security check class
|
|
38
|
+
│ │ │ ├── session.py # AWS session management
|
|
39
|
+
│ │ │ └── logging.py # Logging configuration
|
|
40
|
+
│ │ ├── services/ # Service-specific modules
|
|
41
|
+
│ │ │ ├── guardduty/ # GuardDuty checks
|
|
42
|
+
│ │ │ │ ├── base.py # GuardDuty base check class
|
|
43
|
+
│ │ │ │ ├── client.py # GuardDuty API client
|
|
44
|
+
│ │ │ │ └── checks/ # Individual GuardDuty checks
|
|
45
|
+
│ │ │ └── cloudtrail/ # CloudTrail checks
|
|
46
|
+
│ │ └── utils/ # Utility functions
|
|
47
|
+
│ └── tests/ # Test cases
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Project architecture
|
|
51
|
+
|
|
52
|
+
SRA Verify is designed with an extensible framework that makes it easy to add new security checks.
|
|
53
|
+
|
|
54
|
+
```mermaid
|
|
55
|
+
classDiagram
|
|
56
|
+
class SecurityCheck {
|
|
57
|
+
+check_type: str
|
|
58
|
+
+service: str
|
|
59
|
+
+resource_type: str
|
|
60
|
+
+check_id: str
|
|
61
|
+
+check_name: str
|
|
62
|
+
+description: str
|
|
63
|
+
+rational: str
|
|
64
|
+
+remediation: str
|
|
65
|
+
+severity: str
|
|
66
|
+
+check_logic: str
|
|
67
|
+
+findings: list
|
|
68
|
+
+regions: list
|
|
69
|
+
+session: boto3.Session
|
|
70
|
+
+_clients: dict
|
|
71
|
+
|
|
72
|
+
+_get_enabled_regions()
|
|
73
|
+
+initialize(session, regions)
|
|
74
|
+
+get_client(region)
|
|
75
|
+
+create_finding(status, region, account_id, resource_id, actual_value, remediation)
|
|
76
|
+
+get_findings()
|
|
77
|
+
+get_session_accountId(session)
|
|
78
|
+
+get_management_accountId(session)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
class GuardDutyCheck {
|
|
82
|
+
+_detector_details_cache: dict
|
|
83
|
+
+_detector_ids_cache: dict
|
|
84
|
+
+_setup_clients()
|
|
85
|
+
+get_detector_id(region)
|
|
86
|
+
+get_detector_details(region)
|
|
87
|
+
+get_enabled_regions()
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
class GuardDutyClient {
|
|
91
|
+
+region: str
|
|
92
|
+
+session: boto3.Session
|
|
93
|
+
+client: boto3.client
|
|
94
|
+
+get_detector_id()
|
|
95
|
+
+get_detector_details(detector_id)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
class SRA_GD_1 {
|
|
99
|
+
+check_id: str
|
|
100
|
+
+check_name: str
|
|
101
|
+
+description: str
|
|
102
|
+
+severity: str
|
|
103
|
+
+check_logic: str
|
|
104
|
+
+execute()
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
class SRA_GD_2 {
|
|
108
|
+
+check_id: str
|
|
109
|
+
+check_name: str
|
|
110
|
+
+description: str
|
|
111
|
+
+severity: str
|
|
112
|
+
+check_logic: str
|
|
113
|
+
+execute()
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
class SRA_GD_3 {
|
|
117
|
+
+check_id: str
|
|
118
|
+
+check_name: str
|
|
119
|
+
+description: str
|
|
120
|
+
+severity: str
|
|
121
|
+
+check_logic: str
|
|
122
|
+
+execute()
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
SecurityCheck <|-- GuardDutyCheck : extends
|
|
126
|
+
GuardDutyCheck <|-- SRA_GD_1 : extends
|
|
127
|
+
GuardDutyCheck <|-- SRA_GD_2 : extends
|
|
128
|
+
GuardDutyCheck <|-- SRA_GD_3 : extends
|
|
129
|
+
|
|
130
|
+
GuardDutyCheck --> GuardDutyClient : uses
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Data Flow
|
|
134
|
+
SRA Verify performs security assessments by analyzing AWS service configurations and generating findings.
|
|
135
|
+
|
|
136
|
+
```ascii
|
|
137
|
+
[AWS Account] --> [SRAVerify Tool] --> [Security Checks] --> [Findings]
|
|
138
|
+
| | | |
|
|
139
|
+
| | | |
|
|
140
|
+
v v v v
|
|
141
|
+
[IAM Roles] --> [AWS Session] --> [Service Clients] --> [CSV Reports]
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Component Interactions:
|
|
145
|
+
- SRAVerify assumes IAM roles in target accounts
|
|
146
|
+
- Executes service-specific security checks
|
|
147
|
+
- Generates findings with status and remediation steps
|
|
148
|
+
- Outputs results to CSV format
|
|
149
|
+
- Supports parallel execution across accounts
|
|
150
|
+
- Handles regional service availability
|
|
151
|
+
|
|
152
|
+
### Best Practices for Check Implementation
|
|
153
|
+
|
|
154
|
+
1. Meaningful IDs: Use a consistent naming scheme (SRA-XX-#) where XX is a service abbreviation
|
|
155
|
+
2. Clear Descriptions: Provide detailed descriptions of what the check verifies
|
|
156
|
+
3. Actionable Remediation: Include specific steps for remediation in failure cases
|
|
157
|
+
4. Caching: Use caching for expensive API calls that might be reused across checks
|
|
158
|
+
|
|
159
|
+
Follow these steps to implement your own checks:
|
|
160
|
+
|
|
161
|
+
### 1. Determine the AWS Service
|
|
162
|
+
|
|
163
|
+
First, decide which AWS service your check will target. If it's a service that already has checks (like GuardDuty or
|
|
164
|
+
CloudTrail), you can add to the existing module. Otherwise, you'll need to create a new service module.
|
|
165
|
+
|
|
166
|
+
### 2. Create Service Module (if needed)
|
|
167
|
+
|
|
168
|
+
If you're adding checks for a new service, create the following structure:
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
sraverify/sraverify/services/your_service/
|
|
172
|
+
├── __init__.py
|
|
173
|
+
├── base.py
|
|
174
|
+
├── client.py
|
|
175
|
+
└── checks/
|
|
176
|
+
├── __init__.py
|
|
177
|
+
└── sra_xx_1.py
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### 3. Implement Service Client
|
|
181
|
+
|
|
182
|
+
Create a client class to handle API interactions with the AWS service:
|
|
183
|
+
|
|
184
|
+
- Mirror AWS SDK method naming patterns when appropriate.
|
|
185
|
+
|
|
186
|
+
```python
|
|
187
|
+
# sraverify/sraverify/services/your_service/client.py
|
|
188
|
+
from typing import Dict, Optional, Any
|
|
189
|
+
import boto3
|
|
190
|
+
from botocore.exceptions import ClientError
|
|
191
|
+
from sraverify.core.logging import logger
|
|
192
|
+
|
|
193
|
+
class YourServiceClient:
|
|
194
|
+
def __init__(self, region: str, session: Optional[boto3.Session] = None):
|
|
195
|
+
self.region = region
|
|
196
|
+
self.session = session or boto3.Session()
|
|
197
|
+
self.client = self.session.client('your_service', region_name=region)
|
|
198
|
+
|
|
199
|
+
def get_resource(self) -> Dict[str, Any]:
|
|
200
|
+
try:
|
|
201
|
+
return self.client.describe_resource()
|
|
202
|
+
except ClientError as e:
|
|
203
|
+
logger.error(f"Error getting resource in {self.region}: {e}")
|
|
204
|
+
return {}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### 4. Create Base Check Class
|
|
208
|
+
|
|
209
|
+
Implement a base class for your service that extends SecurityCheck.
|
|
210
|
+
|
|
211
|
+
```python
|
|
212
|
+
# sraverify/sraverify/services/your_service/base.py
|
|
213
|
+
from typing import Dict, Any
|
|
214
|
+
from sraverify.core.check import SecurityCheck
|
|
215
|
+
from sraverify.services.your_service.client import YourServiceClient
|
|
216
|
+
|
|
217
|
+
class YourServiceCheck(SecurityCheck):
|
|
218
|
+
def __init__(self):
|
|
219
|
+
super().__init__(
|
|
220
|
+
check_type="account", # or "management" if appropriate
|
|
221
|
+
service="YourService",
|
|
222
|
+
resource_type="AWS::YourService::Resource"
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
def _setup_clients(self):
|
|
226
|
+
self._clients.clear()
|
|
227
|
+
if hasattr(self, 'regions') and self.regions:
|
|
228
|
+
for region in self.regions:
|
|
229
|
+
self._clients[region] = YourServiceClient(region, session=self.session)
|
|
230
|
+
|
|
231
|
+
# Add helper methods for common operations
|
|
232
|
+
def get_resource_details(self, region: str) -> Dict[str, Any]:
|
|
233
|
+
client = self.get_client(region)
|
|
234
|
+
if not client:
|
|
235
|
+
return {}
|
|
236
|
+
return client.get_resource()
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### 5. Implement Individual Checks
|
|
240
|
+
|
|
241
|
+
Create a new check class that extends your service's base check class:
|
|
242
|
+
|
|
243
|
+
```python
|
|
244
|
+
# sraverify/sraverify/services/your_service/checks/sra_xx_1.py
|
|
245
|
+
from typing import Dict, List, Any
|
|
246
|
+
from sraverify.services.your_service.base import YourServiceCheck
|
|
247
|
+
|
|
248
|
+
class SRA_XX_1(YourServiceCheck):
|
|
249
|
+
def __init__(self):
|
|
250
|
+
super().__init__()
|
|
251
|
+
self.check_id = "SRA-XX-1"
|
|
252
|
+
self.check_name = "Your check name"
|
|
253
|
+
self.description = "Detailed description of what this check verifies"
|
|
254
|
+
self.severity = "HIGH" # or MEDIUM, LOW
|
|
255
|
+
self.check_logic = "Description of the logic used to perform the check"
|
|
256
|
+
|
|
257
|
+
def execute(self) -> List[Dict[str, Any]]:
|
|
258
|
+
account_id = self.get_session_accountId(self.session)
|
|
259
|
+
|
|
260
|
+
for region in self.regions:
|
|
261
|
+
resource = self.get_resource_details(region)
|
|
262
|
+
|
|
263
|
+
if not resource or not self._is_compliant(resource):
|
|
264
|
+
self.findings.append(self.create_finding(
|
|
265
|
+
status="FAIL",
|
|
266
|
+
region=region,
|
|
267
|
+
account_id=account_id,
|
|
268
|
+
resource_id=None,
|
|
269
|
+
actual_value="Current configuration",
|
|
270
|
+
remediation="Steps to remediate the issue"
|
|
271
|
+
))
|
|
272
|
+
else:
|
|
273
|
+
self.findings.append(self.create_finding(
|
|
274
|
+
status="PASS",
|
|
275
|
+
region=region,
|
|
276
|
+
account_id=account_id,
|
|
277
|
+
resource_id=f"resource-id",
|
|
278
|
+
actual_value="Compliant configuration",
|
|
279
|
+
remediation="No remediation needed"
|
|
280
|
+
))
|
|
281
|
+
|
|
282
|
+
return self.findings
|
|
283
|
+
|
|
284
|
+
def _is_compliant(self, resource: Dict[str, Any]) -> bool:
|
|
285
|
+
# Implement your compliance check logic here
|
|
286
|
+
return resource.get('SecureSetting') == True
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### 6. Register Your Check
|
|
290
|
+
|
|
291
|
+
Add your check to the __init__.py file in your service directory:
|
|
292
|
+
|
|
293
|
+
```python
|
|
294
|
+
# sraverify/sraverify/services/your_service/__init__.py
|
|
295
|
+
from sraverify.services.your_service.checks.sra_xx_1 import SRA_XX_1
|
|
296
|
+
|
|
297
|
+
CHECKS = {
|
|
298
|
+
"SRA-XX-1": SRA_XX_1,
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### 7. Import in Main Module
|
|
303
|
+
|
|
304
|
+
Finally, import your service's checks in the main module:
|
|
305
|
+
|
|
306
|
+
```python
|
|
307
|
+
# sraverify/sraverify/main.py
|
|
308
|
+
# Add to imports
|
|
309
|
+
from sraverify.services.your_service import CHECKS as your_service_checks
|
|
310
|
+
|
|
311
|
+
# Add to ALL_CHECKS dictionary
|
|
312
|
+
ALL_CHECKS = {
|
|
313
|
+
**guardduty_checks,
|
|
314
|
+
**cloudtrail_checks,
|
|
315
|
+
**your_service_checks, # Add your new checks
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### 8. Test Your Check
|
|
320
|
+
|
|
321
|
+
Test your new check by running:
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
sraverify --check SRA-XX-1 --debug
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## Caching
|
|
328
|
+
|
|
329
|
+
SRA Verify implements an efficient caching system to minimize redundant API calls when performing security checks across multiple AWS regions and services.
|
|
330
|
+
This improves performance and reduces the risk of hitting API rate limits.
|
|
331
|
+
|
|
332
|
+
```python
|
|
333
|
+
class ServiceCheck(SecurityCheck):
|
|
334
|
+
# Class-level caches shared across all instances
|
|
335
|
+
_resource_cache = {}
|
|
336
|
+
_configuration_cache = {}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
Refer the the GuardDuty base.py file for an implementation example.
|
|
340
|
+
|
|
341
|
+
## Check Types
|
|
342
|
+
|
|
343
|
+
SRA Verify categorizes security checks into different types based on their scope and the AWS account context they operate in. Understanding these check types
|
|
344
|
+
is essential for properly implementing and running checks across your AWS environment.
|
|
345
|
+
|
|
346
|
+
### Available Check Types
|
|
347
|
+
|
|
348
|
+
SRA Verify supports the following check types:
|
|
349
|
+
|
|
350
|
+
**Account Checks**
|
|
351
|
+
|
|
352
|
+
Account checks evaluate security configurations within a single AWS account. These checks focus on resources and settings that are account-specific and can
|
|
353
|
+
be assessed independently.
|
|
354
|
+
|
|
355
|
+
Examples:
|
|
356
|
+
- Verifying GuardDuty detector exists in each region
|
|
357
|
+
- Checking if CloudTrail logging is enabled
|
|
358
|
+
|
|
359
|
+
**Management Checks**
|
|
360
|
+
|
|
361
|
+
Management checks assess configurations that involve AWS Organizations management account or organization-wide settings. These checks typically require
|
|
362
|
+
access to the Organizations API and evaluate controls that affect multiple accounts.
|
|
363
|
+
|
|
364
|
+
Examples:
|
|
365
|
+
- Check for an organization CloudTrail
|
|
366
|
+
|
|
367
|
+
When SRA Verify is deployed and run via CodeBuild, management checks will be ran on the management account. Account checks will be ran on each member.
|
|
368
|
+
|
|
369
|
+
## Library Usage
|
|
370
|
+
### Installation as a Library
|
|
371
|
+
```bash
|
|
372
|
+
pip install git+https://github.com/yourusername/sraverify.git
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### Code Examples
|
|
376
|
+
|
|
377
|
+
Here's a comprehensive example demonstrating all major features of the SRAVerify library:
|
|
378
|
+
|
|
379
|
+
```python
|
|
380
|
+
#!/usr/bin/env python3
|
|
381
|
+
"""
|
|
382
|
+
Comprehensive example of using SRA Verify as a library.
|
|
383
|
+
|
|
384
|
+
This example demonstrates all the major functionality provided by the SRAVerify library,
|
|
385
|
+
including initialization, listing available checks and services, and running checks with
|
|
386
|
+
various filtering options.
|
|
387
|
+
"""
|
|
388
|
+
|
|
389
|
+
import json
|
|
390
|
+
from typing import Dict, Any
|
|
391
|
+
from sraverify import SRAVerify
|
|
392
|
+
|
|
393
|
+
# Configuration
|
|
394
|
+
AWS_PROFILE = 'default' # Change this to your AWS profile if needed
|
|
395
|
+
AWS_REGIONS = ['us-east-1', 'us-west-2'] # Regions to check
|
|
396
|
+
AUDIT_ACCOUNTS = ['123456789012'] # Replace with your audit account IDs
|
|
397
|
+
LOG_ARCHIVE_ACCOUNTS = ['987654321098'] # Replace with your log archive account IDs
|
|
398
|
+
|
|
399
|
+
def print_section(title: str):
|
|
400
|
+
"""Print a section header."""
|
|
401
|
+
print("\n" + "=" * 80)
|
|
402
|
+
print(f" {title} ".center(80, "="))
|
|
403
|
+
print("=" * 80 + "\n")
|
|
404
|
+
|
|
405
|
+
def pretty_print(data: Dict[str, Any]):
|
|
406
|
+
"""Print data in a formatted way."""
|
|
407
|
+
print(json.dumps(data, indent=2))
|
|
408
|
+
|
|
409
|
+
def main():
|
|
410
|
+
"""Run the comprehensive example."""
|
|
411
|
+
print_section("SRAVerify Library Usage Example")
|
|
412
|
+
|
|
413
|
+
# Initialize SRAVerify with configuration
|
|
414
|
+
print("Initializing SRAVerify...")
|
|
415
|
+
sra = SRAVerify(
|
|
416
|
+
profile=AWS_PROFILE,
|
|
417
|
+
regions=AWS_REGIONS,
|
|
418
|
+
debug=True # Enable debug logging
|
|
419
|
+
)
|
|
420
|
+
print("✓ SRAVerify initialized\n")
|
|
421
|
+
|
|
422
|
+
# Example 1: List all available services
|
|
423
|
+
print_section("Available Services")
|
|
424
|
+
services = sra.get_available_services()
|
|
425
|
+
print("Services that can be checked:")
|
|
426
|
+
for service in services:
|
|
427
|
+
print(f" • {service}")
|
|
428
|
+
|
|
429
|
+
# Example 2: List all available checks
|
|
430
|
+
print_section("Available Checks")
|
|
431
|
+
all_checks = sra.get_available_checks()
|
|
432
|
+
print("All available security checks:")
|
|
433
|
+
for check_id, info in all_checks.items():
|
|
434
|
+
print(f"\n{check_id}:")
|
|
435
|
+
print(f" Name: {info['name']}")
|
|
436
|
+
print(f" Service: {info['service']}")
|
|
437
|
+
print(f" Account Type: {info['account_type']}")
|
|
438
|
+
print(f" Severity: {info['severity']}")
|
|
439
|
+
|
|
440
|
+
# Example 3: Get checks for specific account types
|
|
441
|
+
print_section("Account-Specific Checks")
|
|
442
|
+
account_types = ['management', 'audit', 'log-archive', 'application']
|
|
443
|
+
|
|
444
|
+
for acc_type in account_types:
|
|
445
|
+
checks = sra.get_available_checks(account_type=acc_type)
|
|
446
|
+
print(f"\nChecks for {acc_type} accounts:")
|
|
447
|
+
for check_id, info in checks.items():
|
|
448
|
+
print(f" • {check_id}: {info['name']}")
|
|
449
|
+
|
|
450
|
+
# Example 4: Run all checks
|
|
451
|
+
print_section("Running All Checks")
|
|
452
|
+
print("Running all security checks...")
|
|
453
|
+
findings = sra.run_checks(
|
|
454
|
+
account_type='all',
|
|
455
|
+
audit_accounts=AUDIT_ACCOUNTS,
|
|
456
|
+
log_archive_accounts=LOG_ARCHIVE_ACCOUNTS,
|
|
457
|
+
show_progress=True
|
|
458
|
+
)
|
|
459
|
+
|
|
460
|
+
# Process and display findings
|
|
461
|
+
pass_count = sum(1 for f in findings if f['Status'] == 'PASS')
|
|
462
|
+
fail_count = sum(1 for f in findings if f['Status'] == 'FAIL')
|
|
463
|
+
error_count = sum(1 for f in findings if f['Status'] == 'ERROR')
|
|
464
|
+
|
|
465
|
+
print("\nResults Summary:")
|
|
466
|
+
print(f" Total Findings: {len(findings)}")
|
|
467
|
+
print(f" Pass: {pass_count}")
|
|
468
|
+
print(f" Fail: {fail_count}")
|
|
469
|
+
print(f" Error: {error_count}")
|
|
470
|
+
|
|
471
|
+
# Example 5: Run checks for specific service
|
|
472
|
+
print_section("Service-Specific Checks")
|
|
473
|
+
print("Running GuardDuty checks...")
|
|
474
|
+
gd_findings = sra.run_checks(
|
|
475
|
+
service='GuardDuty',
|
|
476
|
+
show_progress=True
|
|
477
|
+
)
|
|
478
|
+
|
|
479
|
+
print(f"\nGuardDuty Findings: {len(gd_findings)}")
|
|
480
|
+
for finding in gd_findings:
|
|
481
|
+
print(f"\nCheck: {finding['CheckId']}")
|
|
482
|
+
print(f"Status: {finding['Status']}")
|
|
483
|
+
print(f"Title: {finding['Title']}")
|
|
484
|
+
if finding['Status'] == 'FAIL':
|
|
485
|
+
print(f"Remediation: {finding['Remediation']}")
|
|
486
|
+
|
|
487
|
+
# Example 6: Run specific check
|
|
488
|
+
print_section("Single Check Example")
|
|
489
|
+
print("Running specific CloudTrail check (SRA-CT-1)...")
|
|
490
|
+
ct_findings = sra.run_checks(
|
|
491
|
+
check_id='SRA-CT-1',
|
|
492
|
+
show_progress=True
|
|
493
|
+
)
|
|
494
|
+
|
|
495
|
+
print("\nCloudTrail Check Results:")
|
|
496
|
+
pretty_print(ct_findings)
|
|
497
|
+
|
|
498
|
+
if __name__ == "__main__":
|
|
499
|
+
main()
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
This example demonstrates:
|
|
503
|
+
1. Initializing SRA Verify with custom configuration
|
|
504
|
+
2. Listing available services
|
|
505
|
+
3. Listing all security checks
|
|
506
|
+
4. Getting account-specific checks
|
|
507
|
+
5. Running all security checks
|
|
508
|
+
6. Running service-specific checks
|
|
509
|
+
7. Running individual checks
|
|
510
|
+
|
|
511
|
+
To use this example:
|
|
512
|
+
1. Save it as `example_sraverify.py`
|
|
513
|
+
2. Update the AWS configuration variables at the top
|
|
514
|
+
3. Run with `python example_sraverify.py`
|
|
515
|
+
|
|
516
|
+
The example demonstrates all major features of the library with proper error handling and formatted output.
|