Add a integration where the sudo password can be specified in a sops encrypted file#324
Open
weriomat wants to merge 11 commits intoserokell:masterfrom
Open
Add a integration where the sudo password can be specified in a sops encrypted file#324weriomat wants to merge 11 commits intoserokell:masterfrom
weriomat wants to merge 11 commits intoserokell:masterfrom
Conversation
…either interactive_sudo or sops decryption is used
|
@weriomat I tried your fork on the master branch and kept running into an issue with parsing the sops YAML file in my case, my secrets.yaml looks like this userPassword: some-password-hash # for use with hashedPasswordFile to set the password for another user
deployPassword: some password This caused an error parsing the Your example yaml like below worked, but that error would happen if I tried to add anything else password:
deploy: somethingSeems like check-jsonschema uses this for JSON schema, so I just changed the type for This one commit in my fork seems to be enough to fix it based on my testing |
Contributor
Author
|
Thank you for investigating this fix, I will update |
Co-authored-by: cinderisles
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
As I use sudo on my machines (to elevate the privileges from the "deploy" user) and don't want to manually type the sudo password every time I run a deployment, I implemented a solution where the password is retrieved from a sops encrypted file.
This is especially nice since I use sops-nix to set the password of the user and now can reuse this fact to run the deployment.
In particular, we need to specify
sudoFileas well assudoSecretfor a node.I introduced a NixOS test for this use case as well as provided an example and explained on how
sudoSecretsworks.Currently, the only drawback I see with this approach is that
SOPS_AGE_KEY_FILE(sops will look for age private keys under$XDG_CONFIG_HOME/sops/age/keys.txtby default) will not be respected by this implementation and therefore forcing users to put the keys under the aforementioned directory (I have not tested that it won't work, but I assume that).P.S. The flake under
example/sopscurrently points to my fork and should be changed when this gets merged :)