github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/rules/cloud/policies/azure/container/logging.go (about) 1 package container 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 CheckLogging = rules.Register( 12 scan.Rule{ 13 AVDID: "AVD-AZU-0040", 14 Provider: providers.AzureProvider, 15 Service: "container", 16 ShortCode: "logging", 17 Summary: "Ensure AKS logging to Azure Monitoring is Configured", 18 Impact: "Logging provides valuable information about access and usage", 19 Resolution: "Enable logging for AKS", 20 Explanation: `Ensure AKS logging to Azure Monitoring is configured for containers to monitor the performance of workloads.`, 21 Links: []string{ 22 "https://docs.microsoft.com/en-us/azure/azure-monitor/insights/container-insights-onboard", 23 }, 24 Terraform: &scan.EngineMetadata{ 25 GoodExamples: terraformLoggingGoodExamples, 26 BadExamples: terraformLoggingBadExamples, 27 Links: terraformLoggingLinks, 28 RemediationMarkdown: terraformLoggingRemediationMarkdown, 29 }, 30 Severity: severity.Medium, 31 }, 32 func(s *state.State) (results scan.Results) { 33 for _, cluster := range s.Azure.Container.KubernetesClusters { 34 if cluster.Metadata.IsUnmanaged() { 35 continue 36 } 37 if cluster.AddonProfile.OMSAgent.Enabled.IsFalse() { 38 results.Add( 39 "Cluster does not have logging enabled via OMS Agent.", 40 cluster.AddonProfile.OMSAgent.Enabled, 41 ) 42 } else { 43 results.AddPassed(&cluster) 44 } 45 } 46 return 47 }, 48 )