NTC Security Tooling
- ntc-security-tooling
- 2.2.0
- AWS
- Security
NTC Security Tooling v2 introduces major improvements including AWS Provider v6 support, AWS European Sovereign Cloud compatibility, and simplified multi-region configuration.
๐ Read the Migration Guide for step-by-step instructions.
Descriptionโ
NTC Security Tooling configures the AWS security services of your organization from a central security account: AWS Security Hub, Amazon GuardDuty, Amazon Inspector and IAM Access Analyzer. It enables them across accounts and regions, sets their organization-wide configuration and collects their findings in one place.
Every account is covered by the same threat detection and is checked against the same security standards.
NTC Security Tooling requires Admin Delegations for Security Hub and security services that should be enabled across the entire organization (e.g. GuardDuty, Inspector, IAM Access Analyzer, Config).
Admin Delegations can be easily managed via NTC Organizations.
Usageโ
Loading the usage example from the implementation blueprint.
Requirementsโ
The following requirements are needed by this module:
-
terraform (>= 1.5.0)
-
aws (>= 6.70)
-
time (>= 0.11)
Providersโ
The following providers are used by this module:
-
aws (>= 6.70)
-
time (>= 0.11)
Modulesโ
The following Modules are called:
lambda_dlq_monitorโ
Source: ./modules/lambda
Version:
lambda_express_starterโ
Source: ./modules/lambda
Version:
lambda_security_reportโ
Source: ./modules/lambda
Version:
lambda_step_functionโ
Source: ./modules/lambda
Version:
regional_security_configโ
Source: ./modules/regional-security-config
Version:
Resourcesโ
The following resources are used by this module:
- aws_cloudwatch_event_rule.ntc_reports_schedule (resource)
- aws_cloudwatch_event_rule.ntc_securityhub_findings (resource)
- aws_cloudwatch_event_rule.ntc_securityhub_findings_dlq_monitor_schedule (resource)
- aws_cloudwatch_event_rule.ntc_securityhub_findings_failed_executions (resource)
- aws_cloudwatch_event_target.ntc_reports_trigger (resource)
- aws_cloudwatch_event_target.ntc_securityhub_findings (resource)
- aws_cloudwatch_event_target.ntc_securityhub_findings_dlq_monitor (resource)
- aws_cloudwatch_event_target.ntc_securityhub_findings_failed_executions (resource)
- aws_cloudwatch_log_group.ntc_securityhub_findings_state_machine (resource)
- aws_config_configuration_aggregator.ntc_aws_config_aggregator (resource)
- aws_dynamodb_table.ntc_securityhub_findings_enrichment (resource)
- aws_iam_policy.ntc_reports_lambda_permissions (resource)
- aws_iam_role.ntc_aws_config_aggregator (resource)
- aws_iam_role.ntc_dlq_monitor_execution_role (resource)
- aws_iam_role.ntc_express_starter_execution_role (resource)
- aws_iam_role.ntc_lambda_execution_role (resource)
- aws_iam_role.ntc_state_machine_event_rule_role (resource)
- aws_iam_role.ntc_state_machine_execution_role (resource)
- aws_iam_role_policy.ntc_dlq_monitor_execution_policy (resource)
- aws_iam_role_policy.ntc_express_starter_execution_policy (resource)
- aws_iam_role_policy.ntc_state_machine_event_rule_policy (resource)
- aws_iam_role_policy.ntc_state_machine_execution_policy (resource)
- aws_iam_role_policy.ntc_state_machine_logging (resource)
- aws_iam_role_policy_attachment.ntc_aws_config_aggregator (resource)
- aws_iam_role_policy_attachment.ntc_reports_lambda (resource)
- aws_kms_alias.ntc_security_tooling_encryption (resource)
- aws_kms_key.ntc_security_tooling_encryption (resource)
- aws_lambda_function_event_invoke_config.ntc_express_starter (resource)
- aws_securityhub_account.ntc_securityhub_central (resource)
- aws_securityhub_configuration_policy.ntc_securityhub_central (resource)
- aws_securityhub_configuration_policy_association.ntc_securityhub_central (resource)
- aws_securityhub_finding_aggregator.ntc_securityhub_central (resource)
- aws_securityhub_insight.ntc_findings_by_severity_last_x_days (resource)
- aws_securityhub_insight.ntc_findings_by_status_last_x_days (resource)
- aws_securityhub_insight.ntc_unresolved_findings_by_severity (resource)
- aws_securityhub_organization_configuration.ntc_securityhub_central (resource)
- aws_sfn_state_machine.ntc_securityhub_findings_state_machine (resource)
- aws_sns_topic.ntc_securityhub_findings_notification_pretty (resource)
- aws_sns_topic.ntc_securityhub_findings_notification_raw (resource)
- aws_sns_topic.ntc_securityhub_reports (resource)
- aws_sns_topic_policy.ntc_securityhub_findings_notification_pretty (resource)
- aws_sns_topic_policy.ntc_securityhub_findings_notification_raw (resource)
- aws_sns_topic_subscription.ntc_securityhub_findings_pretty (resource)
- aws_sns_topic_subscription.ntc_securityhub_findings_raw (resource)
- aws_sns_topic_subscription.ntc_securityhub_reports (resource)
- aws_sqs_queue.ntc_securityhub_findings_dlq (resource)
- aws_sqs_queue_policy.ntc_securityhub_findings_dlq (resource)
- time_sleep.ntc_securityhub_central (resource)
- aws_caller_identity.current (data source)
- aws_iam_policy_document.ntc_aws_config_aggregator (data source)
- aws_iam_policy_document.ntc_dlq_monitor_execution_assume_role (data source)
- aws_iam_policy_document.ntc_dlq_monitor_execution_policy (data source)
- aws_iam_policy_document.ntc_express_starter_execution_assume_role (data source)
- aws_iam_policy_document.ntc_express_starter_execution_policy (data source)
- aws_iam_policy_document.ntc_lambda_assume_role (data source)
- aws_iam_policy_document.ntc_reports_lambda_permissions (data source)
- aws_iam_policy_document.ntc_security_tooling_encryption (data source)
- aws_iam_policy_document.ntc_securityhub_findings_dlq (data source)
- aws_iam_policy_document.ntc_securityhub_findings_notification_pretty (data source)
- aws_iam_policy_document.ntc_securityhub_findings_notification_raw (data source)
- aws_iam_policy_document.ntc_state_machine_event_rule_assume_role (data source)
- aws_iam_policy_document.ntc_state_machine_event_rule_policy (data source)
- aws_iam_policy_document.ntc_state_machine_execution_assume_role (data source)
- aws_iam_policy_document.ntc_state_machine_execution_policy (data source)
- aws_iam_policy_document.ntc_state_machine_logging (data source)
- aws_organizations_organization.current (data source)
- aws_partition.current (data source)
- aws_region.current (data source)
Required Inputsโ
No required inputs.
Optional Inputsโ
The following input variables are optional (have default values):
arm_based_computeโ
Description: Set to false to use x86_64 instead of arm for pipelines and lambdas.
Type: bool
Default: true
config_aggregator_iam_role_nameโ
Description: Name of the IAM role used by AWS Config to aggregate regions.
Type: string
Default: "ntc-config-aggregator-role"
config_aggregator_nameโ
Description: Name of the AWS Config Aggregator used to aggregate Config data from every account in the AWS Organization.
Type: string
Default: "ntc-config-aggregator"
enable_config_aggregationโ
Description: Set to true to enable aggregation of AWS Config across all regions.
Type: bool
Default: false
enable_securityhub_aggregationโ
Description: Set to true to aggregate all securityhub findings to current region (home region).
Type: bool
Default: true
enable_securityhub_central_configurationโ
Description: Set to true to enable Security Hub central configuration. Requires 'enable_securityhub_aggregation' to be set to true.
Type: bool
Default: true
enable_securityhub_consolidated_control_findingsโ
Description: Set to true to consolidate all securityhub findings with duplicate controls from enabled standards.
Type: bool
Default: true
enable_securityhub_default_standardsโ
Description: Set to true to enable securityhub standards that securityhub has designated as automatically enabled.
Type: bool
Default: true
guardduty_configurationโ
Description: Configuration for AWS GuardDuty across multiple regions.
Type:
object({
regions = list(string)
finding_publishing_frequency = optional(string, "SIX_HOURS")
organization_config = optional(object({
auto_enable = optional(string, "ALL")
features = optional(list(object({
auto_enable = string
name = string
additional_configuration = optional(list(object({
auto_enable = string
name = string
})), [])
})), [])
invite_members_by_account_id = optional(list(string), [])
}), {})
export_findings = optional(bool, false)
log_archive_bucket_arn = optional(string, null)
log_archive_kms_key_arn = optional(string, null)
region_overrides = optional(map(object({
finding_publishing_frequency = optional(string)
organization_config = optional(object({
auto_enable = optional(string)
features = optional(list(object({
auto_enable = string
name = string
additional_configuration = optional(list(object({
auto_enable = string
name = string
})))
})))
invite_members_by_account_id = optional(list(string))
}))
export_findings = optional(bool)
log_archive_bucket_arn = optional(string)
log_archive_kms_key_arn = optional(string)
})))
})
Default:
{
"regions": []
}
iam_access_analyzers_configurationโ
Description: Configuration for multiple IAM Access Analyzers across multiple regions.
Type:
list(object({
regions = list(string)
analyzer_name = string
findings_type = string
findings_scope = optional(string, "organization")
unused_access_age = optional(number, 90)
rules = optional(list(object({
rule_name = string
filters = optional(list(object({
filter_key = string
condition = string
values = list(string)
})), [])
})), [])
region_overrides = optional(map(object({
analyzer_name = optional(string)
findings_type = optional(string)
findings_scope = optional(string)
unused_access_age = optional(number)
rules = optional(list(object({
rule_name = string
filters = list(object({
filter_key = string
condition = string
values = list(string)
}))
})))
})))
}))
Default: []
inspector_configurationโ
Description: Configuration for AWS Inspector2 across multiple regions.
Type:
object({
regions = list(string)
organization_config = optional(object({
auto_enable = optional(bool, true)
features = optional(list(object({
auto_enable = string
name = string
})), [])
invite_members_by_account_id = optional(list(string), [])
}), {})
region_overrides = optional(map(object({
organization_config = optional(object({
auto_enable = optional(bool)
features = optional(list(object({
auto_enable = string
name = string
})))
invite_members_by_account_id = optional(list(string))
}))
})))
})
Default:
{
"regions": []
}
lambda_execution_policy_nameโ
Description: Name of security lambda execution policy.
Type: string
Default: "ntc-security-lambda-policy"
lambda_execution_role_nameโ
Description: Name of security lambda execution role.
Type: string
Default: "ntc-security-lambda-role"
lambda_runtimeโ
Description: The runtime with which all the lambda function runs on.
Type: string
Default: "python3.13"
regionโ
Description: AWS region where the resources will be created. Omit to use the provider default region.
Type: string
Default: null
security_tooling_kms_alias_nameโ
Description: Alias of KMS key used for security tooling.
Type: string
Default: "ntc-security-tooling"
securityhub_aggregation_regionsโ
Description: List of regions which should be aggregated in securityhub. Requires 'enable_securityhub_aggregation' to be set to true.
Type: list(string)
Default: []
securityhub_central_configuration_policesโ
Description: Securityhub central configuration policies. Requires 'enable_securityhub_aggregation' to be set to true. Parameters of 'customized_security_controls' support the types 'Boolean', 'Double', 'Enum', 'Integer', 'String' and the list types 'EnumList', 'IntegerList' and 'StringList'. Values of list types must be provided as a comma-separated string (e.g. '80,443').
Type:
list(object({
name = string
description = string
policy_targets = list(string)
service_enabled = optional(bool, true)
enabled_standards = optional(list(string), [])
disabled_control_ids = optional(list(string), [])
enabled_control_ids = optional(list(string), [])
customized_security_controls = optional(list(object({
control_id = string
parameters = optional(list(object({
name = string
value = string
type = string
})), [])
})), [])
}))
Default: []
securityhub_enrichment_settingsโ
Description: Configuration of enrichment for AWS Security Hub findings.
Type:
object({
enable_enrichment = optional(bool, true)
severity_labels = optional(list(string), ["INFORMATIONAL", "LOW", "MEDIUM", "HIGH", "CRITICAL"])
alternate_contact_assume_role = optional(string, "")
lambda_name = optional(string, "ntc-securityhub-enrichment-lambda")
dynamodb_cache_table_name = optional(string, "ntc-securityhub-enrichment-cache")
dynamodb_cache_max_hours = optional(number, 24)
dynamodb_cache_billing_mode = optional(string, "PAY_PER_REQUEST")
dynamodb_cache_provisioned_capacity = optional(object({
read = optional(string, 20)
write = optional(string, 20)
}), {})
})
Default: {}
securityhub_findings_dead_letter_settingsโ
Description: Configuration of the kms encrypted dead-letter queue for securityhub findings which could not be processed.
Standard mode: events which cannot be delivered to the state machine and failed, timed out or aborted executions (via 'failed_executions_event_rule_name').
Express mode: events which cannot be delivered to the starter lambda, events whose execution could not be started after all lambda retries
and executions which did not succeed or whose result is unknown (sent by the starter lambda).
Messages contain the finding and can be used to analyze or replay the finding.
Notifications: a scheduled lambda checks the queue every 'notification_interval_in_hours' and publishes one message to the pretty findings topic
if new messages arrived in that interval. 'enable_notifications' defaults to null, which follows 'enable_notifications' in 'securityhub_notification_settings'.
Set it to true to require the notification (the plan fails if 'securityhub_notification_settings.enable_notifications' is false) or to false to disable it.
The pretty findings topic needs a subscription (in 'subscriptions_findings_pretty' or managed outside of this module) for notifications to reach anyone.
Type:
object({
dead_letter_queue_name = optional(string, "ntc-securityhub-findings-dlq")
dead_letter_queue_retention_in_seconds = optional(number, 1209600)
event_maximum_age_in_seconds = optional(number, 86400)
event_maximum_retry_attempts = optional(number, 185)
failed_executions_event_rule_name = optional(string, "ntc-securityhub-findings-failed-executions")
enable_notifications = optional(bool)
notification_interval_in_hours = optional(number, 6)
monitor_lambda_name = optional(string, "ntc-securityhub-findings-dlq-monitor")
monitor_role_name = optional(string, "ntc-securityhub-findings-dlq-monitor-role")
monitor_schedule_name = optional(string, "ntc-securityhub-findings-dlq-monitor-schedule")
})
Default: {}
securityhub_findings_express_starter_lambda_nameโ
Description: Name of the lambda which starts the synchronous Express executions. Only used when 'securityhub_findings_state_machine_express_mode' is true.
Type: string
Default: "securityhub_findings_express_starter"
securityhub_findings_express_starter_role_nameโ
Description: The iam role name of the lambda which starts the synchronous Express executions. Only used when 'securityhub_findings_state_machine_express_mode' is true.
Type: string
Default: "ntc-securityhub-findings-express-starter-role"
securityhub_findings_lambda_reserved_concurrencyโ
Description: Reserved concurrency of the lambdas for securityhub findings (e.g. { securityhub_findings_update = 10 }).
Lambdas which are not listed use unreserved account concurrency.
Step function lambdas: limiting the update lambda reduces SecurityHub API rate limiting during large bursts of findings. Throttled invocations are retried by the state machine.
'securityhub_findings_express_starter' (express mode only, independent of 'securityhub_findings_express_starter_lambda_name'): the starter lambda waits for each
execution to complete, so it occupies concurrency while the step lambdas run. Limiting it prevents large bursts of findings from exhausting the account concurrency.
Throttled events are retried by lambda for up to 6 hours.
Type: map(number)
Default: {}
securityhub_findings_state_machine_event_rule_role_nameโ
Description: The iam role name to trigger the state machine for securityhub findings.
Type: string
Default: "ntc-securityhub-findings-state-machine-trigger"
securityhub_findings_state_machine_express_modeโ
Description: Set to true to run the state machine for securityhub findings as a synchronous Express workflow instead of a Standard workflow.
Express workflows are billed per request and duration instead of per state transition, which significantly reduces costs for large numbers of findings.
Events are passed to a starter lambda which starts each execution synchronously (at-most-once) and does not retry executions that have already started.
Express executions are limited to a duration of 5 minutes. The Step Functions console shows their execution history from the state machine logs: set 'securityhub_findings_state_machine_log_level' to ALL for a view close to Standard workflows (with ERROR only failed executions are visible) and enable 'securityhub_findings_state_machine_log_include_execution_data' to also see input and output of states.
Changing this value replaces the state machine.
Type: bool
Default: false
securityhub_findings_state_machine_log_include_execution_dataโ
Description: Set to true to include execution data (input and output of states) in the state machine logs. Execution data contains finding details, enable only for troubleshooting.
Type: bool
Default: false
securityhub_findings_state_machine_log_levelโ
Description: Log level of the state machine for securityhub findings. Can be ALL, ERROR, FATAL or OFF. Set to ALL for troubleshooting.
Type: string
Default: "ERROR"
securityhub_findings_state_machine_log_retention_in_daysโ
Description: Number of days to retain logs of the state machine for securityhub findings. Set to 0 to never expire logs.
Type: number
Default: 365
securityhub_findings_state_machine_nameโ
Description: The state machine name for securityhub findings step functions.
Type: string
Default: "ntc-securityhub-findings-state-machine"
securityhub_findings_state_machine_role_nameโ
Description: The iam role name assumed by the state machine for securityhub findings to invoke its lambda steps.
Type: string
Default: "ntc-securityhub-findings-state-machine-role"
securityhub_notification_settingsโ
Description: Configuration of notifications for AWS Security Hub findings.
Type:
object({
enable_notifications = optional(bool, true)
org_identifier = optional(string, "")
event_rule_name = optional(string, "ntc-securityhub-findings-rule")
prettify_lambda_name = optional(string, "ntc-securityhub-findings-prettify-lambda")
severity_labels_findings_raw = optional(list(string), ["HIGH", "CRITICAL"])
sns_topic_name_findings_raw = optional(string, "ntc-securityhub-findings-raw")
subscriptions_findings_raw = optional(list(object({
protocol = string
endpoints = list(string)
subscription_role_arn = optional(string, null)
})), [])
severity_labels_findings_pretty = optional(list(string), ["HIGH", "CRITICAL"])
sns_topic_name_findings_pretty = optional(string, "ntc-securityhub-findings-pretty")
subscriptions_findings_pretty = optional(list(object({
protocol = string
endpoints = list(string)
subscription_role_arn = optional(string, null)
})), [])
reminder_x_days_unresolved_by_severity = optional(object({
critical = optional(number, 1)
high = optional(number, 3)
medium = optional(number, 7)
low = optional(number, 14)
informational = optional(number, 14)
}), {})
})
Default: {}
securityhub_processing_settingsโ
Description: Configuration of processing for AWS Security Hub findings.
Type:
object({
enable_processing = optional(bool, false)
lambda_name = optional(string, "ntc-securityhub-processing-lambda")
automation_rules = optional(list(object({
IsTerminal = bool
RuleName = string
RuleOrder = number
RuleStatus = string
Description = optional(string, "")
Criteria = map(list(object({
Key = optional(string)
Value = string
Comparison = string
})))
Actions = list(object({
Type = string
FindingFieldsUpdate = object({
Note = optional(object({
Text = optional(string)
UpdatedBy = optional(string)
}))
Severity = optional(object({
Normalized = optional(number)
Product = optional(number)
Label = optional(string)
}))
VerificationState = optional(string)
Confidence = optional(number)
Criticality = optional(number)
Types = optional(list(string))
UserDefinedFields = optional(map(string))
Workflow = optional(object({
Status = string
}))
RelatedFindings = optional(list(object({
ProductArn = optional(string)
Id = optional(string)
})))
})
}))
})), [])
})
Default:
{
"automation_rules": []
}
securityhub_report_settingsโ
Description: Configuration of reoccuring Security Hub reports
Type:
list(object({
report = string
schedule_in_days = optional(number, 7)
lambda_prefix_name = optional(string, "ntc-security-report-lambda-")
schedule_prefix_name = optional(string, "ntc-security-report-schedule-")
sns_prefix_name = optional(string, "ntc-security-report-sns-")
subscriptions = optional(list(object({
protocol = string
endpoints = list(string)
subscription_role_arn = optional(string, null)
})), [])
}))
Default: []
service_principal_domainโ
Description: Domain of AWS service principals (e.g. "logging.s3.amazonaws.com") used in policy templates. Service principal names do not follow the partition dns suffix (e.g. aws-eusc also uses "amazonaws.com"), so only change this if a partition uses a different service principal domain.
Type: string
Default: "amazonaws.com"
tracing_mode_lambdasโ
Description: Whether to sample and trace a subset of incoming requests with AWS X-Ray for all Lambdas.
Can be either PassThrough or Active and if omitted tracing is disabled.
If PassThrough, Lambdas will only trace the request from an upstream service if it contains a tracing header with "sampled=1".
If Active, Lambdas will respect any tracing header it receives from an upstream service.
If no tracing header is received, Lambdas will call X-Ray for a tracing decision.
Type: string
Default: null
tracing_mode_step_functionsโ
Description: Whether to sample and trace a subset of incoming requests with AWS X-Ray for all Step Functions.
Can be either PassThrough or Active and if omitted tracing is disabled.
If PassThrough, Lambdas will only trace the request from an upstream service if it contains a tracing header with "sampled=1".
If Active, Lambdas will respect any tracing header it receives from an upstream service.
If no tracing header is received, Lambdas will call X-Ray for a tracing decision.
Type: string
Default: null
Outputsโ
The following outputs are exported:
dead_letter_queue_arn_findingsโ
Description: Amazon Resource Name (ARN) of the dead-letter queue for Security Hub findings which could not be processed
dead_letter_queue_monitor_lambda_arn_findingsโ
Description: Amazon Resource Name (ARN) of the lambda which notifies about new messages in the dead-letter queue for Security Hub findings
dead_letter_queue_url_findingsโ
Description: URL of the dead-letter queue for Security Hub findings which could not be processed
sns_topic_arn_findings_prettyโ
Description: Amazon Resource Name (ARN) of the Security Hub finding SNS topic
sns_topic_arn_findings_rawโ
Description: Amazon Resource Name (ARN) of the Security Hub finding SNS topic
sns_topic_id_findings_prettyโ
Description: Identifier of the Security Hub finding SNS topic
sns_topic_id_findings_rawโ
Description: Identifier of the Security Hub finding SNS topic
stepfunction_arnโ
Description: Amazon Resource Name (ARN) of the Security Hub finding SNS topic
stepfunction_state_machine_definitionโ
Description: Definition of the Security Hub findings state machine
stepfunction_typeโ
Description: Type of the Security Hub findings state machine (STANDARD or EXPRESS)