Skip to main content

A Python utility that helps you securely connect to SSH servers using credentials stored in a KeePass database

Project description

KeePass SSH Connect

GitHub Actions Workflow Status Codecov GitHub License

A Python utility that helps you securely connect to SSH servers using credentials stored in a KeePass database. This tool provides a convenient way to manage and use your server credentials while keeping them secure.

Features

  • 🔐 Securely store SSH server credentials in KeePass
  • 🚀 Easy command-line interface for server connections
  • 🔍 Flexible server filtering and selection
  • 📋 List and manage server entries
  • 🔑 Support for key files and environment variables

Installation

Install using pip:

pip install keepass-ssh-connect

Prerequisites

  • Python 3.8+
  • KeePass database with SSH server entries
  • Required Python packages (installed automatically):
    • pykeepass
    • paramiko
    • python-dotenv
    • colorama

Usage

Basic Usage

# List all servers
keepass-ssh-connect -l

# Connect to a specific server
keepass-ssh-connect -s "production"

# Specify database and group
keepass-ssh-connect -d /path/to/database.kdbx -g "/Servers/Production"

Full CLI Options

usage: keepass-ssh-connect [-h] [-d DATABASE] [-k KEY_FILE] [-g GROUP] 
                            [-s SERVER] [-l] [-v]

KeePass SSH Connection Utility

optional arguments:
  -h, --help            show this help message and exit
  -d DATABASE, --database DATABASE
                        Path to the KeePass database file
  -k KEY_FILE, --key-file KEY_FILE
                        Path to the KeePass key file (optional)
  -g GROUP, --group GROUP
                        KeePass group path to filter server entries
  -s SERVER, --server SERVER
                        Specific server name or partial match to connect to
  -l, --list            List available servers without connecting
  -v, --verbose         Enable verbose output

Environment Variables

You can also use environment variables for default settings:

  • KEEPASS_DB_PATH: Path to the KeePass database
  • KEEPASS_KEY_PATH: Path to the key file
  • KEEPASS_GROUP_PATH: Default group path for server entries

Local File Discovery

If no database path is specified through command-line parameters or environment variables, the utility will automatically search the current directory for KeePass files:

  • It looks for .kdbx files for the database
  • It looks for .keyx files for the key file

When local files are discovered, the utility will print the paths of the files being used, helping you understand which files are being automatically selected.

Example

# If you have 'mypasswords.kdbx' and 'mykey.keyx' in the current directory
keepass-ssh-connect
# This will print:
# Using local database file: mypasswords.kdbx
# Using local key file: mykey.keyx

Note: Local file discovery provides convenience but should be used carefully to avoid unintended file selection.

Configuration in KeePass

  1. Create a group for SSH servers
  2. For each server, add an entry with:
    • Title: Server name
    • Username: SSH username
    • Password: SSH password
    • URL: Server hostname or IP
    • Notes: Additional connection details

Security

  • Credentials are never stored in plain text
  • Supports KeePass key files for additional security
  • Uses environment variables to avoid hardcoding sensitive information

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Grzes-94

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keepass_ssh_connect-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

keepass_ssh_connect-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file keepass_ssh_connect-0.1.0.tar.gz.

File metadata

  • Download URL: keepass_ssh_connect-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.9.5 Windows/10

File hashes

Hashes for keepass_ssh_connect-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d65b229e2be0eb25a306f0fba4414a10b7946541af4a9afab4df1dacd895026f
MD5 6505a29cab889a112044b825113cd741
BLAKE2b-256 4ddc59a896fab1cfe7b7ea16a73f58d7b76c5fa56e646569de502138233b8d2d

See more details on using hashes here.

File details

Details for the file keepass_ssh_connect-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for keepass_ssh_connect-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a45abfa4f25909cadd71cee7c11cdcd5f7df1a666705af15fbdf0a9909310a9
MD5 e51f7bffefd6908560bdebab7c450fbc
BLAKE2b-256 4d2f00154a70146b5c64a27826e4b2480187549f191e13c03d70282601189429

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page