# Ghaymah Cloud SecOps Assessment

![Bash](https://img.shields.io/badge/Language-Bash-4EAA25?style=for-the-badge&logo=gnu-bash&logoColor=white)
![Python](https://img.shields.io/badge/Language-Python-3776AB?style=for-the-badge&logo=python&logoColor=white)
![SIEM](https://img.shields.io/badge/Skill-SIEM_Engineering-FF6600?style=for-the-badge)
![Wazuh](https://img.shields.io/badge/Skill-Detection_Engineering-0080FF?style=for-the-badge)
![Incident Response](https://img.shields.io/badge/Skill-Incident_Response-E34F26?style=for-the-badge)
![Audit](https://img.shields.io/badge/Skill-Security_Audit-4A154B?style=for-the-badge)

## Quick Navigation
- [Executive Summary](#executive-summary)
- [Assessment Architecture](#assessment-architecture)
- [Repository Structure](#repository-structure)
- [Key Findings Dashboard](#key-findings-dashboard)
- [Assessment Deliverables](#assessment-deliverables)

---

## Executive Summary
> **Author:** Ziad Alex  
> **Qabilah Profile:** [https://qabilah.com/profile/ziadalex2003/](https://qabilah.com/profile/ziadalex2003/)  
> **Role:** Cloud Security Engineer Intern (SecOps Track)  
> **Target Environment:** Ghaymah Managed Cloud Services (`ghaymah.systems`, `mithal.space`)

This repository contains a comprehensive Security Operations (SecOps) assessment for Ghaymah Cloud Infrastructure (Managed Kubernetes + Block Storage). The project demonstrates end-to-end security engineering, covering offensive auditing, defensive detection engineering, privacy compliance, and incident response architecture.

The assessment is broken into five core domains:
1. **Security Audit:** A custom, production-ready Bash script automating port enumeration, TLS validation, and local permission audits.
2. **Incident Response:** A full PICERL methodology plan mitigating brute-force attacks and data exfiltration using Wazuh and n8n SOAR.
3. **Privacy Assessment:** Manual dynamic analysis of browser privacy violations, including tracker identification and HTTP security header audits.
4. **SIEM Engineering:** A custom Python-based Security Information and Event Management (SIEM) engine with real-time log parsing and a web dashboard.
5. **Ransomware Response:** A strategic recovery playbook emphasizing immutable backups and environment wipe-before-restore procedures.

---

## Project Objectives
- **Automate Defenses:** Prove the ability to write reliable scripts (`ghaymah_audit.sh`) and parsers (`siem_engine.py`) to automate security workflows.
- **Architect Detection:** Design robust detection rules (Wazuh XML) capable of identifying complex, distributed threats.
- **Communicate Risk:** Translate highly technical findings into actionable, reviewer-friendly documentation (Privacy Reports, Ransomware Plans).

---

## Assessment Architecture

```mermaid
graph TD
    subgraph "Phase 1: External Assessment"
        EXT[External Attack Surface] --> T1(Task 1: Security Auditing)
        T1 --> T3(Task 3: Privacy Assessment)
    end
    
    subgraph "Phase 2 & 3: Internal Defense"
        T3 --> INT[Ghaymah Internal Network]
        T1 -->|Generates Logs| INT
        INT --> T4(Task 4: SIEM Engine)
        T4 -->|Triggers| T2(Task 2: Incident Response SOAR)
    end
    
    subgraph "Phase 4: Disaster Recovery"
        T2 -->|If Defenses Fail| T5(Task 5: Ransomware Recovery)
    end
```

---

## Repository Structure

```text
ghayma/
├── README.md                              ← You are here
├── TESTING_GUIDE.md                       # Instructions for validation
├── docs/                                  # Master Indices & Reviewer Guides
│   ├── evidence-index.md
│   ├── findings-summary.md
│   ├── interview-notes.md
│   └── sample-output.md
│
├── task1-security-audit/                  # Bash automation & compliance
│   ├── ghaymah_audit.sh
│   └── security_checklist.md
│
├── task2-incident-response/               # PICERL, Kill Chain & Wazuh
│   ├── incident_response_plan_PICERL.md
│   ├── kill_chain_timeline.md
│   ├── wazuh_brute_force_rules.xml
│   └── wazuh_rules_explained.md
│
├── task3-privacy-assessment/              # Browser DevTools dynamic analysis
│   └── privacy_assessment_report.md
│
├── task4-siem/                            # Custom Python SIEM Engine
│   ├── siem_engine.py
│   ├── siem_detection_rules.md
│   └── dashboard/                         # ★ LIVE HTML/CSS/JS DASHBOARD ★
│       ├── index.html
│       ├── style.css
│       └── app.js
│
└── task5-ransomware/                      # DR, Backups & Recovery Strategy
    └── ransomware_response_plan.md
```

---

## Key Findings Dashboard

| Task | Finding | Severity | Evidence |
|------|----------|----------|----------|
| **Task 1** | SSH (Port 22) Exposed | WARNING | `ghaymah_audit.png` |
| **Task 1** | Content-Security-Policy (CSP) Missing | WARNING | `ghaymah_audit.png` |
| **Task 3** | Missing HSTS Header | HIGH | `network_headers.png` |
| **Task 3** | Analytics Tracking Scripts (Client-side) | MEDIUM | `network-overview.png` |
| **Task 4** | SIEM: In-Memory State Exhaustion | CRITICAL | Architecture Review |

> [!NOTE]
> For a full list of findings and remediation recommendations, see [docs/findings-summary.md](docs/findings-summary.md).

---

## Tools Used

| Tool | Where | Purpose |
|------|-------|---------|
| **Bash + coreutils** | Task 1 | System auditing (`nc`, `openssl`, `find`, `stat`) |
| **Wazuh** | Task 2, 5 | Host/network IDS, FIM, log correlation |
| **n8n** | Task 2, 5 | SOAR automation (self-hosted on K8s) |
| **Browser DevTools**| Task 3 | Dynamic network and client-storage analysis |
| **Python stdlib** | Task 4 | SIEM engine (no external pip dependencies) |

---

## Security Controls Implemented
- **Automated Hardening:** Fast, targeted bash scripts replacing bloated OS checks.
- **Zero-Trust NetworkPolicies:** Segmented K8s architecture preventing lateral movement.
- **Tiered Detections:** Mathematical thresholds in Wazuh preventing alert fatigue.
- **Immutable Recovery:** WORM storage strategies mitigating ransomware encryption.

---

## Screenshots Gallery
All evidence is embedded directly into the task documentation. Use the links below to view the visual evidence:
- **Task 1:** [Audit Script Execution](task1-security-audit/security_checklist.md#evidence-security-audit-execution)
- **Task 3:** [TLS Certificate Verification](task3-privacy-assessment/privacy_assessment_report.md#evidence)
- **Task 3:** [Missing Security Headers](task3-privacy-assessment/privacy_assessment_report.md#evidence)
- **Task 4:** [SIEM Dashboard UI](task4-siem/siem_deployment_architecture.md#screenshots)
- **Task 4:** [Real-time SIEM Alerts](task4-siem/siem_deployment_architecture.md#screenshots)

*(For a master list of all evidence, see [docs/evidence-index.md](docs/evidence-index.md)).*

---

## Testing & Validation
To run the automated tests, security audits, or spawn the SIEM dashboard locally, please refer to the [TESTING_GUIDE.md](TESTING_GUIDE.md).

---

## Recommendations
The repository demonstrates a highly mature defensive posture. Immediate remediation efforts should focus on edge-level HTTP security headers (HSTS/CSP) and decoupling the SIEM log ingestion using Kafka to ensure horizontal scalability during volumetric attacks.

---

## Lessons Learned
- **Aesthetic vs. Practical Auditing:** Deep system enumerations (`/etc/shadow`, SUID binaries) are theoretically good but often out-of-scope for cloud-shared environments. Targeted checks are far more valuable.
- **Order of Operations:** In a ransomware scenario, wiping the environment *before* restoring data is critical to preventing immediate reinfection by sleeper agents.

---

## Conclusion
This portfolio project demonstrates a balanced approach to Security Operations, blending offensive validation (Bash auditing, Privacy tracking) with robust defensive engineering (SIEM, Wazuh, SOAR). It is highly defensible, structurally organized, and ready for technical interview discussion.

## Assessment Deliverables
- [x] Task 1: Security Audit
- [x] Task 2: Incident Response
- [x] Task 3: Privacy Assessment
- [x] Task 4: SIEM Engine
- [x] Task 5: Ransomware Playbook
