Live data from Hacker News

Remotely unlocking an encrypted hard disk

jyn.dev

91–100 of 100 posts

Re: Remotely unlocking an encrypted hard disk

#91
post #37

Earlier quoted context omitted.

Which server today doesnt have Raid? Just pull one hdd out, extract what you need or change the image. Then you turn off the server, and just start a vm with the captured init and capture the key. Now you can decrypt the server offline with all the time in the world.

This doesn't work with secure boot and UKIs, since the entire "pre-rootfs switch" is signed in a single binary. If your threat model is what you have that is the least you should have.

Can't I just extract the key from uefi/tmp in this case? Not that it's easy, but with the right tools you can so it offline with all the time in the world

Re: Remotely unlocking an encrypted hard disk

#92
post #80
post #2

This has been a "need" for a long time for home users with FDE. The go-to software solution for Linux has been: https://github.com/gsauthof/dracut-sshd

Sure, if you're using dracut, which is not true for "Linux" in general.

Dracut is used by default on:

Fedora, RHEL, CentOS, Rocky, Alma, Arch, and Gentoo

Dracut is available on:

Debian and Ubuntu

That covers most common Linux distros.

-

Personally, I'm using this on Fedora.

Re: Remotely unlocking an encrypted hard disk

#93
post #2

This has been a "need" for a long time for home users with FDE. The go-to software solution for Linux has been: https://github.com/gsauthof/dracut-sshd

I have a setup based on this, but I modified it to encrypt the SSH host key using the TPM. That way, I can detect a MiTM from an attacker who has stolen the drive or modified the boot policy because host key verification will fail.

/usr/lib/dracut/modules.d/46cryptssh:

    #!/bin/bash
    
    check() {
        require_binaries sshd || return 1
        return 0
    }
    
    depends() {
        return 0
    }
    
    install() {
        if [ ! -e /etc/ssh/dracut ]; then
            mkdir /etc/ssh/dracut &&
            tmp=$(mktemp -d) &&
            head -c128 /dev/random > $tmp/passphrase &&
            ssh-keygen -t ed25519 -f /etc/ssh/dracut/ssh_host_ed25519_key -N"$(base64 
cryptsshd.service:

    [Unit]
    Description=OpenSSH Daemon for Disk Encryption Passphrase
    DefaultDependencies=no
    Before=cryptsetup.target
    After=network-online.target
    
    [Service]
    Type=notify-reload
    ExecStartPre=/bin/sh -c '/usr/bin/ssh-keygen -p -f /etc/ssh/ssh_host_ed25519_key \
        -N "" -P "$(/usr/bin/tpm2_unseal -c /etc/ssh/seal -p pcr:sha256:0,7 | base64)"'
    ExecStart=/usr/bin/sshd -D
    KillMode=process
    Restart=always
    
    [Install]
    WantedBy=sysinit.target
That encrypts the SSH host key using a password sealed with PCR7, which is invalidated if an attacker disables Secure Boot or tampers with the enrolled keys. Thus, an attacker can't extract the key from the drive or by modifying the kernel command line to boot to a shell (since that's not allowed without disabling secure boot).

It's still probably vulnerable to a cold boot attack, since the key is decrypted CPU-side. It would be interesting to perform the actual key operations on the TPM itself to prevent this.

Re: Remotely unlocking an encrypted hard disk

#94
post #90
post #42

Earlier quoted context omitted.

> Just pull one hdd out, That only works with RAID 1. If the server uses RAID 5 or RAID 6, this won’t work. > extract what you need Well, yes. This is addressed in the FAQ. > or change the image. > Then you turn off the server, and just start a vm with the captured init and capture the key. Well, as explained in the FAQ, an attacker will have to do so quickly , before the Mandos server decides that the Mandos client…

Why wouldn't this work with Raid5? One of my raid5 hdds cought fire and the server was still running. Talking about mdadm in this case. 5 minutes is plenty to boot initrd from a vm... what's that gonna take? 10 seconds?

[deleted]

Re: Remotely unlocking an encrypted hard disk

#95
post #90
post #42

Earlier quoted context omitted.

> Just pull one hdd out, That only works with RAID 1. If the server uses RAID 5 or RAID 6, this won’t work. > extract what you need Well, yes. This is addressed in the FAQ. > or change the image. > Then you turn off the server, and just start a vm with the captured init and capture the key. Well, as explained in the FAQ, an attacker will have to do so quickly , before the Mandos server decides that the Mandos client…

Why wouldn't this work with Raid5? One of my raid5 hdds cought fire and the server was still running. Talking about mdadm in this case. 5 minutes is plenty to boot initrd from a vm... what's that gonna take? 10 seconds?

I assume they're saying it won't work because the suggestion is to "pull one" HDD out.

With RAID 5, pulling 1/3 gives you only partial data, and pulling 2/3 removes too much so the system can't run.

Re: Remotely unlocking an encrypted hard disk

#96
post #95
post #90

Earlier quoted context omitted.

Why wouldn't this work with Raid5? One of my raid5 hdds cought fire and the server was still running. Talking about mdadm in this case. 5 minutes is plenty to boot initrd from a vm... what's that gonna take? 10 seconds?

I assume they're saying it won't work because the suggestion is to "pull one" HDD out. With RAID 5, pulling 1/3 gives you only partial data, and pulling 2/3 removes too much so the system can't run.

Ok, that is assuming /boot is ON the raid which I wouldn't want to rate for probability

But even if it is, you could just pull one after the other and wait for the resilver before pulling the next one (you will hear if it resilvers automatically)

Re: Remotely unlocking an encrypted hard disk

#97
post #59
post #28

Earlier quoted context omitted.

Police show up and arrest you. Could be with reason, could be by accident. Maybe you did something wrong, maybe you didn’t. They also physically size your servers, and in doing so they unplug the system. If you have disk encryption, your data now requires the police to force you to produce a password, which may or may not be within their powers, depending on the jurisdiction. It’s strictly better to have full disk en…

Except they are more sophisticated than this in the real world. They have kits to clone drives and keep power running without interrupting it

In the real real world, not all police has that or uses it in every raid. We got visited once as a group of people some ten years ago, coordinated to happen at the same time at different locations across multiple states, and at none of the locations they brought any such equipment or expert, even though both the accused crime revolved around computing and warrant specifically was for computer equipment. They asked nicely for passphrases and since we didn’t provide any they got nowhere. They even allowed us to power down some machines for them, haha.

Re: Remotely unlocking an encrypted hard disk

#99
post #63

I'd love to see this in the bootloader, along with a selection of binaries useful for recovery. Might sound silly but over the years I have had many a remote system get to the bootloader and then no further after an upgrade. Nowadays we've usually got a nicely sized EFI partition, why not stuff it all in there? Gimme a full Linux userspace from the bootloader, it would feel luxurious when I'm up at 3 am trying to rec…

In new installs you do stuff everything in EFI partition and skip the old /boot partition as such. The better solution is to use tpm, unified kernel image and secure boot skipping the network unlock. The whole process is like this - 1. enable secure boot; 2. generate and install your own secure boot keys (using sbctl); 3. use clevis to enable automatic unlocking of the root fs only when secure boot check passes; 4. g…

> 3. use clevis to enable automatic unlocking of the root fs only when secure boot check passes;

Can also use systemd-cryptsetup/systemd-cryptenroll for this. I've not used clevis myself, but I'd imagine you have to do somewhat more rolling-your-own compared to the systemd tools.

> The unified kernel image doesn't accept additional kernel parameters, so only parameters that are set during generation of the initram are used. The secure boot makes sure no one else has tampered with the boot chain. And TPM stores the disk key securely.

FYI, multi-profile UKIs are a thing. You can have one UKI with multiple different command lines, e.g. one for regular boot, one for emergency mode, etc.

https://uapi-group.org/specifications/specs/unified_kernel_i...

Re: Remotely unlocking an encrypted hard disk

#100
post #92
post #80

Earlier quoted context omitted.

Sure, if you're using dracut, which is not true for "Linux" in general.

Dracut is used by default on: Fedora, RHEL, CentOS, Rocky, Alma, Arch, and Gentoo Dracut is available on: Debian and Ubuntu That covers most common Linux distros. - Personally, I'm using this on Fedora.

”Fedora, RHEL, CentOS, Rocky, Alma” are all the same distro group: Enterprise Linux (EL). That it's ”available” on other distros is irrelevant, almost anything is ”available” as a non standard choice for any distro.
Post reply on HN