-
Notifications
You must be signed in to change notification settings - Fork 2
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
automatically reset ssh sk permissions, unlock key #23
Open
amyipdev
wants to merge
1
commit into
acmcsufoss:main
Choose a base branch
from
amyipdev:fork/ssh-with-ease
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This process should already be automated. Did you
git-crypt init
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't already automated - if you
git-crypt lock
it will not automatically unlock right now on the current version - and yesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be part of the
shellHook
then, rather than part of a one-off SSH script. Or ideally, the user shouldn'tgit-crypt lock
at all.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that continues the nix debate from #22 - which my point there was more that it doesn't make sense to
nix-shell
every time just to SSH. if you're gonna be terraforming something then yeah sure, but to just check on something quick via ssh isn't exactly a wonderfulnix-shell
use case. it's variable but it takes anywhere from 5 to 50 seconds on my laptop (NVMe, 4900hs, and connected to a fast and reliable network) to open a nix-shell when the packages have already been downloaded, for a quick ssh that's not ideal. as for not doinggit-crypt lock
, sure, although we should probably add another line to the README anyways saying to dogit-crypt unlock
(git-crypt init
does not unlock the repo for me, onlyunlock
does -init
just prints a message saying the repo already uses git-crypt)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way around this should be to use direnv, which automatically drops you into the Nix shell. In the future, more things may be required in the development environment to do anything at all, so I'm personally against supporting another way of interacting with this repo.
direnv also caches the shell, so entering the shell takes no time with it.
This is certainly the odd behavior. A note in the README to run
git-crypt unlock
if the files aren't already unlocked would be a good idea, butgit-crypt init
, if played nicely, should already unlock the files automatically.Tip
You can use the
[!TIP]
syntax to add a Tip box into the README for this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is true! It is a very simple addition, but said simple addition comes with the implication that we're either supporting a new way of interacting with the repository, or we're agreeing that it's a half-supported way to half-interact with it, which might very well be dropped in the near future (or even tomorrow for that matter).
With that, the question then becomes: is it worth it to support a new way of interacting with the repository when it comes with these costs? Is using Nix shell and/or Direnv that hard that it would justify the new way?
Either will work fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the latter would be true. There is a potential compromise solution: add
chmod
to theshellHook
, and have instructions for non-nix-shell users. For instance, I currently have have the following exports in my zshrc, along with functions for faster ssh to 306/cirno and my home entry point:Is Direnv selectively enable-able? And is there a way we could automate Direnv setup in a non-destructive way for users if so? That's the only way I can see this being practical - I'd be fine using Direnv within the scope of acm-aws only, but due to hacky workarounds that may be present in other environments I would not want to use Direnv elsewhere. Ideally I also want to not create an even higher entry barrier for people - thin out the learning curve a bit, for instance.
Will it even be possible to ssh without nix-shell post-#21? I honestly don't know what the implications of transitioning to flakes are.
Alright - think if we move forward with that README addition, my recommendation would be info over tip; seems slightly closer to the intended point, plus (and this is purely subjective) info looks nicer than tip.
Also, on both my laptop (Fedora 39) and desktop (Arch), this is what
init
gets me (no decrypt):In fact, for our use case - "decrypt this repo using the in-repo GPG-encrypted key" - the helppage says we should be using
unlock
, notinit
:I wonder if this could come from legacy git-crypt - since
git-crypt init KEYFILE
is listed as an alias forgit-crypt unlock KEYFILE
...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are all great questions. I don't think I can answer them until the PR is finalized, and currently I'm just working on it. Everything could still be changed.
Issue #20 lists the upsides of migrating to Flakes, but Nix 4 (not real yet) is supposed to be Flakes-only, and a lot of core Nix people are adamant on encouraging use of Flakes, so it's best for us to try and heed that advice for maintainability.
This sounds good.
This makes sense.
git-crypt
's usage means we shouldn't even be worrying about having to decrypt things, because the git hooks are supposed to handle it. But the hooks are sometimes pretty fragile, e.g. they might not run until you dogit status
(unconfirmed), so this clarification is valid.I believe
git-crypt init
is supposed to set up the git hooks, so it's weird that it would warn that it's "already been initialized" on the first run. If the hooks are missing, that would be pretty dangerous, since someone might try to push unencrypted secrets over.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, sounds good - how about we put this PR on hold until #21 is done?
From my (albeit limited) experience the hooks appear to already be set in just fine - without doing
git-crypt init
it doesn't appear to push unencrypted secrets, but 🤷🏼♀️There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM.