Re: Password hash as LUKS key
Martin Olsson <[email protected]> Mon, 20 Mar 2023 18:06:42 +0100
| Newsgroups | dev.linux.lists.cryptsetup |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Mar 15, 2023 at 08:35:05PM +0000, Michael Kj�rling wrote: > Aside from that already mentioned by Grzegorz Szymaszek, a more > general question: what leads you to believe that you can give the > output from mkpasswd (which at least on Debian is provided by the > "whois" package) to cryptsetup (provided by the "cryptsetup-bin" > package) and have the mkpasswd output be recognized by cryptsetup as > being somehow special? > A quick web search for the two didn't reveal anything obvious > connecting the two; and the cryptsetup man page does not mention > mkpasswd. Oh, I was pretty certain that it wasn't going to work since like you said it isn't documented anywhere. So I just assumed it wasn't supported but then Arno replied: >In priciple, >this works and is supported, but interactive, pipe and >read-from-file are all a bit different. So I decided to give it another try. But I'm pretty sure now that Arno misunderstood what I wanted to accomplish. I want to encrypt the password before piping it to cryptsetup. mkpasswd was just an example of that operation. You can also use python for example: python3 -c 'import crypt,getpass; print(crypt.crypt(getpass.getpass(), crypt.mksalt(crypt.METHOD_SHA512))) But as you pointed out there is nothing in cryptsetup that recognizes the encrypted string as anything other than a normal password. I was hoping there was an option somewhere that I could add as an argument to my cryptsetup command. As there is no such option I am wondering if there is another solution to my use case: "I want to encrypt a drive for a user and I don't want the user to send me their password in clear text."