#ssh-key #public-key #ssh #key #github #utilities

app keysync

A utility to sync local authorized_keys file updated with your with Github, Gitlab, and Launchpad public keys

9 releases (stable)

4.0.0 Jun 13, 2022
3.0.3 Jan 25, 2021
3.0.0 Dec 6, 2020
2.0.0 Oct 22, 2020
0.1.4 Oct 13, 2020

#2452 in Command line utilities

33 downloads per month

MIT/Apache

2MB
1.5K SLoC

Keysync

An SSH key syncing utility

CI CD Crates.io Crates.io License

Table of Contents
  1. About
  2. Installation
  3. Usage
  4. Building and Testing
  5. Contributing
  6. Status
  7. Built With
  8. Contact
  9. License

Keysync Demo

About

Warning this project unmaintained and definitely over engineered, there are easier ways to fetch keys"

keysync is a command line utility and service to help keep your local authorized_keys file synced to a master copy of public keys.

The program allows syncing from Github, GitLab, Launchpad at the moment, custom url support is coming soon. It downloads and filters only keys that you don't already have a local copy of. This application can be used for either as one time sync when run, or running automatically in the background as a systemd service. You can have the file it updated at a preset interval or a custom cron expression, you can even support multiple users and providers.

Note: Automatic jobs will fail if the computer goes to sleep/hibernate. The systemd daemon is recommended primarily for servers. For personal computers it is recommended to just run the command manually whenever you add public keys.

Warning If you're Github, GitLab or Launchpad is compromised an attacker can upload their keys to gain access to you're computer. For security please do not set this program up for a root user, you're just asking for trouble.

Installation

If you have rust installed you can use cargo.
requires a the following packages to be install: libsqlite-dev, build-essential, libssl-dev (Debian names)
cargo install nxcloud

Other packaged binary's are available in Releases.

Usage

The binary name is keysync

To display application use keysync help
Use keysync <subcommand> help for help with that subcommand.

Examples

Downloads the public keys from github for the username.
keysync get <username>

Downloads the public keys from GitLab for the username, a url must be provided or '' for https://gitlab.com.
keysync get --gitlab <url> <username>

Adds automatic job for the user, where username is the Github or GitLab username.
Valid schedules are [Hourly, Daily, Weekly, Monthly, Custom].
keysync set <username> <schedule>

Adds automattic job for user with custom cron schedule.
keysync set <username> custom -c <cron>

Building and Testing

This repository is a standard rust project bin structure.

Setup

  • Install Rust
  • Install build-essential, libssl-dev, libsqlite3-dev (Linux)
    apt install build-essential libssl-dev libsqlite3-dev (Debian based)
  • Clone repository

Compile and Run

Rust support building or running with the following commands:
cargo build Will build an executable in /target/debug/.
cargo run -- <args> Will build and run an executable.

Testing

Testing all standard test can be done with rust built in test framework.
cargo test

Some tests cannot be completed with 100% reliability (for example they might fail without network access), this will run all ignored tests.
cargo test -- --ignored

Documentation

Rust built in documentation tools can be generated.
cargo doc

To open with your default browser.
cargo doc --open

Contributing

Contributions are completely welcome and encouraged!
Examples of contributing could include:

  • Submitting a feature request or bug report.
  • Asking for improved documentation.
  • Code by creating a pull request.

Refer to Contributing

Status

Development is still in progress with new features being planned.
Feel free to Contribute.

Built With

Rust
SQLite

Contact

Created by Ethan Budd
Email: budde25@protonmail.com

License

Dual-licensed under either either of the following:

Dependencies

~38–56MB
~1M SLoC