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

Infer or set whether to create our own socket #22

Merged
merged 12 commits into from
Mar 15, 2025

Conversation

mrdomino
Copy link
Collaborator

@mrdomino mrdomino commented Mar 15, 2025

This integrates #9 and #20 into one PR.

We add a --create-socket flag, deprecating --reuse-socket since the former seems more intuitive. If --create-socket is true, then the program will create and manage its own temporary SSH control socket; if it is false, the program will not. If it is unspecified, then the program will try to parse the output of ssh -G to decide whether or not to create a socket, specifically looking for a controlmaster auto line that would imply that the user is already using their own SSH connection multiplexing.

This PR also includes a couple other changes:

  • We switch to using the linux-native-sync-persistent keyring on Linux, in the hopes that this will work with what aspect-credential-helper will be using.
  • Increments the version to 0.4.0.

flowchartsman and others added 7 commits February 16, 2025 11:26
The semantics of `--reuse-socket` were confusing; `--create-socket`
tries to be more straightforward, a true value indicates that the
program is going to do something (which seems more intuitive.)

This also should open the door for inferring the value as in stairwell-inc#9 if the
flag is not specified (probably by making it an enum type rather than an
`Option<bool>`.)
has_user_socket is now called infer_create_socket, and has the same
polarity as create_socket (it returns true if the program should do
something.) It also returns a simple bool, treating any errors as false
returns (i.e. "the program shouldn't do anything special.")

Also removed the `controlpersist` check since it is not straightforward
to decide whether this value is set appropriately; infer_create_socket
is a heuristic check, and it's okay for it to be a loose heuristic.
This wound up being a shocking amount of boilerplate and I'm not sure it
was worth it since all that it really gets is the ability to explicitly
specify the default.
@mrdomino mrdomino requested a review from flowchartsman March 15, 2025 16:22
I don't like this. It's too much boilerplate for not enough gain.

This reverts commit bbcb254.
@mrdomino
Copy link
Collaborator Author

The commit-by-commit history is best viewed from the CLI; one of the merges has three parents and the GitHub UI presently butchers those.

Relative to bbcb254, this drops the ability to explicitly specify the
default but keeps everything else and has a lot less code.
mrdomino added a commit to mrdomino/aspect-reauth that referenced this pull request Mar 15, 2025
…ersion' into infer-socket

These commits are not directly related to stairwell-inc#22, but they're small so I'm
including them anyway to reduce the number of PRs to review.
flowchartsman

This comment was marked as outdated.

I had thought the former was deprecated; it turns out that it was only
its usage without argument (`default_value` rather than `default_value =
...`) that was deprecated.
Matches what aspect-credential-helper will be using on Linux, but
continues using Secret Service for persistence.
@mrdomino mrdomino merged commit 77738fd into stairwell-inc:main Mar 15, 2025
4 checks passed
Copy link
Contributor

@flowchartsman flowchartsman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mrdomino mrdomino deleted the infer-socket branch March 15, 2025 20:13
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