Skip to content

[EPIC] Finish ConfigureCommand - System Security Configuration #16

Closed
3 of 3 issues completed
Closed

Description

@josecelano

This Epic completes the ConfigureCommand implementation by adding system security configuration capabilities. After establishing the foundational architecture and Docker installation in previous work, this Epic focuses specifically on system-level security hardening through three key areas:

Goals

  1. Automatic Security Updates - Configure unattended-upgrades for automated security patch management
  2. UFW Firewall Configuration - Implement network-level security with safe SSH access preservation
  3. Template Architecture Refinement - Consolidate Ansible templates into a centralized variables pattern

This Epic provides immediate production value by securing deployed instances with industry-standard security practices, while also establishing a clean architectural foundation for future service additions.

Implementation Strategy

Phase 1: Automatic Security Updates (#17)

Estimated Time: 1-2 days

  • Lower risk implementation that configures unattended-upgrades for automatic security patching
  • Install and configure unattended-upgrades package
  • Enable automatic reboots at 2:00 AM for security updates
  • Configure update notifications and logging

Phase 2: UFW Firewall Configuration (#18)

Estimated Time: 2-3 days

  • Higher risk implementation requiring careful SSH access handling
  • Reset UFW to clean state
  • Configure restrictive default policies (deny incoming, allow outgoing)
  • CRITICALLY: Allow SSH access BEFORE enabling firewall
  • Use configurable SSH port from user_inputs.ssh_port

Phase 3: Template Architecture Refinement (#19)

Estimated Time: 1-2 days

  • Architectural cleanup and consistency improvement
  • Consolidate 2 Tera templates into 1 centralized variables pattern
  • Create variables.yml.tera matching OpenTofu's approach
  • Convert inventory.yml.tera and configure-firewall.yml.tera to static files
  • Establish consistent pattern for future service additions

Architecture Impact

Domain Changes Required

The ConfigureStep enum in src/domain/environment/state/configure_failed.rs needs to be extended:

/// Steps in the configure workflow
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum ConfigureStep {
    /// Installing Docker
    InstallDocker,
    /// Installing Docker Compose
    InstallDockerCompose,
    /// Configuring automatic security updates
    ConfigureSecurityUpdates,
    /// Configuring UFW firewall
    ConfigureFirewall,
}

New Application Steps

Two new step implementations required:

  • src/application/steps/system/configure_security_updates.rs
  • src/application/steps/system/configure_firewall.rs

New Ansible Templates

Two new Ansible playbook templates:

  • templates/ansible/configure-security-updates.yml (static)
  • templates/ansible/configure-firewall.yml.tera (dynamic - requires SSH port resolution)

Acceptance Criteria

  • Security Updates: Instances automatically install security updates and reboot when needed
  • Firewall Active: UFW firewall is enabled with restrictive default policies
  • SSH Access Maintained: SSH access continues to work on configured port
  • Domain Integration: New steps properly integrated into ConfigureStep enum
  • Template Consistency: Ansible templates use centralized variables pattern matching OpenTofu
  • Reduced Complexity: Only one Tera template (variables.yml.tera) needs variable processing
  • Error Handling: Comprehensive error handling with actionable messages
  • Tests Pass: All existing tests continue to pass
  • E2E Validation: Full E2E tests validate the new configurations
  • Backward Compatibility: Existing functionality remains unchanged

Related

Roadmap: Task 3.1 - Finish ConfigureCommand
Related Issues: #1 (Roadmap)

Total Estimated Effort: 4-7 days

Full specification: Epic Documentation

Sub-issues

Sub-issues

3 of 3 Issues completed
Loading 3 sub-issues

Activity

  1. changed the title [-]Epic: Finish ConfigureCommand - System Security Configuration[/-] [+]EPIC: Finish ConfigureCommand - System Security Configuration[/+] on Oct 21, 2025
  2. added a commit that references this issue on Oct 21, 2025
  3. changed the title [-]EPIC: Finish ConfigureCommand - System Security Configuration[/-] [+][EPIC] Finish ConfigureCommand - System Security Configuration[/+] on Oct 29, 2025
  4. added 4 commits that reference this issue on Oct 30, 2025
  5. josecelano commented on Nov 6, 2025

    @josecelano
    MemberAuthor

    All subissues have been completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementepicroadmapsecurity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions