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

Add SSH_ARGS environment variable #205

Closed
wants to merge 1 commit into from
Closed

Conversation

gaykitty
Copy link

This variable allows users to specify other custom arguments to be used with ssh and scp. This allows users to take advantage of more advanced ssh features like ControlPath, which could be used to fix #102 among other things.

Copy link
Member

@cafkafk cafkafk left a comment

Choose a reason for hiding this comment

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

Could you fix the merge conflicts please, and then rebase this on top of the master branch?

This variable allows users to specify other custom arguments to be
used with ssh and scp. This allows users to take advantage of more
advanced ssh features like ControlPath, which could be used to fix DBCDK#102
among other things.
@gaykitty
Copy link
Author

I rebased my changes and update the vendor hashes in default.nix and flake.nix, which I forgot last time.

Copy link
Member

@cafkafk cafkafk left a comment

Choose a reason for hiding this comment

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

TIL about ControlPath and ControlMaster, this is cool :O

Code looks okay, and it doesn't seem to introduce any regressions. That said, I'm unsure how to use this, trying with SSH_ARGS="-o ControlPath=~/.ssh/control-%h-%p-%r" or SSH_ARGS="-oControlPath=~/.ssh/control-%h-%p-%r" both fail.

Could you give me an example of usage? Also, perhaps adding this to the "Environment Variables" section of the README.md might be very helpful to make this feature discoverable.

@gaykitty
Copy link
Author

In the months since I opened this PR I've stopped using morph (I actually forgot I opened this PR). So I'm not sure how to test this as I don't have a server I'm managing with morph. I believe I tested using ControlPath at the time I wrote this PR but I don't remember that well. I do still use ControlPath in my current scripts though, maybe they could provide a useful reference on how to use it.

https://git.sr.ht/~zethra/turtle/tree/main/item/deploy.sh#L21

@srhb
Copy link
Contributor

srhb commented Mar 13, 2024

Thanks!

This is not quite as trivial because of the difference in handling the different kind of options, ie. if you use both the hardcoded options and SSH_ARGS with "-o something"

Because each case is different in NIX_SSHOPTS and the pure command args, I think I much prefer using SSH_CONFIG_FILE for complex interactions here, as it will have fewer edge cases and work homogenously in both cases.

Using that, it's totally possible to use ControlMaster and friends today, and using Include in the actual file, you could compose it with the normal user config as well.

Closing.

@srhb srhb closed this Mar 13, 2024
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.

Do not re-establish ssh connection while copying each and every secret
3 participants