Skip to content

feat: Add SSH certificate authentication support for Terratest#1594

Merged
james00012 merged 2 commits intomainfrom
ssh-certificate
Sep 28, 2025
Merged

feat: Add SSH certificate authentication support for Terratest#1594
james00012 merged 2 commits intomainfrom
ssh-certificate

Conversation

@james00012
Copy link
Copy Markdown
Contributor

@james00012 james00012 commented Sep 22, 2025

Summary

Adds SSH certificate-based authentication support to Terratest as a secure alternative to traditional SSH keys.

Fixes #1591

Changes

  • Added terraform-ssh-certificate-example module with EC2 instance configured for certificate authentication
  • Implemented TestTerraformSshCertificateExample test suite
  • Added CheckSshConnectionWithCertificate helper function in SSH module
  • Included user data script to configure TrustedUserCAKeys for SSH daemon

Testing

The test validates:

  • SSH CA key pair generation
  • User certificate signing
  • Certificate-based SSH connections
  • Command execution over authenticated sessions

Use Cases

  • Infrastructure using SSH certificate authentication
  • Short-lived SSH certificates for improved security
  • Automated testing with certificate-based access control

- Add terraform-ssh-certificate-example module with EC2 instance configured for certificate-based SSH authentication
- Implement TestTerraformSshCertificateExample test case to validate SSH certificate authentication workflow
- Add CheckSshConnectionWithCertificate helper function in ssh module for certificate-based connections
- Include comprehensive documentation and example usage in README
- Configure user_data script to set up TrustedUserCAKeys for SSH certificate validation

This enables testing of infrastructure that uses SSH certificate authentication instead of traditional key-based auth, providing a more secure and manageable authentication method for automated testing scenarios.
@james00012 james00012 merged commit fa175b0 into main Sep 28, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to Connect to SSH server via signed keys

2 participants