-
Notifications
You must be signed in to change notification settings - Fork 3
Description
I believe that ssh-agent-lib should expose the listening capabilities of service-binding, which supports socket activation with both systemd and macOS' launchd: https://github.com/wiktor-k/service-binding?tab=readme-ov-file#launchd-socket-activation
I'd love to see this supported as a feature, as this allows for use of launchd's SecureSocketWithKey abilities, which exports a secure path as an env variable. This is how macOS's built-in SSH agent works.
In the past, I've used this functionality with a small wrapped for the gpg-agent to have it export SSH_AUTH_SOCK in a way that it's available to all GUI apps by default as well: https://gist.github.com/dotsam/30d179ef9e005a149b118b72a13e32e7
I believe this method relies on service ordering however, as two SSH_AUTH_SOCKSs get set, and the last one is the one that's used:
$ launchctl print gui/501
gui/501 = {
type = login
handle = 100020
active count = 457
service count = 456
active service count = 225
creator = loginwindow[583]
creator euid = 0
session = Aqua
endpoint destination = com.apple.xpc.launchd.domain.user.501
auxiliary bootstrapper = com.apple.xpc.otherbsd (complete)
security context = {
uid = 501
asid = 100020
}
bringup time = 978 ms
death port = 0x14003
environment = {
SSH_AUTH_SOCK => /private/tmp/com.apple.launchd.ArRQ2YQzkd/ssh
SSH_AUTH_SOCK => /private/tmp/com.apple.launchd.JikDe3G8qT/Listeners
PATH => /opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
}
services = {
...
This might also complicate #29, depending on how things are implemented