github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/rules/cloud/policies/aws/mq/enable_general_logging.go (about) 1 package mq 2 3 import ( 4 "github.com/khulnasoft-lab/defsec/internal/rules" 5 "github.com/khulnasoft-lab/defsec/pkg/providers" 6 "github.com/khulnasoft-lab/defsec/pkg/scan" 7 "github.com/khulnasoft-lab/defsec/pkg/severity" 8 "github.com/khulnasoft-lab/defsec/pkg/state" 9 ) 10 11 var CheckEnableGeneralLogging = rules.Register( 12 scan.Rule{ 13 AVDID: "AVD-AWS-0071", 14 Provider: providers.AWSProvider, 15 Service: "mq", 16 ShortCode: "enable-general-logging", 17 Summary: "MQ Broker should have general logging enabled", 18 Impact: "Without logging it is difficult to trace issues", 19 Resolution: "Enable general logging", 20 Explanation: `Logging should be enabled to allow tracing of issues and activity to be investigated more fully. Logs provide additional information and context which is often invalauble during investigation`, 21 Links: []string{ 22 "https://docs.aws.amazon.com/amazon-mq/latest/developer-guide/configure-logging-monitoring-activemq.html", 23 }, 24 Terraform: &scan.EngineMetadata{ 25 GoodExamples: terraformEnableGeneralLoggingGoodExamples, 26 BadExamples: terraformEnableGeneralLoggingBadExamples, 27 Links: terraformEnableGeneralLoggingLinks, 28 RemediationMarkdown: terraformEnableGeneralLoggingRemediationMarkdown, 29 }, 30 CloudFormation: &scan.EngineMetadata{ 31 GoodExamples: cloudFormationEnableGeneralLoggingGoodExamples, 32 BadExamples: cloudFormationEnableGeneralLoggingBadExamples, 33 Links: cloudFormationEnableGeneralLoggingLinks, 34 RemediationMarkdown: cloudFormationEnableGeneralLoggingRemediationMarkdown, 35 }, 36 Severity: severity.Low, 37 }, 38 func(s *state.State) (results scan.Results) { 39 for _, broker := range s.AWS.MQ.Brokers { 40 if broker.Logging.General.IsFalse() { 41 results.Add( 42 "Broker does not have general logging enabled.", 43 broker.Logging.General, 44 ) 45 } else { 46 results.AddPassed(&broker) 47 } 48 } 49 return 50 }, 51 )