Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sj26/ssh-keyscan-buildkite-plugin
Run ssh-keyscan into a known hosts file as a pre-command hook for use in Buildkite builds
https://github.com/sj26/ssh-keyscan-buildkite-plugin
buildkite buildkite-plugin known-hosts ssh ssh-keyscan
Last synced: about 1 month ago
JSON representation
Run ssh-keyscan into a known hosts file as a pre-command hook for use in Buildkite builds
- Host: GitHub
- URL: https://github.com/sj26/ssh-keyscan-buildkite-plugin
- Owner: sj26
- License: mit
- Created: 2024-02-15T21:58:27.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-02-16T04:03:12.000Z (9 months ago)
- Last Synced: 2024-06-12T19:01:21.839Z (5 months ago)
- Topics: buildkite, buildkite-plugin, known-hosts, ssh, ssh-keyscan
- Language: Shell
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SSH Keyscan
Run [`ssh-keyscan`] into a [known hosts file] as [a pre-command hook] for use in [Buildkite] builds.
Your pipeline may be using HTTPS repositories but you also need to use SSH, so you can't rely on built-in ssh keyscan priming your known hosts file. Or maybe you're using Terraform with SSH modules. Or you're doing SSH operations against a deployment environment.
[`ssh-keyscan`]: https://man.openbsd.org/ssh-keyscan.1
[known hosts file]: https://man.openbsd.org/sshd.8#SSH_KNOWN_HOSTS_FILE_FORMAT
[a pre-command hook]: https://buildkite.com/docs/agent/v3/hooks#job-lifecycle-hooks
[Buildkite]: https://buildkite.com## Example
```yaml
steps:
- plugins:
- sj26/ssh-keyscan:
host: github.com
command: ssh clone [email protected]:buildkite/bash-example.git
```## Choosing known hosts location
By default, the host key will be scanned into `~/.ssh/known_hosts`.
You can scan into a different location usign the `known_hosts_path` parameter:
```yaml
steps:
- plugins:
- sj26/ssh-keyscan:
host: github.com
known_hosts_path: /etc/ssh/ssh_known_hosts
```## Caveats
ssh-keyscan will always run, and always append to the known hosts file, even if the host entry already exists. This may be solved in a future version.
Only one host can be scanned. You can add this plugin multiple times as a workaround. Multiple hosts may be supported in a future version.