runbooks 0.7.9__py3-none-any.whl → 0.9.1__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.
- runbooks/__init__.py +1 -1
- runbooks/cfat/README.md +12 -1
- runbooks/cfat/__init__.py +1 -1
- runbooks/cfat/assessment/compliance.py +4 -1
- runbooks/cfat/assessment/runner.py +42 -34
- runbooks/cfat/models.py +1 -1
- runbooks/cloudops/__init__.py +123 -0
- runbooks/cloudops/base.py +385 -0
- runbooks/cloudops/cost_optimizer.py +811 -0
- runbooks/cloudops/infrastructure_optimizer.py +29 -0
- runbooks/cloudops/interfaces.py +828 -0
- runbooks/cloudops/lifecycle_manager.py +29 -0
- runbooks/cloudops/mcp_cost_validation.py +678 -0
- runbooks/cloudops/models.py +251 -0
- runbooks/cloudops/monitoring_automation.py +29 -0
- runbooks/cloudops/notebook_framework.py +676 -0
- runbooks/cloudops/security_enforcer.py +449 -0
- runbooks/common/__init__.py +152 -0
- runbooks/common/accuracy_validator.py +1039 -0
- runbooks/common/context_logger.py +440 -0
- runbooks/common/cross_module_integration.py +594 -0
- runbooks/common/enhanced_exception_handler.py +1108 -0
- runbooks/common/enterprise_audit_integration.py +634 -0
- runbooks/common/mcp_cost_explorer_integration.py +900 -0
- runbooks/common/mcp_integration.py +548 -0
- runbooks/common/performance_monitor.py +387 -0
- runbooks/common/profile_utils.py +216 -0
- runbooks/common/rich_utils.py +172 -1
- runbooks/feedback/user_feedback_collector.py +440 -0
- runbooks/finops/README.md +377 -458
- runbooks/finops/__init__.py +4 -21
- runbooks/finops/account_resolver.py +279 -0
- runbooks/finops/accuracy_cross_validator.py +638 -0
- runbooks/finops/aws_client.py +721 -36
- runbooks/finops/budget_integration.py +313 -0
- runbooks/finops/cli.py +59 -5
- runbooks/finops/cost_optimizer.py +1340 -0
- runbooks/finops/cost_processor.py +211 -37
- runbooks/finops/dashboard_router.py +900 -0
- runbooks/finops/dashboard_runner.py +990 -232
- runbooks/finops/embedded_mcp_validator.py +288 -0
- runbooks/finops/enhanced_dashboard_runner.py +8 -7
- runbooks/finops/enhanced_progress.py +327 -0
- runbooks/finops/enhanced_trend_visualization.py +423 -0
- runbooks/finops/finops_dashboard.py +184 -1829
- runbooks/finops/helpers.py +509 -196
- runbooks/finops/iam_guidance.py +400 -0
- runbooks/finops/markdown_exporter.py +466 -0
- runbooks/finops/multi_dashboard.py +1502 -0
- runbooks/finops/optimizer.py +15 -15
- runbooks/finops/profile_processor.py +2 -2
- runbooks/finops/runbooks.inventory.organizations_discovery.log +0 -0
- runbooks/finops/runbooks.security.report_generator.log +0 -0
- runbooks/finops/runbooks.security.run_script.log +0 -0
- runbooks/finops/runbooks.security.security_export.log +0 -0
- runbooks/finops/schemas.py +589 -0
- runbooks/finops/service_mapping.py +195 -0
- runbooks/finops/single_dashboard.py +710 -0
- runbooks/finops/tests/test_reference_images_validation.py +1 -1
- runbooks/inventory/README.md +12 -1
- runbooks/inventory/core/collector.py +157 -29
- runbooks/inventory/list_ec2_instances.py +9 -6
- runbooks/inventory/list_ssm_parameters.py +10 -10
- runbooks/inventory/organizations_discovery.py +210 -164
- runbooks/inventory/rich_inventory_display.py +74 -107
- runbooks/inventory/run_on_multi_accounts.py +13 -13
- runbooks/inventory/runbooks.inventory.organizations_discovery.log +0 -0
- runbooks/inventory/runbooks.security.security_export.log +0 -0
- runbooks/main.py +1371 -240
- runbooks/metrics/dora_metrics_engine.py +711 -17
- runbooks/monitoring/performance_monitor.py +433 -0
- runbooks/operate/README.md +394 -0
- runbooks/operate/base.py +215 -47
- runbooks/operate/ec2_operations.py +435 -5
- runbooks/operate/iam_operations.py +598 -3
- runbooks/operate/privatelink_operations.py +1 -1
- runbooks/operate/rds_operations.py +508 -0
- runbooks/operate/s3_operations.py +508 -0
- runbooks/operate/vpc_endpoints.py +1 -1
- runbooks/remediation/README.md +489 -13
- runbooks/remediation/base.py +5 -3
- runbooks/remediation/commons.py +8 -4
- runbooks/security/ENTERPRISE_SECURITY_FRAMEWORK.md +506 -0
- runbooks/security/README.md +12 -1
- runbooks/security/__init__.py +265 -33
- runbooks/security/cloudops_automation_security_validator.py +1164 -0
- runbooks/security/compliance_automation.py +12 -10
- runbooks/security/compliance_automation_engine.py +1021 -0
- runbooks/security/enterprise_security_framework.py +930 -0
- runbooks/security/enterprise_security_policies.json +293 -0
- runbooks/security/executive_security_dashboard.py +1247 -0
- runbooks/security/integration_test_enterprise_security.py +879 -0
- runbooks/security/module_security_integrator.py +641 -0
- runbooks/security/multi_account_security_controls.py +2254 -0
- runbooks/security/real_time_security_monitor.py +1196 -0
- runbooks/security/report_generator.py +1 -1
- runbooks/security/run_script.py +4 -8
- runbooks/security/security_baseline_tester.py +39 -52
- runbooks/security/security_export.py +99 -120
- runbooks/sre/README.md +472 -0
- runbooks/sre/__init__.py +33 -0
- runbooks/sre/mcp_reliability_engine.py +1049 -0
- runbooks/sre/performance_optimization_engine.py +1032 -0
- runbooks/sre/production_monitoring_framework.py +584 -0
- runbooks/sre/reliability_monitoring_framework.py +1011 -0
- runbooks/validation/__init__.py +2 -2
- runbooks/validation/benchmark.py +154 -149
- runbooks/validation/cli.py +159 -147
- runbooks/validation/mcp_validator.py +291 -248
- runbooks/vpc/README.md +478 -0
- runbooks/vpc/__init__.py +2 -2
- runbooks/vpc/manager_interface.py +366 -351
- runbooks/vpc/networking_wrapper.py +68 -36
- runbooks/vpc/rich_formatters.py +22 -8
- runbooks-0.9.1.dist-info/METADATA +308 -0
- {runbooks-0.7.9.dist-info → runbooks-0.9.1.dist-info}/RECORD +120 -59
- {runbooks-0.7.9.dist-info → runbooks-0.9.1.dist-info}/entry_points.txt +1 -1
- runbooks/finops/cross_validation.py +0 -375
- runbooks-0.7.9.dist-info/METADATA +0 -636
- {runbooks-0.7.9.dist-info → runbooks-0.9.1.dist-info}/WHEEL +0 -0
- {runbooks-0.7.9.dist-info → runbooks-0.9.1.dist-info}/licenses/LICENSE +0 -0
- {runbooks-0.7.9.dist-info → runbooks-0.9.1.dist-info}/top_level.txt +0 -0
@@ -5,7 +5,6 @@ from string import Template
|
|
5
5
|
|
6
6
|
from jinja2 import Template
|
7
7
|
|
8
|
-
from runbooks.utils.logger import configure_logger
|
9
8
|
from runbooks.common.rich_utils import (
|
10
9
|
console,
|
11
10
|
create_panel,
|
@@ -14,6 +13,7 @@ from runbooks.common.rich_utils import (
|
|
14
13
|
print_success,
|
15
14
|
print_warning,
|
16
15
|
)
|
16
|
+
from runbooks.utils.logger import configure_logger
|
17
17
|
|
18
18
|
from .utils import language, level_const
|
19
19
|
|
runbooks/security/run_script.py
CHANGED
@@ -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
|
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)
|
@@ -10,6 +10,7 @@ from typing import Any, Dict, List, Optional
|
|
10
10
|
import boto3
|
11
11
|
import botocore
|
12
12
|
|
13
|
+
from runbooks.common.profile_utils import create_management_session
|
13
14
|
from runbooks.common.rich_utils import (
|
14
15
|
STATUS_INDICATORS,
|
15
16
|
console,
|
@@ -46,9 +47,8 @@ class SecurityBaselineTester:
|
|
46
47
|
self.translator = language.get_translator("main", lang_code)
|
47
48
|
|
48
49
|
def _create_session(self):
|
49
|
-
|
50
|
-
|
51
|
-
return boto3.Session(profile_name=self.profile)
|
50
|
+
# Use enterprise profile management for security operations (management profile for cross-account)
|
51
|
+
return create_management_session(profile=self.profile)
|
52
52
|
|
53
53
|
def _load_config(self):
|
54
54
|
## Get the absolute directory where *this script* is located
|
@@ -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(
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
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[
|
120
|
-
[bold cyan]Account:[/bold cyan] {caller_identity[
|
121
|
-
[bold cyan]ARN:[/bold cyan] {caller_identity[
|
122
|
-
|
123
|
-
console.print(
|
124
|
-
auditor_info,
|
125
|
-
|
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
|
-
|
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}")
|