Lab 20: Capstone — Enterprise Hardened HA Server

Time: 45 minutes | Level: Architect | Docker: docker run -it --rm --privileged ubuntu:22.04 bash

Overview

This capstone synthesises all four Architect tracks into a complete enterprise hardening + HA blueprint. You will: audit CIS Level 2 compliance with Lynis, write an Ansible playbook to enforce all hardening controls, configure Prometheus + Alertmanager monitoring stubs, design a Pacemaker/HAProxy HA configuration, set up a LUKS-encrypted data volume, enforce AppArmor mandatory access control, configure comprehensive auditd rules and AIDE integrity monitoring, and produce a final JSON compliance report that scores all controls. This is the definitive Architect competency check.


Step 1 — CIS Level 2 Baseline Audit

apt-get update -qq && apt-get install -y -qq lynis aide 2>/dev/null

echo "=== Lynis Version ==="
lynis --version

echo ""
echo "=== CIS Level 2 Baseline Scan ==="
lynis audit system --quick --no-colors --skip-plugins 2>&1 | \
  grep -E "(Hardening index|Tests performed|WARNING|Suggestion)" | head -20

📸 Verified Output:

=== Lynis Version ===
3.0.7

=== CIS Level 2 Baseline Scan ===
  Hardening index : 60 [############        ]
  Tests performed : 221

📸 Verified Output:

💡 Tip: CIS Level 2 target is Lynis hardening index ≥ 80. The gap from 60 to 80+ requires applying SSH hardening, PAM configuration, audit rules, and AppArmor enforcement.


Step 2 — Ansible Hardening Playbook

Build the Ansible playbook that enforces all CIS Level 2 controls:

📸 Verified Output:


Step 3 — Prometheus + Alertmanager Monitoring Integration

📸 Verified Output:


Step 4 — Pacemaker/HAProxy HA Configuration

📸 Verified Output:


Step 5 — LUKS Encrypted Data Volume

📸 Verified Output:


Step 6 — AppArmor Profiles

📸 Verified Output:


Step 7 — auditd Rules + AIDE Integration

📸 Verified Output:


Step 8 — Capstone: Final Enterprise Compliance Report

Generate the comprehensive JSON compliance report that integrates all controls:

📸 Verified Output:


Summary

Domain
Key Controls
Tools

CIS Hardening

Level 2 audit, Lynis score ≥ 65

lynis

Ansible Automation

Full playbook with roles, pre/post assertions

ansible-playbook

Monitoring

Prometheus scrape + security alert rules

prometheus, alertmanager

High Availability

Pacemaker resources + HAProxy load balancer

pcs, haproxy

Encrypted Storage

LUKS volume with keyfile + crypttab auto-mount

cryptsetup

AppArmor MAC

Per-service AppArmor profiles, enforcement mode

apparmor_parser, aa-enforce

Audit + Integrity

auditd 64-bit rules + AIDE database + cron reports

auditd, aide, aureport

Compliance Report

JSON scoring script integrating all controls

Bash + Python

Architect Competencies Demonstrated

Track
Labs
Key Outcome

High Availability

01–05

Pacemaker/HAProxy/Keepalived cluster design

Ansible

06–10

Full infrastructure-as-code provisioning

Observability

11–15

ELK + Prometheus/Grafana production stack

Security & Compliance

16–20

CIS hardening, SCAP, auditd, patch management

Last updated