3. Environment Setup Guide
January 5, 2024About 1 min
Prerequisite Knowledge
- Basic command line experience
- Familiarity with package managers
- Understanding of environment variables
- Basic Docker concepts
Required Software Overview
Each tool listed below is essential for the course. We'll explain why you need each one:
- RVM (Ruby Version Manager) - Manages Ruby installations
- Ruby v3+ - Core programming language for our testing framework
- Git - Version control for managing code
- VS Code/IDE - For writing and editing code
- Docker - For container-based testing
- AWS CLI - For interacting with AWS services
Required Accounts Setup
Create accounts with these services before proceeding:
AWS Console Account
- Purpose: Cloud infrastructure testing
- Sign up: AWS Console
Platform One (P1) Account
- Purpose: Access to hardened containers
- Register: Platform One Registration
P1 Harbor Access
- Purpose: Container registry access
- Get CLI token from your user account page: Harbor Login
Environment Configuration
1. Test Kitchen Variables
Important variables that control testing behavior:
INSPEC_CONTROL
: Specifies which single control to run in thebundle exec kitchen verify
phase - useful for testing and debugging a single requirement.- default:
none
- default:
KITCHEN_LOCAL_YAML
: Specifies the target testing environment you want to use to run and validate the profile.- default:
none
- default:
VANILLA_CONTAINER_IMAGE
: Specifies the Docker container image you consider 'not hardened' (used bykitchen.container.yml
).- default:
registry.access.redhat.com/ubi8/ubi:8.9-1028
- default:
HARDENED_CONTAINER_IMAGE
: Specifies the Docker container image you consider 'hardened' (used bykitchen.container.yml
).- default:
registry1.dso.mil/ironbank/redhat/ubi/ubi8
- default:
2. AWS Environment Setup
Option 1: AWS Profiles (Recommended)
- Easier management of multiple environments
- More secure than environment variables
- Setup guide: AWS CLI Profiles
Option 2: Environment Variables
- Traditional AWS environment variables
- Documentation: AWS CLI Installation
Step-by-Step Installation Guide
Ruby Setup
- Install RVM or alternative Ruby manager
- Install Ruby 3.1+
- Configure OpenSSL and certificates
AWS Configuration
- Install AWS CLI
- Configure credentials
- Test connection
Project Setup
- Clone repository
- Configure Harbor CLI access
- Set up Docker registry access
- Install dependencies
Verification Steps
Run these commands to verify your setup:
- Verify your newly installed Ruby environment by running
ruby --version
. - Confirm that InSpec was installed by running
bundle exec inspec --version
. - Check that Test Kitchen was installed by running
bundle exec kitchen version
. - Verify that your
aws-cli
is correctly configured by runningaws s3 ls
(or your preferred test command for AWS CLI). - Confirm your bundle installation by running
bundle exec inspec --version
. - Verify you can pull from RepoOne by running
docker pull https://repo1.dso.mil/dsop/redhat/ubi/ubi8
. - Celebrate 🎉️ if everything went well.