runbooks 0.7.9__py3-none-any.whl → 0.9.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. runbooks/__init__.py +1 -1
  2. runbooks/cfat/README.md +12 -1
  3. runbooks/cfat/__init__.py +1 -1
  4. runbooks/cfat/assessment/runner.py +42 -34
  5. runbooks/cfat/models.py +1 -1
  6. runbooks/common/__init__.py +152 -0
  7. runbooks/common/accuracy_validator.py +1039 -0
  8. runbooks/common/context_logger.py +440 -0
  9. runbooks/common/cross_module_integration.py +594 -0
  10. runbooks/common/enhanced_exception_handler.py +1108 -0
  11. runbooks/common/enterprise_audit_integration.py +634 -0
  12. runbooks/common/mcp_integration.py +539 -0
  13. runbooks/common/performance_monitor.py +387 -0
  14. runbooks/common/profile_utils.py +216 -0
  15. runbooks/common/rich_utils.py +171 -0
  16. runbooks/feedback/user_feedback_collector.py +440 -0
  17. runbooks/finops/README.md +339 -451
  18. runbooks/finops/__init__.py +4 -21
  19. runbooks/finops/account_resolver.py +279 -0
  20. runbooks/finops/accuracy_cross_validator.py +638 -0
  21. runbooks/finops/aws_client.py +721 -36
  22. runbooks/finops/budget_integration.py +313 -0
  23. runbooks/finops/cli.py +59 -5
  24. runbooks/finops/cost_processor.py +211 -37
  25. runbooks/finops/dashboard_router.py +900 -0
  26. runbooks/finops/dashboard_runner.py +990 -232
  27. runbooks/finops/embedded_mcp_validator.py +288 -0
  28. runbooks/finops/enhanced_dashboard_runner.py +8 -7
  29. runbooks/finops/enhanced_progress.py +327 -0
  30. runbooks/finops/enhanced_trend_visualization.py +423 -0
  31. runbooks/finops/finops_dashboard.py +29 -1880
  32. runbooks/finops/helpers.py +509 -196
  33. runbooks/finops/iam_guidance.py +400 -0
  34. runbooks/finops/markdown_exporter.py +466 -0
  35. runbooks/finops/multi_dashboard.py +1502 -0
  36. runbooks/finops/optimizer.py +15 -15
  37. runbooks/finops/profile_processor.py +2 -2
  38. runbooks/finops/runbooks.inventory.organizations_discovery.log +0 -0
  39. runbooks/finops/runbooks.security.report_generator.log +0 -0
  40. runbooks/finops/runbooks.security.run_script.log +0 -0
  41. runbooks/finops/runbooks.security.security_export.log +0 -0
  42. runbooks/finops/service_mapping.py +195 -0
  43. runbooks/finops/single_dashboard.py +710 -0
  44. runbooks/finops/tests/test_reference_images_validation.py +1 -1
  45. runbooks/inventory/README.md +12 -1
  46. runbooks/inventory/core/collector.py +157 -29
  47. runbooks/inventory/list_ec2_instances.py +9 -6
  48. runbooks/inventory/list_ssm_parameters.py +10 -10
  49. runbooks/inventory/organizations_discovery.py +210 -164
  50. runbooks/inventory/rich_inventory_display.py +74 -107
  51. runbooks/inventory/run_on_multi_accounts.py +13 -13
  52. runbooks/main.py +740 -134
  53. runbooks/metrics/dora_metrics_engine.py +711 -17
  54. runbooks/monitoring/performance_monitor.py +433 -0
  55. runbooks/operate/README.md +394 -0
  56. runbooks/operate/base.py +215 -47
  57. runbooks/operate/ec2_operations.py +7 -5
  58. runbooks/operate/privatelink_operations.py +1 -1
  59. runbooks/operate/vpc_endpoints.py +1 -1
  60. runbooks/remediation/README.md +489 -13
  61. runbooks/remediation/commons.py +8 -4
  62. runbooks/security/ENTERPRISE_SECURITY_FRAMEWORK.md +506 -0
  63. runbooks/security/README.md +12 -1
  64. runbooks/security/__init__.py +164 -33
  65. runbooks/security/compliance_automation.py +12 -10
  66. runbooks/security/compliance_automation_engine.py +1021 -0
  67. runbooks/security/enterprise_security_framework.py +931 -0
  68. runbooks/security/enterprise_security_policies.json +293 -0
  69. runbooks/security/integration_test_enterprise_security.py +879 -0
  70. runbooks/security/module_security_integrator.py +641 -0
  71. runbooks/security/report_generator.py +1 -1
  72. runbooks/security/run_script.py +4 -8
  73. runbooks/security/security_baseline_tester.py +36 -49
  74. runbooks/security/security_export.py +99 -120
  75. runbooks/sre/README.md +472 -0
  76. runbooks/sre/__init__.py +33 -0
  77. runbooks/sre/mcp_reliability_engine.py +1049 -0
  78. runbooks/sre/performance_optimization_engine.py +1032 -0
  79. runbooks/sre/reliability_monitoring_framework.py +1011 -0
  80. runbooks/validation/__init__.py +2 -2
  81. runbooks/validation/benchmark.py +154 -149
  82. runbooks/validation/cli.py +159 -147
  83. runbooks/validation/mcp_validator.py +265 -236
  84. runbooks/vpc/README.md +478 -0
  85. runbooks/vpc/__init__.py +2 -2
  86. runbooks/vpc/manager_interface.py +366 -351
  87. runbooks/vpc/networking_wrapper.py +62 -33
  88. runbooks/vpc/rich_formatters.py +22 -8
  89. {runbooks-0.7.9.dist-info → runbooks-0.9.0.dist-info}/METADATA +136 -54
  90. {runbooks-0.7.9.dist-info → runbooks-0.9.0.dist-info}/RECORD +94 -55
  91. {runbooks-0.7.9.dist-info → runbooks-0.9.0.dist-info}/entry_points.txt +1 -1
  92. runbooks/finops/cross_validation.py +0 -375
  93. {runbooks-0.7.9.dist-info → runbooks-0.9.0.dist-info}/WHEEL +0 -0
  94. {runbooks-0.7.9.dist-info → runbooks-0.9.0.dist-info}/licenses/LICENSE +0 -0
  95. {runbooks-0.7.9.dist-info → runbooks-0.9.0.dist-info}/top_level.txt +0 -0
@@ -15,7 +15,6 @@ Compatible with both local (via pip or Docker) and AWS Lambda environments.
15
15
  import argparse
16
16
  import sys
17
17
 
18
- from runbooks.utils.logger import configure_logger
19
18
  from runbooks.common.rich_utils import (
20
19
  console,
21
20
  create_panel,
@@ -24,6 +23,7 @@ from runbooks.common.rich_utils import (
24
23
  print_success,
25
24
  print_warning,
26
25
  )
26
+ from runbooks.utils.logger import configure_logger
27
27
 
28
28
  from .security_baseline_tester import SecurityBaselineTester
29
29
 
@@ -79,15 +79,11 @@ def main():
79
79
  [green]Configuration:[/green]
80
80
  [cyan]AWS Profile:[/cyan] {args.profile}
81
81
  [cyan]Language:[/cyan] {args.language}
82
- [cyan]Output Directory:[/cyan] {args.output or './results'}
82
+ [cyan]Output Directory:[/cyan] {args.output or "./results"}
83
83
 
84
84
  [dim]Starting comprehensive security assessment...[/dim]"""
85
85
 
86
- console.print(create_panel(
87
- startup_info,
88
- title="🔒 Security Baseline Tester",
89
- border_style="cyan"
90
- ))
86
+ console.print(create_panel(startup_info, title="🔒 Security Baseline Tester", border_style="cyan"))
91
87
 
92
88
  print_info("Initializing AWS Security Baseline Tester...")
93
89
  print_info(f"Using AWS profile: {args.profile}")
@@ -99,7 +95,7 @@ def main():
99
95
  tester.run()
100
96
 
101
97
  print_success("AWS Security Baseline testing completed successfully!")
102
-
98
+
103
99
  except Exception as e:
104
100
  print_error(f"An unexpected error occurred: {e}", exception=e)
105
101
  logger.error(f"An unexpected error occurred: {e}", exc_info=True)
@@ -70,13 +70,15 @@ class SecurityBaselineTester:
70
70
  """Execute the security baseline assessment with Rich CLI output."""
71
71
  try:
72
72
  # Print security assessment header
73
- console.print(create_panel(
74
- "[bold cyan]AWS Security Baseline Assessment[/bold cyan]\n\n"
75
- f"[dim]Profile: {self.profile} | Language: {self.language}[/dim]",
76
- title="🛡️ Starting Security Assessment",
77
- border_style="cyan"
78
- ))
79
-
73
+ console.print(
74
+ create_panel(
75
+ "[bold cyan]AWS Security Baseline Assessment[/bold cyan]\n\n"
76
+ f"[dim]Profile: {self.profile} | Language: {self.language}[/dim]",
77
+ title="🛡️ Starting Security Assessment",
78
+ border_style="cyan",
79
+ )
80
+ )
81
+
80
82
  self._validate_session()
81
83
  caller_identity = self._get_caller_identity()
82
84
  self._print_auditor_info(caller_identity)
@@ -85,19 +87,16 @@ class SecurityBaselineTester:
85
87
 
86
88
  account_id, results = self._execute_tests()
87
89
  self._generate_report(account_id, results)
88
-
90
+
89
91
  # Export results in multiple formats
90
92
  if self.export_formats:
91
93
  print_info("Exporting security assessment results...")
92
94
  self.exporter.export_security_results(
93
- account_id=account_id,
94
- results=results,
95
- language=self.language,
96
- formats=self.export_formats
95
+ account_id=account_id, results=results, language=self.language, formats=self.export_formats
97
96
  )
98
97
 
99
98
  print_success("Security baseline assessment completed successfully!")
100
-
99
+
101
100
  except Exception as e:
102
101
  print_error(f"Security baseline test failed: {str(e)}", exception=e)
103
102
  logging.error(f"An error occurred during the security baseline test: {str(e)}", exc_info=True)
@@ -116,16 +115,13 @@ class SecurityBaselineTester:
116
115
 
117
116
  def _print_auditor_info(self, caller_identity):
118
117
  """Display auditor information with Rich formatting."""
119
- auditor_info = f"""[bold cyan]User ID:[/bold cyan] {caller_identity['UserId']}
120
- [bold cyan]Account:[/bold cyan] {caller_identity['Account']}
121
- [bold cyan]ARN:[/bold cyan] {caller_identity['Arn']}"""
122
-
123
- console.print(create_panel(
124
- auditor_info,
125
- title="🔐 Security Assessment Context",
126
- border_style="cyan",
127
- padding=1
128
- ))
118
+ auditor_info = f"""[bold cyan]User ID:[/bold cyan] {caller_identity["UserId"]}
119
+ [bold cyan]Account:[/bold cyan] {caller_identity["Account"]}
120
+ [bold cyan]ARN:[/bold cyan] {caller_identity["Arn"]}"""
121
+
122
+ console.print(
123
+ create_panel(auditor_info, title="🔐 Security Assessment Context", border_style="cyan", padding=1)
124
+ )
129
125
 
130
126
  def _execute_tests(self):
131
127
  iam_client = self.session.client("iam")
@@ -138,21 +134,20 @@ class SecurityBaselineTester:
138
134
  # Create progress bar for security checks
139
135
  checks = self.config.get("checks", [])
140
136
  total_checks = len(checks)
141
-
137
+
142
138
  with create_progress_bar(description="Security Assessment") as progress:
143
139
  task = progress.add_task("Running security checks...", total=total_checks)
144
-
140
+
145
141
  with ThreadPoolExecutor(max_workers=self.config.get("max_workers", 5)) as executor:
146
142
  futures = {
147
- executor.submit(self._run_check, check_name, credential_report): check_name
148
- for check_name in checks
143
+ executor.submit(self._run_check, check_name, credential_report): check_name for check_name in checks
149
144
  }
150
145
 
151
146
  results = {
152
147
  level: [] for level in ["Success", "Warning", "Danger", "Error", "Info"] if isinstance(level, str)
153
148
  }
154
149
  completed_checks = 0
155
-
150
+
156
151
  for future in as_completed(futures):
157
152
  result = future.result()
158
153
  results[result.level].append(result)
@@ -172,9 +167,9 @@ class SecurityBaselineTester:
172
167
  {"name": "Status", "style": "bold", "justify": "left"},
173
168
  {"name": "Count", "style": "bold", "justify": "center"},
174
169
  {"name": "Percentage", "style": "dim", "justify": "right"},
175
- ]
170
+ ],
176
171
  )
177
-
172
+
178
173
  # Calculate statistics
179
174
  for level in ["Danger", "Warning", "Success", "Info", "Error"]:
180
175
  count = len(results.get(level, []))
@@ -183,7 +178,7 @@ class SecurityBaselineTester:
183
178
  percentage_str = f"{percentage:.1f}%"
184
179
  else:
185
180
  percentage_str = "0%"
186
-
181
+
187
182
  # Style based on level
188
183
  if level == "Danger":
189
184
  status_text = f"🔴 {level}"
@@ -200,36 +195,32 @@ class SecurityBaselineTester:
200
195
  else: # Error
201
196
  status_text = f"❌ {level}"
202
197
  style = "critical"
203
-
198
+
204
199
  summary_table.add_row(status_text, str(count), percentage_str, style=style)
205
-
200
+
206
201
  console.print(summary_table)
207
-
202
+
208
203
  # Calculate overall security score
209
204
  total_issues = len(results.get("Danger", [])) + len(results.get("Warning", []))
210
205
  total_success = len(results.get("Success", []))
211
-
206
+
212
207
  if total_checks > 0:
213
208
  security_score = (total_success / total_checks) * 100
214
209
  if security_score >= 90:
215
210
  score_style = "success"
216
211
  score_icon = "🛡️"
217
212
  elif security_score >= 75:
218
- score_style = "warning"
213
+ score_style = "warning"
219
214
  score_icon = "⚠️"
220
215
  else:
221
216
  score_style = "error"
222
217
  score_icon = "🚨"
223
-
218
+
224
219
  score_summary = f"""[bold {score_style}]{score_icon} Overall Security Score: {security_score:.1f}%[/bold {score_style}]
225
220
 
226
221
  [dim]Total Checks: {total_checks} | Issues Found: {total_issues} | Successful: {total_success}[/dim]"""
227
-
228
- console.print(create_panel(
229
- score_summary,
230
- title="Security Posture Assessment",
231
- border_style=score_style
232
- ))
222
+
223
+ console.print(create_panel(score_summary, title="Security Posture Assessment", border_style=score_style))
233
224
 
234
225
  def _run_check(self, check_name, credential_report):
235
226
  # check_module = __import__(f"checklist.{check_name}", fromlist=[check_name])
@@ -331,10 +322,6 @@ class SecurityBaselineTester:
331
322
 
332
323
  [dim]Open the HTML report in your browser to view detailed findings.[/dim]"""
333
324
 
334
- console.print(create_panel(
335
- report_success,
336
- title="📊 Report Generation Complete",
337
- border_style="green"
338
- ))
339
-
325
+ console.print(create_panel(report_success, title="📊 Report Generation Complete", border_style="green"))
326
+
340
327
  print_success(f"HTML report saved to: {report_path}")