this post was submitted on 06 Nov 2025
25 points (100.0% liked)

Selfhosted

52766 readers
546 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS
 

Hey everyone, here's an idea, what do you think? (Please stop me...)

I have a few remote servers where disk encryption is only a moderately important measure; I definitely want to keep it but I'm also annoyed by having to ssh into it during the initrd-phase to provide a passkey on every reboot. What I would like is to get a notification with a link to my idp for some device flow, allowing me to authorize the server to obtain the secrets necessary for decryption.

As far as I can tell, this hasn't been done before, or have I missed something? A naive idea would be to have custom oidc-claims for the different servers where the value is the luks-passphrase. Feels like a bad idea, though. Any ideas on the details as to how? I obviously don't want to bloat my initrd-image, so a bash script using curl would be ideal.

all 15 comments
sorted by: hot top controversial new old
[–] Eknz@lemmy.eknz.org 6 points 16 hours ago (1 children)

Ironically, the passphrase for the encryption wouldn't be encrypted in this scenario as claims can be decoded from the token payload if intercepted. It would also probably be stored as-is server side as well. Claims aren't designed as secrets.

Perhaps you could authorise a request to an actual secrets manager via oidc though, allowing the volume to be unlocked.

[–] dont@lemmy.world 1 points 14 hours ago (1 children)

Yes, I was thinking about storing encrypted keys, but still, using claims is clearly just wrong... Using a vault to store the key is probably the way to go, even though it adds another service the setup depends on.

[–] Eknz@lemmy.eknz.org 2 points 13 hours ago* (last edited 13 hours ago) (1 children)

A fall-back to the current way of unlocking the volume would probably be a good idea. It wouldn't be fun to lose access to something because a cloud service went down or access to it was lost etc.

[–] dont@lemmy.world 1 points 13 hours ago

Definitely! I have bmc/kvm everywhere (well, everywhere that matters).

I have talked myself out of this (for now), though. I think if I ever find the time to revisit this, I will try to to it by injecting some oidc-based approval (memo to myself: ciba flow?) into something like clevis/tang.

[–] Brkdncr@lemmy.world 2 points 15 hours ago (1 children)

Isn’t Kmip how this is solved?

[–] dont@lemmy.world 1 points 14 hours ago

Sort of, but this seems a bit heavy. (That being said, I was also considering pkcs#11 on a net-hsm, which seems to do basically the same...)

[–] thelittleblackbird@lemmy.world 2 points 15 hours ago (1 children)

Chech here, I think is a more sensible way of doing things https://www.recompile.se/mandos

[–] dont@lemmy.world 0 points 15 hours ago (1 children)

Interesting, do you happen to know how this "approval" works here, concretely?

[–] thelittleblackbird@lemmy.world 1 points 11 hours ago (1 children)

I am afraid I don't get the question.

What do you exactly mean?

[–] dont@lemmy.world 1 points 7 hours ago (1 children)

It wasn't clear to me at first glance how the mandos server gets the approval to supply the client with its desired key, but I figured it out in the meantime: that's done through the mandos-monitor tui. However, that doesn't quite fit my ux-expectations. Thanks for mentioning it, though. It's an interesting project I will keep in mind.

[–] thelittleblackbird@lemmy.world 2 points 5 hours ago

Ehmmmm I still don't grasp what you mean.

In any case, mandos has a possibility to do it automatically via rsa encryption, so you have the possibility of totally unattended restart.

Because the server is (ideally) in a different location, if one of yiur systems is stolen / compromised then you only delete / revoked the certificates ID and then that machine would not be able to decrypt its own luks system.

I never deployed this system on my own, but I know a few guys who did it

Regards

[–] utjebe@reddthat.com 1 points 3 hours ago

I was sorting somethingting similar some time ago with https://www.dwarmstrong.org/remote-unlock-dropbear/

Also there is https://github.com/latchset/tang and https://github.com/latchset/clevis

Then I changed it so my server boots and offers basic functionality like DNS and any encrypted data would wait until I unlock it. When I fiddle with it could be annoying, but otherwise works very well considering I need to unlock it just a few times a year.

[–] KaninchenSpeed@lemmy.blahaj.zone 1 points 6 hours ago* (last edited 6 hours ago)

If you already have/can run a local server, then maybe storing the luks passphrase there and running a script on it which sshs into the remote server end enters the stored passphrase on command. Maybe a simple http server triggers it, which you could auth using forward auth of your reverse proxy, so you wouldnt need to implement auth in your script.

Of cause the passphrase is stored in plain text, but that will be the case in any case not using a tpm.

You could do notifications with a simple webhook of your favourite chat app, or by running a ntfy server (and app) and also sending the notification with a curl from a initrd script.

[–] emrsmsrli@lemmy.world 0 points 13 hours ago

I followed this guide and it works very well for me. It's basically a setup for a dropbear ssh server on boot time.