py-gitsshgen
Automatic generation of SSH keys for VCS
Why?
I was incredibly tired of doing the same procedure over and over for dozens of different VCS hosted in cloud and on-prem. There was no full-pledge solution offered even in hub and lab for end-to-end setup of SSH key for login to Git across different platforms.
How to use?
The script generates OpenSSH keypair and pushes public key to VCS using PAT (Personal Access Token) or App Password (Bitbucket only). The private key automatically goes to ~/.ssh/{name}.pem + reference to it is appended to ~/.ssh/config for automatic pickup by Git with OpenSSH configuration. The setup is assumed OpenSSH always.
Supported parameters for key generation - https://asyncssh.readthedocs.io/en/latest/api.html#asyncssh.generate_private_key Supported parameters for private key export - https://asyncssh.readthedocs.io/en/latest/api.html#asyncssh.SSHKey.export_private_key
Default settings:
- Algo for generation - ssh-ed25519
- No passphrase
- Output private key with cipher AES256 with SHA256 hashing and 128 rounds of bcrypt.
You can install it using pip
pip install gitsshgen
All actions are done interactively in terminal:
usage: gitsshgen [-h] [-t T] [-api API_URL] [-n N] [-a ALGO] [-ks KEY_SIZE] [-e EXPONENT] [-p PASSPHRASE] [-c CIPHER] [-r ROUNDS] [-hn HASH_NAME] [-sl SSH_LABEL]
{github,gitlab,bitbucket,gogs,gitea} url u
positional arguments:
{github,gitlab,bitbucket,gogs,gitea}
instance type
url instance url
u instance username
optional arguments:
-h, --help show this help message and exit
-t T personal application token
-api API_URL API URL endpoint
-n N, --name N name for private key
-a ALGO, --algorithm ALGO
algorithm for keypair (default is ssh-ed25519)
-ks KEY_SIZE, --key-size KEY_SIZE
key size (only for RSA)
-e EXPONENT, --exponent EXPONENT
exponent (only for RSA)
-p PASSPHRASE, --passphrase PASSPHRASE
passphrase for OpenSSH key (default is None)
-c CIPHER, --cipher CIPHER
cipher for OpenSSH key (default is aes256)
-r ROUNDS, --rounds ROUNDS
rounds for OpenSSH key (default is 128)
-hn HASH_NAME, --hash-name HASH_NAME
hash name for OpenSSH key (default is sha256)
-sl SSH_LABEL, --ssh-label SSH_LABEL
ssh label in VCS
Example with token:
gitsshgen bitbucket bitbucket.org testusername -t testtoken
If you don't provide token, script will open browser on page where you can make one, and ask you to enter it.
gitsshgen bitbucket bitbucket.org testusername
VCS Compatibility
- Github
- Gitlab
- Gogs
- Bitbucket
- Gitea
Metadata
Release files for gitsshgen 1.2.3
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 | Actions |
|---|---|---|---|---|
| gitsshgen-1.2.3.tar.gz | 12.2 kB | Without provenance | Details for gitsshgen-1.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gitsshgen-1.2.3-py3-none-any.whl | Python 3 | none | any | Details for gitsshgen-1.2.3-py3-none-any.whl |
Total release size: 25.4 kB
Release files / gitsshgen-1.2.3.tar.gz
| Download URL | gitsshgen-1.2.3.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e9e3235d532fdc60c3153ca4881f98ceb1f64b9955601e72d147c174a46a1523
|
|
BLAKE2b-256 checksum How to use checksums |
1382e80dd6820df8f8b5fb0176b8daad9843ab73f848cf2653fb945d1dfdb4ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3
|
Release files / gitsshgen-1.2.3-py3-none-any.whl
| Download URL | gitsshgen-1.2.3-py3-none-any.whl |
|---|---|
| Size | 13.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b4d7f030397c12595ca8c12d92c779018a793454aa5af4783965e5f0f633f6e6
|
|
BLAKE2b-256 checksum How to use checksums |
f227ef9b3af9d88a5a214960291e62884dc4a58ecd6655b8cbc793b55ffe7443
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3
|
Security for gitsshgen 1.2.3
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.