Skip to content

Python script to automate fetching SSH keys to access the CSCS infrastructure

License

Notifications You must be signed in to change notification settings

empa-scientific-it/cscs-keygen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cscs-keygen

Python script to automate fetching a new SSH keypair for CSCS infrastructure. It relies on credentials stored in a cloud-based password manager, like Bitwarden or 1Password.

Setup

Prerequisites

  • Python 3.11+
  • One of the following installation methods:
    • Poetry for development and package management
    • pipx for isolated system-wide installation
    • pip for traditional Python package installation
  • An account with a supported password manager. Currently: Bitwarden, 1Password
    • The password manager must be configured to store the following information:
      • The username of your CSCS account
      • The password of your CSCS account
      • The configured TOPT secret of your CSCS account
  • The command-line interface (CLI) of the password manager of your choice:
  • (optional) A virtual environment with venv or pipenv (or any other similar utility of your choice)

Note

Bitwarden's free plan does not include the option to store TOTP secrets. You will need to upgrade to a paid plan to use this script with Bitwarden.

Installation

Using pipx (recommended for users)

For a clean, isolated installation that's available system-wide:

pipx install git+https://github.com/empa-scientific-it/cscs-keygen.git

To upgrade an existing installation:

pipx upgrade cscs-keygen

Using Poetry (recommended for developers)

  1. Clone this repository:
git clone https://github.com/empa-scientific-it/cscs-keygen.git
cd cscs-keygen
  1. Install dependencies and the package:
poetry install
  1. Activate the virtual environment:
poetry shell

Using pip

If you prefer using pip, you can install from a requirements.txt file:

# Create and activate a virtual environment (optional but recommended)
python -m venv .venv
source .venv/bin/activate  # On Windows, use `.venv\Scripts\activate`

# Install dependencies
pip install -r requirements.txt

Usage

Using pipx installation:

cscs-keygen --help

Using Poetry:

# Inside Poetry shell
cscs-keygen --help

# Or without activating the shell
poetry run cscs-keygen --help

Using pip:

cscs-keygen --help

For more details, check out the docs (🚧 WIP) of this project.

Development

To set up the development environment:

# Install with development dependencies
poetry install --with dev

# Run tests
poetry run pytest

# Run linting/formatting
poetry run ruff check .
poetry run ruff format .

About

Python script to automate fetching SSH keys to access the CSCS infrastructure

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages