1use serde::{Deserialize, Serialize};
4use std::time::Duration;
5
6#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct CloudSecurityMonitoringConfig {
9 pub enabled: bool,
11 pub events: Vec<SecurityEvent>,
13 pub threat_detection: ThreatDetectionConfig,
15 pub incident_response: IncidentResponseConfig,
17 pub compliance: ComplianceMonitoringConfig,
19}
20
21#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
23pub enum SecurityEvent {
24 UnauthorizedAccess,
25 SuspiciousActivity,
26 DataBreach,
27 MalwareDetection,
28 NetworkIntrusion,
29 PrivilegeEscalation,
30 QuantumCircuitTampering,
31 ConfigurationChanges,
32 Custom(String),
33}
34
35#[derive(Debug, Clone, Serialize, Deserialize)]
37pub struct ThreatDetectionConfig {
38 pub enabled: bool,
40 pub methods: Vec<ThreatDetectionMethod>,
42 pub response_policies: Vec<ThreatResponsePolicy>,
44 pub intelligence: ThreatIntelligenceConfig,
46}
47
48#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
50pub enum ThreatDetectionMethod {
51 SignatureBased,
52 BehaviorBased,
53 MachineLearning,
54 AnomalyDetection,
55 HybridApproach,
56 Custom(String),
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize)]
61pub struct ThreatResponsePolicy {
62 pub name: String,
64 pub threat_types: Vec<ThreatType>,
66 pub actions: Vec<ThreatResponseAction>,
68 pub escalation: ThreatEscalationRules,
70}
71
72#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
74pub enum ThreatType {
75 Malware,
76 Phishing,
77 DDoS,
78 DataExfiltration,
79 InsiderThreat,
80 QuantumThreat,
81 Custom(String),
82}
83
84#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
86pub enum ThreatResponseAction {
87 Alert,
88 Block,
89 Quarantine,
90 Isolate,
91 Investigate,
92 Escalate,
93 Custom(String),
94}
95
96#[derive(Debug, Clone, Serialize, Deserialize)]
98pub struct ThreatEscalationRules {
99 pub triggers: Vec<EscalationTrigger>,
101 pub levels: Vec<ThreatEscalationLevel>,
103}
104
105#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
107pub enum EscalationTrigger {
108 ThreatSeverity,
109 ResponseTimeout,
110 FailedMitigation,
111 Custom(String),
112}
113
114#[derive(Debug, Clone, Serialize, Deserialize)]
116pub struct ThreatEscalationLevel {
117 pub name: String,
119 pub severity_threshold: f64,
121 pub response_time: Duration,
123 pub contacts: Vec<String>,
125}
126
127#[derive(Debug, Clone, Serialize, Deserialize)]
129pub struct ThreatIntelligenceConfig {
130 pub enabled: bool,
132 pub sources: Vec<IntelligenceSource>,
134 pub feeds: Vec<FeedIntegrationConfig>,
136 pub update_frequency: Duration,
138}
139
140#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
142pub enum IntelligenceSource {
143 Commercial,
144 OpenSource,
145 Government,
146 Community,
147 Internal,
148 Custom(String),
149}
150
151#[derive(Debug, Clone, Serialize, Deserialize)]
153pub struct FeedIntegrationConfig {
154 pub name: String,
156 pub feed_type: String,
158 pub endpoint: String,
160 pub auth: FeedAuthConfig,
162}
163
164#[derive(Debug, Clone, Serialize, Deserialize)]
166pub struct FeedAuthConfig {
167 pub auth_type: AuthType,
169 pub credentials: std::collections::HashMap<String, String>,
171}
172
173#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
175pub enum AuthType {
176 ApiKey,
177 OAuth,
178 Basic,
179 Certificate,
180 Custom(String),
181}
182
183#[derive(Debug, Clone, Serialize, Deserialize, Default)]
185pub struct IncidentResponseConfig {
186 pub automated: bool,
188 pub playbooks: Vec<ResponsePlaybook>,
190 pub communication: CommunicationPlan,
192}
193
194#[derive(Debug, Clone, Serialize, Deserialize)]
196pub struct ResponsePlaybook {
197 pub name: String,
199 pub triggers: Vec<String>,
201 pub steps: Vec<ResponseStep>,
203}
204
205#[derive(Debug, Clone, Serialize, Deserialize)]
207pub struct ResponseStep {
208 pub name: String,
210 pub action_type: ResponseActionType,
212 pub parameters: std::collections::HashMap<String, String>,
214}
215
216#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
218pub enum ResponseActionType {
219 Notify,
220 Execute,
221 Isolate,
222 Investigate,
223 Document,
224 Custom(String),
225}
226
227#[derive(Debug, Clone, Serialize, Deserialize)]
229pub struct CommunicationPlan {
230 pub channels: Vec<String>,
232 pub stakeholders: Vec<StakeholderGroup>,
234 pub escalation_matrix: Vec<EscalationContact>,
236}
237
238#[derive(Debug, Clone, Serialize, Deserialize)]
240pub struct StakeholderGroup {
241 pub name: String,
243 pub contacts: Vec<String>,
245 pub conditions: Vec<String>,
247}
248
249#[derive(Debug, Clone, Serialize, Deserialize)]
251pub struct EscalationContact {
252 pub name: String,
254 pub method: String,
256 pub level: i32,
258 pub response_time: Duration,
260}
261
262#[derive(Debug, Clone, Serialize, Deserialize, Default)]
264pub struct ComplianceMonitoringConfig {
265 pub enabled: bool,
267 pub frameworks: Vec<ComplianceFramework>,
269 pub audit: AuditConfig,
271 pub reporting: ComplianceReportingConfig,
273}
274
275#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
277pub enum ComplianceFramework {
278 SOC2,
279 ISO27001,
280 GDPR,
281 HIPAA,
282 PciDss,
283 FedRAMP,
284 Custom(String),
285}
286
287#[derive(Debug, Clone, Serialize, Deserialize)]
289pub struct AuditConfig {
290 pub enabled: bool,
292 pub retention: Duration,
294 pub events: Vec<AuditEvent>,
296}
297
298#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
300pub enum AuditEvent {
301 UserLogin,
302 UserLogout,
303 DataAccess,
304 ConfigChange,
305 PermissionChange,
306 SystemAccess,
307 Custom(String),
308}
309
310#[derive(Debug, Clone, Serialize, Deserialize)]
312pub struct ComplianceReportingConfig {
313 pub automated: bool,
315 pub frequency: Duration,
317 pub types: Vec<ReportType>,
319}
320
321#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
323pub enum ReportType {
324 ComplianceStatus,
325 VulnerabilityAssessment,
326 SecurityPosture,
327 IncidentSummary,
328 Custom(String),
329}
330
331impl Default for CloudSecurityMonitoringConfig {
332 fn default() -> Self {
333 Self {
334 enabled: true,
335 events: vec![
336 SecurityEvent::UnauthorizedAccess,
337 SecurityEvent::SuspiciousActivity,
338 SecurityEvent::ConfigurationChanges,
339 ],
340 threat_detection: ThreatDetectionConfig::default(),
341 incident_response: IncidentResponseConfig::default(),
342 compliance: ComplianceMonitoringConfig::default(),
343 }
344 }
345}
346
347impl Default for ThreatDetectionConfig {
348 fn default() -> Self {
349 Self {
350 enabled: true,
351 methods: vec![ThreatDetectionMethod::SignatureBased],
352 response_policies: vec![],
353 intelligence: ThreatIntelligenceConfig::default(),
354 }
355 }
356}
357
358impl Default for ThreatIntelligenceConfig {
359 fn default() -> Self {
360 Self {
361 enabled: false,
362 sources: vec![IntelligenceSource::OpenSource],
363 feeds: vec![],
364 update_frequency: Duration::from_secs(3600), }
366 }
367}
368
369impl Default for CommunicationPlan {
370 fn default() -> Self {
371 Self {
372 channels: vec!["email".to_string()],
373 stakeholders: vec![],
374 escalation_matrix: vec![],
375 }
376 }
377}
378
379impl Default for AuditConfig {
380 fn default() -> Self {
381 Self {
382 enabled: true,
383 retention: Duration::from_secs(86400 * 365), events: vec![
385 AuditEvent::UserLogin,
386 AuditEvent::DataAccess,
387 AuditEvent::ConfigChange,
388 ],
389 }
390 }
391}
392
393impl Default for ComplianceReportingConfig {
394 fn default() -> Self {
395 Self {
396 automated: false,
397 frequency: Duration::from_secs(86400 * 30), types: vec![ReportType::ComplianceStatus],
399 }
400 }
401}