UNPKG

cloud-report

Version:

Collects and analyzes cloud resources

44 lines (43 loc) 2.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const types_1 = require("../../../types"); const base_1 = require("../../base"); class AuditLogsAnalyzer extends base_1.BaseAnalyzer { analyze(params, fullReport) { const allAuditLogs = params.audit_logs; if (!allAuditLogs) { return undefined; } const audit_logs = { type: types_1.CheckAnalysisType.Security }; audit_logs.what = "Are audit logs enabled for RedShift clusters?"; audit_logs.why = "Audit logs contains information about connection requests and queries"; audit_logs.recommendation = "Recommended to enable AuditLogs for all RedShift clusters"; audit_logs.benchmark = ['all']; const allRegionsAnalysis = {}; for (const region in allAuditLogs) { const regionAuditLogs = allAuditLogs[region]; allRegionsAnalysis[region] = []; for (const clusterIdentifier in regionAuditLogs) { const audit_log_analysis = {}; const auditLog = regionAuditLogs[clusterIdentifier]; audit_log_analysis.resource = { clusterIdentifier, auditLog }; audit_log_analysis.resourceSummary = { name: "Cluster", value: clusterIdentifier, }; if (auditLog && auditLog.LoggingEnabled) { audit_log_analysis.severity = types_1.SeverityStatus.Good; audit_log_analysis.message = "Audit log is enabled"; } else { audit_log_analysis.severity = types_1.SeverityStatus.Failure; audit_log_analysis.message = "Audit log is not enabled"; audit_log_analysis.action = "Enable audit log for cluster"; } allRegionsAnalysis[region].push(audit_log_analysis); } } audit_logs.regions = allRegionsAnalysis; return { audit_logs }; } } exports.AuditLogsAnalyzer = AuditLogsAnalyzer;