How cmchenr/secure-workload-aws-workspaces works
Main Components
• AWS Lambda Functions:
• labels_lambda (handler.py): Synchronizes AWS WorkSpace tags and additional attributes (e.g., UserName) to Cisco Secure Workload.
• cleanup_lambda (handler.py): Cleans up Cisco Secure Workload records when a WorkSpace is terminated.
• Scheduled Task Component (workspace_scheduled_task):
• XML file (RestartTetrationOnResume.xml): Defines a scheduled task that triggers on the system event when a WorkSpace resumes from hibernation.
• PowerShell script (start_enforcement_agent.ps1): Contains the logic to verify connectivity and restart the enforcement services on the WorkSpace.
• External Systems/Services:
• Amazon WorkSpaces: The virtual desktops whose context and security events are being managed.
• Cisco Secure Workload: The endpoint security system that ingests labels and sensor data, and enforces policies.
• AWS CloudWatch Events: Although not explicit in the file tree, the README indicates that CloudWatch events are used to schedule the Lambda functions (e.g., every 2 minutes for labels updates and every 10 minutes for cleanup).
• Environment Variables:
• These serve as configuration points for both lambdas, controlling behavior such as tag synchronization, deletion of sensor records, and connecting to Cisco Secure Workload with its API credentials.
Relationships and Interactions
• Data Flow:
• For the labels_lambda:
1. Triggered by a recurring CloudWatch event.
2. Reads current AWS WorkSpaces and their associated tags and attributes.
3. If configured (via ADD_TAGS and ATTRIBUTES_LIST), synchronizes this data with Cisco Secure Workload via its API.
• For the cleanup_lambda:
1. Also triggered by a recurring CloudWatch event.
2. Monitors WorkSpace terminations and issues cleanup commands to Cisco Secure Workload (possibly deleting stale sensor records if DELETE_SENSORS is true).
• For the Scheduled Task:
1. On a WorkSpace (or a golden image) coming out of hibernation, the scheduled task (defined by the XML template) is automatically triggered.
2. It launches the PowerShell script, which checks connectivity (e.g., to www.tetrationcloud.com or a Cisco-specific IP) and then restarts key Cisco Secure Workload agent services.
• Architectural Patterns:
• Serverless design for the automation components (lambda functions).
• Scheduled tasks on a Windows-based WorkSpace image to manage service state upon hibernation.
• Loose coupling between AWS and Cisco systems via REST API calls, with configuration via environment variables for flexibility.