artosan / nitroluks

Unlock LUKS disk by Nitrokey on boot.
GNU General Public License v2.0
33 stars 11 forks source link

nitroluks in /bin or /usr/bin ? #3

Closed miwie closed 6 years ago

miwie commented 6 years ago

Before installing nitroluks I really want to understand how this works and had a look into (some) code. In keyscript.sh I see the following code:

# call nitroluks to get the LUKS key
/bin/nitro_luks

but in the built DEB the binary nitro_luks is located in /usr/bin. Do miss something?

techge commented 6 years ago

/bin/ should usually reference to /usr/bin and isn't an own folder. So both /bin/nitro_luks as well as /usr/bin/nitro_luks should do the same.

miwie commented 6 years ago

Really? After installing nitroluks I find /usr/bin/nitro_luks but cannot see it in /bin

techge commented 6 years ago

Okay, I guess this is OS specific then...

artosan commented 6 years ago

After installing nitroluks you find the binary from your local system under /usr/bin/nitro_luks and when the new initramfs is built, the path to the nitro_luks binary within the initramfs which is executing during the boot is /bin/nitro_luks.

So when the keyscript.sh is executed during the boot, it has only access to the of the initramfs environment where the correct path to nitro_luks is /bin/nitro_luks

After the initramfs generation, you can verify that it indeed is there:

$ uname -r
4.9.0-6-amd64
$ lsinitramfs /boot/initrd.img-4.9.0-6-amd64 | grep nitro_luks
bin/nitro_luks

I hope this answered to your question :)

miwie commented 6 years ago

Thanks for the clarification!