Browse the Repo

file-type-icon.circleci
file-type-icon_ci
file-type-icon_docs
file-type-iconexamples
file-type-iconmodules
file-type-icontest
file-type-iconip-lockdown-test-scripts
file-type-iconGopkg.lock
file-type-iconGopkg.toml
file-type-iconREADME.md
file-type-iconauto_update_test.go
file-type-iconaws_config_test.go
file-type-iconaws_organizations_config_rules_test.go
file-type-iconaws_organizations_test.go
file-type-iconcloudtrail_test.go
file-type-iconcross_account_iam_roles_test.go
file-type-iconcustom_iam_entity_test.go
file-type-iconfail2ban_test.go
file-type-iconguardduty_test.go
file-type-iconiam_groups_test.go
file-type-iconiam_ssm_test.go
file-type-iconiam_user_password_policy_test.go
file-type-iconiam_users_test.go
file-type-iconip_lockdown_test.go
file-type-iconkms_master_key_test.go
file-type-iconntp_test.go
file-type-iconos_hardening_test.go
file-type-iconsaml_iam_roles_test.go
file-type-iconssh_grunt_houston_test.go
file-type-iconssh_grunt_iam_test.go
file-type-icontest_helpers.go
file-type-icontest_helpers_aws_auth.go
file-type-icontls_cert_private_test.go
file-type-icon.editorconfig
file-type-icon.gitignore
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME.adoc

Browse the Repo

file-type-icon.circleci
file-type-icon_ci
file-type-icon_docs
file-type-iconexamples
file-type-iconmodules
file-type-icontest
file-type-iconip-lockdown-test-scripts
file-type-iconGopkg.lock
file-type-iconGopkg.toml
file-type-iconREADME.md
file-type-iconauto_update_test.go
file-type-iconaws_config_test.go
file-type-iconaws_organizations_config_rules_test.go
file-type-iconaws_organizations_test.go
file-type-iconcloudtrail_test.go
file-type-iconcross_account_iam_roles_test.go
file-type-iconcustom_iam_entity_test.go
file-type-iconfail2ban_test.go
file-type-iconguardduty_test.go
file-type-iconiam_groups_test.go
file-type-iconiam_ssm_test.go
file-type-iconiam_user_password_policy_test.go
file-type-iconiam_users_test.go
file-type-iconip_lockdown_test.go
file-type-iconkms_master_key_test.go
file-type-iconntp_test.go
file-type-iconos_hardening_test.go
file-type-iconsaml_iam_roles_test.go
file-type-iconssh_grunt_houston_test.go
file-type-iconssh_grunt_iam_test.go
file-type-icontest_helpers.go
file-type-icontest_helpers_aws_auth.go
file-type-icontls_cert_private_test.go
file-type-icon.editorconfig
file-type-icon.gitignore
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME.adoc
ssh-grunt

ssh-grunt

Manage SSH access to EC2 Instances using groups in AWS IAM or your Identity Provider (e.g., ADFS, Google, Okta, etc).

Code Preview

Preview the Code

mobile file icon

README.md

down

Tests

This folder contains the tests for the modules in this repo.

Running the tests locally

Note #1: Many of these tests create real resources in an AWS account. That means they cost money to run, especially if you don't clean up after yourself. Please be considerate of the resources you create and take extra care to clean everything up when you're done!

Note #2: Never hit CTRL + C or cancel a build once tests are running or the cleanup tasks won't run!

Note #3: We set -timeout 45m on all tests not because they necessarily take 45 minutes, but because Go has a default test timeout of 10 minutes, after which it does a SIGQUIT, preventing the tests from properly cleaning up after themselves. Therefore, we set a timeout of 45 minutes to make sure all tests have enough time to finish and cleanup.

Prerequisites

  • Install the latest version of Go.
  • Install dep for Go dependency management. On OSX, the simplest way to install is brew update; brew install dep.
  • Install Terraform.
  • Add your AWS credentials as environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
  • For some of the tests, you also need to set the GITHUB_OAUTH_TOKEN environment variable to a valid GitHub auth token with "repo" access. You can generate one here: https://github.com/settings/tokens

Setup

Download Go dependencies using dep:

cd test
dep ensure

Run all the tests

cd test
go test -v -timeout 45m -parallel 128

Note: The automated tests for the kms-master-key and cloudtrail packages are disabled by default. That's because generating a KMS Master Key costs $1/month, even if we delete it right after, which can add up quickly if we run this test often. To enable the test, you need to set the RUN_KMS_TEST or RUN_CLOUDTRAIL_TEST environment variables:

cd test
RUN_KMS_TEST=true go test -v -timeout 45m -parallel 128

Run a specific test

To run a specific test called TestFoo:

cd test
go test -v -timeout 45m -parallel 128 -run TestFoo

Questions? Ask away.

We're here to talk about our services, answer any questions, give advice, or just to chat.

Ready to hand off the Gruntwork?