Skip to content

agent: show requesting process in confirm prompt#124

Merged
Foxboron merged 1 commit intoFoxboron:masterfrom
Mic92:confirm-peer-info
Apr 24, 2026
Merged

agent: show requesting process in confirm prompt#124
Foxboron merged 1 commit intoFoxboron:masterfrom
Mic92:confirm-peer-info

Conversation

@Mic92
Copy link
Copy Markdown
Contributor

@Mic92 Mic92 commented Apr 24, 2026

As discussed in #123

When a key is added with -c, append the requesting process and a few of
its ancestors to the askpass prompt:

   Allow use of key joerg@turingmachine?
   Key fingerprint SHA256:Lhse...Y95Ws.
   Requested by ssh (1776813) ← zsh ← tmux: server ← systemd

The peer pid comes from SO_PEERCRED on the accepted socket; the chain is
read from /proc/<pid>/status (max 4 hops). It's best effort and the line is
omitted if the lookup fails.

One downside: RO /proc has to be added to the landlock allowlist.

This is from my laptop:

ssh-tpm-agent-requestor

Append "Requested by ssh (1234) ← git ← zsh ← kitty" to the askpass
prompt for keys added with -c, so users can tell what is asking.

The peer pid comes from SO_PEERCRED on the accepted socket; the chain
is read from /proc and omitted on failure. A connAgent wrapper carries
the peer string into Sign since agent.ServeAgent hides the net.Conn.

Allow RO /proc under landlock so the lookup works when sandboxed.
@Mic92 Mic92 force-pushed the confirm-peer-info branch from c7a0ce9 to feb0f2d Compare April 24, 2026 11:44
@Mic92
Copy link
Copy Markdown
Contributor Author

Mic92 commented Apr 24, 2026

CI bug looks pre-existing / flakey?

@Foxboron
Copy link
Copy Markdown
Owner

CI bug looks pre-existing / flakey?

Need to lock the kernel keyring to the process, but because Go green threads are weird the keyring is pinned to it's own os-thread and keys are communicated over a channel.

I suspect there is something racey somewhere that works most of the time.

https://github.com/Foxboron/ssh-tpm-agent/blob/master/internal/keyring/threadkeyring.go

@Foxboron
Copy link
Copy Markdown
Owner

Thanks!

@Foxboron Foxboron merged commit 0297aa9 into Foxboron:master Apr 24, 2026
5 of 6 checks passed
@Mic92 Mic92 deleted the confirm-peer-info branch April 25, 2026 05:54
@Foxboron
Copy link
Copy Markdown
Owner

@Mic92 are you fine if I use your screenshot in the release notes?

@Mic92
Copy link
Copy Markdown
Contributor Author

Mic92 commented Apr 27, 2026

@Mic92 are you fine if I use your screenshot in the release notes?

Sure

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.

2 participants