Page MenuHomeVyOS Platform

SSH Agent is not available for Git commit archive
Closed, ResolvedPublicBUG

Description

Issue: when the user's ssh keys are password protected, they are prompted for password (twice) when commit-archive is enabled with a git ssh url, even if their ssh keys have been added to an ssh-agent

Expected behavior: user can start an ssh-agent session, enter their password once, and when they commit they are not prompted for ssh.

Reproduction steps:
ssh-keygen (enter a password, do not use generate ssh client-key since it will not make password-protected keys
eval $(ssh-agent)
ssh-add (enter your password)
(add the public key to github)
conf
set system config-management commit-archive location git://git@github.com:<username>/<repo>.git
commit
(you will be prompted for the password twice, once for pull once for push)

Tested on: VyOS 1.5-rolling-202412100007

Planned fix: I made a live change to the GitC#upload method on my test system to add SSH_AUTH_SOCK and SSH_AGENT_PID to the env dictionary that is passed to the git command. I'll add some validation and get a PR put together soon.

EDIT: removed formatting marks from the repro steps

Details

Version
VyOS 1.5-rolling-202412100007
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

Viacheslav triaged this task as Normal priority.Jan 14 2025, 5:13 PM
Viacheslav changed the task status from Open to Needs testing.Jan 20 2025, 5:36 PM
Viacheslav assigned this task to xeluior.

Note that if you have configured a Git commit archive backend with a password protected SSH key, it will probably hang if you use the REST API to make and commit changes. This is not a problem if you don’t use the API, but it’s something to be aware of.

Maybe needs a note in the documentation.

dmbaturin changed Is it a breaking change? from Unspecified (possibly destroys the router) to Perfectly compatible.
dmbaturin moved this task from Backlog to Finished on the VyOS 1.4 Sagitta (1.4.2) board.
dmbaturin moved this task from Open to Finished on the VyOS 1.5 Circinus board.
dmbaturin moved this task from Need Triage to Completed on the VyOS Rolling board.