Categorygithub.com/ernoaapa/fetch-ssh-keys
modulepackage
1.1.7
Repository: https://github.com/ernoaapa/fetch-ssh-keys.git
Documentation: pkg.go.dev

# README

fetch-ssh-keys

Build Status Go Report Card

fetch-ssh-keys is small shell command to get users public SSH keys from different cloud services like GitHub.

Note: Tested only on Linux and Mac. If you test on any other platform, please me know!

Usage

fetch-ssh-keys <source name> <parameters> <output file>

For example fetch users public SSH keys from GitHub my-lovely-team team in my-awesome-company organization and output in SSH authorized_keys format

# Fetch 'my-lovely-team' keys in 'my-awesome-company' organisation
fetch-ssh-keys github --organization my-awesome-company --team my-lovely-team --token YOUR-TOKEN-HERE ./the-keys

# Fetch 'ernoaapa' and 'arnested' public keys
fetch-ssh-keys github --user ernoaapa --user arnested  --token YOUR-TOKEN-HERE ./the-keys

# Fetch 'ernoaapa/fetch-ssh-keys' deploy keys (requires a Github token with the `repo` or `public_repo` scope)
fetch-ssh-keys github --deploy-key ernoaapa/fetch-ssh-keys  --token YOUR-TOKEN-HERE ./the-keys

Tool can be used for example to automatically update .ssh/authorized_keys file by giving path to .ssh/authorized_keys as last argument and adding the script to cron job.

Installation

  • Download binary from releases
  • Give execution rights (chmod +x fetch-ssh-keys) and add it into your $PATH

Configuration

ParameterRequiredDescription
--formatNo (default ssh)Output format. Only ssh authorized_keys format supported for now
--file-modeNo (default 0600)File permissions when writing to a file
--commentNo (default none)Include COMMENT at top and bottom

GitHub

ParameterDescription
--organizationName of the organization which members keys to pick
--teamName or slug of the team which members keys to pick
--userName of the user which keys to pick
--deploy-keyName of the owner/repo which deploy keys to pick
--tokenGitHub API token to use for communication. Without token you get only public members of the organization.
--public-onlyReturn only members what are publicly members of the given organization

You can give --organisation (optionally combined with --team flag) and/or one or more --user or --deploy-key flags.

The --deploy-key parameter requires a Github token with the repo or public_repo scope.

Development

Get dependencies

go get ./...

Run

go run main.go github --output ssh

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

Version string to be set at compile time via command line (-ldflags "-X main.VersionString=1.2.3").