Skip to content

feat: support SSH IdentityAgent config directive#1630

Merged
DonDebonair merged 4 commits intopyinfra-dev:3.xfrom
KalvadTech:feat/ssh-identity-agent
Apr 19, 2026
Merged

feat: support SSH IdentityAgent config directive#1630
DonDebonair merged 4 commits intopyinfra-dev:3.xfrom
KalvadTech:feat/ssh-identity-agent

Conversation

@wowi42
Copy link
Copy Markdown
Collaborator

@wowi42 wowi42 commented Mar 24, 2026

Honor the IdentityAgent field from ~/.ssh/config so that external SSH agents (e.g. 1Password) work transparently with pyinfra.

Closes #1592

  • Pull request is based on the default branch (3.x at this time)
  • Pull request includes tests for any new/updated operations/facts
  • Pull request includes documentation for any new/updated operations/facts
  • Tests pass (see scripts/dev-test.sh)
  • Type checking & code style passes (see scripts/dev-lint.sh)

wowi42 added 2 commits March 24, 2026 14:52
Honor the IdentityAgent field from ~/.ssh/config so that external SSH
agents (e.g. 1Password) work transparently with pyinfra.

Closes pyinfra-dev#1592
@uwearzt
Copy link
Copy Markdown

uwearzt commented Apr 9, 2026

Installed the fix with

uv tool install --python 3.14 git+https://github.com/KalvadTech/pyinfra.git@feat/ssh-identity-agent

Works perfect with the 1password ssh-agent on macOS.

Resolves conflict in src/pyinfra/connectors/ssh.py caused by this
branch adding ``import os`` (needed to honor the SSH IdentityAgent
config directive by temporarily overriding SSH_AUTH_SOCK) while 3.x
removed the now-unused ``import shlex``. Keep both changes: take the
new ``os`` import from this branch, drop ``shlex`` as 3.x did.
@wowi42
Copy link
Copy Markdown
Collaborator Author

wowi42 commented Apr 14, 2026

@Fizzadar could be nice to merge this one

Comment thread src/pyinfra/connectors/sshuserclient/client.py Outdated
@DonDebonair
Copy link
Copy Markdown
Collaborator

Good PR. Left 1 nitpick comment. Otherwise good to merge.

@DonDebonair DonDebonair merged commit 2f8df17 into pyinfra-dev:3.x Apr 19, 2026
26 checks passed
@wowi42 wowi42 deleted the feat/ssh-identity-agent branch April 20, 2026 19:25
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.

Support SSH IdentityAgent (e.g. 1Password SSH agent)

3 participants