NixOS Secrets Management - Part 1/3

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ต.ค. 2024

ความคิดเห็น • 51

  • @luisliz
    @luisliz 4 หลายเดือนก่อน +12

    Holly shit can’t believe the insane quality of nix TH-camrs that is starting out. Tyyyyyy!!!

    • @Emergent_Mind
      @Emergent_Mind  4 หลายเดือนก่อน +2

      Thanks for the compliment!

  • @vernonhinkelschmidt
    @vernonhinkelschmidt 5 หลายเดือนก่อน +3

    I am coming here to say this:
    This is 100% the best series on this topic! These videos along with your accompanying website were an insane blessing to have. Outside of this tutorial there are exactly 0 articles, or guides on how to set up sops-nix with a git private key. Everyone has tutorials over how to setup Wireguard, Passwords, but no one has put in what seemingly to many is such a small detail. When I adapted your code from the home manager section to actually place the key at the correct location, and did a rebuild it worked flawlessly. Cannot thank you enough for this series!

    • @Emergent_Mind
      @Emergent_Mind  5 หลายเดือนก่อน

      Thank you for the kind compliment. I'm glad it was helpful!

  • @DanielGomez-ut8bl
    @DanielGomez-ut8bl 28 วันที่ผ่านมา

    You're doing god's work here. I've been looking on how to do this for a long time, thank you!

    • @Emergent_Mind
      @Emergent_Mind  28 วันที่ผ่านมา

      Thanks for the kind compliment. Glad the content is useful for you.

  • @aimpizza6823
    @aimpizza6823 6 หลายเดือนก่อน +2

    Just from watching the first part I am amazed of the quality of your teaching. Really appreciate it as the topic is a bit niche :]

    • @Emergent_Mind
      @Emergent_Mind  6 หลายเดือนก่อน

      Thank you for the kind compliment! More to come.

  • @alirezadavoodi7955
    @alirezadavoodi7955 2 หลายเดือนก่อน

    Holly molly, for a long time I was trying to integrate my cli secrets with my nix configs. This is awesome buddy.

    • @Emergent_Mind
      @Emergent_Mind  2 หลายเดือนก่อน

      Glad this is helpful for you! Thanks for watching and commenting :)

  • @christopherchalcraft1134
    @christopherchalcraft1134 5 หลายเดือนก่อน

    amazing video. great quality and so clearly explained for a for a fomplef topic. i watch a lot of tech content and nix specifically and this is close to the top.

    • @Emergent_Mind
      @Emergent_Mind  5 หลายเดือนก่อน

      Thanks for watching and for the compliment.

  • @lalebot
    @lalebot 3 หลายเดือนก่อน

    Hello, thanks for the video. Can you edit the secret without the key.txt only with age derived from the host's ssh key? Or is it only for sops-nix?

    • @Emergent_Mind
      @Emergent_Mind  2 หลายเดือนก่อน

      Hi, you're welcome. I'm not entirely sure I understand your question but let me try to provide an answer. The key or keys you use to encrypt/decrypt your secrets file don't have to be derived from the host's ssh key if you don't want them to be. Deriving an age key from the host ssh key simply means that you don't have to store a separate age private key for host because it already has the ssh key. Regardless of how you generate the keys, you will need to use sops to decrypt/encrypt the secrets. I hope that helps.
      Thanks for watching and commenting.

  • @Julien-rc1bi
    @Julien-rc1bi 6 หลายเดือนก่อน +2

    Thanks for the great video. I'm using sops-nix with an age text file key and it works great. I'm a bit confused about the use of the public ssh key to generate an age public key: how do you manage the ssh key upon reinstall of the system? In other words, can you make your ssh key invariant to ensure that the private age key define in .sops.yaml always match your private ssh key in /etc/ssh ?

    • @Emergent_Mind
      @Emergent_Mind  6 หลายเดือนก่อน +8

      Thanks for the compliment, I'm glad you enjoyed the video.
      There two ways to handle the ssh key situation on reinstall.
      The first would be to copy the system's ssh key prior to reinstall and then write it to the reinstalled system after. Actually, when you're booted to the nixos installer environment you can write the ssh key pair to `/mnt/etc/ssh` and then when the install is executed the keys are written to the system. Pro: no need to update .sops.yaml and updatekeys on secrets.yaml Con: need to copy or have a back up of the original ssh key and put it on the reinstalled system
      The second would be to accept that the old ssh key will be paved and instead, generate a new age key for the system derived from the new ssh key. You'd just update the .sops.yaml to replace the original age public key with the new one and run a sops updatekeys command to encrypt the secrets appropriate. Pro: no need to move copies of the ssh key around Con: you need to update .sops.yaml and updatekys on secrets.yaml
      There may actually be other options but those are the two that I would consider. They both require a similar amount of effort but in different ways. If it's a scenario that you're running into frequently you could look into automating parts of the process with scripts.
      I'm experimenting with automating remote installation at the moment and currently have it set up so that, prior to install, an ssh key for the target system is generated on a source system, age keys are derived, my .sops.yaml and secrets are updated, and the ssh keys are injected into the installer. It's been a lot of fun trial and error but it's all automatic.
      Is that helpful? Let me know how it goes.

    • @Julien-rc1bi
      @Julien-rc1bi 6 หลายเดือนก่อน +3

      @@Emergent_Mind thanks a lot for the detailed answer. It makes lots of sense and I'll experiment a bit with the two options once I'm back from holiday.

  • @Dyrgrip
    @Dyrgrip 4 หลายเดือนก่อน

    Awesome content! Thank you for sharing your secrets! :)

    • @Emergent_Mind
      @Emergent_Mind  4 หลายเดือนก่อน

      Thank you for watching!

  • @thepinkunicorn6
    @thepinkunicorn6 4 หลายเดือนก่อน +2

    Small correction, at 6:15 after the -p flag it needs to just be "age", not "age-keygen" :)

    • @Emergent_Mind
      @Emergent_Mind  3 หลายเดือนก่อน +1

      You are correct; good catch. Thanks for pointing this out!

  • @McGilly17
    @McGilly17 2 หลายเดือนก่อน

    Absolutely phenomenal series. Thank you so much EmergentMind. I am trying to implement this right now with my config for both linux and mac. Would you use a different access key creation method for mac laptops if they dont have a host key? I must admit I am a little confused on what actually creates the host keys if you are using Darwin... i understood it to be in services.openssh (which isnt available in Darwin).

    • @Emergent_Mind
      @Emergent_Mind  2 หลายเดือนก่อน +1

      I'm glad this has been valuable for you. I'm not what the service is called on Darwin either but I'll ask someone who knows and get back you.

    • @McGilly17
      @McGilly17 2 หลายเดือนก่อน

      @@Emergent_Mindmuch appreciated! Thank you. Your nix configs (along with misterios and Ryan Yins) have been so freaking helpful in frankensteining my own.
      If you are discussing this stuff on GitHub I’m there under mcgilly17 as well (hope to have my configs published soon!).

    • @McGilly17
      @McGilly17 2 หลายเดือนก่อน

      @@Emergent_Mind Thank you so much! Appreciate any help I can get!

    • @Emergent_Mind
      @Emergent_Mind  2 หลายเดือนก่อน

      I asked... He didn't have it documented but said he remembered just generating the key manually on mac and then copied it over. Sorry that's not very helpful. Iirc openssh is something that is planned for Darwin, so doing it manually for now and coming back to it later may be an option

    • @Emergent_Mind
      @Emergent_Mind  2 หลายเดือนก่อน +1

      I asked... He didn't have it documented but said he remembered just generating the key manually on mac and then copied it over. Sorry that's not very helpful. Iirc openssh is something that is planned for Darwin, so doing it manually for now and coming back to it later may be an option

  • @HyuLilium
    @HyuLilium 6 หลายเดือนก่อน

    Have you tried to restore the backed up age private key contents? I've tried and I got checksum error when trying to decrypt with it.

    • @Emergent_Mind
      @Emergent_Mind  6 หลายเดือนก่อน

      Hi there, I have but it not since I was testing it out early on. There are many potential issues that could occur there so I'm not sure how to help. Maybe post your issue with some additional context on discourse.nixos.org/ I'll keep an eye out for it but I do happen to be headed on vacation for a couple of weeks so hopefully someone else can point you in the right direction. Let me know how it goes and thanks for watching!

  • @MOIS3Y-YT
    @MOIS3Y-YT 6 หลายเดือนก่อน

    I like the option of using ssh-host-key for different hosts, but what about reinstalling the system?
    I mean, yes, we have a backup dev key and we won’t lose the ability to decrypt secrets.yaml, but with a new installation, the host key will change, which means we need to copy the dev key to the host, then do sops updatekeys and add the new public age key of the host to . sops.yaml.
    Did I miss anything? Perhaps you know a better way?

    • @Emergent_Mind
      @Emergent_Mind  6 หลายเดือนก่อน +1

      What you described is correct. Alternatively, you could backup the 'known' host ssh key prior to reinstall and then overwrite the autogenerated one with it, which would keep the .sops.yaml and age key data unchanged. Hard to say if one is more convenient than the other though.
      I am working on some remote install automation at the moment, which includes handling secrets management with a private repo, and automatically generates keys and updates .sops.yaml accordingly. It's still a work in progress because of other aspects of the process but it's close to being done. I'll be making some videos to describe it all when it's finished.
      Thanks for watching!

  • @hikingpete
    @hikingpete 5 หลายเดือนก่อน +2

    At t=663 you have a `cat -p ...`. What's up with that? Do you have a non-standard `cat`? It's a `bat` alias, isn't it. I would encourage you to use the proper names, or the standard utilities.

    • @Emergent_Mind
      @Emergent_Mind  5 หลายเดือนก่อน +1

      Thanks for the suggestion!I will keep this in mind for future videos.

  • @agh0x01
    @agh0x01 6 หลายเดือนก่อน

    Am interested to hear you elaborate on why PGP is no good.

    • @Emergent_Mind
      @Emergent_Mind  6 หลายเดือนก่อน

      Hahaha, I suspected someone would call me out on that at some point. :)
      My disdain for PGP is specifically from consistently bad experiences using it over a couple decades. Every time I need it for more than a minimal touch, 'out-of-the-box' scenario I run into endless problems and often lose significant amounts of time trying to troubleshoot (often to no avail). I will admit that this is most likely my own failings more than an intrinsic problem with the technoloyg but I do find it needlessly convoluted. So really, I just avoid it whenever I can.
      Has your experience with it been positive?
      Thanks for watching and for the comment!

    • @agh0x01
      @agh0x01 6 หลายเดือนก่อน +1

      @@Emergent_Mind yeah, I was just genuinely interested to know if it had failings as means of protecting sensitive information, as I use GPG occasionally. It sounds like your concerns were more about usability rather than the security side, although granted, a security product that is difficult or especially confusing to use can result in the security one believes to have not actually being.

  • @S4ntia60
    @S4ntia60 6 หลายเดือนก่อน

    Delve? is this AI?

    • @Emergent_Mind
      @Emergent_Mind  6 หลายเดือนก่อน +5

      It seems like you have provided an unrelated statement. I'm not sure what you are asking.
      To clarify, could you please provide more context or rephrase your question? I'm here to help, and I'll do my best to provide a useful, helpful, and actionable answer once I understand your question.
      ;P no, I am not AI

  • @needMoreInput
    @needMoreInput 6 หลายเดือนก่อน +1

    I think you should just go for sharing how to do the dual key thing, even if not many may need it. I can tell you no one else will teach it I am also now curious, never even considered it as a possibility tbh

    • @Emergent_Mind
      @Emergent_Mind  6 หลายเดือนก่อน +2

      Thanks for the suggestion and your other comment! There are already a few things I would like to improve about how I presented this series. There are a lot of other topics I'm planning to cover in the near future but I've added the multi-key topic as something to go through, when this series eventually gets a revision. It's good to know what people are interested in hearing about!

  • @Medan1993
    @Medan1993 4 หลายเดือนก่อน

    For 6:09 I had some issues with using nix-shell command in that format, so instead I went with "nix shell nixpkgs#age -c age-keygen -y ~/.config/sops/age/keys.txt" However the other one was working so no issues there.

    • @Emergent_Mind
      @Emergent_Mind  3 หลายเดือนก่อน

      Actually, there is a typo in that command, as @thepinkunicorn6 pointed out to me about the same time you commented. After the -p flag it should have been just "age" instead of "age-keygen". Glad you got it sorted out though! There are many ways to accomplish the same things and so much to learn :)
      Thanks for watching and commenting!