Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse of auth sock across multiple instances #3

Closed
joneskoo opened this issue Apr 26, 2020 · 4 comments
Closed

Reuse of auth sock across multiple instances #3

joneskoo opened this issue Apr 26, 2020 · 4 comments

Comments

@joneskoo
Copy link

I watched the Twitch stream after the fact. You were considering the auth sock name… The usual ssh agent uses its pid in the unix socket file name, which avoids conflicts in case of multiple instances.

If yubikey-agent is supposed to work with multiple instances of it running, it should probably do something similar, and PID is probably reasonable for this?

If it's not supposed to work with multiple instances running, it should probably fail startup with error. It does not do that currently.

@FiloSottile
Copy link
Owner

It's not supposed to work with multiple instances running, and I want it to be easy to set a single environment variable and have it work in all terminals. The ssh-agent default of only configuring the current shell seems so backwards to me.

I'd be happy for it to exit with an error at startup if the socket is still being listened on, but if it's just a dangling file I want it to get deleted. Is there a better way to tell if the socket is being listened on than trying to connect to it?

@joneskoo
Copy link
Author

joneskoo commented Apr 26, 2020

I don't know. Could encode pid in the filename and check if that pid is still running…

On the other hand, arguably this should be launched by launchd/systemd not by opening from a shell (rc)? So perhaps it won't be a problem to replace the socket always and instead maybe just print usage if no arguments (pass some argument in the unit file).

I wonder if both systemd and launchd will actually listen for the unix socket for us - or is it easier to listen ourselves? That would also bypass the whole problem. Perhaps better to come back to this after those are implemented.

@FiloSottile
Copy link
Owner

maybe just print usage if no arguments (pass some argument in the unit file)

Oh that's a good idea. We should definitely encourage launchd/systemd management, it's a better UX.

@FiloSottile
Copy link
Owner

We settled on single instance and removing the socket.

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

No branches or pull requests

2 participants