File: ssh-agent-ordering.patch

package info (click to toggle)
gcr4 4.4.0.1-8
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 7,308 kB
  • sloc: ansic: 62,525; sh: 240; makefile: 59; xml: 27; javascript: 5
file content (32 lines) | stat: -rw-r--r-- 1,147 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From: Alessandro Astone <alessandro.astone@canonical.com>
Date: Thu, 20 Mar 2025 13:17:33 +0100
Subject: Define ordering with other ssh agents

The last unit to call `systemctl --user set-environment SSH_AUTH_SOCK=<foo>`
wins the race.

The gcr ssh-agent is a graphical wrapper around ssh-agent, so always prefer it
when installed.
On the other hand, gpg-agent-ssh is different as it can manage SSH keys as
GPG subkeys, so prefer gpg-agent-ssh if enabled. This relies on gpg-agent-ssh
checking for explicit enablement before exporting SSH_AUTH_SOCK.

Forwarded: https://gitlab.gnome.org/GNOME/gcr/-/merge_requests/168
---
 gcr/gcr-ssh-agent.socket.in | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcr/gcr-ssh-agent.socket.in b/gcr/gcr-ssh-agent.socket.in
index 0127df9..cad1f21 100644
--- a/gcr/gcr-ssh-agent.socket.in
+++ b/gcr/gcr-ssh-agent.socket.in
@@ -1,5 +1,9 @@
 [Unit]
 Description=GCR ssh-agent wrapper
+# If gcr is installed, take priority in setting SSH_AUTH_SOCK over ssh-agent
+After=ssh-agent.socket
+# Conversly, allow gpg-agent-ssh to overwrite if explicitely enabled
+Before=gpg-agent-ssh.socket
 
 [Socket]
 Priority=6