Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Host key verification issue with private terraform modules #69

Open
lward-lucid opened this issue Oct 6, 2022 · 1 comment
Open

Host key verification issue with private terraform modules #69

lward-lucid opened this issue Oct 6, 2022 · 1 comment

Comments

@lward-lucid
Copy link

Hi

Can this action be extended (or would you accept a PR) that allowed the known_host file to be set when running this action? Or have the action pre-loaded with at least githubs host keys - https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints

Currently the default openssh (and via this git) has the StrictHostKeyChecking enabled (rightly so), however due to this the terrascan action cannot checkout a terraform module hosted in a private git repository (not sure if this would also apply to public git repo as well)

We use private modules that are accessed via git like so

module "module_foo" {
  name    = "foo-bar"
  source  = "git::[email protected]:some-org-name/terraform-modules//some-module-name?ref=v15.0.2"
}

The terrascan action allows us to set the scm_token param to checkout these module (private repos) but it fails on host key verification

terrascan scan  -d . -i terraform -t aws -c .github/linters/terrascan.toml --repo-url https://github.com/some-org-name/terraform.git --repo-ref refs/pull/1234/merge
2022-10-06T18:10:27.685Z	error	downloader/getter.go:105	failed to download "git::ssh://[email protected]/some-otg-name/terraform-modules?ref=v18.0.0". error: 'error downloading 'ssh://[email protected]/some-org-name/terraform-modules?ref=v18.0.0': /usr/bin/git exited with 128: Cloning into '/tmp/asdasd'...
Host key verification failed.
fatal: Could not read from remote repository.

Thanks

@lward-lucid
Copy link
Author

Just realised after posting this the scm_token is only going to be used on https git checkouts and would not be used in the code example above that is using git:: protocol. So even if host key support is added we would end up having an issue with passing ssh creds to the action in order to git checkout the modules.

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

No branches or pull requests

1 participant