https://github.com/conortm/ghkeys
Populate authorized_keys from GitHub users and/or teams
https://github.com/conortm/ghkeys
github golang ssh-key
Last synced: 17 days ago
JSON representation
Populate authorized_keys from GitHub users and/or teams
- Host: GitHub
- URL: https://github.com/conortm/ghkeys
- Owner: conortm
- License: mit
- Created: 2015-04-23T02:18:17.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2016-03-09T03:45:32.000Z (almost 10 years ago)
- Last Synced: 2024-06-19T13:47:19.321Z (over 1 year ago)
- Topics: github, golang, ssh-key
- Language: Go
- Homepage: https://conortm.io/ghkeys
- Size: 39.1 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ghkeys [](https://travis-ci.org/conortm/ghkeys) [](https://coveralls.io/r/conortm/ghkeys?branch=master)
[ghkeys](https://github.com/conortm/ghkeys) is a simple command line tool for syncing server users' authorized SSH keys with those of one or more GitHub accounts.
Via configuration, specify individual GitHub users and/or entire teams, whose SSH keys should either be output directly or written to server users' `authorized_keys` files.
## Installation
```bash
go get github.com/conortm/ghkeys
```
## Configuration
Create a `config.yml` file like [`config.example.yml`](./config.example.yml):
```yaml
---
# Replace with your own personal access token:
github_token: my_github_token
# Array of server usernames and the GitHub source(s) of their authorized keys:
users:
- username: superadmin
github_users:
- github_user_1
github_teams:
# Specify teams by Org name and team name, separated by a /
- MyOrg/Team 1
- MyOrg/Team 2
- username: admin
github_users:
- github_user_1
- github_user_2
github_teams:
- MyOtherOrg/Team 3
```
*Note*: Replace `my_github_token` with your own [personal access token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/).
## Usage
To print all keys:
```bash
ghkeys -config=/path/to/config.yml
```
Pass single username argument to print only that user's keys, for example, when using `AuthorizedKeysCommand`:
```bash
ghkeys -config=/path/to/config.yml superadmin
```
Use the `-write` flag to write keys to users' `authorized_keys` files:
```bash
ghkeys -config=/path/to/config.yml -write
```
## TODO
- [ ] Implement https://github.com/sourcegraph/apiproxy
- [ ] Validate config file
- [ ] Better error handling
## License
[MIT](./LICENSE) © [Conor McNamara](http://conortm.io/)