Crates.io | superkeyloader |
lib.rs | superkeyloader |
version | 0.1.1 |
source | src |
created_at | 2020-03-23 18:41:54.547256 |
updated_at | 2020-03-28 15:32:02.030438 |
description | A small utility to copy all your GitHub SSH public keys on your system. |
homepage | https://github.com/biosan/superkeyloader |
repository | https://github.com/biosan/superkeyloader |
max_upload_size | |
id | 221852 |
size | 72,426 |
A small utility to copy all your GitHub SSH public keys on your system.
Superkeyloader is a simple CLI binary written in Rust that downloads your SSH keys from GitHub and append them to your ~/.ssh/authorized_keys
file.
Use it when setting up a new machine (VPS, home server, Pi, etc) to authorize all your SSH key at the same time.
A couple of months ago I installed Ubuntu Server 19.10. During the installation, it asked my GitHub username, and copied my SSH public keys on GitHub into my user's authorized keys. Was great experience, I set a strong password and disabled SSH password login from the first boot. Great security and great convenience.
I searched for a tool that would do the same thing, but I found nothing. If you know a tool that does this thing please let me know.
So I decided to build one my own.
The first implementation was a simple Python CLI built with click
. Cool and easy to build.
It required a Python interpreter, that it's installed on most, but not all, modern systems.
I wanted a single small binary, and packaging the Python tool wasn't practical.
Learning Rust has been on my to-do list for a long time, and this project seemed a good learning opportunity.
The result is this small Rust tool.
Install from Cargo (requires Rust toolchain):
cargo install superkeyloader
Download binary from releases page and add it to you $PATH
. Available for linux and macOS on "x86"
NOTE: Linux binaries that ends with
gnu
requires some GNU dependencies. If you want a fully self-contained binary with no external dependencies download themusl
version.
superkeyloader
USAGE:
superkeyloader [FLAGS] [OPTIONS] <username>
FLAGS:
-h, --help
Prints help information
-m, --human
-j, --json
-q, --quiet
Pass many times for less log output
-p, --stdout
-V, --version
Prints version information
-v, --verbose
Pass many times for more log output
By default, it'll only report errors. Passing `-v` one time also prints warnings, `-vv` enables info
logging, `-vvv` debug, and `-vvvv` trace.
OPTIONS:
-o, --output <path>
[default: ~/.ssh/authorized_keys]
ARGS:
<username>
Build ARM binaries IMPORTANT
Improve documentation and publish it
Add a simple installation script
Add support for external machines (like ssh-copy-id
)
Add support for GitLab and BitBucket
Publish on Homebrew
Publish on other package managers
Add Windows support with real-world testing (if someone cares about)
Probably no one will ever read this, but in the rare case that you end up here and you want to add some features, improve my code, suggest a new functionality, or more probably to fill up a issue to fix a bug, etc., in any case you are welcome to make PRs, fill issues, or send me a mail.
I'm also very interested in real-world test cases and usage scenarios. Let me know if this small utility was useful to you or if you have any idea on how to improve it.
Development dependencies and other small tasks are handled by just
, a Rust-based alternative to make
.
Steps to start contributing:
just
cargo install just
just setup-dev-env
It will install:
convco
- Check that commits conform to conventional commits specification (I choose this over commitlint
to remove non-Rust dependencies).
rusty-hook
- Install git hooks
grcov
- Code coverage tool from Mozilla (I use it on macOS to get local code coverage reports, not strictly required)
rust nightly
- Rust nightly toolchain, required by grcov
clippy
- Rust code linter (cargo
component)
rustfmt
- Rust code formatter (cargo
component)
and setup git hooks.
This repository has git hooks to enforce good formatting, code linting, and testing on developer side (thanks rusty-hook
), the same rules will be applied on GitHub Actions.
NOTE:
rusty-hook
should setup hooks when you first runcargo test
. In case it doesn't work or after some time it stops working, you could setup hooks again withjust install-hooks
.
This repo follow Conventional Commits, and use convco
to enforce them (on developer side).
convco
is run by the commit-msg
hook every time you make a commit.
NOTE: It's installed by
just setup-dev-env
All this conventions are also enforced on CI. Using commitlint-github-action
.
The action use commitlint
, so there is also a very basic configuration file. If you use commitlint
it will use it.
This project use GitHub Actions for CI and building releases.
Configuration is based on Mean Bean CI
template.
Code formatting, linting and commit messages rules (see above) are enforced on CI too.
Thanks to the awesome action-rs
project.
Code coverage is calculated on every push by action-rs/grcov
and uploaded to Coveralls, where you could see coverage history.
This project is licensed under the MIT license.