Skip to content

Support encrypted SSH private key passphrases - #50

Merged
gensyn merged 4 commits into
mainfrom
copilot/add-passphrase-parameter
Sep 1, 2026
Merged

Support encrypted SSH private key passphrases#50
gensyn merged 4 commits into
mainfrom
copilot/add-passphrase-parameter

Conversation

Copilot AI commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

The SSH service accepted either a password or a key file, but it did not support encrypted private keys. That blocked valid SSH auth flows when a key was protected by a passphrase.

  • Key changes
    • Added an optional passphrase field to the ssh_command.execute service and documented it alongside key_file.
    • Enforced validation: passphrase is only accepted when key_file is provided, preventing invalid combinations.
    • Passed the value through to asyncssh.connect(...) so encrypted private keys can be decrypted during authentication.
service: ssh_command.execute
data:
  host: example.com
  username: deploy
  key_file: /config/ssh/id_ed25519
  passphrase: !secret ssh_key_passphrase
  command: "uptime"
  • Compatibility and docs
    • Updated the README and service metadata so the new parameter is exposed in the integration documentation and UI schema.

Copilot AI linked an issue Sep 1, 2026 that may be closed by this pull request
Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
Copilot AI changed the title [WIP] Add optional passphrase parameter for private key Support encrypted SSH private key passphrases Sep 1, 2026
Copilot AI requested a review from gensyn September 1, 2026 06:49
Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
@gensyn
gensyn marked this pull request as ready for review September 1, 2026 07:55
Copilot AI lite review requested due to automatic review settings September 1, 2026 07:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The functional changes are small, validated end-to-end via updated schema/validation, and covered by new unit tests for both forwarding and error handling.

Pull request overview

Adds support for encrypted SSH private keys by introducing an optional passphrase service parameter, validating its usage, and forwarding it into the AsyncSSH connection flow so passphrase-protected keys can be decrypted during authentication.

Changes:

  • Added passphrase to the ssh_command.execute service schema, validation rules, and connection kwargs.
  • Added user-facing strings/translations and updated README/service metadata to expose the new field.
  • Extended unit tests to cover validation and AsyncSSH error handling/forwarding for passphrases.
File summaries
File Description
translations/en.json Adds service-field label/description and new validation/error translation keys for passphrase support.
translations/de.json Adds German translations for the new passphrase field and related validation/error messages.
strings.json Updates base integration strings with the new passphrase field and error/validation messages.
services.yaml Exposes passphrase in service UI schema (and marks secrets as password-type text fields).
README.md Documents the new passphrase parameter and its validation rule.
const.py Introduces CONF_PASSPHRASE constant.
init.py Extends service validation and voluptuous schema to accept/validate passphrase.
coordinator.py Forwards passphrase into asyncssh.connect(...) and maps KeyEncryptionError to a translated validation error.
tests/unit_tests/test_validate_service_data.py Adds validation tests for passphrase/key_file combinations.
tests/unit_tests/test_async_execute.py Adds tests for invalid passphrase handling and forwarding passphrase to connect.
Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread __init__.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@gensyn
gensyn merged commit 74536ea into main Sep 1, 2026
5 checks passed
@gensyn
gensyn deleted the copilot/add-passphrase-parameter branch September 1, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handling Private Key Passphrases

3 participants