blockmine 1.20.0 → 1.22.0
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.
- package/.claude/agents/README.md +469 -0
- package/.claude/agents/auth-route-debugger.md +118 -0
- package/.claude/agents/auth-route-tester.md +93 -0
- package/.claude/agents/auto-error-resolver.md +97 -0
- package/.claude/agents/build-optimizer.md +236 -0
- package/.claude/agents/code-architecture-reviewer.md +83 -0
- package/.claude/agents/code-refactor-master.md +94 -0
- package/.claude/agents/cost-optimizer.md +134 -0
- package/.claude/agents/deployment-orchestrator.md +113 -0
- package/.claude/agents/documentation-architect.md +82 -0
- package/.claude/agents/frontend-error-fixer.md +77 -0
- package/.claude/agents/iac-code-generator.md +71 -0
- package/.claude/agents/incident-responder.md +346 -0
- package/.claude/agents/infrastructure-architect.md +31 -0
- package/.claude/agents/kubernetes-specialist.md +56 -0
- package/.claude/agents/migration-planner.md +181 -0
- package/.claude/agents/network-architect.md +196 -0
- package/.claude/agents/plan-reviewer.md +52 -0
- package/.claude/agents/refactor-planner.md +63 -0
- package/.claude/agents/security-scanner.md +102 -0
- package/.claude/agents/web-research-specialist.md +78 -0
- package/.claude/commands/cost-analysis.md +315 -0
- package/.claude/commands/dev-docs-update.md +55 -0
- package/.claude/commands/dev-docs.md +51 -0
- package/.claude/commands/incident-debug.md +247 -0
- package/.claude/commands/infra-plan.md +81 -0
- package/.claude/commands/migration-plan.md +478 -0
- package/.claude/commands/route-research-for-testing.md +37 -0
- package/.claude/commands/security-review.md +66 -0
- package/.claude/hooks/CONFIG.md +448 -0
- package/.claude/hooks/README.md +163 -0
- package/.claude/hooks/SKILL_ACTIVATION_COMPLETE.md +226 -0
- package/.claude/hooks/WINDOWS_HOOKS_README.md +151 -0
- package/.claude/hooks/add-skill-activation-banners.ts +132 -0
- package/.claude/hooks/comprehensive-skill-test.ts +1315 -0
- package/.claude/hooks/error-handling-reminder.sh +12 -0
- package/.claude/hooks/error-handling-reminder.ts +222 -0
- package/.claude/hooks/k8s-manifest-validator.sh +56 -0
- package/.claude/hooks/package-lock.json +556 -0
- package/.claude/hooks/package.json +16 -0
- package/.claude/hooks/post-tool-use-tracker.ps1 +174 -0
- package/.claude/hooks/post-tool-use-tracker.sh +183 -0
- package/.claude/hooks/security-policy-check.sh +247 -0
- package/.claude/hooks/skill-activation-prompt.ps1 +10 -0
- package/.claude/hooks/skill-activation-prompt.sh +10 -0
- package/.claude/hooks/skill-activation-prompt.ts +141 -0
- package/.claude/hooks/stop-build-check-enhanced.sh +130 -0
- package/.claude/hooks/terraform-validator.sh +53 -0
- package/.claude/hooks/test-input.json +7 -0
- package/.claude/hooks/test-skill-activation.ts +427 -0
- package/.claude/hooks/trigger-build-resolver.sh +79 -0
- package/.claude/hooks/tsc-check.sh +173 -0
- package/.claude/hooks/tsconfig.json +19 -0
- package/.claude/settings.json +55 -0
- package/.claude/settings.local.json +28 -3
- package/.claude/skills/README.md +507 -0
- package/.claude/skills/api-engineering/SKILL.md +63 -0
- package/.claude/skills/api-engineering/resources/api-versioning.md +88 -0
- package/.claude/skills/api-engineering/resources/graphql-patterns.md +106 -0
- package/.claude/skills/api-engineering/resources/rate-limiting.md +118 -0
- package/.claude/skills/api-engineering/resources/rest-api-design.md +105 -0
- package/.claude/skills/backend-dev-guidelines/SKILL.md +306 -0
- package/.claude/skills/backend-dev-guidelines/resources/architecture-overview.md +451 -0
- package/.claude/skills/backend-dev-guidelines/resources/async-and-errors.md +307 -0
- package/.claude/skills/backend-dev-guidelines/resources/complete-examples.md +638 -0
- package/.claude/skills/backend-dev-guidelines/resources/configuration.md +275 -0
- package/.claude/skills/backend-dev-guidelines/resources/database-patterns.md +224 -0
- package/.claude/skills/backend-dev-guidelines/resources/middleware-guide.md +213 -0
- package/.claude/skills/backend-dev-guidelines/resources/routing-and-controllers.md +756 -0
- package/.claude/skills/backend-dev-guidelines/resources/sentry-and-monitoring.md +336 -0
- package/.claude/skills/backend-dev-guidelines/resources/services-and-repositories.md +789 -0
- package/.claude/skills/backend-dev-guidelines/resources/testing-guide.md +235 -0
- package/.claude/skills/backend-dev-guidelines/resources/validation-patterns.md +754 -0
- package/.claude/skills/budget-and-cost-management/SKILL.md +850 -0
- package/.claude/skills/build-engineering/SKILL.md +431 -0
- package/.claude/skills/build-engineering/resources/artifact-repositories.md +72 -0
- package/.claude/skills/build-engineering/resources/build-caching.md +96 -0
- package/.claude/skills/build-engineering/resources/build-pipelines.md +105 -0
- package/.claude/skills/build-engineering/resources/build-security.md +95 -0
- package/.claude/skills/build-engineering/resources/build-systems.md +389 -0
- package/.claude/skills/build-engineering/resources/compilation-optimization.md +201 -0
- package/.claude/skills/build-engineering/resources/dependency-management.md +73 -0
- package/.claude/skills/build-engineering/resources/monorepo-builds.md +110 -0
- package/.claude/skills/build-engineering/resources/performance-optimization.md +113 -0
- package/.claude/skills/build-engineering/resources/reproducible-builds.md +82 -0
- package/.claude/skills/cloud-engineering/SKILL.md +675 -0
- package/.claude/skills/cloud-engineering/resources/aws-patterns.md +742 -0
- package/.claude/skills/cloud-engineering/resources/azure-patterns.md +714 -0
- package/.claude/skills/cloud-engineering/resources/cleared-cloud-environments.md +987 -0
- package/.claude/skills/cloud-engineering/resources/cloud-cost-optimization.md +757 -0
- package/.claude/skills/cloud-engineering/resources/cloud-networking.md +1058 -0
- package/.claude/skills/cloud-engineering/resources/cloud-security-tools.md +1530 -0
- package/.claude/skills/cloud-engineering/resources/cloud-security.md +990 -0
- package/.claude/skills/cloud-engineering/resources/gcp-patterns.md +758 -0
- package/.claude/skills/cloud-engineering/resources/migration-strategies.md +820 -0
- package/.claude/skills/cloud-engineering/resources/multi-cloud-strategies.md +670 -0
- package/.claude/skills/cloud-engineering/resources/oci-patterns.md +1198 -0
- package/.claude/skills/cloud-engineering/resources/serverless-patterns.md +795 -0
- package/.claude/skills/cloud-engineering/resources/well-architected-frameworks.md +966 -0
- package/.claude/skills/cybersecurity/SKILL.md +409 -0
- package/.claude/skills/cybersecurity/resources/security-architecture.md +266 -0
- package/.claude/skills/database-engineering/SKILL.md +61 -0
- package/.claude/skills/database-engineering/resources/backup-and-recovery.md +72 -0
- package/.claude/skills/database-engineering/resources/database-replication.md +63 -0
- package/.claude/skills/database-engineering/resources/postgresql-fundamentals.md +70 -0
- package/.claude/skills/database-engineering/resources/query-optimization.md +68 -0
- package/.claude/skills/devsecops/SKILL.md +374 -0
- package/.claude/skills/devsecops/resources/ci-cd-security.md +204 -0
- package/.claude/skills/devsecops/resources/compliance-automation.md +530 -0
- package/.claude/skills/devsecops/resources/compliance-frameworks.md +2322 -0
- package/.claude/skills/devsecops/resources/container-security.md +915 -0
- package/.claude/skills/devsecops/resources/cspm-integration.md +1440 -0
- package/.claude/skills/devsecops/resources/policy-enforcement.md +619 -0
- package/.claude/skills/devsecops/resources/secrets-management.md +755 -0
- package/.claude/skills/devsecops/resources/security-monitoring.md +146 -0
- package/.claude/skills/devsecops/resources/security-scanning.md +887 -0
- package/.claude/skills/devsecops/resources/security-testing.md +203 -0
- package/.claude/skills/devsecops/resources/supply-chain-security.md +518 -0
- package/.claude/skills/devsecops/resources/vulnerability-management.md +481 -0
- package/.claude/skills/devsecops/resources/zero-trust-architecture.md +177 -0
- package/.claude/skills/documentation-as-code/SKILL.md +323 -0
- package/.claude/skills/documentation-as-code/resources/api-documentation.md +90 -0
- package/.claude/skills/documentation-as-code/resources/changelog-management.md +79 -0
- package/.claude/skills/documentation-as-code/resources/diagram-generation.md +44 -0
- package/.claude/skills/documentation-as-code/resources/docs-as-code-workflow.md +99 -0
- package/.claude/skills/documentation-as-code/resources/documentation-automation.md +68 -0
- package/.claude/skills/documentation-as-code/resources/documentation-sites.md +79 -0
- package/.claude/skills/documentation-as-code/resources/markdown-best-practices.md +162 -0
- package/.claude/skills/documentation-as-code/resources/openapi-specification.md +77 -0
- package/.claude/skills/documentation-as-code/resources/readme-engineering.md +60 -0
- package/.claude/skills/documentation-as-code/resources/technical-writing-guide.md +202 -0
- package/.claude/skills/engineering-management/SKILL.md +356 -0
- package/.claude/skills/engineering-management/resources/career-ladders.md +609 -0
- package/.claude/skills/engineering-management/resources/hiring-and-assessment.md +555 -0
- package/.claude/skills/engineering-management/resources/one-on-one-guides.md +609 -0
- package/.claude/skills/engineering-management/resources/resource-planning.md +557 -0
- package/.claude/skills/engineering-management/resources/team-organization-patterns.md +491 -0
- package/.claude/skills/engineering-management/resources/technical-interviews.md +474 -0
- package/.claude/skills/engineering-operations-management/SKILL.md +817 -0
- package/.claude/skills/error-tracking/SKILL.md +379 -0
- package/.claude/skills/frontend-dev-guidelines/SKILL.md +403 -0
- package/.claude/skills/frontend-dev-guidelines/resources/common-patterns.md +331 -0
- package/.claude/skills/frontend-dev-guidelines/resources/complete-examples.md +872 -0
- package/.claude/skills/frontend-dev-guidelines/resources/component-patterns.md +502 -0
- package/.claude/skills/frontend-dev-guidelines/resources/data-fetching.md +767 -0
- package/.claude/skills/frontend-dev-guidelines/resources/file-organization.md +502 -0
- package/.claude/skills/frontend-dev-guidelines/resources/loading-and-error-states.md +501 -0
- package/.claude/skills/frontend-dev-guidelines/resources/performance.md +406 -0
- package/.claude/skills/frontend-dev-guidelines/resources/routing-guide.md +364 -0
- package/.claude/skills/frontend-dev-guidelines/resources/styling-guide.md +428 -0
- package/.claude/skills/frontend-dev-guidelines/resources/typescript-standards.md +418 -0
- package/.claude/skills/general-it-engineering/SKILL.md +393 -0
- package/.claude/skills/general-it-engineering/resources/asset-management.md +712 -0
- package/.claude/skills/general-it-engineering/resources/automation-orchestration.md +817 -0
- package/.claude/skills/general-it-engineering/resources/business-continuity.md +786 -0
- package/.claude/skills/general-it-engineering/resources/change-management.md +715 -0
- package/.claude/skills/general-it-engineering/resources/enterprise-monitoring.md +729 -0
- package/.claude/skills/general-it-engineering/resources/help-desk-operations.md +738 -0
- package/.claude/skills/general-it-engineering/resources/incident-service-management.md +834 -0
- package/.claude/skills/general-it-engineering/resources/it-governance.md +753 -0
- package/.claude/skills/general-it-engineering/resources/itil-framework.md +503 -0
- package/.claude/skills/general-it-engineering/resources/service-management.md +669 -0
- package/.claude/skills/infrastructure-architecture/SKILL.md +328 -0
- package/.claude/skills/infrastructure-architecture/resources/architecture-decision-records.md +505 -0
- package/.claude/skills/infrastructure-architecture/resources/architecture-patterns.md +528 -0
- package/.claude/skills/infrastructure-architecture/resources/capacity-planning.md +453 -0
- package/.claude/skills/infrastructure-architecture/resources/cleared-environment-architecture.md +773 -0
- package/.claude/skills/infrastructure-architecture/resources/cost-architecture.md +499 -0
- package/.claude/skills/infrastructure-architecture/resources/data-architecture.md +501 -0
- package/.claude/skills/infrastructure-architecture/resources/disaster-recovery.md +535 -0
- package/.claude/skills/infrastructure-architecture/resources/migration-architecture.md +512 -0
- package/.claude/skills/infrastructure-architecture/resources/multi-region-design.md +608 -0
- package/.claude/skills/infrastructure-architecture/resources/reference-architectures.md +562 -0
- package/.claude/skills/infrastructure-architecture/resources/security-architecture.md +538 -0
- package/.claude/skills/infrastructure-architecture/resources/system-design-principles.md +489 -0
- package/.claude/skills/infrastructure-architecture/resources/workload-classification.md +1000 -0
- package/.claude/skills/infrastructure-strategy/SKILL.md +924 -0
- package/.claude/skills/network-engineering/SKILL.md +385 -0
- package/.claude/skills/network-engineering/resources/dns-management.md +738 -0
- package/.claude/skills/network-engineering/resources/load-balancing.md +820 -0
- package/.claude/skills/network-engineering/resources/network-architecture.md +546 -0
- package/.claude/skills/network-engineering/resources/network-security.md +921 -0
- package/.claude/skills/network-engineering/resources/network-troubleshooting.md +749 -0
- package/.claude/skills/network-engineering/resources/routing-switching.md +373 -0
- package/.claude/skills/network-engineering/resources/sdn-networking.md +695 -0
- package/.claude/skills/network-engineering/resources/service-mesh-networking.md +777 -0
- package/.claude/skills/network-engineering/resources/tcp-ip-protocols.md +444 -0
- package/.claude/skills/network-engineering/resources/vpn-connectivity.md +672 -0
- package/.claude/skills/observability-engineering/SKILL.md +101 -0
- package/.claude/skills/observability-engineering/resources/apm-tools.md +97 -0
- package/.claude/skills/observability-engineering/resources/correlation-strategies.md +87 -0
- package/.claude/skills/observability-engineering/resources/distributed-tracing.md +98 -0
- package/.claude/skills/observability-engineering/resources/logs-aggregation.md +118 -0
- package/.claude/skills/observability-engineering/resources/observability-cost-optimization.md +141 -0
- package/.claude/skills/observability-engineering/resources/opentelemetry.md +110 -0
- package/.claude/skills/platform-engineering/SKILL.md +555 -0
- package/.claude/skills/platform-engineering/resources/architecture-overview.md +600 -0
- package/.claude/skills/platform-engineering/resources/container-orchestration.md +916 -0
- package/.claude/skills/platform-engineering/resources/cost-optimization.md +634 -0
- package/.claude/skills/platform-engineering/resources/developer-platforms.md +670 -0
- package/.claude/skills/platform-engineering/resources/gitops-automation.md +650 -0
- package/.claude/skills/platform-engineering/resources/infrastructure-as-code.md +778 -0
- package/.claude/skills/platform-engineering/resources/infrastructure-standards.md +708 -0
- package/.claude/skills/platform-engineering/resources/multi-tenancy.md +602 -0
- package/.claude/skills/platform-engineering/resources/platform-security.md +711 -0
- package/.claude/skills/platform-engineering/resources/resource-management.md +592 -0
- package/.claude/skills/platform-engineering/resources/service-mesh.md +628 -0
- package/.claude/skills/release-engineering/SKILL.md +393 -0
- package/.claude/skills/release-engineering/resources/artifact-management.md +108 -0
- package/.claude/skills/release-engineering/resources/build-optimization.md +84 -0
- package/.claude/skills/release-engineering/resources/ci-cd-pipelines.md +411 -0
- package/.claude/skills/release-engineering/resources/deployment-strategies.md +197 -0
- package/.claude/skills/release-engineering/resources/pipeline-security.md +62 -0
- package/.claude/skills/release-engineering/resources/progressive-delivery.md +83 -0
- package/.claude/skills/release-engineering/resources/release-automation.md +68 -0
- package/.claude/skills/release-engineering/resources/release-orchestration.md +77 -0
- package/.claude/skills/release-engineering/resources/rollback-strategies.md +66 -0
- package/.claude/skills/release-engineering/resources/versioning-strategies.md +59 -0
- package/.claude/skills/route-tester/SKILL.md +392 -0
- package/.claude/skills/skill-developer/ADVANCED.md +197 -0
- package/.claude/skills/skill-developer/HOOK_MECHANISMS.md +306 -0
- package/.claude/skills/skill-developer/PATTERNS_LIBRARY.md +152 -0
- package/.claude/skills/skill-developer/SKILL.md +430 -0
- package/.claude/skills/skill-developer/SKILL_RULES_REFERENCE.md +315 -0
- package/.claude/skills/skill-developer/TRIGGER_TYPES.md +305 -0
- package/.claude/skills/skill-developer/TROUBLESHOOTING.md +514 -0
- package/.claude/skills/skill-rules.json +2940 -0
- package/.claude/skills/sre/SKILL.md +464 -0
- package/.claude/skills/sre/resources/alerting-best-practices.md +282 -0
- package/.claude/skills/sre/resources/capacity-planning.md +226 -0
- package/.claude/skills/sre/resources/chaos-engineering.md +193 -0
- package/.claude/skills/sre/resources/disaster-recovery.md +232 -0
- package/.claude/skills/sre/resources/incident-management.md +436 -0
- package/.claude/skills/sre/resources/observability-stack.md +240 -0
- package/.claude/skills/sre/resources/on-call-runbooks.md +167 -0
- package/.claude/skills/sre/resources/performance-optimization.md +108 -0
- package/.claude/skills/sre/resources/reliability-patterns.md +183 -0
- package/.claude/skills/sre/resources/slo-sli-sla.md +464 -0
- package/.claude/skills/sre/resources/toil-reduction.md +145 -0
- package/.claude/skills/systems-engineering/SKILL.md +648 -0
- package/.claude/skills/systems-engineering/resources/automation-patterns.md +771 -0
- package/.claude/skills/systems-engineering/resources/configuration-management.md +998 -0
- package/.claude/skills/systems-engineering/resources/linux-administration.md +672 -0
- package/.claude/skills/systems-engineering/resources/networking-fundamentals.md +982 -0
- package/.claude/skills/systems-engineering/resources/performance-tuning.md +871 -0
- package/.claude/skills/systems-engineering/resources/powershell-scripting.md +482 -0
- package/.claude/skills/systems-engineering/resources/security-hardening.md +739 -0
- package/.claude/skills/systems-engineering/resources/shell-scripting.md +915 -0
- package/.claude/skills/systems-engineering/resources/storage-management.md +628 -0
- package/.claude/skills/systems-engineering/resources/system-monitoring.md +787 -0
- package/.claude/skills/systems-engineering/resources/troubleshooting-guide.md +753 -0
- package/.claude/skills/systems-engineering/resources/windows-administration.md +738 -0
- package/.claude/skills/technical-leadership/SKILL.md +728 -0
- package/CHANGELOG.md +90 -39
- package/README.md +94 -0
- package/backend/docs/SECRETS_DOCUMENTATION.md +327 -0
- package/backend/jest.config.js +59 -0
- package/backend/package-lock.json +6129 -0
- package/backend/package.json +16 -4
- package/backend/prisma/migrations/20251026104609_add_websocket_api/migration.sql +33 -0
- package/backend/prisma/schema.prisma +33 -0
- package/backend/src/__tests__/core/DependencyService.test.js +336 -0
- package/backend/src/__tests__/core/UserService.test.js +875 -0
- package/backend/src/__tests__/repositories/BaseRepository.test.js +146 -0
- package/backend/src/__tests__/repositories/BotRepository.test.js +118 -0
- package/backend/src/__tests__/repositories/CommandRepository.test.js +132 -0
- package/backend/src/__tests__/repositories/EventGraphRepository.test.js +93 -0
- package/backend/src/__tests__/repositories/GroupRepository.test.js +155 -0
- package/backend/src/__tests__/repositories/PermissionRepository.test.js +130 -0
- package/backend/src/__tests__/repositories/PluginRepository.test.js +107 -0
- package/backend/src/__tests__/repositories/ServerRepository.test.js +80 -0
- package/backend/src/__tests__/repositories/UserRepository.test.js +128 -0
- package/backend/src/__tests__/secretsFilter.test.js +425 -0
- package/backend/src/__tests__/services/BotLifecycleService.test.js +411 -0
- package/backend/src/__tests__/services/BotProcessManager.test.js +285 -0
- package/backend/src/__tests__/services/CacheManager.test.js +125 -0
- package/backend/src/__tests__/services/CommandExecutionService.test.js +460 -0
- package/backend/src/__tests__/services/ResourceMonitorService.test.js +207 -0
- package/backend/src/__tests__/services/TelemetryService.test.js +291 -0
- package/backend/src/__tests__/setup.js +25 -0
- package/backend/src/api/routes/apiKeys.js +181 -0
- package/backend/src/api/routes/bots.js +49 -7
- package/backend/src/api/routes/plugins.js +2 -1
- package/backend/src/api/routes/system.js +174 -0
- package/backend/src/container.js +82 -0
- package/backend/src/core/BotManager.js +142 -871
- package/backend/src/core/BotManager.old.js +1093 -0
- package/backend/src/core/BotProcess.js +1092 -850
- package/backend/src/core/BreakLoopSignal.js +8 -0
- package/backend/src/core/EventGraphManager.js +280 -193
- package/backend/src/core/GraphExecutionEngine.js +321 -928
- package/backend/src/core/MessageQueue.js +27 -6
- package/backend/src/core/NodeRegistry.js +37 -991
- package/backend/src/core/PluginManager.js +62 -12
- package/backend/src/core/PrismaService.js +32 -0
- package/backend/src/core/UserService.js +3 -3
- package/backend/src/core/__tests__/PrismaService.test.js +24 -0
- package/backend/src/core/commands/README.md +305 -0
- package/backend/src/core/commands/dev.js +13 -7
- package/backend/src/core/commands/ping.js +10 -4
- package/backend/src/core/commands/whois.js +63 -0
- package/backend/src/core/config/validation.js +27 -0
- package/backend/src/core/constants/graphTypes.js +21 -0
- package/backend/src/core/node-registries/actions.js +132 -0
- package/backend/src/core/node-registries/arrays.js +137 -0
- package/backend/src/core/node-registries/bot.js +23 -0
- package/backend/src/core/node-registries/data.js +290 -0
- package/backend/src/core/node-registries/debug.js +26 -0
- package/backend/src/core/node-registries/events.js +187 -0
- package/backend/src/core/node-registries/flow.js +139 -0
- package/backend/src/core/node-registries/logic.js +45 -0
- package/backend/src/core/node-registries/math.js +42 -0
- package/backend/src/core/node-registries/objects.js +98 -0
- package/backend/src/core/node-registries/strings.js +153 -0
- package/backend/src/core/node-registries/time.js +113 -0
- package/backend/src/core/node-registries/users.js +79 -0
- package/backend/src/core/nodes/actions/bot_look_at.js +36 -0
- package/backend/src/core/nodes/actions/bot_set_variable.js +32 -0
- package/backend/src/core/nodes/actions/http_request.js +98 -0
- package/backend/src/core/nodes/actions/send_log.js +28 -0
- package/backend/src/core/nodes/actions/send_message.js +32 -0
- package/backend/src/core/nodes/actions/send_websocket_response.js +33 -0
- package/backend/src/core/nodes/arrays/add_element.js +23 -0
- package/backend/src/core/nodes/arrays/contains.js +40 -0
- package/backend/src/core/nodes/arrays/find_index.js +23 -0
- package/backend/src/core/nodes/arrays/get_by_index.js +23 -0
- package/backend/src/core/nodes/arrays/get_next.js +35 -0
- package/backend/src/core/nodes/arrays/get_random_element.js +32 -0
- package/backend/src/core/nodes/arrays/remove_by_index.js +30 -0
- package/backend/src/core/nodes/bot/get_position.js +20 -0
- package/backend/src/core/nodes/data/array_literal.js +31 -0
- package/backend/src/core/nodes/data/boolean_literal.js +21 -0
- package/backend/src/core/nodes/data/cast.js +42 -0
- package/backend/src/core/nodes/data/datetime_literal.js +27 -0
- package/backend/src/core/nodes/data/entity_info.js +69 -0
- package/backend/src/core/nodes/data/get_argument.js +23 -0
- package/backend/src/core/nodes/data/get_bot_look.js +14 -0
- package/backend/src/core/nodes/data/get_entity_field.js +18 -0
- package/backend/src/core/nodes/data/get_nearby_entities.js +32 -0
- package/backend/src/core/nodes/data/get_nearby_players.js +64 -0
- package/backend/src/core/nodes/data/get_server_players.js +18 -0
- package/backend/src/core/nodes/data/get_user_field.js +40 -0
- package/backend/src/core/nodes/data/get_variable.js +23 -0
- package/backend/src/core/nodes/data/length.js +25 -0
- package/backend/src/core/nodes/data/make_object.js +31 -0
- package/backend/src/core/nodes/data/number_literal.js +21 -0
- package/backend/src/core/nodes/data/string_literal.js +34 -0
- package/backend/src/core/nodes/data/type_check.js +53 -0
- package/backend/src/core/nodes/debug/log.js +16 -0
- package/backend/src/core/nodes/flow/branch.js +15 -0
- package/backend/src/core/nodes/flow/break.js +14 -0
- package/backend/src/core/nodes/flow/delay.js +43 -0
- package/backend/src/core/nodes/flow/for_each.js +39 -0
- package/backend/src/core/nodes/flow/sequence.js +16 -0
- package/backend/src/core/nodes/flow/switch.js +47 -0
- package/backend/src/core/nodes/flow/while.js +64 -0
- package/backend/src/core/nodes/logic/__tests__/compare.test.js +83 -0
- package/backend/src/core/nodes/logic/compare.js +33 -0
- package/backend/src/core/nodes/logic/operation.js +35 -0
- package/backend/src/core/nodes/math/__tests__/operation.test.js +65 -0
- package/backend/src/core/nodes/math/operation.js +31 -0
- package/backend/src/core/nodes/math/random_number.js +43 -0
- package/backend/src/core/nodes/objects/create.js +40 -0
- package/backend/src/core/nodes/objects/delete.js +26 -0
- package/backend/src/core/nodes/objects/get.js +23 -0
- package/backend/src/core/nodes/objects/has_key.js +30 -0
- package/backend/src/core/nodes/objects/set.js +27 -0
- package/backend/src/core/nodes/strings/__tests__/concat.test.js +89 -0
- package/backend/src/core/nodes/strings/concat.js +27 -0
- package/backend/src/core/nodes/strings/contains.js +41 -0
- package/backend/src/core/nodes/strings/ends_with.js +43 -0
- package/backend/src/core/nodes/strings/equals.js +36 -0
- package/backend/src/core/nodes/strings/length.js +36 -0
- package/backend/src/core/nodes/strings/matches.js +39 -0
- package/backend/src/core/nodes/strings/split.js +37 -0
- package/backend/src/core/nodes/strings/starts_with.js +43 -0
- package/backend/src/core/nodes/time/__tests__/now.test.js +24 -0
- package/backend/src/core/nodes/time/add.js +33 -0
- package/backend/src/core/nodes/time/compare.js +35 -0
- package/backend/src/core/nodes/time/diff.js +29 -0
- package/backend/src/core/nodes/time/format.js +32 -0
- package/backend/src/core/nodes/time/now.js +18 -0
- package/backend/src/core/nodes/users/check_blacklist.js +37 -0
- package/backend/src/core/nodes/users/get_groups.js +36 -0
- package/backend/src/core/nodes/users/get_permissions.js +36 -0
- package/backend/src/core/nodes/users/set_blacklist.js +37 -0
- package/backend/src/core/services/BotLifecycleService.js +596 -0
- package/backend/src/core/services/BotProcessManager.js +163 -0
- package/backend/src/core/services/CacheManager.js +111 -0
- package/backend/src/core/services/CommandExecutionService.js +351 -0
- package/backend/src/core/services/ResourceMonitorService.js +90 -0
- package/backend/src/core/services/TelemetryService.js +124 -0
- package/backend/src/core/services/ValidationService.js +132 -0
- package/backend/src/core/services/__tests__/ValidationService.test.js +148 -0
- package/backend/src/core/services.js +20 -5
- package/backend/src/core/system/CommandContext.js +84 -0
- package/backend/src/core/system/Transport.js +78 -0
- package/backend/src/core/utils/__tests__/jsonParser.test.js +44 -0
- package/backend/src/core/utils/jsonParser.js +18 -0
- package/backend/src/core/utils/secretsFilter.js +262 -0
- package/backend/src/core/utils/variableParser.js +89 -0
- package/backend/src/core/validation/__tests__/nodeSchemas.test.js +175 -0
- package/backend/src/core/validation/nodeSchemas.js +112 -0
- package/backend/src/lib/prisma.js +2 -4
- package/backend/src/real-time/botApi/handlers/commandHandlers.js +28 -0
- package/backend/src/real-time/botApi/handlers/graphHandlers.js +99 -0
- package/backend/src/real-time/botApi/handlers/graphWebSocketHandlers.js +147 -0
- package/backend/src/real-time/botApi/handlers/index.js +43 -0
- package/backend/src/real-time/botApi/handlers/messageHandlers.js +66 -0
- package/backend/src/real-time/botApi/handlers/statusHandlers.js +17 -0
- package/backend/src/real-time/botApi/handlers/userHandlers.js +141 -0
- package/backend/src/real-time/botApi/index.js +40 -0
- package/backend/src/real-time/botApi/middleware.js +79 -0
- package/backend/src/real-time/botApi/utils.js +54 -0
- package/backend/src/real-time/socketHandler.js +6 -2
- package/backend/src/repositories/BaseRepository.js +43 -0
- package/backend/src/repositories/BotRepository.js +42 -0
- package/backend/src/repositories/CommandRepository.js +53 -0
- package/backend/src/repositories/EventGraphRepository.js +40 -0
- package/backend/src/repositories/GroupRepository.js +69 -0
- package/backend/src/repositories/PermissionRepository.js +48 -0
- package/backend/src/repositories/PluginRepository.js +42 -0
- package/backend/src/repositories/ServerRepository.js +27 -0
- package/backend/src/repositories/UserRepository.js +48 -0
- package/backend/src/server.js +3 -0
- package/backend/src/test-refactor.js +85 -0
- package/frontend/dist/assets/index-CfTo92bP.css +1 -0
- package/frontend/dist/assets/index-CiFD5X9Z.js +8344 -0
- package/frontend/dist/index.html +2 -2
- package/frontend/package.json +1 -5
- package/package.json +2 -1
- package/frontend/dist/assets/index-BFd7YoAj.css +0 -1
- package/frontend/dist/assets/index-CMMutadc.js +0 -8352
- package/nul +0 -0
|
@@ -0,0 +1,2322 @@
|
|
|
1
|
+
# Compliance Frameworks
|
|
2
|
+
|
|
3
|
+
Comprehensive guide to compliance frameworks including FedRAMP, CMMC, NIST 800-53/800-171, ITAR, CJIS, PCI-DSS, HIPAA, and SOC 2.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Overview](#overview)
|
|
8
|
+
- [FedRAMP (Federal Risk and Authorization Management Program)](#fedramp-federal-risk-and-authorization-management-program)
|
|
9
|
+
- [CMMC (Cybersecurity Maturity Model Certification)](#cmmc-cybersecurity-maturity-model-certification)
|
|
10
|
+
- [NIST 800-53](#nist-800-53)
|
|
11
|
+
- [NIST 800-171](#nist-800-171)
|
|
12
|
+
- [ITAR (International Traffic in Arms Regulations)](#itar-international-traffic-in-arms-regulations)
|
|
13
|
+
- [CJIS (Criminal Justice Information Services)](#cjis-criminal-justice-information-services)
|
|
14
|
+
- [PCI-DSS (Payment Card Industry Data Security Standard)](#pci-dss-payment-card-industry-data-security-standard)
|
|
15
|
+
- [HIPAA (Health Insurance Portability and Accountability Act)](#hipaa-health-insurance-portability-and-accountability-act)
|
|
16
|
+
- [SOC 2 (Service Organization Control 2)](#soc-2-service-organization-control-2)
|
|
17
|
+
- [Compliance Mapping](#compliance-mapping)
|
|
18
|
+
- [Implementation Checklists](#implementation-checklists)
|
|
19
|
+
- [Audit Preparation](#audit-preparation)
|
|
20
|
+
- [Best Practices](#best-practices)
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Overview
|
|
25
|
+
|
|
26
|
+
**Compliance frameworks** provide structured approaches to implementing security controls, managing risk, and demonstrating compliance with regulatory requirements.
|
|
27
|
+
|
|
28
|
+
**Framework Hierarchy:**
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
Compliance Framework Landscape:
|
|
32
|
+
┌─────────────────────────────────────────────────────┐
|
|
33
|
+
│ GOVERNMENT & DEFENSE │
|
|
34
|
+
│ - FedRAMP (Low, Moderate, High) │
|
|
35
|
+
│ - CMMC (Levels 1-3) │
|
|
36
|
+
│ - NIST 800-53 (DoD, Federal) │
|
|
37
|
+
│ - NIST 800-171 (CUI) │
|
|
38
|
+
│ - ITAR (Export control) │
|
|
39
|
+
│ - CJIS (Law enforcement) │
|
|
40
|
+
├─────────────────────────────────────────────────────┤
|
|
41
|
+
│ COMMERCIAL & INDUSTRY │
|
|
42
|
+
│ - PCI-DSS (Payment cards) │
|
|
43
|
+
│ - HIPAA (Healthcare) │
|
|
44
|
+
│ - SOC 2 (Service providers) │
|
|
45
|
+
│ - ISO 27001 (International) │
|
|
46
|
+
│ - GDPR (EU data protection) │
|
|
47
|
+
└─────────────────────────────────────────────────────┘
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Applicability Matrix:**
|
|
51
|
+
|
|
52
|
+
| Framework | Industry | Scope | Mandatory |
|
|
53
|
+
|-----------|----------|-------|-----------|
|
|
54
|
+
| FedRAMP | Government cloud services | Federal agencies | Yes (for cloud) |
|
|
55
|
+
| CMMC | Defense contractors | DoD supply chain | Yes (upcoming) |
|
|
56
|
+
| NIST 800-53 | Federal agencies | Government systems | Yes |
|
|
57
|
+
| NIST 800-171 | Defense contractors | CUI handling | Yes |
|
|
58
|
+
| ITAR | Defense/aerospace | Export-controlled data | Yes |
|
|
59
|
+
| CJIS | Law enforcement | Criminal justice data | Yes |
|
|
60
|
+
| PCI-DSS | Payment processors | Card data | Yes |
|
|
61
|
+
| HIPAA | Healthcare | PHI/ePHI | Yes |
|
|
62
|
+
| SOC 2 | Service providers | Customer data | Voluntary |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## FedRAMP (Federal Risk and Authorization Management Program)
|
|
67
|
+
|
|
68
|
+
**FedRAMP** is a government-wide program providing a standardized approach to security assessment, authorization, and continuous monitoring for cloud products and services.
|
|
69
|
+
|
|
70
|
+
### Impact Levels
|
|
71
|
+
|
|
72
|
+
| Level | Controls | Data Classification | Use Case |
|
|
73
|
+
|-------|----------|---------------------|----------|
|
|
74
|
+
| **Low** | 125+ controls | Public information | Low-impact systems |
|
|
75
|
+
| **Moderate** | 325+ controls | Moderate sensitivity | Most federal systems |
|
|
76
|
+
| **High** | 421+ controls | High sensitivity | Law enforcement, financial |
|
|
77
|
+
|
|
78
|
+
### Control Families (NIST 800-53)
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
FedRAMP Control Structure (800-53):
|
|
82
|
+
┌─────────────────────────────────────────────────────┐
|
|
83
|
+
│ AC - Access Control (22 controls) │
|
|
84
|
+
│ AT - Awareness and Training (5 controls) │
|
|
85
|
+
│ AU - Audit and Accountability (16 controls) │
|
|
86
|
+
│ CA - Security Assessment and Authorization (9) │
|
|
87
|
+
│ CM - Configuration Management (11 controls) │
|
|
88
|
+
│ CP - Contingency Planning (13 controls) │
|
|
89
|
+
│ IA - Identification and Authentication (11) │
|
|
90
|
+
│ IR - Incident Response (10 controls) │
|
|
91
|
+
│ MA - Maintenance (6 controls) │
|
|
92
|
+
│ MP - Media Protection (8 controls) │
|
|
93
|
+
│ PE - Physical and Environmental Protection (20) │
|
|
94
|
+
│ PL - Planning (9 controls) │
|
|
95
|
+
│ PS - Personnel Security (8 controls) │
|
|
96
|
+
│ RA - Risk Assessment (6 controls) │
|
|
97
|
+
│ SA - System and Services Acquisition (23) │
|
|
98
|
+
│ SC - System and Communications Protection (46) │
|
|
99
|
+
│ SI - System and Information Integrity (23) │
|
|
100
|
+
│ PM - Program Management (16 controls) │
|
|
101
|
+
└─────────────────────────────────────────────────────┘
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Key Requirements
|
|
105
|
+
|
|
106
|
+
**1. Continuous Monitoring:**
|
|
107
|
+
|
|
108
|
+
```yaml
|
|
109
|
+
# continuous-monitoring-requirements.yaml
|
|
110
|
+
monitoring:
|
|
111
|
+
operating_system_scans:
|
|
112
|
+
frequency: monthly
|
|
113
|
+
tool: "Tenable, Qualys, or equivalent"
|
|
114
|
+
scope: "All VMs, containers, serverless"
|
|
115
|
+
|
|
116
|
+
database_scans:
|
|
117
|
+
frequency: monthly
|
|
118
|
+
tool: "AppDetectivePro, DbProtect, or equivalent"
|
|
119
|
+
scope: "All databases (RDS, Aurora, etc.)"
|
|
120
|
+
|
|
121
|
+
web_application_scans:
|
|
122
|
+
frequency: monthly
|
|
123
|
+
tool: "WebInspect, AppScan, Burp Suite"
|
|
124
|
+
scope: "All public-facing applications"
|
|
125
|
+
|
|
126
|
+
incident_response:
|
|
127
|
+
initial_notification: "1 hour"
|
|
128
|
+
full_report: "within SLA"
|
|
129
|
+
documentation: "required in POA&M"
|
|
130
|
+
|
|
131
|
+
inventory:
|
|
132
|
+
update_frequency: "monthly"
|
|
133
|
+
required_fields:
|
|
134
|
+
- asset_type
|
|
135
|
+
- ip_address
|
|
136
|
+
- software_versions
|
|
137
|
+
- patch_status
|
|
138
|
+
- data_classification
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**2. FedRAMP Authorization Process:**
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
Authorization Process (6-12 months):
|
|
145
|
+
┌─────────────────────────────────────────────────────┐
|
|
146
|
+
│ 1. Package Development (2-4 months) │
|
|
147
|
+
│ - System Security Plan (SSP) │
|
|
148
|
+
│ - 13+ required attachments │
|
|
149
|
+
│ - Control implementation evidence │
|
|
150
|
+
├─────────────────────────────────────────────────────┤
|
|
151
|
+
│ 2. 3PAO Assessment (2-3 months) │
|
|
152
|
+
│ - Security Assessment Plan (SAP) │
|
|
153
|
+
│ - On-site assessment │
|
|
154
|
+
│ - Security Assessment Report (SAR) │
|
|
155
|
+
├─────────────────────────────────────────────────────┤
|
|
156
|
+
│ 3. Remediation (1-2 months) │
|
|
157
|
+
│ - Fix identified vulnerabilities │
|
|
158
|
+
│ - Document in POA&M │
|
|
159
|
+
│ - 3PAO validation │
|
|
160
|
+
├─────────────────────────────────────────────────────┤
|
|
161
|
+
│ 4. Authorization (1-3 months) │
|
|
162
|
+
│ - FedRAMP PMO review │
|
|
163
|
+
│ - JAB review (for JAB P-ATO) │
|
|
164
|
+
│ - Agency review (for Agency ATO) │
|
|
165
|
+
│ - Authorization to Operate (ATO) issued │
|
|
166
|
+
├─────────────────────────────────────────────────────┤
|
|
167
|
+
│ 5. Continuous Monitoring (ongoing) │
|
|
168
|
+
│ - Monthly deliverables │
|
|
169
|
+
│ - Annual assessment │
|
|
170
|
+
│ - POA&M updates │
|
|
171
|
+
└─────────────────────────────────────────────────────┘
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**3. Terraform Implementation Example:**
|
|
175
|
+
|
|
176
|
+
```hcl
|
|
177
|
+
# fedramp-compliant-infrastructure.tf
|
|
178
|
+
# Example: FedRAMP Moderate baseline
|
|
179
|
+
|
|
180
|
+
# Encryption at rest (SC-28)
|
|
181
|
+
resource "aws_ebs_encryption_by_default" "fedramp" {
|
|
182
|
+
enabled = true
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
# Logging and monitoring (AU-2, AU-3, AU-12)
|
|
186
|
+
resource "aws_cloudtrail" "fedramp_trail" {
|
|
187
|
+
name = "fedramp-cloudtrail"
|
|
188
|
+
s3_bucket_name = aws_s3_bucket.cloudtrail_bucket.id
|
|
189
|
+
include_global_service_events = true
|
|
190
|
+
is_multi_region_trail = true
|
|
191
|
+
enable_log_file_validation = true
|
|
192
|
+
|
|
193
|
+
event_selector {
|
|
194
|
+
read_write_type = "All"
|
|
195
|
+
include_management_events = true
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
tags = {
|
|
199
|
+
Compliance = "FedRAMP-Moderate"
|
|
200
|
+
Control = "AU-2,AU-3,AU-12"
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
# VPC Flow Logs (SI-4)
|
|
205
|
+
resource "aws_flow_log" "fedramp_vpc_flow" {
|
|
206
|
+
vpc_id = aws_vpc.main.id
|
|
207
|
+
traffic_type = "ALL"
|
|
208
|
+
iam_role_arn = aws_iam_role.flow_log_role.arn
|
|
209
|
+
log_destination = aws_cloudwatch_log_group.flow_log.arn
|
|
210
|
+
|
|
211
|
+
tags = {
|
|
212
|
+
Control = "SI-4"
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
# Config for compliance monitoring (CM-2, CM-3, CM-6)
|
|
217
|
+
resource "aws_config_configuration_recorder" "fedramp" {
|
|
218
|
+
name = "fedramp-config-recorder"
|
|
219
|
+
role_arn = aws_iam_role.config_role.arn
|
|
220
|
+
|
|
221
|
+
recording_group {
|
|
222
|
+
all_supported = true
|
|
223
|
+
include_global_resource_types = true
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
resource "aws_config_configuration_recorder_status" "fedramp" {
|
|
228
|
+
name = aws_config_configuration_recorder.fedramp.name
|
|
229
|
+
is_enabled = true
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
# GuardDuty for threat detection (SI-4)
|
|
233
|
+
resource "aws_guardduty_detector" "fedramp" {
|
|
234
|
+
enable = true
|
|
235
|
+
|
|
236
|
+
datasources {
|
|
237
|
+
s3_logs {
|
|
238
|
+
enable = true
|
|
239
|
+
}
|
|
240
|
+
kubernetes {
|
|
241
|
+
audit_logs {
|
|
242
|
+
enable = true
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
tags = {
|
|
248
|
+
Control = "SI-4"
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
# Security Hub for centralized findings (CA-7, RA-5, SI-2)
|
|
253
|
+
resource "aws_securityhub_account" "fedramp" {}
|
|
254
|
+
|
|
255
|
+
resource "aws_securityhub_standards_subscription" "cis" {
|
|
256
|
+
depends_on = [aws_securityhub_account.fedramp]
|
|
257
|
+
standards_arn = "arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0"
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
# KMS for encryption (SC-12, SC-13)
|
|
261
|
+
resource "aws_kms_key" "fedramp" {
|
|
262
|
+
description = "FedRAMP encryption key"
|
|
263
|
+
deletion_window_in_days = 30
|
|
264
|
+
enable_key_rotation = true
|
|
265
|
+
|
|
266
|
+
tags = {
|
|
267
|
+
Control = "SC-12,SC-13"
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
# WAF for application protection (SC-7)
|
|
272
|
+
resource "aws_wafv2_web_acl" "fedramp" {
|
|
273
|
+
name = "fedramp-waf"
|
|
274
|
+
scope = "REGIONAL"
|
|
275
|
+
|
|
276
|
+
default_action {
|
|
277
|
+
allow {}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
rule {
|
|
281
|
+
name = "RateLimitRule"
|
|
282
|
+
priority = 1
|
|
283
|
+
|
|
284
|
+
statement {
|
|
285
|
+
rate_based_statement {
|
|
286
|
+
limit = 2000
|
|
287
|
+
aggregate_key_type = "IP"
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
action {
|
|
292
|
+
block {}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
visibility_config {
|
|
296
|
+
cloudwatch_metrics_enabled = true
|
|
297
|
+
metric_name = "RateLimitRule"
|
|
298
|
+
sampled_requests_enabled = true
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
visibility_config {
|
|
303
|
+
cloudwatch_metrics_enabled = true
|
|
304
|
+
metric_name = "FedRAMPWAF"
|
|
305
|
+
sampled_requests_enabled = true
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
tags = {
|
|
309
|
+
Control = "SC-7"
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## CMMC (Cybersecurity Maturity Model Certification)
|
|
317
|
+
|
|
318
|
+
**CMMC 2.0** is a cybersecurity framework for the Defense Industrial Base (DIB) to protect Controlled Unclassified Information (CUI) and Federal Contract Information (FCI).
|
|
319
|
+
|
|
320
|
+
### CMMC Levels
|
|
321
|
+
|
|
322
|
+
```
|
|
323
|
+
CMMC 2.0 Structure:
|
|
324
|
+
┌─────────────────────────────────────────────────────┐
|
|
325
|
+
│ Level 1: Foundational │
|
|
326
|
+
│ - 17 practices (subset of FAR 52.204-21) │
|
|
327
|
+
│ - Protects FCI (Federal Contract Information) │
|
|
328
|
+
│ - Annual self-assessment │
|
|
329
|
+
│ - Required for all DoD contractors │
|
|
330
|
+
├─────────────────────────────────────────────────────┤
|
|
331
|
+
│ Level 2: Advanced │
|
|
332
|
+
│ - 110 practices (NIST SP 800-171 Rev 2) │
|
|
333
|
+
│ - Protects CUI (Controlled Unclassified Info) │
|
|
334
|
+
│ - Self-assessment OR C3PAO assessment │
|
|
335
|
+
│ - Required for CUI contractors │
|
|
336
|
+
├─────────────────────────────────────────────────────┤
|
|
337
|
+
│ Level 3: Expert │
|
|
338
|
+
│ - 110+ practices (subset of NIST SP 800-172) │
|
|
339
|
+
│ - Advanced/persistent threats (APT) │
|
|
340
|
+
│ - C3PAO assessment required │
|
|
341
|
+
│ - Government validation required │
|
|
342
|
+
│ - Critical national security programs │
|
|
343
|
+
└─────────────────────────────────────────────────────┘
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### CMMC Level 1 (17 Practices)
|
|
347
|
+
|
|
348
|
+
**Control Domains:**
|
|
349
|
+
|
|
350
|
+
```yaml
|
|
351
|
+
# CMMC Level 1 Requirements
|
|
352
|
+
access_control:
|
|
353
|
+
- AC.L1-3.1.1: "Limit system access to authorized users"
|
|
354
|
+
- AC.L1-3.1.2: "Limit system access to transaction types"
|
|
355
|
+
- AC.L1-3.1.20: "External connections controlled"
|
|
356
|
+
- AC.L1-3.1.22: "Control public information on systems"
|
|
357
|
+
|
|
358
|
+
identification_authentication:
|
|
359
|
+
- IA.L1-3.5.1: "Identify users, processes, devices"
|
|
360
|
+
- IA.L1-3.5.2: "Authenticate users, processes, devices"
|
|
361
|
+
|
|
362
|
+
media_protection:
|
|
363
|
+
- MP.L1-3.8.3: "Sanitize/dispose of media with CUI"
|
|
364
|
+
|
|
365
|
+
physical_protection:
|
|
366
|
+
- PE.L1-3.10.1: "Limit physical access to systems"
|
|
367
|
+
- PE.L1-3.10.3: "Escort visitors"
|
|
368
|
+
- PE.L1-3.10.4: "Physical access logs"
|
|
369
|
+
- PE.L1-3.10.5: "Manage physical access devices"
|
|
370
|
+
|
|
371
|
+
system_communications_protection:
|
|
372
|
+
- SC.L1-3.13.1: "Boundary protection"
|
|
373
|
+
- SC.L1-3.13.5: "Public-access system separation"
|
|
374
|
+
|
|
375
|
+
system_information_integrity:
|
|
376
|
+
- SI.L1-3.14.1: "Identify/report/correct flaws"
|
|
377
|
+
- SI.L1-3.14.2: "Malicious code protection"
|
|
378
|
+
- SI.L1-3.14.4: "Update malicious code protection"
|
|
379
|
+
- SI.L1-3.14.5: "System/file scans"
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### CMMC Level 2 (NIST 800-171)
|
|
383
|
+
|
|
384
|
+
**14 Control Families:**
|
|
385
|
+
|
|
386
|
+
```
|
|
387
|
+
NIST 800-171 Control Families (110 controls):
|
|
388
|
+
┌─────────────────────────────────────────────────────┐
|
|
389
|
+
│ 3.1 Access Control (AC) - 22 requirements │
|
|
390
|
+
│ 3.2 Awareness and Training (AT) - 3 requirements │
|
|
391
|
+
│ 3.3 Audit and Accountability (AU) - 9 requirements │
|
|
392
|
+
│ 3.4 Configuration Management (CM) - 9 requirements │
|
|
393
|
+
│ 3.5 Identification & Authentication (IA) - 11 req │
|
|
394
|
+
│ 3.6 Incident Response (IR) - 5 requirements │
|
|
395
|
+
│ 3.7 Maintenance (MA) - 6 requirements │
|
|
396
|
+
│ 3.8 Media Protection (MP) - 9 requirements │
|
|
397
|
+
│ 3.9 Personnel Security (PS) - 2 requirements │
|
|
398
|
+
│ 3.10 Physical Protection (PE) - 6 requirements │
|
|
399
|
+
│ 3.11 Risk Assessment (RA) - 5 requirements │
|
|
400
|
+
│ 3.12 Security Assessment (CA) - 5 requirements │
|
|
401
|
+
│ 3.13 System/Comms Protection (SC) - 13 requirements │
|
|
402
|
+
│ 3.14 System/Info Integrity (SI) - 5 requirements │
|
|
403
|
+
└─────────────────────────────────────────────────────┘
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
**Implementation Example:**
|
|
407
|
+
|
|
408
|
+
```hcl
|
|
409
|
+
# cmmc-level2-controls.tf
|
|
410
|
+
# Example: NIST 800-171 controls
|
|
411
|
+
|
|
412
|
+
# 3.1.1 - Limit system access to authorized users
|
|
413
|
+
resource "aws_iam_account_password_policy" "cmmc" {
|
|
414
|
+
minimum_password_length = 14
|
|
415
|
+
require_lowercase_characters = true
|
|
416
|
+
require_numbers = true
|
|
417
|
+
require_uppercase_characters = true
|
|
418
|
+
require_symbols = true
|
|
419
|
+
allow_users_to_change_password = true
|
|
420
|
+
max_password_age = 90
|
|
421
|
+
password_reuse_prevention = 24
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
# 3.1.3 - Control flow of CUI
|
|
425
|
+
resource "aws_security_group" "cmmc_app" {
|
|
426
|
+
name = "cmmc-application-sg"
|
|
427
|
+
description = "CMMC Level 2 security group"
|
|
428
|
+
vpc_id = aws_vpc.main.id
|
|
429
|
+
|
|
430
|
+
# Only allow traffic from known sources
|
|
431
|
+
ingress {
|
|
432
|
+
description = "HTTPS from approved networks"
|
|
433
|
+
from_port = 443
|
|
434
|
+
to_port = 443
|
|
435
|
+
protocol = "tcp"
|
|
436
|
+
cidr_blocks = ["10.0.0.0/8"] # Internal only
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
# Deny all by default
|
|
440
|
+
egress {
|
|
441
|
+
description = "Allow HTTPS to approved destinations"
|
|
442
|
+
from_port = 443
|
|
443
|
+
to_port = 443
|
|
444
|
+
protocol = "tcp"
|
|
445
|
+
cidr_blocks = ["10.0.0.0/8"]
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
tags = {
|
|
449
|
+
CMMC_Control = "3.1.3"
|
|
450
|
+
CUI = "true"
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
# 3.3.1 - Create audit records
|
|
455
|
+
resource "aws_cloudwatch_log_group" "cmmc_audit" {
|
|
456
|
+
name = "/cmmc/audit-logs"
|
|
457
|
+
retention_in_days = 365 # CMMC requires 1 year minimum
|
|
458
|
+
|
|
459
|
+
tags = {
|
|
460
|
+
CMMC_Control = "3.3.1"
|
|
461
|
+
DataType = "AuditLogs"
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
# 3.8.3 - Sanitize/destroy media containing CUI
|
|
466
|
+
resource "aws_s3_bucket" "cmmc_cui" {
|
|
467
|
+
bucket = "cmmc-cui-data"
|
|
468
|
+
|
|
469
|
+
tags = {
|
|
470
|
+
DataClassification = "CUI"
|
|
471
|
+
CMMC_Control = "3.8.3"
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
resource "aws_s3_bucket_lifecycle_configuration" "cmmc_cui_lifecycle" {
|
|
476
|
+
bucket = aws_s3_bucket.cmmc_cui.id
|
|
477
|
+
|
|
478
|
+
rule {
|
|
479
|
+
id = "cui-retention-deletion"
|
|
480
|
+
status = "Enabled"
|
|
481
|
+
|
|
482
|
+
expiration {
|
|
483
|
+
days = 2555 # 7 years
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
noncurrent_version_expiration {
|
|
487
|
+
noncurrent_days = 30
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
# 3.13.8 - Cryptographic protection
|
|
493
|
+
resource "aws_s3_bucket_server_side_encryption_configuration" "cmmc_cui" {
|
|
494
|
+
bucket = aws_s3_bucket.cmmc_cui.id
|
|
495
|
+
|
|
496
|
+
rule {
|
|
497
|
+
apply_server_side_encryption_by_default {
|
|
498
|
+
sse_algorithm = "aws:kms"
|
|
499
|
+
kms_master_key_id = aws_kms_key.cmmc.arn
|
|
500
|
+
}
|
|
501
|
+
bucket_key_enabled = true
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
# 3.13.11 - Cryptographic mechanisms (FIPS 140-2)
|
|
506
|
+
resource "aws_kms_key" "cmmc" {
|
|
507
|
+
description = "CMMC CUI encryption key"
|
|
508
|
+
deletion_window_in_days = 30
|
|
509
|
+
enable_key_rotation = true
|
|
510
|
+
|
|
511
|
+
tags = {
|
|
512
|
+
CMMC_Control = "3.13.11"
|
|
513
|
+
FIPS_140_2 = "true"
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
# 3.14.1 - Timely flaw identification
|
|
518
|
+
resource "aws_inspector2_enabler" "cmmc" {
|
|
519
|
+
account_ids = [data.aws_caller_identity.current.account_id]
|
|
520
|
+
resource_types = ["EC2", "ECR", "LAMBDA"]
|
|
521
|
+
}
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
### Score Interpretation
|
|
525
|
+
|
|
526
|
+
```
|
|
527
|
+
CMMC Scoring System:
|
|
528
|
+
┌─────────────────────────────────────────────────────┐
|
|
529
|
+
│ Met (3 points) │
|
|
530
|
+
│ - Fully implemented │
|
|
531
|
+
│ - Evidence provided │
|
|
532
|
+
│ - Sustainable/documented │
|
|
533
|
+
├─────────────────────────────────────────────────────┤
|
|
534
|
+
│ Not Met (0 points) │
|
|
535
|
+
│ - Not implemented │
|
|
536
|
+
│ - Partially implemented │
|
|
537
|
+
│ - No evidence │
|
|
538
|
+
├─────────────────────────────────────────────────────┤
|
|
539
|
+
│ Not Applicable (N/A) │
|
|
540
|
+
│ - Control doesn't apply to system │
|
|
541
|
+
│ - Must justify why │
|
|
542
|
+
└─────────────────────────────────────────────────────┘
|
|
543
|
+
|
|
544
|
+
Scoring Threshold:
|
|
545
|
+
- Level 1: Must meet all 17 practices (100%)
|
|
546
|
+
- Level 2: Must meet all 110 practices (100%)
|
|
547
|
+
- Level 3: Must meet all enhanced practices (100%)
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
---
|
|
551
|
+
|
|
552
|
+
## NIST 800-53
|
|
553
|
+
|
|
554
|
+
**NIST SP 800-53** provides a catalog of security and privacy controls for federal information systems and organizations.
|
|
555
|
+
|
|
556
|
+
### Revisions
|
|
557
|
+
|
|
558
|
+
| Revision | Published | Controls | Focus |
|
|
559
|
+
|----------|-----------|----------|-------|
|
|
560
|
+
| Rev 4 | 2013 | 1000+ | Legacy federal systems |
|
|
561
|
+
| Rev 5 | 2020 | 1000+ | Modern threats, supply chain, privacy |
|
|
562
|
+
|
|
563
|
+
### Control Baselines
|
|
564
|
+
|
|
565
|
+
```
|
|
566
|
+
NIST 800-53 Baselines:
|
|
567
|
+
┌─────────────────────────────────────────────────────┐
|
|
568
|
+
│ LOW Impact (125 controls) │
|
|
569
|
+
│ - Confidentiality: Low │
|
|
570
|
+
│ - Integrity: Low │
|
|
571
|
+
│ - Availability: Low │
|
|
572
|
+
│ - Example: Public website │
|
|
573
|
+
├─────────────────────────────────────────────────────┤
|
|
574
|
+
│ MODERATE Impact (325 controls) │
|
|
575
|
+
│ - Confidentiality: Moderate │
|
|
576
|
+
│ - Integrity: Moderate │
|
|
577
|
+
│ - Availability: Moderate │
|
|
578
|
+
│ - Example: Most federal systems │
|
|
579
|
+
├─────────────────────────────────────────────────────┤
|
|
580
|
+
│ HIGH Impact (421 controls) │
|
|
581
|
+
│ - Confidentiality: High │
|
|
582
|
+
│ - Integrity: High │
|
|
583
|
+
│ - Availability: High │
|
|
584
|
+
│ - Example: National security systems │
|
|
585
|
+
└─────────────────────────────────────────────────────┘
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
### Key Control Families
|
|
589
|
+
|
|
590
|
+
**Access Control (AC):**
|
|
591
|
+
```yaml
|
|
592
|
+
# Example: AC-2 Account Management
|
|
593
|
+
AC-2:
|
|
594
|
+
control: "Account Management"
|
|
595
|
+
requirement: |
|
|
596
|
+
a. Define and document account types
|
|
597
|
+
b. Assign account managers
|
|
598
|
+
c. Require approvals for account creation
|
|
599
|
+
d. Create, enable, modify, disable, remove accounts per procedures
|
|
600
|
+
e. Monitor account use
|
|
601
|
+
f. Notify account managers when accounts no longer needed
|
|
602
|
+
g. Authorize access based on valid authorization
|
|
603
|
+
h. Notify account managers when system usage or need-to-know changes
|
|
604
|
+
i. Review accounts for compliance
|
|
605
|
+
j. Establish process for reissuing credentials
|
|
606
|
+
|
|
607
|
+
implementation:
|
|
608
|
+
- name: "Automated account management"
|
|
609
|
+
tool: "AWS IAM, Azure AD"
|
|
610
|
+
automation: |
|
|
611
|
+
- Terraform/IaC for account provisioning
|
|
612
|
+
- Lambda/Azure Functions for lifecycle management
|
|
613
|
+
- CloudWatch/Azure Monitor for usage monitoring
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
---
|
|
617
|
+
|
|
618
|
+
## NIST 800-171
|
|
619
|
+
|
|
620
|
+
**NIST SP 800-171** protects Controlled Unclassified Information (CUI) in non-federal systems and organizations.
|
|
621
|
+
|
|
622
|
+
### Scope
|
|
623
|
+
|
|
624
|
+
```
|
|
625
|
+
800-171 Applicability:
|
|
626
|
+
┌─────────────────────────────────────────────────────┐
|
|
627
|
+
│ WHO: Defense contractors, subcontractors │
|
|
628
|
+
│ WHAT: Systems processing/storing/transmitting CUI │
|
|
629
|
+
│ WHEN: Required in DoD contracts (DFARS clause) │
|
|
630
|
+
│ WHERE: Contractor-owned systems │
|
|
631
|
+
└─────────────────────────────────────────────────────┘
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
### Control Requirements (110 Total)
|
|
635
|
+
|
|
636
|
+
**Key Requirements:**
|
|
637
|
+
|
|
638
|
+
```yaml
|
|
639
|
+
# High-priority 800-171 controls
|
|
640
|
+
critical_controls:
|
|
641
|
+
access_control:
|
|
642
|
+
- "3.1.1: Limit access to authorized users/processes"
|
|
643
|
+
- "3.1.2: Limit access to authorized functions"
|
|
644
|
+
- "3.1.5: Multi-factor authentication"
|
|
645
|
+
- "3.1.12: Monitor/control remote sessions"
|
|
646
|
+
|
|
647
|
+
identification_authentication:
|
|
648
|
+
- "3.5.3: MFA for privileged and non-privileged accounts"
|
|
649
|
+
- "3.5.7: Prevent password reuse (24 generations)"
|
|
650
|
+
- "3.5.8: Prohibit password reuse"
|
|
651
|
+
- "3.5.10: Store/transmit encrypted credentials"
|
|
652
|
+
|
|
653
|
+
media_protection:
|
|
654
|
+
- "3.8.3: Sanitize/destroy media with CUI"
|
|
655
|
+
- "3.8.9: Protect backups in separate facility"
|
|
656
|
+
|
|
657
|
+
system_communications_protection:
|
|
658
|
+
- "3.13.8: Implement cryptographic mechanisms"
|
|
659
|
+
- "3.13.11: FIPS-validated cryptography for CUI"
|
|
660
|
+
|
|
661
|
+
audit_accountability:
|
|
662
|
+
- "3.3.1: Create audit records"
|
|
663
|
+
- "3.3.2: Ensure actions traced to users"
|
|
664
|
+
- "3.3.8: Protect audit information"
|
|
665
|
+
- "3.3.9: Limit audit information management"
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
### Assessment Methodology
|
|
669
|
+
|
|
670
|
+
```python
|
|
671
|
+
# nist-800-171-assessment.py
|
|
672
|
+
"""NIST 800-171 self-assessment tool"""
|
|
673
|
+
|
|
674
|
+
class NIST_800_171_Assessment:
|
|
675
|
+
def __init__(self):
|
|
676
|
+
self.controls = self.load_controls()
|
|
677
|
+
self.scores = {}
|
|
678
|
+
|
|
679
|
+
def assess_control(self, control_id, implementation_status):
|
|
680
|
+
"""
|
|
681
|
+
Assess a single control
|
|
682
|
+
|
|
683
|
+
Args:
|
|
684
|
+
control_id: e.g., "3.1.1"
|
|
685
|
+
implementation_status: "implemented", "partially", "planned", "not_implemented"
|
|
686
|
+
|
|
687
|
+
Returns:
|
|
688
|
+
Score: 5 (implemented), 3 (partially), 1 (planned), 0 (not implemented)
|
|
689
|
+
"""
|
|
690
|
+
score_map = {
|
|
691
|
+
"implemented": 5,
|
|
692
|
+
"partially": 3,
|
|
693
|
+
"planned": 1,
|
|
694
|
+
"not_implemented": 0
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
self.scores[control_id] = score_map.get(implementation_status, 0)
|
|
698
|
+
return self.scores[control_id]
|
|
699
|
+
|
|
700
|
+
def calculate_score(self):
|
|
701
|
+
"""Calculate overall assessment score"""
|
|
702
|
+
total_possible = len(self.controls) * 5
|
|
703
|
+
total_achieved = sum(self.scores.values())
|
|
704
|
+
percentage = (total_achieved / total_possible) * 100
|
|
705
|
+
|
|
706
|
+
return {
|
|
707
|
+
"total_controls": len(self.controls),
|
|
708
|
+
"total_possible_points": total_possible,
|
|
709
|
+
"points_achieved": total_achieved,
|
|
710
|
+
"percentage": percentage,
|
|
711
|
+
"recommendation": self.get_recommendation(percentage)
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
def get_recommendation(self, percentage):
|
|
715
|
+
"""Provide recommendation based on score"""
|
|
716
|
+
if percentage >= 95:
|
|
717
|
+
return "Ready for C3PAO assessment"
|
|
718
|
+
elif percentage >= 80:
|
|
719
|
+
return "Close to ready, address remaining gaps"
|
|
720
|
+
elif percentage >= 60:
|
|
721
|
+
return "Significant work needed, prioritize high-impact controls"
|
|
722
|
+
else:
|
|
723
|
+
return "Early stage, develop comprehensive implementation plan"
|
|
724
|
+
|
|
725
|
+
def generate_poam(self):
|
|
726
|
+
"""Generate Plan of Action and Milestones"""
|
|
727
|
+
poam = []
|
|
728
|
+
for control_id, score in self.scores.items():
|
|
729
|
+
if score < 5: # Not fully implemented
|
|
730
|
+
poam.append({
|
|
731
|
+
"control": control_id,
|
|
732
|
+
"current_score": score,
|
|
733
|
+
"weakness": self.controls[control_id]["description"],
|
|
734
|
+
"resources": "TBD",
|
|
735
|
+
"scheduled_completion": "TBD",
|
|
736
|
+
"milestones": []
|
|
737
|
+
})
|
|
738
|
+
return poam
|
|
739
|
+
|
|
740
|
+
# Usage
|
|
741
|
+
assessment = NIST_800_171_Assessment()
|
|
742
|
+
assessment.assess_control("3.1.1", "implemented")
|
|
743
|
+
assessment.assess_control("3.1.5", "partially")
|
|
744
|
+
results = assessment.calculate_score()
|
|
745
|
+
poam = assessment.generate_poam()
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
---
|
|
749
|
+
|
|
750
|
+
## ITAR (International Traffic in Arms Regulations)
|
|
751
|
+
|
|
752
|
+
**ITAR** controls the export and import of defense-related articles and services on the United States Munitions List (USML).
|
|
753
|
+
|
|
754
|
+
### Key Requirements
|
|
755
|
+
|
|
756
|
+
```
|
|
757
|
+
ITAR Compliance Requirements:
|
|
758
|
+
┌─────────────────────────────────────────────────────┐
|
|
759
|
+
│ DATA PROTECTION │
|
|
760
|
+
│ - Export-controlled data segregation │
|
|
761
|
+
│ - Access limited to U.S. persons │
|
|
762
|
+
│ - No foreign national access without authorization │
|
|
763
|
+
│ - Encrypted storage and transmission │
|
|
764
|
+
├─────────────────────────────────────────────────────┤
|
|
765
|
+
│ PERSONNEL │
|
|
766
|
+
│ - U.S. citizenship verification │
|
|
767
|
+
│ - Foreign person access requires DSP-5/TAA │
|
|
768
|
+
│ - Background checks │
|
|
769
|
+
│ - Security awareness training │
|
|
770
|
+
├─────────────────────────────────────────────────────┤
|
|
771
|
+
│ TECHNICAL │
|
|
772
|
+
│ - Geographic restrictions (U.S. data centers) │
|
|
773
|
+
│ - No international data transfers │
|
|
774
|
+
│ - Segregated from non-ITAR data │
|
|
775
|
+
│ - Audit trails for all access │
|
|
776
|
+
└─────────────────────────────────────────────────────┘
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
### Cloud Implementation
|
|
780
|
+
|
|
781
|
+
```hcl
|
|
782
|
+
# itar-compliant-infrastructure.tf
|
|
783
|
+
|
|
784
|
+
# Restrict to U.S. regions only
|
|
785
|
+
provider "aws" {
|
|
786
|
+
region = "us-gov-west-1" # GovCloud only
|
|
787
|
+
|
|
788
|
+
# Prevent accidental deployment to non-US regions
|
|
789
|
+
allowed_account_ids = [var.govcloud_account_id]
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
# ITAR data bucket
|
|
793
|
+
resource "aws_s3_bucket" "itar_data" {
|
|
794
|
+
bucket = "itar-technical-data"
|
|
795
|
+
|
|
796
|
+
tags = {
|
|
797
|
+
DataClassification = "ITAR"
|
|
798
|
+
ExportControl = "USML-Category-VIII"
|
|
799
|
+
AccessRestriction = "US-Persons-Only"
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
# Restrict access to U.S. persons only
|
|
804
|
+
resource "aws_s3_bucket_policy" "itar_access" {
|
|
805
|
+
bucket = aws_s3_bucket.itar_data.id
|
|
806
|
+
|
|
807
|
+
policy = jsonencode({
|
|
808
|
+
Version = "2012-10-17"
|
|
809
|
+
Statement = [
|
|
810
|
+
{
|
|
811
|
+
Sid = "RestrictToUSPersons"
|
|
812
|
+
Effect = "Deny"
|
|
813
|
+
Principal = "*"
|
|
814
|
+
Action = "s3:*"
|
|
815
|
+
Resource = [
|
|
816
|
+
"${aws_s3_bucket.itar_data.arn}",
|
|
817
|
+
"${aws_s3_bucket.itar_data.arn}/*"
|
|
818
|
+
]
|
|
819
|
+
Condition = {
|
|
820
|
+
StringNotEquals = {
|
|
821
|
+
"aws:PrincipalTag/Citizenship" = "US"
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
Sid = "EnforceEncryption"
|
|
827
|
+
Effect = "Deny"
|
|
828
|
+
Principal = "*"
|
|
829
|
+
Action = "s3:PutObject"
|
|
830
|
+
Resource = "${aws_s3_bucket.itar_data.arn}/*"
|
|
831
|
+
Condition = {
|
|
832
|
+
StringNotEquals = {
|
|
833
|
+
"s3:x-amz-server-side-encryption" = "aws:kms"
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
]
|
|
838
|
+
})
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
# VPC with no internet access
|
|
842
|
+
resource "aws_vpc" "itar_vpc" {
|
|
843
|
+
cidr_block = "10.100.0.0/16"
|
|
844
|
+
|
|
845
|
+
tags = {
|
|
846
|
+
Name = "itar-vpc"
|
|
847
|
+
DataClassification = "ITAR"
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
# NO internet gateway - completely isolated
|
|
852
|
+
# Access only via Direct Connect from U.S. facilities
|
|
853
|
+
|
|
854
|
+
resource "aws_subnet" "itar_private" {
|
|
855
|
+
vpc_id = aws_vpc.itar_vpc.id
|
|
856
|
+
cidr_block = "10.100.1.0/24"
|
|
857
|
+
availability_zone = "us-gov-west-1a"
|
|
858
|
+
|
|
859
|
+
tags = {
|
|
860
|
+
Name = "itar-private-subnet"
|
|
861
|
+
ITAR = "true"
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
# Audit all access
|
|
866
|
+
resource "aws_cloudtrail" "itar_audit" {
|
|
867
|
+
name = "itar-audit-trail"
|
|
868
|
+
s3_bucket_name = aws_s3_bucket.itar_audit_logs.id
|
|
869
|
+
include_global_service_events = true
|
|
870
|
+
is_multi_region_trail = false # Stay in US region only
|
|
871
|
+
enable_log_file_validation = true
|
|
872
|
+
|
|
873
|
+
event_selector {
|
|
874
|
+
read_write_type = "All"
|
|
875
|
+
include_management_events = true
|
|
876
|
+
|
|
877
|
+
data_resource {
|
|
878
|
+
type = "AWS::S3::Object"
|
|
879
|
+
values = ["${aws_s3_bucket.itar_data.arn}/*"]
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
tags = {
|
|
884
|
+
Purpose = "ITAR-Compliance-Audit"
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
```
|
|
888
|
+
|
|
889
|
+
### Access Control Matrix
|
|
890
|
+
|
|
891
|
+
```yaml
|
|
892
|
+
# ITAR access control matrix
|
|
893
|
+
access_control:
|
|
894
|
+
us_persons:
|
|
895
|
+
definition: "U.S. citizens, permanent residents, protected persons"
|
|
896
|
+
access: "Full access to ITAR data"
|
|
897
|
+
verification: "I-9 verification required"
|
|
898
|
+
documentation: "Citizenship proof on file"
|
|
899
|
+
|
|
900
|
+
foreign_nationals:
|
|
901
|
+
definition: "Non-U.S. persons"
|
|
902
|
+
access: "DENIED unless authorized"
|
|
903
|
+
authorization_required:
|
|
904
|
+
- "DSP-5 (manufacturing license agreement)"
|
|
905
|
+
- "TAA (Technical Assistance Agreement)"
|
|
906
|
+
- "Approved by DDTC"
|
|
907
|
+
documentation: "Export license on file"
|
|
908
|
+
|
|
909
|
+
automated_systems:
|
|
910
|
+
access: "Only if operated by U.S. persons"
|
|
911
|
+
location: "Must reside in United States"
|
|
912
|
+
support: "Support staff must be U.S. persons"
|
|
913
|
+
```
|
|
914
|
+
|
|
915
|
+
---
|
|
916
|
+
|
|
917
|
+
## CJIS (Criminal Justice Information Services)
|
|
918
|
+
|
|
919
|
+
**CJIS Security Policy** governs access to Criminal Justice Information (CJI), including FBI databases, fingerprints, and criminal history records.
|
|
920
|
+
|
|
921
|
+
### Key Requirements
|
|
922
|
+
|
|
923
|
+
```
|
|
924
|
+
CJIS Security Policy Areas:
|
|
925
|
+
┌─────────────────────────────────────────────────────┐
|
|
926
|
+
│ 1. Information Exchange Agreements │
|
|
927
|
+
│ 2. Security Awareness Training (mandatory) │
|
|
928
|
+
│ 3. Incident Response │
|
|
929
|
+
│ 4. Auditing and Accountability │
|
|
930
|
+
│ 5. Access Control (MFA required) │
|
|
931
|
+
│ 6. Identification and Authentication │
|
|
932
|
+
│ 7. Configuration Management │
|
|
933
|
+
│ 8. Media Protection │
|
|
934
|
+
│ 9. Physical Protection │
|
|
935
|
+
│ 10. System and Communications Protection │
|
|
936
|
+
│ 11. Information Integrity │
|
|
937
|
+
│ 12. Maintenance │
|
|
938
|
+
│ 13. Personnel Security (background checks) │
|
|
939
|
+
└─────────────────────────────────────────────────────┘
|
|
940
|
+
```
|
|
941
|
+
|
|
942
|
+
### Advanced Authentication (5.11.1)
|
|
943
|
+
|
|
944
|
+
```yaml
|
|
945
|
+
# CJIS MFA requirements
|
|
946
|
+
authentication_requirements:
|
|
947
|
+
mfa_required_for:
|
|
948
|
+
- "All users accessing CJI"
|
|
949
|
+
- "Remote access (mandatory)"
|
|
950
|
+
- "Local access (recommended)"
|
|
951
|
+
|
|
952
|
+
acceptable_factors:
|
|
953
|
+
- "Something you know (password/PIN)"
|
|
954
|
+
- "Something you have (token, smart card, phone)"
|
|
955
|
+
- "Something you are (biometric)"
|
|
956
|
+
|
|
957
|
+
password_requirements:
|
|
958
|
+
minimum_length: 8
|
|
959
|
+
complexity: "Mix of upper, lower, numbers, special"
|
|
960
|
+
max_age_days: 90
|
|
961
|
+
history: 10 # Previous passwords
|
|
962
|
+
account_lockout: 5 # Failed attempts
|
|
963
|
+
|
|
964
|
+
implementation:
|
|
965
|
+
aws:
|
|
966
|
+
- "IAM with MFA enforcement"
|
|
967
|
+
- "Cognito with TOTP/SMS"
|
|
968
|
+
- "Directory Service with smart cards"
|
|
969
|
+
azure:
|
|
970
|
+
- "Azure AD with Conditional Access"
|
|
971
|
+
- "MFA with authenticator app"
|
|
972
|
+
gcp:
|
|
973
|
+
- "Identity Platform with 2FA"
|
|
974
|
+
- "Security keys"
|
|
975
|
+
```
|
|
976
|
+
|
|
977
|
+
### Encryption Requirements (5.10)
|
|
978
|
+
|
|
979
|
+
```hcl
|
|
980
|
+
# CJIS encryption requirements
|
|
981
|
+
# Data at rest: FIPS 140-2 validated encryption
|
|
982
|
+
# Data in transit: TLS 1.2+ or IPsec
|
|
983
|
+
|
|
984
|
+
# S3 bucket with CJIS-compliant encryption
|
|
985
|
+
resource "aws_s3_bucket" "cji_data" {
|
|
986
|
+
bucket = "cjis-criminal-data"
|
|
987
|
+
|
|
988
|
+
tags = {
|
|
989
|
+
DataType = "CJI"
|
|
990
|
+
Compliance = "CJIS"
|
|
991
|
+
Sensitivity = "Criminal-Justice-Information"
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
resource "aws_s3_bucket_server_side_encryption_configuration" "cji_encryption" {
|
|
996
|
+
bucket = aws_s3_bucket.cji_data.id
|
|
997
|
+
|
|
998
|
+
rule {
|
|
999
|
+
apply_server_side_encryption_by_default {
|
|
1000
|
+
sse_algorithm = "aws:kms"
|
|
1001
|
+
kms_master_key_id = aws_kms_key.cjis_key.arn
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
# FIPS 140-2 validated KMS key
|
|
1007
|
+
resource "aws_kms_key" "cjis_key" {
|
|
1008
|
+
description = "CJIS CJI encryption key"
|
|
1009
|
+
deletion_window_in_days = 30
|
|
1010
|
+
enable_key_rotation = true
|
|
1011
|
+
|
|
1012
|
+
tags = {
|
|
1013
|
+
Compliance = "CJIS"
|
|
1014
|
+
FIPS_140_2 = "Validated"
|
|
1015
|
+
KeyPurpose = "CJI-Encryption"
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
# Application Load Balancer with TLS 1.2+
|
|
1020
|
+
resource "aws_lb_listener" "cjis_https" {
|
|
1021
|
+
load_balancer_arn = aws_lb.cjis_lb.arn
|
|
1022
|
+
port = 443
|
|
1023
|
+
protocol = "HTTPS"
|
|
1024
|
+
ssl_policy = "ELBSecurityPolicy-TLS-1-2-2017-01" # CJIS compliant
|
|
1025
|
+
certificate_arn = aws_acm_certificate.cjis_cert.arn
|
|
1026
|
+
|
|
1027
|
+
default_action {
|
|
1028
|
+
type = "forward"
|
|
1029
|
+
target_group_arn = aws_lb_target_group.cjis_tg.arn
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
# VPN with IPsec for site-to-site
|
|
1034
|
+
resource "aws_vpn_connection" "cjis_vpn" {
|
|
1035
|
+
customer_gateway_id = aws_customer_gateway.agency_gateway.id
|
|
1036
|
+
vpn_gateway_id = aws_vpn_gateway.cjis_vgw.id
|
|
1037
|
+
type = "ipsec.1"
|
|
1038
|
+
|
|
1039
|
+
# CJIS-approved cryptography
|
|
1040
|
+
tunnel1_ike_versions = ["ikev2"]
|
|
1041
|
+
tunnel1_phase1_encryption_algorithms = ["AES256"]
|
|
1042
|
+
tunnel1_phase1_integrity_algorithms = ["SHA2-256"]
|
|
1043
|
+
tunnel1_phase1_dh_group_numbers = [14]
|
|
1044
|
+
tunnel1_phase2_encryption_algorithms = ["AES256"]
|
|
1045
|
+
tunnel1_phase2_integrity_algorithms = ["SHA2-256"]
|
|
1046
|
+
tunnel1_phase2_dh_group_numbers = [14]
|
|
1047
|
+
|
|
1048
|
+
tags = {
|
|
1049
|
+
Compliance = "CJIS-5.10"
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
```
|
|
1053
|
+
|
|
1054
|
+
### Personnel Security (5.13)
|
|
1055
|
+
|
|
1056
|
+
```yaml
|
|
1057
|
+
# CJIS personnel requirements
|
|
1058
|
+
personnel_requirements:
|
|
1059
|
+
background_checks:
|
|
1060
|
+
federal_contractors:
|
|
1061
|
+
- "FBI fingerprint check"
|
|
1062
|
+
- "National criminal history check"
|
|
1063
|
+
- "State criminal history check"
|
|
1064
|
+
|
|
1065
|
+
noncriminal_justice_agencies:
|
|
1066
|
+
- "State-based fingerprint and background check"
|
|
1067
|
+
- "Covers felony and misdemeanor convictions"
|
|
1068
|
+
|
|
1069
|
+
training:
|
|
1070
|
+
frequency: "Annual"
|
|
1071
|
+
topics:
|
|
1072
|
+
- "CJIS Security Policy overview"
|
|
1073
|
+
- "Appropriate use of CJI"
|
|
1074
|
+
- "Sanctions for misuse"
|
|
1075
|
+
- "Reporting procedures"
|
|
1076
|
+
documentation: "Certificate of completion required"
|
|
1077
|
+
|
|
1078
|
+
termination:
|
|
1079
|
+
procedures:
|
|
1080
|
+
- "Immediate access revocation"
|
|
1081
|
+
- "Account deactivation within 2 hours"
|
|
1082
|
+
- "Credential collection"
|
|
1083
|
+
- "Exit interview"
|
|
1084
|
+
```
|
|
1085
|
+
|
|
1086
|
+
---
|
|
1087
|
+
|
|
1088
|
+
## PCI-DSS (Payment Card Industry Data Security Standard)
|
|
1089
|
+
|
|
1090
|
+
**PCI-DSS** protects cardholder data and applies to any organization that stores, processes, or transmits credit card information.
|
|
1091
|
+
|
|
1092
|
+
### Requirements (12 Total)
|
|
1093
|
+
|
|
1094
|
+
```
|
|
1095
|
+
PCI-DSS 4.0 Requirements:
|
|
1096
|
+
┌─────────────────────────────────────────────────────┐
|
|
1097
|
+
│ Build and Maintain a Secure Network │
|
|
1098
|
+
│ 1. Install and maintain network security controls │
|
|
1099
|
+
│ 2. Apply secure configurations │
|
|
1100
|
+
├─────────────────────────────────────────────────────┤
|
|
1101
|
+
│ Protect Account Data │
|
|
1102
|
+
│ 3. Protect stored account data │
|
|
1103
|
+
│ 4. Protect cardholder data with cryptography │
|
|
1104
|
+
├─────────────────────────────────────────────────────┤
|
|
1105
|
+
│ Maintain a Vulnerability Management Program │
|
|
1106
|
+
│ 5. Protect systems from malware │
|
|
1107
|
+
│ 6. Develop and maintain secure systems │
|
|
1108
|
+
├─────────────────────────────────────────────────────┤
|
|
1109
|
+
│ Implement Strong Access Control │
|
|
1110
|
+
│ 7. Restrict access to system components and data │
|
|
1111
|
+
│ 8. Identify users and authenticate access │
|
|
1112
|
+
│ 9. Restrict physical access to cardholder data │
|
|
1113
|
+
├─────────────────────────────────────────────────────┤
|
|
1114
|
+
│ Monitor and Test Networks │
|
|
1115
|
+
│ 10. Log and monitor all access │
|
|
1116
|
+
│ 11. Test security systems and processes regularly │
|
|
1117
|
+
├─────────────────────────────────────────────────────┤
|
|
1118
|
+
│ Maintain an Information Security Policy │
|
|
1119
|
+
│ 12. Support information security with policies │
|
|
1120
|
+
└─────────────────────────────────────────────────────┘
|
|
1121
|
+
```
|
|
1122
|
+
|
|
1123
|
+
### Cardholder Data Environment (CDE)
|
|
1124
|
+
|
|
1125
|
+
```
|
|
1126
|
+
CDE Architecture:
|
|
1127
|
+
┌─────────────────────────────────────────────────────┐
|
|
1128
|
+
│ OUT-OF-SCOPE SYSTEMS │
|
|
1129
|
+
│ - Marketing website │
|
|
1130
|
+
│ - Corporate email │
|
|
1131
|
+
│ - Internal apps (no CHD) │
|
|
1132
|
+
└───────────┬─────────────────────────────────────────┘
|
|
1133
|
+
│
|
|
1134
|
+
↓ Firewall (Req 1.2)
|
|
1135
|
+
┌───────────┴─────────────────────────────────────────┐
|
|
1136
|
+
│ CONNECTED-TO SYSTEMS (in scope) │
|
|
1137
|
+
│ - Systems that connect to CDE │
|
|
1138
|
+
│ - Must meet all PCI requirements │
|
|
1139
|
+
│ - Can impact CDE security │
|
|
1140
|
+
├─────────────────────────────────────────────────────┤
|
|
1141
|
+
│ ┌──────────────────────────────────────────┐ │
|
|
1142
|
+
│ │ CARDHOLDER DATA ENVIRONMENT (CDE) │ │
|
|
1143
|
+
│ │ - Payment processing app │ │
|
|
1144
|
+
│ │ - Database with CHD │ │
|
|
1145
|
+
│ │ - Payment gateway │ │
|
|
1146
|
+
│ │ - Tokenization service │ │
|
|
1147
|
+
│ └──────────────────────────────────────────┘ │
|
|
1148
|
+
└─────────────────────────────────────────────────────┘
|
|
1149
|
+
```
|
|
1150
|
+
|
|
1151
|
+
### Implementation Example
|
|
1152
|
+
|
|
1153
|
+
```hcl
|
|
1154
|
+
# pci-dss-infrastructure.tf
|
|
1155
|
+
|
|
1156
|
+
# Requirement 1: Network segmentation
|
|
1157
|
+
resource "aws_security_group" "pci_database" {
|
|
1158
|
+
name = "pci-database-sg"
|
|
1159
|
+
description = "PCI-DSS database security group"
|
|
1160
|
+
vpc_id = aws_vpc.pci_vpc.id
|
|
1161
|
+
|
|
1162
|
+
# Only allow access from application tier
|
|
1163
|
+
ingress {
|
|
1164
|
+
description = "PostgreSQL from app tier"
|
|
1165
|
+
from_port = 5432
|
|
1166
|
+
to_port = 5432
|
|
1167
|
+
protocol = "tcp"
|
|
1168
|
+
security_groups = [aws_security_group.pci_app.id]
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
# No outbound internet access
|
|
1172
|
+
egress {
|
|
1173
|
+
description = "Allow internal VPC only"
|
|
1174
|
+
from_port = 0
|
|
1175
|
+
to_port = 0
|
|
1176
|
+
protocol = "-1"
|
|
1177
|
+
cidr_blocks = [aws_vpc.pci_vpc.cidr_block]
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
tags = {
|
|
1181
|
+
PCI_Requirement = "1.2.1"
|
|
1182
|
+
Environment = "CDE"
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
# Requirement 3: Protect stored CHD
|
|
1187
|
+
resource "aws_db_instance" "pci_database" {
|
|
1188
|
+
identifier = "pci-cardholder-db"
|
|
1189
|
+
engine = "postgres"
|
|
1190
|
+
engine_version = "14.7"
|
|
1191
|
+
instance_class = "db.t3.medium"
|
|
1192
|
+
|
|
1193
|
+
# Encryption at rest (Req 3.5)
|
|
1194
|
+
storage_encrypted = true
|
|
1195
|
+
kms_key_id = aws_kms_key.pci_key.arn
|
|
1196
|
+
|
|
1197
|
+
# Automated backups (Req 3.4)
|
|
1198
|
+
backup_retention_period = 35 # PCI requires ability to restore
|
|
1199
|
+
backup_window = "03:00-04:00"
|
|
1200
|
+
|
|
1201
|
+
# No public access (Req 1.3)
|
|
1202
|
+
publicly_accessible = false
|
|
1203
|
+
|
|
1204
|
+
# Enable logging (Req 10.2)
|
|
1205
|
+
enabled_cloudwatch_logs_exports = ["postgresql", "upgrade"]
|
|
1206
|
+
|
|
1207
|
+
tags = {
|
|
1208
|
+
PCI_Requirement = "3.4,3.5"
|
|
1209
|
+
DataType = "CHD"
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
# Requirement 4: Encrypt transmission
|
|
1214
|
+
resource "aws_lb" "pci_alb" {
|
|
1215
|
+
name = "pci-alb"
|
|
1216
|
+
internal = false
|
|
1217
|
+
load_balancer_type = "application"
|
|
1218
|
+
security_groups = [aws_security_group.pci_alb.id]
|
|
1219
|
+
subnets = aws_subnet.pci_public[*].id
|
|
1220
|
+
|
|
1221
|
+
tags = {
|
|
1222
|
+
PCI_Requirement = "4.1"
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
resource "aws_lb_listener" "pci_https" {
|
|
1227
|
+
load_balancer_arn = aws_lb.pci_alb.arn
|
|
1228
|
+
port = 443
|
|
1229
|
+
protocol = "HTTPS"
|
|
1230
|
+
ssl_policy = "ELBSecurityPolicy-TLS-1-2-Ext-2018-06" # PCI compliant
|
|
1231
|
+
certificate_arn = aws_acm_certificate.pci_cert.arn
|
|
1232
|
+
|
|
1233
|
+
default_action {
|
|
1234
|
+
type = "forward"
|
|
1235
|
+
target_group_arn = aws_lb_target_group.pci_app.arn
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
# Requirement 8: Identify and authenticate
|
|
1240
|
+
resource "aws_iam_account_password_policy" "pci" {
|
|
1241
|
+
minimum_password_length = 12 # PCI requires 12+ characters
|
|
1242
|
+
require_lowercase_characters = true
|
|
1243
|
+
require_numbers = true
|
|
1244
|
+
require_uppercase_characters = true
|
|
1245
|
+
require_symbols = true
|
|
1246
|
+
allow_users_to_change_password = true
|
|
1247
|
+
max_password_age = 90
|
|
1248
|
+
password_reuse_prevention = 4
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
# Requirement 10: Log and monitor
|
|
1252
|
+
resource "aws_cloudtrail" "pci_trail" {
|
|
1253
|
+
name = "pci-audit-trail"
|
|
1254
|
+
s3_bucket_name = aws_s3_bucket.pci_logs.id
|
|
1255
|
+
include_global_service_events = true
|
|
1256
|
+
is_multi_region_trail = true
|
|
1257
|
+
enable_log_file_validation = true
|
|
1258
|
+
|
|
1259
|
+
event_selector {
|
|
1260
|
+
read_write_type = "All"
|
|
1261
|
+
include_management_events = true
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
tags = {
|
|
1265
|
+
PCI_Requirement = "10.2,10.3"
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
# Requirement 11: Vulnerability scanning
|
|
1270
|
+
resource "aws_inspector2_enabler" "pci" {
|
|
1271
|
+
account_ids = [data.aws_caller_identity.current.account_id]
|
|
1272
|
+
resource_types = ["EC2", "ECR"]
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
# ASV scan required quarterly - use approved vendor
|
|
1276
|
+
```
|
|
1277
|
+
|
|
1278
|
+
### SAQ (Self-Assessment Questionnaire) Types
|
|
1279
|
+
|
|
1280
|
+
| SAQ Type | Description | Merchant Level |
|
|
1281
|
+
|----------|-------------|----------------|
|
|
1282
|
+
| A | Card-not-present, outsourced | Eligible merchants |
|
|
1283
|
+
| A-EP | E-commerce, outsourced payment | Eligible merchants |
|
|
1284
|
+
| B | Imprint machines, standalone terminals | Eligible merchants |
|
|
1285
|
+
| B-IP | Standalone IP-connected terminals | Eligible merchants |
|
|
1286
|
+
| C | Payment app systems, no electronic storage | Eligible merchants |
|
|
1287
|
+
| C-VT | Virtual terminals, no electronic storage | Eligible merchants |
|
|
1288
|
+
| D | All others, or SAQ D Merchant | All merchants |
|
|
1289
|
+
| D (Service Provider) | Service providers | All service providers |
|
|
1290
|
+
|
|
1291
|
+
---
|
|
1292
|
+
|
|
1293
|
+
## HIPAA (Health Insurance Portability and Accountability Act)
|
|
1294
|
+
|
|
1295
|
+
**HIPAA** protects Protected Health Information (PHI) and electronic PHI (ePHI) in healthcare.
|
|
1296
|
+
|
|
1297
|
+
### Key Rules
|
|
1298
|
+
|
|
1299
|
+
```
|
|
1300
|
+
HIPAA Rules:
|
|
1301
|
+
┌─────────────────────────────────────────────────────┐
|
|
1302
|
+
│ Privacy Rule (45 CFR Part 160, Part 164 Subparts A, E) │
|
|
1303
|
+
│ - Patient rights to PHI │
|
|
1304
|
+
│ - Permitted uses and disclosures │
|
|
1305
|
+
│ - Minimum necessary standard │
|
|
1306
|
+
├─────────────────────────────────────────────────────┤
|
|
1307
|
+
│ Security Rule (45 CFR Part 164 Subpart C) │
|
|
1308
|
+
│ - Administrative safeguards │
|
|
1309
|
+
│ - Physical safeguards │
|
|
1310
|
+
│ - Technical safeguards │
|
|
1311
|
+
├─────────────────────────────────────────────────────┤
|
|
1312
|
+
│ Breach Notification Rule │
|
|
1313
|
+
│ - Notify individuals (60 days) │
|
|
1314
|
+
│ - Notify HHS │
|
|
1315
|
+
│ - Notify media (>500 affected) │
|
|
1316
|
+
└─────────────────────────────────────────────────────┘
|
|
1317
|
+
```
|
|
1318
|
+
|
|
1319
|
+
### Security Rule Safeguards
|
|
1320
|
+
|
|
1321
|
+
**Administrative Safeguards:**
|
|
1322
|
+
```yaml
|
|
1323
|
+
administrative_safeguards:
|
|
1324
|
+
security_management_process:
|
|
1325
|
+
- "Risk analysis (required)"
|
|
1326
|
+
- "Risk management (required)"
|
|
1327
|
+
- "Sanction policy (required)"
|
|
1328
|
+
- "Information system activity review (required)"
|
|
1329
|
+
|
|
1330
|
+
assigned_security_responsibility:
|
|
1331
|
+
- "Designate security official (required)"
|
|
1332
|
+
|
|
1333
|
+
workforce_security:
|
|
1334
|
+
- "Authorization/supervision (addressable)"
|
|
1335
|
+
- "Workforce clearance (addressable)"
|
|
1336
|
+
- "Termination procedures (addressable)"
|
|
1337
|
+
|
|
1338
|
+
information_access_management:
|
|
1339
|
+
- "Isolating health care clearinghouse (required)"
|
|
1340
|
+
- "Access authorization (addressable)"
|
|
1341
|
+
- "Access establishment/modification (addressable)"
|
|
1342
|
+
|
|
1343
|
+
security_awareness_training:
|
|
1344
|
+
- "Security reminders (addressable)"
|
|
1345
|
+
- "Protection from malware (addressable)"
|
|
1346
|
+
- "Log-in monitoring (addressable)"
|
|
1347
|
+
- "Password management (addressable)"
|
|
1348
|
+
|
|
1349
|
+
security_incident_procedures:
|
|
1350
|
+
- "Response and reporting (required)"
|
|
1351
|
+
|
|
1352
|
+
contingency_plan:
|
|
1353
|
+
- "Data backup plan (required)"
|
|
1354
|
+
- "Disaster recovery plan (required)"
|
|
1355
|
+
- "Emergency mode operation plan (required)"
|
|
1356
|
+
- "Testing/revision procedures (addressable)"
|
|
1357
|
+
- "Applications and data criticality analysis (addressable)"
|
|
1358
|
+
|
|
1359
|
+
evaluation:
|
|
1360
|
+
- "Periodic technical/nontechnical evaluation (required)"
|
|
1361
|
+
|
|
1362
|
+
business_associate_contracts:
|
|
1363
|
+
- "Written contract/arrangement (required)"
|
|
1364
|
+
```
|
|
1365
|
+
|
|
1366
|
+
**Technical Safeguards:**
|
|
1367
|
+
```hcl
|
|
1368
|
+
# HIPAA technical safeguards implementation
|
|
1369
|
+
|
|
1370
|
+
# Access Control (164.312(a)(1))
|
|
1371
|
+
resource "aws_iam_role" "hipaa_app_role" {
|
|
1372
|
+
name = "hipaa-application-role"
|
|
1373
|
+
|
|
1374
|
+
assume_role_policy = jsonencode({
|
|
1375
|
+
Version = "2012-10-17"
|
|
1376
|
+
Statement = [{
|
|
1377
|
+
Action = "sts:AssumeRole"
|
|
1378
|
+
Effect = "Allow"
|
|
1379
|
+
Principal = {
|
|
1380
|
+
Service = "ec2.amazonaws.com"
|
|
1381
|
+
}
|
|
1382
|
+
}]
|
|
1383
|
+
})
|
|
1384
|
+
|
|
1385
|
+
tags = {
|
|
1386
|
+
HIPAA_Control = "164.312(a)(1)"
|
|
1387
|
+
Purpose = "Access-Control"
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
# Unique user identification (164.312(a)(2)(i))
|
|
1392
|
+
resource "aws_cognito_user_pool" "hipaa_users" {
|
|
1393
|
+
name = "hipaa-user-pool"
|
|
1394
|
+
|
|
1395
|
+
password_policy {
|
|
1396
|
+
minimum_length = 12
|
|
1397
|
+
require_lowercase = true
|
|
1398
|
+
require_numbers = true
|
|
1399
|
+
require_symbols = true
|
|
1400
|
+
require_uppercase = true
|
|
1401
|
+
temporary_password_validity_days = 1
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
mfa_configuration = "ON" # HIPAA best practice
|
|
1405
|
+
|
|
1406
|
+
account_recovery_setting {
|
|
1407
|
+
recovery_mechanism {
|
|
1408
|
+
name = "admin_only"
|
|
1409
|
+
priority = 1
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
tags = {
|
|
1414
|
+
HIPAA_Control = "164.312(a)(2)(i)"
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
# Encryption and decryption (164.312(a)(2)(iv))
|
|
1419
|
+
resource "aws_kms_key" "hipaa_key" {
|
|
1420
|
+
description = "HIPAA ePHI encryption key"
|
|
1421
|
+
deletion_window_in_days = 30
|
|
1422
|
+
enable_key_rotation = true
|
|
1423
|
+
|
|
1424
|
+
tags = {
|
|
1425
|
+
HIPAA_Control = "164.312(a)(2)(iv),164.312(e)(2)(ii)"
|
|
1426
|
+
DataType = "ePHI"
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
# RDS with encryption
|
|
1431
|
+
resource "aws_db_instance" "hipaa_db" {
|
|
1432
|
+
identifier = "hipaa-patient-db"
|
|
1433
|
+
engine = "postgres"
|
|
1434
|
+
instance_class = "db.t3.medium"
|
|
1435
|
+
|
|
1436
|
+
# Encryption at rest
|
|
1437
|
+
storage_encrypted = true
|
|
1438
|
+
kms_key_id = aws_kms_key.hipaa_key.arn
|
|
1439
|
+
|
|
1440
|
+
# Audit logging (164.312(b))
|
|
1441
|
+
enabled_cloudwatch_logs_exports = ["postgresql"]
|
|
1442
|
+
|
|
1443
|
+
# Backup/recovery (164.308(a)(7)(i))
|
|
1444
|
+
backup_retention_period = 35
|
|
1445
|
+
backup_window = "03:00-04:00"
|
|
1446
|
+
|
|
1447
|
+
tags = {
|
|
1448
|
+
HIPAA_Control = "164.312(a)(2)(iv),164.308(a)(7)(i)"
|
|
1449
|
+
DataType = "ePHI"
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
# Integrity controls (164.312(c)(1))
|
|
1454
|
+
resource "aws_cloudtrail" "hipaa_audit" {
|
|
1455
|
+
name = "hipaa-audit-trail"
|
|
1456
|
+
s3_bucket_name = aws_s3_bucket.hipaa_logs.id
|
|
1457
|
+
include_global_service_events = true
|
|
1458
|
+
is_multi_region_trail = true
|
|
1459
|
+
enable_log_file_validation = true # Integrity protection
|
|
1460
|
+
|
|
1461
|
+
tags = {
|
|
1462
|
+
HIPAA_Control = "164.312(c)(1),164.312(b)"
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
# Transmission security (164.312(e)(1))
|
|
1467
|
+
resource "aws_lb_listener" "hipaa_https" {
|
|
1468
|
+
load_balancer_arn = aws_lb.hipaa_alb.arn
|
|
1469
|
+
port = 443
|
|
1470
|
+
protocol = "HTTPS"
|
|
1471
|
+
ssl_policy = "ELBSecurityPolicy-TLS-1-2-2017-01"
|
|
1472
|
+
certificate_arn = aws_acm_certificate.hipaa_cert.arn
|
|
1473
|
+
|
|
1474
|
+
default_action {
|
|
1475
|
+
type = "forward"
|
|
1476
|
+
target_group_arn = aws_lb_target_group.hipaa_app.arn
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
# Automatic logoff (164.312(a)(2)(iii))
|
|
1481
|
+
resource "aws_cognito_user_pool_client" "hipaa_app" {
|
|
1482
|
+
name = "hipaa-application"
|
|
1483
|
+
user_pool_id = aws_cognito_user_pool.hipaa_users.id
|
|
1484
|
+
|
|
1485
|
+
# Session timeout (30 minutes recommended)
|
|
1486
|
+
refresh_token_validity = 30
|
|
1487
|
+
access_token_validity = 30
|
|
1488
|
+
id_token_validity = 30
|
|
1489
|
+
|
|
1490
|
+
token_validity_units {
|
|
1491
|
+
refresh_token = "minutes"
|
|
1492
|
+
access_token = "minutes"
|
|
1493
|
+
id_token = "minutes"
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
```
|
|
1497
|
+
|
|
1498
|
+
### BAA (Business Associate Agreement)
|
|
1499
|
+
|
|
1500
|
+
```yaml
|
|
1501
|
+
# AWS BAA requirements
|
|
1502
|
+
baa_requirements:
|
|
1503
|
+
aws_services_hipaa_eligible:
|
|
1504
|
+
compute:
|
|
1505
|
+
- "EC2"
|
|
1506
|
+
- "ECS"
|
|
1507
|
+
- "EKS"
|
|
1508
|
+
- "Lambda"
|
|
1509
|
+
storage:
|
|
1510
|
+
- "S3"
|
|
1511
|
+
- "EBS"
|
|
1512
|
+
- "EFS"
|
|
1513
|
+
- "Glacier"
|
|
1514
|
+
database:
|
|
1515
|
+
- "RDS (all engines)"
|
|
1516
|
+
- "DynamoDB"
|
|
1517
|
+
- "Aurora"
|
|
1518
|
+
- "Redshift"
|
|
1519
|
+
other:
|
|
1520
|
+
- "CloudTrail"
|
|
1521
|
+
- "CloudWatch Logs"
|
|
1522
|
+
- "AWS Backup"
|
|
1523
|
+
|
|
1524
|
+
aws_services_not_hipaa_eligible:
|
|
1525
|
+
- "CloudFront (with restrictions)"
|
|
1526
|
+
- "Route 53 (DNS queries not covered)"
|
|
1527
|
+
- "API Gateway (logging may expose PHI)"
|
|
1528
|
+
|
|
1529
|
+
configuration_requirements:
|
|
1530
|
+
- "Enable encryption at rest"
|
|
1531
|
+
- "Enable encryption in transit"
|
|
1532
|
+
- "Enable logging and monitoring"
|
|
1533
|
+
- "Restrict access to authorized users"
|
|
1534
|
+
- "Sign AWS BAA"
|
|
1535
|
+
```
|
|
1536
|
+
|
|
1537
|
+
---
|
|
1538
|
+
|
|
1539
|
+
## SOC 2 (Service Organization Control 2)
|
|
1540
|
+
|
|
1541
|
+
**SOC 2** is an auditing procedure ensuring service providers securely manage data to protect customer interests.
|
|
1542
|
+
|
|
1543
|
+
### Trust Services Criteria
|
|
1544
|
+
|
|
1545
|
+
```
|
|
1546
|
+
SOC 2 Trust Service Criteria:
|
|
1547
|
+
┌─────────────────────────────────────────────────────┐
|
|
1548
|
+
│ SECURITY (Common Criteria - Required) │
|
|
1549
|
+
│ CC1: Control Environment │
|
|
1550
|
+
│ CC2: Communication and Information │
|
|
1551
|
+
│ CC3: Risk Assessment │
|
|
1552
|
+
│ CC4: Monitoring Activities │
|
|
1553
|
+
│ CC5: Control Activities │
|
|
1554
|
+
│ CC6: Logical and Physical Access Controls │
|
|
1555
|
+
│ CC7: System Operations │
|
|
1556
|
+
│ CC8: Change Management │
|
|
1557
|
+
│ CC9: Risk Mitigation │
|
|
1558
|
+
├─────────────────────────────────────────────────────┤
|
|
1559
|
+
│ ADDITIONAL CRITERIA (Optional) │
|
|
1560
|
+
│ AVAILABILITY: System uptime and operational │
|
|
1561
|
+
│ CONFIDENTIALITY: Designated confidential info │
|
|
1562
|
+
│ PROCESSING INTEGRITY: Complete, valid, authorized │
|
|
1563
|
+
│ PRIVACY: Personal information collection/use │
|
|
1564
|
+
└─────────────────────────────────────────────────────┘
|
|
1565
|
+
```
|
|
1566
|
+
|
|
1567
|
+
### SOC 2 Type I vs Type II
|
|
1568
|
+
|
|
1569
|
+
| Aspect | Type I | Type II |
|
|
1570
|
+
|--------|--------|---------|
|
|
1571
|
+
| **Focus** | Design of controls | Design AND operating effectiveness |
|
|
1572
|
+
| **Duration** | Point in time | 3-12 months |
|
|
1573
|
+
| **Testing** | Control description | Control testing over period |
|
|
1574
|
+
| **Effort** | 4-8 weeks | 3-6 months |
|
|
1575
|
+
| **Cost** | Lower | Higher |
|
|
1576
|
+
| **Value** | Initial compliance | Ongoing assurance |
|
|
1577
|
+
|
|
1578
|
+
### Implementation Example
|
|
1579
|
+
|
|
1580
|
+
```yaml
|
|
1581
|
+
# soc2-control-mapping.yaml
|
|
1582
|
+
# Map infrastructure controls to SOC 2 criteria
|
|
1583
|
+
|
|
1584
|
+
security_controls:
|
|
1585
|
+
CC6.1_logical_access:
|
|
1586
|
+
description: "Controls provide reasonable assurance that access is restricted to authorized users"
|
|
1587
|
+
implementation:
|
|
1588
|
+
- name: "IAM with MFA"
|
|
1589
|
+
terraform: "aws_iam_user with MFA enforcement"
|
|
1590
|
+
evidence:
|
|
1591
|
+
- "IAM credential report"
|
|
1592
|
+
- "MFA device list"
|
|
1593
|
+
- "Access review logs"
|
|
1594
|
+
|
|
1595
|
+
- name: "Least privilege"
|
|
1596
|
+
terraform: "aws_iam_role with minimal permissions"
|
|
1597
|
+
evidence:
|
|
1598
|
+
- "IAM policy documents"
|
|
1599
|
+
- "Permission boundaries"
|
|
1600
|
+
- "Access review documentation"
|
|
1601
|
+
|
|
1602
|
+
CC6.6_encryption:
|
|
1603
|
+
description: "Entity implements logical access security measures to protect against threats from sources outside its system boundaries"
|
|
1604
|
+
implementation:
|
|
1605
|
+
- name: "Data encryption at rest"
|
|
1606
|
+
terraform: "aws_s3_bucket_server_side_encryption_configuration"
|
|
1607
|
+
evidence:
|
|
1608
|
+
- "S3 encryption status reports"
|
|
1609
|
+
- "RDS encryption status"
|
|
1610
|
+
- "KMS key rotation logs"
|
|
1611
|
+
|
|
1612
|
+
- name: "Data encryption in transit"
|
|
1613
|
+
terraform: "aws_lb_listener with TLS 1.2+"
|
|
1614
|
+
evidence:
|
|
1615
|
+
- "TLS policy configurations"
|
|
1616
|
+
- "Certificate validity reports"
|
|
1617
|
+
- "Cipher suite configurations"
|
|
1618
|
+
|
|
1619
|
+
CC7.2_monitoring:
|
|
1620
|
+
description: "Entity monitors system components and the operation of those components for anomalies"
|
|
1621
|
+
implementation:
|
|
1622
|
+
- name: "CloudWatch alarms"
|
|
1623
|
+
terraform: "aws_cloudwatch_metric_alarm"
|
|
1624
|
+
evidence:
|
|
1625
|
+
- "Alarm configurations"
|
|
1626
|
+
- "Alarm history"
|
|
1627
|
+
- "Incident response logs"
|
|
1628
|
+
|
|
1629
|
+
- name: "Security Hub findings"
|
|
1630
|
+
terraform: "aws_securityhub_account"
|
|
1631
|
+
evidence:
|
|
1632
|
+
- "Finding summaries"
|
|
1633
|
+
- "Remediation records"
|
|
1634
|
+
- "Monthly security reports"
|
|
1635
|
+
|
|
1636
|
+
CC8.1_change_management:
|
|
1637
|
+
description: "Entity authorizes, designs, develops or acquires, implements, operates, approves, maintains, and monitors environmental protections, software, data backup processes, and recovery infrastructure"
|
|
1638
|
+
implementation:
|
|
1639
|
+
- name: "Infrastructure as Code"
|
|
1640
|
+
terraform: "All resources defined in Terraform"
|
|
1641
|
+
evidence:
|
|
1642
|
+
- "Git commit history"
|
|
1643
|
+
- "Pull request approvals"
|
|
1644
|
+
- "Terraform state files"
|
|
1645
|
+
- "CI/CD pipeline logs"
|
|
1646
|
+
|
|
1647
|
+
- name: "Change approval process"
|
|
1648
|
+
terraform: "GitHub branch protection"
|
|
1649
|
+
evidence:
|
|
1650
|
+
- "Branch protection rules"
|
|
1651
|
+
- "Code review history"
|
|
1652
|
+
- "Deployment approvals"
|
|
1653
|
+
|
|
1654
|
+
availability_controls:
|
|
1655
|
+
A1.2_monitoring:
|
|
1656
|
+
description: "Entity monitors the system to ensure ongoing performance"
|
|
1657
|
+
implementation:
|
|
1658
|
+
- name: "Application monitoring"
|
|
1659
|
+
tools:
|
|
1660
|
+
- "CloudWatch Metrics"
|
|
1661
|
+
- "X-Ray tracing"
|
|
1662
|
+
- "Application Insights"
|
|
1663
|
+
evidence:
|
|
1664
|
+
- "Uptime reports (99.9%+)"
|
|
1665
|
+
- "Incident reports"
|
|
1666
|
+
- "RCA documentation"
|
|
1667
|
+
|
|
1668
|
+
A1.3_recovery:
|
|
1669
|
+
description: "Entity implements controls to restore systems"
|
|
1670
|
+
implementation:
|
|
1671
|
+
- name: "Automated backups"
|
|
1672
|
+
terraform: "aws_db_instance with backup_retention_period"
|
|
1673
|
+
evidence:
|
|
1674
|
+
- "Backup schedules"
|
|
1675
|
+
- "Restore test results"
|
|
1676
|
+
- "DR runbooks"
|
|
1677
|
+
```
|
|
1678
|
+
|
|
1679
|
+
### Audit Preparation Checklist
|
|
1680
|
+
|
|
1681
|
+
```markdown
|
|
1682
|
+
# SOC 2 Audit Preparation Checklist
|
|
1683
|
+
|
|
1684
|
+
## Pre-Audit (3 months before)
|
|
1685
|
+
- [ ] Engage SOC 2 auditor
|
|
1686
|
+
- [ ] Define scope (Security only or +APCPP)
|
|
1687
|
+
- [ ] Define observation period (3, 6, or 12 months)
|
|
1688
|
+
- [ ] Map controls to trust services criteria
|
|
1689
|
+
- [ ] Implement missing controls
|
|
1690
|
+
- [ ] Begin evidence collection
|
|
1691
|
+
|
|
1692
|
+
## During Observation Period
|
|
1693
|
+
- [ ] Collect evidence continuously
|
|
1694
|
+
- [ ] Access reviews (monthly)
|
|
1695
|
+
- [ ] Security awareness training records
|
|
1696
|
+
- [ ] Vulnerability scan reports (monthly)
|
|
1697
|
+
- [ ] Penetration test results (annual)
|
|
1698
|
+
- [ ] Incident response documentation
|
|
1699
|
+
- [ ] Change management records
|
|
1700
|
+
- [ ] Backup and recovery logs
|
|
1701
|
+
|
|
1702
|
+
- [ ] Conduct internal audits
|
|
1703
|
+
- [ ] Address any control gaps
|
|
1704
|
+
- [ ] Document policies and procedures
|
|
1705
|
+
|
|
1706
|
+
## Audit Phase (4-8 weeks)
|
|
1707
|
+
- [ ] Provide system description
|
|
1708
|
+
- [ ] Provide control documentation
|
|
1709
|
+
- [ ] Provide evidence samples
|
|
1710
|
+
- [ ] Respond to auditor questions
|
|
1711
|
+
- [ ] Facilitate auditor testing
|
|
1712
|
+
- [ ] Address findings
|
|
1713
|
+
|
|
1714
|
+
## Post-Audit
|
|
1715
|
+
- [ ] Review draft report
|
|
1716
|
+
- [ ] Address management responses
|
|
1717
|
+
- [ ] Receive final SOC 2 report
|
|
1718
|
+
- [ ] Share report with customers
|
|
1719
|
+
- [ ] Implement remediation for any exceptions
|
|
1720
|
+
```
|
|
1721
|
+
|
|
1722
|
+
---
|
|
1723
|
+
|
|
1724
|
+
## Compliance Mapping
|
|
1725
|
+
|
|
1726
|
+
### Multi-Framework Control Mapping
|
|
1727
|
+
|
|
1728
|
+
```yaml
|
|
1729
|
+
# control-mapping.yaml
|
|
1730
|
+
# Map single control implementation to multiple frameworks
|
|
1731
|
+
|
|
1732
|
+
encryption_at_rest:
|
|
1733
|
+
implementation: "AWS KMS + S3 encryption"
|
|
1734
|
+
terraform_resource: "aws_s3_bucket_server_side_encryption_configuration"
|
|
1735
|
+
|
|
1736
|
+
mapped_controls:
|
|
1737
|
+
fedramp:
|
|
1738
|
+
- "SC-28: Protection of Information at Rest"
|
|
1739
|
+
- "SC-28(1): Cryptographic Protection"
|
|
1740
|
+
|
|
1741
|
+
cmmc:
|
|
1742
|
+
- "3.13.8: Implement cryptographic mechanisms"
|
|
1743
|
+
- "3.13.11: Employ FIPS-validated cryptography"
|
|
1744
|
+
|
|
1745
|
+
nist_800_171:
|
|
1746
|
+
- "3.13.8: Implement cryptographic mechanisms"
|
|
1747
|
+
- "3.13.11: Employ FIPS-validated cryptography when used to protect CUI"
|
|
1748
|
+
|
|
1749
|
+
pci_dss:
|
|
1750
|
+
- "3.4: Render PAN unreadable (encryption)"
|
|
1751
|
+
- "3.5: Document key-management procedures"
|
|
1752
|
+
|
|
1753
|
+
hipaa:
|
|
1754
|
+
- "164.312(a)(2)(iv): Encryption and decryption"
|
|
1755
|
+
- "164.312(e)(2)(ii): Encryption"
|
|
1756
|
+
|
|
1757
|
+
soc2:
|
|
1758
|
+
- "CC6.6: Logical access security measures"
|
|
1759
|
+
- "CC6.7: Transmission of sensitive data"
|
|
1760
|
+
|
|
1761
|
+
multi_factor_authentication:
|
|
1762
|
+
implementation: "AWS IAM with MFA enforcement"
|
|
1763
|
+
terraform_resource: "aws_iam_user + aws_iam_user_mfa_device"
|
|
1764
|
+
|
|
1765
|
+
mapped_controls:
|
|
1766
|
+
fedramp:
|
|
1767
|
+
- "IA-2(1): Multi-factor Authentication to Privileged Accounts"
|
|
1768
|
+
- "IA-2(2): Multi-factor Authentication to Non-Privileged Accounts"
|
|
1769
|
+
|
|
1770
|
+
cmmc:
|
|
1771
|
+
- "3.5.3: Use multi-factor authentication for local and network access"
|
|
1772
|
+
|
|
1773
|
+
nist_800_171:
|
|
1774
|
+
- "3.5.3: Use multi-factor authentication"
|
|
1775
|
+
|
|
1776
|
+
cjis:
|
|
1777
|
+
- "5.11.1.2: Advanced Authentication"
|
|
1778
|
+
|
|
1779
|
+
pci_dss:
|
|
1780
|
+
- "8.3: Secure all individual non-console admin access and remote access to CDE using MFA"
|
|
1781
|
+
|
|
1782
|
+
hipaa:
|
|
1783
|
+
- "164.312(d): Person or entity authentication"
|
|
1784
|
+
|
|
1785
|
+
soc2:
|
|
1786
|
+
- "CC6.1: Logical access controls"
|
|
1787
|
+
|
|
1788
|
+
audit_logging:
|
|
1789
|
+
implementation: "CloudTrail + CloudWatch Logs"
|
|
1790
|
+
terraform_resource: "aws_cloudtrail + aws_cloudwatch_log_group"
|
|
1791
|
+
|
|
1792
|
+
mapped_controls:
|
|
1793
|
+
fedramp:
|
|
1794
|
+
- "AU-2: Event Logging"
|
|
1795
|
+
- "AU-3: Content of Audit Records"
|
|
1796
|
+
- "AU-12: Audit Record Generation"
|
|
1797
|
+
|
|
1798
|
+
cmmc:
|
|
1799
|
+
- "3.3.1: Create audit records"
|
|
1800
|
+
- "3.3.2: Ensure actions can be traced to users"
|
|
1801
|
+
|
|
1802
|
+
nist_800_171:
|
|
1803
|
+
- "3.3.1: Create, protect, and retain audit records"
|
|
1804
|
+
- "3.3.2: Ensure actions traced to individual users"
|
|
1805
|
+
|
|
1806
|
+
pci_dss:
|
|
1807
|
+
- "10.2: Implement automated audit trails"
|
|
1808
|
+
- "10.3: Record audit trail entries"
|
|
1809
|
+
|
|
1810
|
+
hipaa:
|
|
1811
|
+
- "164.312(b): Audit controls"
|
|
1812
|
+
- "164.308(a)(1)(ii)(D): Information system activity review"
|
|
1813
|
+
|
|
1814
|
+
cjis:
|
|
1815
|
+
- "5.4: Auditing and Accountability"
|
|
1816
|
+
|
|
1817
|
+
soc2:
|
|
1818
|
+
- "CC7.2: Monitor system components"
|
|
1819
|
+
```
|
|
1820
|
+
|
|
1821
|
+
---
|
|
1822
|
+
|
|
1823
|
+
## Implementation Checklists
|
|
1824
|
+
|
|
1825
|
+
### FedRAMP Moderate Readiness Checklist
|
|
1826
|
+
|
|
1827
|
+
```markdown
|
|
1828
|
+
# FedRAMP Moderate Implementation Checklist
|
|
1829
|
+
|
|
1830
|
+
## Access Control (AC)
|
|
1831
|
+
- [ ] AC-2: Account management procedures documented
|
|
1832
|
+
- [ ] AC-3: Access enforcement via IAM/RBAC
|
|
1833
|
+
- [ ] AC-4: Information flow enforcement (security groups, NACLs)
|
|
1834
|
+
- [ ] AC-5: Separation of duties implemented
|
|
1835
|
+
- [ ] AC-6: Least privilege access enforced
|
|
1836
|
+
- [ ] AC-7: Unsuccessful logon attempts locked (5 attempts)
|
|
1837
|
+
- [ ] AC-17: Remote access via VPN with MFA
|
|
1838
|
+
- [ ] AC-18: Wireless access controlled (if applicable)
|
|
1839
|
+
- [ ] AC-20: Use of external systems controlled
|
|
1840
|
+
|
|
1841
|
+
## Audit and Accountability (AU)
|
|
1842
|
+
- [ ] AU-2: Auditable events defined and documented
|
|
1843
|
+
- [ ] AU-3: Audit record content meets requirements
|
|
1844
|
+
- [ ] AU-4: Audit storage capacity planned
|
|
1845
|
+
- [ ] AU-5: Response to audit processing failures
|
|
1846
|
+
- [ ] AU-6: Audit review, analysis, and reporting
|
|
1847
|
+
- [ ] AU-8: Time stamps (NTP configured)
|
|
1848
|
+
- [ ] AU-9: Protection of audit information
|
|
1849
|
+
- [ ] AU-11: Audit record retention (90 days online, 1 year total)
|
|
1850
|
+
- [ ] AU-12: Audit record generation (CloudTrail, VPC Flow Logs)
|
|
1851
|
+
|
|
1852
|
+
## Configuration Management (CM)
|
|
1853
|
+
- [ ] CM-2: Baseline configuration established
|
|
1854
|
+
- [ ] CM-3: Configuration change control
|
|
1855
|
+
- [ ] CM-6: Configuration settings documented
|
|
1856
|
+
- [ ] CM-7: Least functionality (disable unnecessary services)
|
|
1857
|
+
- [ ] CM-8: Information system component inventory
|
|
1858
|
+
- [ ] CM-10: Software usage restrictions
|
|
1859
|
+
|
|
1860
|
+
## Contingency Planning (CP)
|
|
1861
|
+
- [ ] CP-1: Contingency planning policy
|
|
1862
|
+
- [ ] CP-2: Contingency plan documented
|
|
1863
|
+
- [ ] CP-3: Contingency training
|
|
1864
|
+
- [ ] CP-4: Contingency plan testing (annual)
|
|
1865
|
+
- [ ] CP-9: Information system backup (automated daily)
|
|
1866
|
+
- [ ] CP-10: Information system recovery and reconstitution
|
|
1867
|
+
|
|
1868
|
+
## Identification and Authentication (IA)
|
|
1869
|
+
- [ ] IA-2: Unique identification and authentication
|
|
1870
|
+
- [ ] IA-2(1): MFA for privileged accounts
|
|
1871
|
+
- [ ] IA-2(2): MFA for non-privileged accounts (FedRAMP High)
|
|
1872
|
+
- [ ] IA-2(12): PIV credential acceptance
|
|
1873
|
+
- [ ] IA-4: Identifier management
|
|
1874
|
+
- [ ] IA-5: Authenticator management
|
|
1875
|
+
- [ ] IA-5(1): Password-based authentication (14 chars, 90 days)
|
|
1876
|
+
- [ ] IA-5(11): Hardware token-based authentication
|
|
1877
|
+
- [ ] IA-8: Identification and authentication (non-org users)
|
|
1878
|
+
|
|
1879
|
+
## Incident Response (IR)
|
|
1880
|
+
- [ ] IR-1: Incident response policy
|
|
1881
|
+
- [ ] IR-2: Incident response training
|
|
1882
|
+
- [ ] IR-4: Incident handling
|
|
1883
|
+
- [ ] IR-5: Incident monitoring
|
|
1884
|
+
- [ ] IR-6: Incident reporting (1 hour to agency)
|
|
1885
|
+
- [ ] IR-7: Incident response assistance
|
|
1886
|
+
- [ ] IR-8: Incident response plan
|
|
1887
|
+
|
|
1888
|
+
## System and Communications Protection (SC)
|
|
1889
|
+
- [ ] SC-5: Denial of service protection (WAF, Shield)
|
|
1890
|
+
- [ ] SC-7: Boundary protection (firewalls, security groups)
|
|
1891
|
+
- [ ] SC-8: Transmission confidentiality (TLS 1.2+)
|
|
1892
|
+
- [ ] SC-12: Cryptographic key management (KMS)
|
|
1893
|
+
- [ ] SC-13: Cryptographic protection (FIPS 140-2)
|
|
1894
|
+
- [ ] SC-28: Protection of information at rest (encryption)
|
|
1895
|
+
|
|
1896
|
+
## System and Information Integrity (SI)
|
|
1897
|
+
- [ ] SI-2: Flaw remediation (30 days for high, 90 for moderate)
|
|
1898
|
+
- [ ] SI-3: Malicious code protection
|
|
1899
|
+
- [ ] SI-4: Information system monitoring (GuardDuty, CloudWatch)
|
|
1900
|
+
- [ ] SI-5: Security alerts and advisories
|
|
1901
|
+
- [ ] SI-12: Information handling and retention
|
|
1902
|
+
|
|
1903
|
+
## Monthly Continuous Monitoring Deliverables
|
|
1904
|
+
- [ ] POA&M (Plan of Action & Milestones) update
|
|
1905
|
+
- [ ] Vulnerability scan results
|
|
1906
|
+
- [ ] Executive summary of security posture
|
|
1907
|
+
- [ ] Incident reports (if any)
|
|
1908
|
+
- [ ] Significant change requests
|
|
1909
|
+
```
|
|
1910
|
+
|
|
1911
|
+
### CMMC Level 2 Readiness Checklist
|
|
1912
|
+
|
|
1913
|
+
```markdown
|
|
1914
|
+
# CMMC Level 2 (NIST 800-171) Implementation Checklist
|
|
1915
|
+
|
|
1916
|
+
## Access Control (3.1.x)
|
|
1917
|
+
- [ ] 3.1.1: Limit system access to authorized users
|
|
1918
|
+
- [ ] 3.1.2: Limit system access to authorized transactions
|
|
1919
|
+
- [ ] 3.1.3: Control CUI flow
|
|
1920
|
+
- [ ] 3.1.4: Separate duties of individuals
|
|
1921
|
+
- [ ] 3.1.5: Employ least privilege
|
|
1922
|
+
- [ ] 3.1.6: Use non-privileged accounts
|
|
1923
|
+
- [ ] 3.1.7: Prevent non-privileged users from executing privileged functions
|
|
1924
|
+
- [ ] 3.1.8: Limit unsuccessful logon attempts
|
|
1925
|
+
- [ ] 3.1.9: Provide privacy and security notices
|
|
1926
|
+
- [ ] 3.1.10: Use session lock
|
|
1927
|
+
- [ ] 3.1.11: Terminate session after inactivity
|
|
1928
|
+
- [ ] 3.1.12: Monitor and control remote access sessions
|
|
1929
|
+
- [ ] 3.1.13: Employ cryptographic mechanisms (remote access)
|
|
1930
|
+
- [ ] 3.1.14: Route remote access via managed access control points
|
|
1931
|
+
- [ ] 3.1.15: Authorize remote execution/access processing
|
|
1932
|
+
- [ ] 3.1.16: Authorize wireless access
|
|
1933
|
+
- [ ] 3.1.17: Protect wireless access using authentication and encryption
|
|
1934
|
+
- [ ] 3.1.18: Control connection of mobile devices
|
|
1935
|
+
- [ ] 3.1.19: Encrypt CUI on mobile devices
|
|
1936
|
+
- [ ] 3.1.20: Control external system connections
|
|
1937
|
+
- [ ] 3.1.21: Limit use of portable storage devices
|
|
1938
|
+
- [ ] 3.1.22: Control CUI posted on publicly accessible systems
|
|
1939
|
+
|
|
1940
|
+
## Identification and Authentication (3.5.x)
|
|
1941
|
+
- [ ] 3.5.1: Identify system users, processes
|
|
1942
|
+
- [ ] 3.5.2: Authenticate users, processes, devices
|
|
1943
|
+
- [ ] 3.5.3: Use MFA for local and network access to privileged and non-privileged accounts
|
|
1944
|
+
- [ ] 3.5.4: Employ replay-resistant authentication
|
|
1945
|
+
- [ ] 3.5.5: Prevent reuse of identifiers
|
|
1946
|
+
- [ ] 3.5.6: Disable identifiers after period of inactivity
|
|
1947
|
+
- [ ] 3.5.7: Enforce minimum password complexity
|
|
1948
|
+
- [ ] 3.5.8: Prohibit password reuse (24 generations)
|
|
1949
|
+
- [ ] 3.5.9: Allow temporary password use for system logons (one time only)
|
|
1950
|
+
- [ ] 3.5.10: Store and transmit only cryptographically-protected passwords
|
|
1951
|
+
- [ ] 3.5.11: Obscure feedback of authentication information
|
|
1952
|
+
|
|
1953
|
+
## System and Communications Protection (3.13.x)
|
|
1954
|
+
- [ ] 3.13.1: Monitor, control, and protect communications at external boundaries
|
|
1955
|
+
- [ ] 3.13.2: Employ architectural designs, software development techniques
|
|
1956
|
+
- [ ] 3.13.3: Separate user functionality from system management
|
|
1957
|
+
- [ ] 3.13.4: Prevent unauthorized transfer via shared resources
|
|
1958
|
+
- [ ] 3.13.5: Implement subnetworks for publicly accessible components
|
|
1959
|
+
- [ ] 3.13.6: Deny network communications traffic by default
|
|
1960
|
+
- [ ] 3.13.7: Prevent remote devices from simultaneously establishing connections
|
|
1961
|
+
- [ ] 3.13.8: Implement cryptographic mechanisms to prevent unauthorized disclosure
|
|
1962
|
+
- [ ] 3.13.9: Terminate network connections at end of session
|
|
1963
|
+
- [ ] 3.13.10: Establish and manage cryptographic keys
|
|
1964
|
+
- [ ] 3.13.11: Employ FIPS-validated cryptography when used to protect CUI
|
|
1965
|
+
- [ ] 3.13.12: Prohibit remote activation of collaborative computing devices
|
|
1966
|
+
- [ ] 3.13.13: Control and monitor use of mobile code
|
|
1967
|
+
- [ ] 3.13.14: Control and monitor use of VoIP
|
|
1968
|
+
- [ ] 3.13.15: Protect authenticity of communications sessions
|
|
1969
|
+
- [ ] 3.13.16: Protect confidentiality of CUI at rest
|
|
1970
|
+
|
|
1971
|
+
## Evidence Collection
|
|
1972
|
+
- [ ] System Security Plan (SSP)
|
|
1973
|
+
- [ ] Network diagrams
|
|
1974
|
+
- [ ] Data flow diagrams
|
|
1975
|
+
- [ ] Policies and procedures
|
|
1976
|
+
- [ ] Configuration standards
|
|
1977
|
+
- [ ] Access control matrix
|
|
1978
|
+
- [ ] Incident response plan
|
|
1979
|
+
- [ ] Asset inventory
|
|
1980
|
+
- [ ] Risk assessment
|
|
1981
|
+
- [ ] Penetration test results
|
|
1982
|
+
- [ ] Vulnerability scan results
|
|
1983
|
+
```
|
|
1984
|
+
|
|
1985
|
+
---
|
|
1986
|
+
|
|
1987
|
+
## Audit Preparation
|
|
1988
|
+
|
|
1989
|
+
### Evidence Repository Structure
|
|
1990
|
+
|
|
1991
|
+
```
|
|
1992
|
+
compliance-evidence/
|
|
1993
|
+
├── policies/
|
|
1994
|
+
│ ├── information-security-policy.pdf
|
|
1995
|
+
│ ├── acceptable-use-policy.pdf
|
|
1996
|
+
│ ├── incident-response-policy.pdf
|
|
1997
|
+
│ ├── change-management-policy.pdf
|
|
1998
|
+
│ └── data-classification-policy.pdf
|
|
1999
|
+
│
|
|
2000
|
+
├── procedures/
|
|
2001
|
+
│ ├── access-control-procedures.pdf
|
|
2002
|
+
│ ├── backup-recovery-procedures.pdf
|
|
2003
|
+
│ ├── patch-management-procedures.pdf
|
|
2004
|
+
│ └── password-management-procedures.pdf
|
|
2005
|
+
│
|
|
2006
|
+
├── technical-documentation/
|
|
2007
|
+
│ ├── system-security-plan.pdf
|
|
2008
|
+
│ ├── network-diagrams.pdf
|
|
2009
|
+
│ ├── data-flow-diagrams.pdf
|
|
2010
|
+
│ ├── architecture-diagrams.pdf
|
|
2011
|
+
│ └── encryption-documentation.pdf
|
|
2012
|
+
│
|
|
2013
|
+
├── assessments/
|
|
2014
|
+
│ ├── risk-assessments/
|
|
2015
|
+
│ │ ├── 2024-Q1-risk-assessment.pdf
|
|
2016
|
+
│ │ ├── 2024-Q2-risk-assessment.pdf
|
|
2017
|
+
│ │ └── risk-register.xlsx
|
|
2018
|
+
│ │
|
|
2019
|
+
│ ├── vulnerability-scans/
|
|
2020
|
+
│ │ ├── 2024-01-scan-results.pdf
|
|
2021
|
+
│ │ ├── 2024-02-scan-results.pdf
|
|
2022
|
+
│ │ └── remediation-tracking.xlsx
|
|
2023
|
+
│ │
|
|
2024
|
+
│ └── penetration-tests/
|
|
2025
|
+
│ ├── 2024-annual-pentest-report.pdf
|
|
2026
|
+
│ └── remediation-evidence/
|
|
2027
|
+
│
|
|
2028
|
+
├── training/
|
|
2029
|
+
│ ├── security-awareness-training/
|
|
2030
|
+
│ │ ├── training-materials.pdf
|
|
2031
|
+
│ │ ├── attendance-records.xlsx
|
|
2032
|
+
│ │ └── completion-certificates/
|
|
2033
|
+
│ │
|
|
2034
|
+
│ └── role-based-training/
|
|
2035
|
+
│ ├── developer-security-training.pdf
|
|
2036
|
+
│ └── admin-training-records.xlsx
|
|
2037
|
+
│
|
|
2038
|
+
├── operational-evidence/
|
|
2039
|
+
│ ├── access-reviews/
|
|
2040
|
+
│ │ ├── 2024-Q1-access-review.xlsx
|
|
2041
|
+
│ │ ├── 2024-Q2-access-review.xlsx
|
|
2042
|
+
│ │ └── revocation-evidence/
|
|
2043
|
+
│ │
|
|
2044
|
+
│ ├── backup-logs/
|
|
2045
|
+
│ │ └── backup-success-reports.pdf
|
|
2046
|
+
│ │
|
|
2047
|
+
│ ├── patch-management/
|
|
2048
|
+
│ │ ├── patch-schedules.xlsx
|
|
2049
|
+
│ │ └── patch-completion-reports/
|
|
2050
|
+
│ │
|
|
2051
|
+
│ ├── change-management/
|
|
2052
|
+
│ │ ├── change-requests/
|
|
2053
|
+
│ │ ├── change-approvals/
|
|
2054
|
+
│ │ └── rollback-plans/
|
|
2055
|
+
│ │
|
|
2056
|
+
│ └── incident-response/
|
|
2057
|
+
│ ├── incident-reports/
|
|
2058
|
+
│ ├── root-cause-analyses/
|
|
2059
|
+
│ └── lessons-learned/
|
|
2060
|
+
│
|
|
2061
|
+
├── monitoring/
|
|
2062
|
+
│ ├── cloudtrail-logs/
|
|
2063
|
+
│ ├── vpc-flow-logs/
|
|
2064
|
+
│ ├── application-logs/
|
|
2065
|
+
│ ├── security-hub-findings/
|
|
2066
|
+
│ └── alert-response-logs/
|
|
2067
|
+
│
|
|
2068
|
+
└── compliance-reports/
|
|
2069
|
+
├── monthly-compliance-status.pdf
|
|
2070
|
+
├── quarterly-executive-summary.pdf
|
|
2071
|
+
├── annual-assessment-report.pdf
|
|
2072
|
+
└── poam-tracking.xlsx
|
|
2073
|
+
```
|
|
2074
|
+
|
|
2075
|
+
### Audit Response Template
|
|
2076
|
+
|
|
2077
|
+
```markdown
|
|
2078
|
+
# Audit Finding Response Template
|
|
2079
|
+
|
|
2080
|
+
## Finding Details
|
|
2081
|
+
**Finding ID:** [Auditor-assigned ID]
|
|
2082
|
+
**Control Reference:** [Framework control number]
|
|
2083
|
+
**Severity:** [Critical / High / Medium / Low]
|
|
2084
|
+
**Finding Description:** [Auditor's description]
|
|
2085
|
+
|
|
2086
|
+
## Management Response
|
|
2087
|
+
|
|
2088
|
+
### Current State
|
|
2089
|
+
[Describe the current implementation status]
|
|
2090
|
+
|
|
2091
|
+
### Root Cause Analysis
|
|
2092
|
+
[Explain why the gap exists]
|
|
2093
|
+
- Technical limitations: [if applicable]
|
|
2094
|
+
- Process gaps: [if applicable]
|
|
2095
|
+
- Resource constraints: [if applicable]
|
|
2096
|
+
|
|
2097
|
+
### Remediation Plan
|
|
2098
|
+
|
|
2099
|
+
**Option 1: Immediate Remediation**
|
|
2100
|
+
- **Action:** [Specific remediation steps]
|
|
2101
|
+
- **Owner:** [Responsible person/team]
|
|
2102
|
+
- **Timeline:** [Completion date]
|
|
2103
|
+
- **Resources Required:** [Budget, personnel, tools]
|
|
2104
|
+
- **Evidence:** [How compliance will be demonstrated]
|
|
2105
|
+
|
|
2106
|
+
**Option 2: Compensating Controls** (if immediate remediation not feasible)
|
|
2107
|
+
- **Compensating Control:** [Alternative control]
|
|
2108
|
+
- **Justification:** [Why this provides equivalent protection]
|
|
2109
|
+
- **Implementation Date:** [When compensating control implemented]
|
|
2110
|
+
|
|
2111
|
+
### Verification
|
|
2112
|
+
- **Testing Method:** [How control effectiveness will be validated]
|
|
2113
|
+
- **Test Frequency:** [Ongoing monitoring approach]
|
|
2114
|
+
- **Success Criteria:** [What constitutes successful implementation]
|
|
2115
|
+
|
|
2116
|
+
### Sign-off
|
|
2117
|
+
**Prepared by:** [Name, Title, Date]
|
|
2118
|
+
**Reviewed by:** [Security Officer, Date]
|
|
2119
|
+
**Approved by:** [Executive Sponsor, Date]
|
|
2120
|
+
```
|
|
2121
|
+
|
|
2122
|
+
---
|
|
2123
|
+
|
|
2124
|
+
## Best Practices
|
|
2125
|
+
|
|
2126
|
+
### 1. Compliance Automation
|
|
2127
|
+
|
|
2128
|
+
```python
|
|
2129
|
+
# compliance_automation.py
|
|
2130
|
+
"""Automate compliance checking and evidence collection"""
|
|
2131
|
+
|
|
2132
|
+
import boto3
|
|
2133
|
+
from datetime import datetime, timedelta
|
|
2134
|
+
|
|
2135
|
+
class ComplianceAutomation:
|
|
2136
|
+
def __init__(self):
|
|
2137
|
+
self.s3 = boto3.client('s3')
|
|
2138
|
+
self.config = boto3.client('config')
|
|
2139
|
+
self.securityhub = boto3.client('securityhub')
|
|
2140
|
+
self.cloudtrail = boto3.client('cloudtrail')
|
|
2141
|
+
|
|
2142
|
+
def check_encryption_compliance(self):
|
|
2143
|
+
"""Check if all S3 buckets have encryption enabled"""
|
|
2144
|
+
results = []
|
|
2145
|
+
buckets = self.s3.list_buckets()['Buckets']
|
|
2146
|
+
|
|
2147
|
+
for bucket in buckets:
|
|
2148
|
+
bucket_name = bucket['Name']
|
|
2149
|
+
try:
|
|
2150
|
+
encryption = self.s3.get_bucket_encryption(Bucket=bucket_name)
|
|
2151
|
+
results.append({
|
|
2152
|
+
'bucket': bucket_name,
|
|
2153
|
+
'compliant': True,
|
|
2154
|
+
'encryption': encryption['ServerSideEncryptionConfiguration']
|
|
2155
|
+
})
|
|
2156
|
+
except:
|
|
2157
|
+
results.append({
|
|
2158
|
+
'bucket': bucket_name,
|
|
2159
|
+
'compliant': False,
|
|
2160
|
+
'encryption': None
|
|
2161
|
+
})
|
|
2162
|
+
|
|
2163
|
+
return results
|
|
2164
|
+
|
|
2165
|
+
def generate_evidence_package(self, control_id):
|
|
2166
|
+
"""Generate evidence package for specific control"""
|
|
2167
|
+
evidence = {
|
|
2168
|
+
'control_id': control_id,
|
|
2169
|
+
'generated_date': datetime.now().isoformat(),
|
|
2170
|
+
'evidence_items': []
|
|
2171
|
+
}
|
|
2172
|
+
|
|
2173
|
+
if control_id == 'AC-2': # Account Management
|
|
2174
|
+
# Collect IAM user list
|
|
2175
|
+
iam = boto3.client('iam')
|
|
2176
|
+
users = iam.list_users()
|
|
2177
|
+
evidence['evidence_items'].append({
|
|
2178
|
+
'type': 'IAM User List',
|
|
2179
|
+
'data': users
|
|
2180
|
+
})
|
|
2181
|
+
|
|
2182
|
+
# Collect access reviews
|
|
2183
|
+
# Collect MFA status
|
|
2184
|
+
# etc.
|
|
2185
|
+
|
|
2186
|
+
elif control_id == 'AU-2': # Audit Logging
|
|
2187
|
+
# Collect CloudTrail configuration
|
|
2188
|
+
trails = self.cloudtrail.describe_trails()
|
|
2189
|
+
evidence['evidence_items'].append({
|
|
2190
|
+
'type': 'CloudTrail Configuration',
|
|
2191
|
+
'data': trails
|
|
2192
|
+
})
|
|
2193
|
+
|
|
2194
|
+
return evidence
|
|
2195
|
+
|
|
2196
|
+
def continuous_compliance_monitoring(self):
|
|
2197
|
+
"""Run continuous compliance checks"""
|
|
2198
|
+
compliance_status = {
|
|
2199
|
+
'timestamp': datetime.now().isoformat(),
|
|
2200
|
+
'checks': []
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
# Check 1: Encryption at rest
|
|
2204
|
+
encryption_results = self.check_encryption_compliance()
|
|
2205
|
+
compliance_status['checks'].append({
|
|
2206
|
+
'control': 'SC-28',
|
|
2207
|
+
'description': 'Protection of Information at Rest',
|
|
2208
|
+
'results': encryption_results,
|
|
2209
|
+
'compliant': all(r['compliant'] for r in encryption_results)
|
|
2210
|
+
})
|
|
2211
|
+
|
|
2212
|
+
# Check 2: MFA enabled
|
|
2213
|
+
# Check 3: Logging enabled
|
|
2214
|
+
# etc.
|
|
2215
|
+
|
|
2216
|
+
return compliance_status
|
|
2217
|
+
|
|
2218
|
+
# Usage
|
|
2219
|
+
automation = ComplianceAutomation()
|
|
2220
|
+
status = automation.continuous_compliance_monitoring()
|
|
2221
|
+
evidence = automation.generate_evidence_package('AC-2')
|
|
2222
|
+
```
|
|
2223
|
+
|
|
2224
|
+
### 2. Multi-Framework Tagging Strategy
|
|
2225
|
+
|
|
2226
|
+
```hcl
|
|
2227
|
+
# tagging-strategy.tf
|
|
2228
|
+
# Standard tagging for compliance tracking
|
|
2229
|
+
|
|
2230
|
+
locals {
|
|
2231
|
+
common_tags = {
|
|
2232
|
+
# Business tags
|
|
2233
|
+
CostCenter = "IT-Security"
|
|
2234
|
+
Owner = "security-team@company.com"
|
|
2235
|
+
Environment = "Production"
|
|
2236
|
+
|
|
2237
|
+
# Data classification tags
|
|
2238
|
+
DataClassification = "CUI" # or "PHI", "PCI", "Public"
|
|
2239
|
+
|
|
2240
|
+
# Compliance tags
|
|
2241
|
+
ComplianceFrameworks = "FedRAMP-Moderate,CMMC-L2,NIST-800-171"
|
|
2242
|
+
ComplianceControls = "AC-2,AU-2,SC-28"
|
|
2243
|
+
|
|
2244
|
+
# Technical tags
|
|
2245
|
+
BackupRequired = "true"
|
|
2246
|
+
EncryptionRequired = "true"
|
|
2247
|
+
MonitoringLevel = "enhanced"
|
|
2248
|
+
|
|
2249
|
+
# Operational tags
|
|
2250
|
+
MaintenanceWindow = "Sun-03:00-05:00"
|
|
2251
|
+
PatchGroup = "critical-systems"
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
resource "aws_s3_bucket" "compliant_bucket" {
|
|
2256
|
+
bucket = "compliant-data-bucket"
|
|
2257
|
+
|
|
2258
|
+
tags = merge(local.common_tags, {
|
|
2259
|
+
# Resource-specific tags
|
|
2260
|
+
DataRetentionYears = "7"
|
|
2261
|
+
ContainsCUI = "true"
|
|
2262
|
+
ITARControlled = "false"
|
|
2263
|
+
})
|
|
2264
|
+
}
|
|
2265
|
+
```
|
|
2266
|
+
|
|
2267
|
+
### 3. Compliance Dashboard
|
|
2268
|
+
|
|
2269
|
+
```python
|
|
2270
|
+
# compliance_dashboard.py
|
|
2271
|
+
"""Generate compliance dashboard metrics"""
|
|
2272
|
+
|
|
2273
|
+
def generate_compliance_dashboard():
|
|
2274
|
+
"""Generate executive dashboard for compliance status"""
|
|
2275
|
+
dashboard = {
|
|
2276
|
+
'overall_compliance': {},
|
|
2277
|
+
'by_framework': {},
|
|
2278
|
+
'trends': {},
|
|
2279
|
+
'risk_areas': []
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
# FedRAMP
|
|
2283
|
+
dashboard['by_framework']['FedRAMP'] = {
|
|
2284
|
+
'status': 'Authorized',
|
|
2285
|
+
'controls_total': 325,
|
|
2286
|
+
'controls_implemented': 320,
|
|
2287
|
+
'controls_in_progress': 5,
|
|
2288
|
+
'poam_items': 5,
|
|
2289
|
+
'last_assessment': '2024-01-15',
|
|
2290
|
+
'next_assessment': '2025-01-15'
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
# CMMC
|
|
2294
|
+
dashboard['by_framework']['CMMC'] = {
|
|
2295
|
+
'status': 'Level 2 Certified',
|
|
2296
|
+
'practices_total': 110,
|
|
2297
|
+
'practices_met': 110,
|
|
2298
|
+
'certification_date': '2024-03-20',
|
|
2299
|
+
'expiration_date': '2027-03-20'
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
# Calculate overall compliance percentage
|
|
2303
|
+
total_controls = sum(f['controls_total'] for f in dashboard['by_framework'].values())
|
|
2304
|
+
implemented = sum(f['controls_implemented'] for f in dashboard['by_framework'].values())
|
|
2305
|
+
dashboard['overall_compliance']['percentage'] = (implemented / total_controls) * 100
|
|
2306
|
+
|
|
2307
|
+
# Identify risk areas
|
|
2308
|
+
dashboard['risk_areas'] = [
|
|
2309
|
+
{'control': 'AC-2(3)', 'issue': 'Automated account disablement not fully implemented'},
|
|
2310
|
+
{'control': 'SI-4', 'issue': 'Container monitoring gaps in dev environment'},
|
|
2311
|
+
]
|
|
2312
|
+
|
|
2313
|
+
return dashboard
|
|
2314
|
+
```
|
|
2315
|
+
|
|
2316
|
+
---
|
|
2317
|
+
|
|
2318
|
+
**Related Resources:**
|
|
2319
|
+
- [cloud-security.md](../cloud-engineering/resources/cloud-security.md) - Security controls
|
|
2320
|
+
- [cleared-cloud-environments.md](../cloud-engineering/resources/cleared-cloud-environments.md) - Government clouds
|
|
2321
|
+
- [cspm-integration.md](cspm-integration.md) - CSPM tool integration
|
|
2322
|
+
- [workload-classification.md](../infrastructure-architecture/resources/workload-classification.md) - Data classification
|