SSH assets python library
This little utility allows configuring SSH keys to be loaded automatically to the SSH agent based on asset configuration files, and can detect loaded keys based on the key hash to avoid reloading existing keys.
This library can:
- load SSH key details from various key formats to get key hashes, comments and other key details
- detect keys loaded to the SSH agent by key hash instead of filename
- define known SSH keys from multiple locations (project specific folders, shared team folders) with options to name and autoload the key with the module
- load and unload keys to the agent based on custom configuration file, without asking key password if the key was already loaded
Installing
This tool can be installed from PyPI.
pip install ssh-assets
Using the CLI tool
This package installs command line utility ssh-assets. The tool currently has
only one command load-keys that can be used to load the keys configured in
the assets configuration file as shown below.
Following command loads any keys not yet loaded to the agent, but limits this
to the keys with autoload property set to true:
ssh-assets keys load
ssh-assets keys load --group personal
ssh-assets keys edit personal --no-autoload
ssh-assets keys edit personal --autoload
ssh-assets keys add demo --path ~/.ssh/id_rsa.demo --autoload --expire=8h
ssh-assets keys delete demo
SSH assets configuration file
This module uses configuration file ~/.ssh/assets.yml to define paths to the
SSH keys.
Example configuration file:
---
groups:
- name: personal
expire: 5d
keys:
- personal
- missing-demo-key
- name: work
expire: 1d
keys:
- aws
- master
- myproject
keys:
- name: personal
path: ~/.ssh/id_rsa
autoload: true
- name: aws
path: ~/.ssh/id_rsa-aws
- name: myproject
path: ~/Work/Keys/ssh_project_id
autoload: true
- name: master
expire: 1d
path: ~/Work/Keys/master_ssh_key
autoloaddefaults to False in configuration if not specified.exporedefines a valid value for key expiration in SSH agent, for example8hor5d
Example python code
With such configuration file, you can load the keys marked as autoload to the SSH
agent with following example code. Calling the load method again does not try loading
the keys again (key is detected in agent loaded keys by hash).
from ssh_assets.session import SshAssetSession
SshAssetSession().load_pending_keys()
History
This module replaces previous module systematic-ssh-config when ready.
Metadata
Release files for ssh-assets 1.7.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ssh_assets-1.7.2.tar.gz | 23.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ssh_assets-1.7.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 66.5 kB
Release files / ssh_assets-1.7.2.tar.gz
| Download URL | ssh_assets-1.7.2.tar.gz |
|---|---|
| Size | 23.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15a5693466eed7762a90ee8fb064569dd78490c3003d398aaf4a3c558b0be979
|
|
BLAKE2b-256 checksum How to use checksums |
725bf3c2e3bcd652e8d94f6de0936ab2224731fd73718a1d2fa2ee3cc3706d0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.4 Darwin/22.5.0
|
Release files / ssh_assets-1.7.2-py3-none-any.whl
| Download URL | ssh_assets-1.7.2-py3-none-any.whl |
|---|---|
| Size | 43.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
45c8a638be54f62fab160b107de9f2d83237de71890e1bd9dc4d57307d2f0fc3
|
|
BLAKE2b-256 checksum How to use checksums |
5f0e505c05181d5d5549d028303a4d851dec609d8f43d2bcbe7f1ae96f2858bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.4 Darwin/22.5.0
|
Security for ssh-assets 1.7.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.