FS#30780 - [initscripts] emulate Fedora password prompt
Attached to Project:
Arch Linux
Opened by c (c) - Saturday, 21 July 2012, 08:13 GMT
Last edited by Tom Gundersen (tomegun) - Monday, 23 July 2012, 19:39 GMT
Opened by c (c) - Saturday, 21 July 2012, 08:13 GMT
Last edited by Tom Gundersen (tomegun) - Monday, 23 July 2012, 19:39 GMT
|
Details
Description:
I don't know what Fedora's initramfs or initscripts do but if you have two luks devices with the same password it seems to first try the previously entered and successfully used password before prompting again when opening a second luks device. Additional info: * 1.5.0-1 |
This task depends upon
GRUB_CMD_LINE_DEFAULT="quiet cryptdevice=DEV:NAME"
/etc/crypttab
[...]
OTHERNAME OTHERDEV none
When I installed Fedora it asked me for a passphrase for DEV and OTHERDEV. In the test I had used the same passphrase for both and was surprised that I was only asked to enter one passphrase. Either the OTHERDEV which was SWAP didn't actually use the passphrase and use a random key on each boot or it did re-try the previously entered passphrase before asking.
Can you follow or do you need more info?
(I find it extremely unlikely that Fedora is checking previously entered passwords.)
I tried but it failed. Anything wrong or missing somewhere?
/etc/crypttab
OTHERNAME OTHERDEV /dev/urandom swap,cipher=aes-xts-plain64:sha512,size=512
/etc/fstab
OTHERDEV swap swap defaults 0 0 # UUID won't work because different each time, isn't it?
It fails with this error:
Activating swap [BUSY] swapon: /dev/mapper/OTHERNAME: read swap header failed: Invalid argument
Mon Jul 23 10:05:09 2012: [FAIL]
Seems like some step doesn't realize it has to mkswap. Or does it get tried to swapon too early?
@Tom: It looks like that 'if IFS=, in_array swap [..]' check is failing, and thus mkswap is never run. See what I mean:
$ source /etc/rc.d/functions
$ options=swap,cipher=aes-xts-plain64:sha512,size=512
$ if IFS=, in_array swap ${options[@]}; then echo win; else echo fail; fi # IFS isn't taken into account here
fail
$ IFS=,
$ if in_array swap ${options[@]}; then echo win; else echo fail; fi # here it works
win
crypttab:
swap /dev/vda2 /dev/urandom swap
tmp /dev/vda3 /dev/urandom tmp
fstab:
/dev/mapper/swap none swap defaults 0 0
/dev/mapper/tmp /tmp ext2 defaults 0 0
And it works fine:
[ 2.948659] EXT4-fs (dm-1): mounting ext2 file system using the ext4 subsystem
[ 2.969752] Adding 262140k swap on /dev/mapper/swap. Priority:-1 extents:1 across:262140k
@c: your fstab seems to be wrong. It should not be "OTHERDEV", but /dev/mapper/OTHERNAME.
Some more example code: (I believe this is the correct way to handle IFS changes, by saving and then restoring its old value.)
$ source /etc/rc.d/functions
$ options=swap
$ in_array swap ${options[@]} && echo works
works
$ options=swap,kittens
$ in_array swap ${options[@]} && echo works
$ SAVEIFS=$IFS IFS=,
$ in_array swap ${options[@]} && echo works
works
$ IFS=$SAVEIFS
What crypto options does it use if I omit the last field as in your example?
Try, it will print what it uses on the console ;-)