Skip to content

Latest commit

Β 

History

History
198 lines (156 loc) Β· 10.7 KB

README.md

File metadata and controls

198 lines (156 loc) Β· 10.7 KB

Aegis πŸ›‘οΈ

Security Scan & Plan Build Status SonarCloud Quality Gate Semgrep Security Scanned
Go Language Terraform Infrastructure as Code License
DORA Compliant BaFin Compliant AWS FSI Ready

A ready-to-use AWS infrastructure blueprint that provides a physical starting point for DORA & BaFin compliance (written in Terraform & Go).


πŸ“– The Aegis Story (Why does this exist?)

Imagine you are starting a FinTech startup (like a digital bank or a payment app) in Germany.

To get your license to operate, you have to pass a massive audit by BaFin (the German financial regulator) under DORA (the new EU law for financial security). The regulators have a very strict, non-negotiable rule:

βš–οΈ "No single employee is allowed to deploy code or make changes to the production system alone. Every single change must be approved by a second person (the Four-Eyes Principle), and every action must leave an indestructible log that cannot be modified or deleted."

If you try to build this yourself from scratch, it is a massive, highly complex engineering headache. Aegis solves this out-of-the-box.


πŸ› οΈ What is Aegis & What did we build?

Aegis is a pre-configured template that sets up a secure AWS Landing Zone (a clean, locked-down cloud environment) integrated with an active, automated Four-Eyes operational workflow:

1. πŸ”Œ The Suspended Pipeline (The cloud-based gatekeeper)

  • The Problem: How do you physically freeze a deployment in AWS so it cannot proceed until a second person approves it?
  • What we built: We wrote Terraform code that configures an AWS Step Functions state machine and an SQS Queue. When a developer (the "Maker") starts a change, the deployment automatically halts mid-air, packages up the approval token, dumps it in SQS, and waits safely.

2. πŸ›‘ The Self-Approval Blocker (The smart Go Lambda)

  • The Problem: A clever developer might try to bypass the rule and approve their own request by assuming a different AWS role or session name.
  • What we built: We wrote a lightweight Go Lambda function running on Graviton. When someone tries to approve the change (the "Checker"), this Go program reads their AWS IAM session, normalizes their identity, and physically blocks the approval if it detects the Maker and Checker are the exact same human.

3. πŸ”’ The Indestructible Vault (WORM S3 Bucket)

  • The Problem: If a hacker gets your AWS root password, or a rogue administrator wants to cover their tracks, they will try to delete the deployment logs.
  • What we built: We configured an AWS S3 bucket in strict WORM (Write Once, Read Many) Compliance Mode using S3 Object Lock. Once our Go logger writes an audit log to this bucket, the vault is mathematically sealed by AWS. Even a root administrator cannot delete or modify those logs.

4. πŸ’» The Terminal Control Center (Our companion TUI)

  • The Problem: Running these suspended cloud pipelines typically requires developers to log into the cluttered, complex AWS Web Console or write obscure terminal scripts.
  • What we built: We built an interactive terminal dashboard using Bubble Tea in Go. Compliance operators can boot it up in their terminal, scroll through pending deployments, inspect who requested what, and safely approve or reject them with a single keypress!

1. Core Architectural Pillars

  • πŸ”Œ Plug-and-Play Integration: Instantly deployable into any AWS account using standard Terraform modules.
  • βš–οΈ Separation of Duties (DORA Art. 9.1): Critical operations are held in suspense using Step Functions and SQS task tokens (waitForTaskToken) until evaluated by a validator.
  • πŸ›‘ Automated Fraud Blocking (DORA Art. 9.2): An arm64 Go Lambda running on Graviton compares Maker and Checker identities (normalizing assumed-role STS ARNs) and blocks self-approvals dynamically.
  • πŸ”’ Immutable Audit Trail (DORA Art. 10): Audit logs are streamed directly to an S3 bucket configured in strict WORM COMPLIANCE mode (Object Lock) with KMS encryption.
  • 🌐 Network Isolation (AWS FSI): Multi-AZ VPC deployment where compute (ECS Fargate) and data (RDS PostgreSQL) run in isolated private subnets with no public IPs or routes.

2. System Architecture

graph TD
    subgraph "Compute & Compliance Orchestration"
        A[Developer or CI/CD] -->|1. Maker initiates change| B[Step Functions Workflow]
        B -->|2. RecordInitialRequest| C[Go Logger Lambda]
        C -->|3. Emit raw log| D[CloudWatch Logs]
        B -->|4. WaitForApproval| E[SQS Queue - Holds Task Token]
        F[Compliance Officer] -->|5. Approves change| G[Approval Payload]
        G -->|6. Resume with Token| B
        B -->|7. ValidateFourEyes| H[Go Validator Lambda]
        H -->|8. Compare Maker vs Checker| H
        H -->|9. Evaluation Result| B
        B -->|10. Choice: isValid?| I{Choice}
        I -->|Yes| J[ExecuteChange State]
        I -->|No| K[RejectChange State / Fraud Alert]
        J & K -->|11. Format & Emit final log| C
        D -->|12. Ship immutably via CloudTrail| L[(WORM S3 Bucket with Object Lock)]
    end

    subgraph "Core AWS Landing Zone (VPC)"
        subgraph "Public Subnets"
            M[Application Load Balancer]
        end
        subgraph "Private Subnets"
            N[ECS Fargate Tasks]
        end
        subgraph "Isolated Subnets"
            O[(RDS PostgreSQL Database)]
        end
        M --> N
        N --> O
        N -->|Triggers| B
    end
Loading

3. Regulatory Controls Mapping

Regulatory Directive Core Compliance Requirement AWS Infrastructure Enforcement
DORA Article 9.1 Separation of Duties (Maker-Checker) Step Functions pauses deployments via SQS task tokens until a validator confirms a distinct identity.
DORA Article 9.2 Fraud Prevention & Integrity Graviton-compiled Go Lambda normalizes STS session identities and blocks self-approvals dynamically.
DORA Article 10.1 Immutable Audit Logs (WORM) S3 bucket configured in COMPLIANCE mode with Object Lock. Deletion/modification of logs is mathematically blocked by AWS.
DORA Article 10.2 Contextual Audit Tracking Go Logger Lambda formats and outputs standardized audit logs, streamed directly to the immutable WORM bucket.

4. Getting Started

Ready to deploy Aegis? Please refer to the step-by-step landing zone bootstrap guide in RUNBOOK.md.

For detailed technical notes on ASPICE, networking architecture, and AWS IAM role models, read the ARCHITECTURE.md.


5. Verification Playbook

A. Run Go Unit Tests

Verifies the Go logic for fraud validation, regulatory time windows, and logging serialization:

make test

B. Run AWS Integration Tests

⚠️ Prerequisite: These tests run against live AWS resources. Ensure you have active AWS credentials configured and have successfully deployed the landing zone (using make deploy) before running these scripts.

Verifies live Step Functions executions, SQS callbacks, and Lambda blocks:

  • Fraud Block Validation: Verifies self-approvals are blocked and transition to the RejectChange state:
    python3 tests/test-aegis-flow.py
  • Happy Path Validation: Simulates a successful checker approval transitioning to the ExecuteChange state:
    python3 tests/test-aegis-success.py

C. WORM Immutability Stress Test

Simulates a hostile administrator trying to wipe the logs:

make stress-test
  • Object Eradication: Access is denied by AWS Object Lock (AccessDenied).
  • Bucket Eradication: Access is denied by AWS S3 (BucketNotEmpty).

D. Run Automated DORA Compliance Scanner

Aegis includes a custom built static auditing CLI engine in Go that checks the local infrastructure as code configurations against the exact EU DORA Articles:

make check

This runs a rigorous, Dracula-styled terminal auditor evaluating:

  • AEGIS-DORA-10.1-WORM-LOCK: Immutable Object Lock configurations.
  • AEGIS-DORA-10.1-WORM-MODE: Retention state in active compliance.
  • AEGIS-DORA-10.2-TRAIL-VALIDATION: Cryptographic signature validations on log transfers.
  • AEGIS-DORA-9.2-SUBNET-ISOLATION: Private Subnet and Routing boundary security.
  • AEGIS-DORA-11.1-CI-TFSEC & CHECKOV: Continuous integration vulnerability scanning pipelines.

6. Aegis Terminal Control Center (TUI) πŸ’»

Aegis includes an interactive, developer-first terminal command center built using the Bubble Tea and Lipgloss frameworks by Charm. It allows cloud operators and compliance officers to monitor, inspect, and approve suspended deployments directly from their terminal.

Run the Dashboard locally:

# Build the TUI binary
go build -o aegis-tui ./cmd/aegis-tui/

# Launch the interactive console
./aegis-tui

Key Controls:

  • j / k or ↓ / ↑: Scroll and navigate through suspended deployments.
  • a / Enter: Approve change (triggers the Checker callback and resumes the pipeline).
  • r: Reject/Cancel change.
  • q or Ctrl+C: Quit the control center.