|
Description
|
'pktool genkey' has a very strange CLI syntax for creating files in a given directory.
Instead of the expected UNIX syntax which would be:
pktool genkey keystore=file outkey=/path/to/file keytype=aes keylen=256
One has to specify the file and directory separately, this makes scripting harder than
it should be but more importantly it has led to this very strange bug:
braveheart# mkdir tank
braveheart# pwd
/
braveheart# ls -ld tank
drwxr-xr-x 2 root root 512 Oct 5 11:39 tank
braveheart# truss -t open pktool genkey keystore=file keytype=aes keylen=256 dir=/etc/zfs/keys outkey=tank
....
open("tank", O_RDONLY|O_CREAT|O_EXCL, 0600) Err#17 EEXIST
Cannot write the indicated output key file (tank).
Error generating key:
libkmf error: KMF_ERR_BAD_PARAMETER
Note that the cwd has a "directory" named tank but I told pktool to put the keyfile named tank in a different directory to the current one.
The proper fix in my opinion is to follow common UNIX practice and allow outfile to specify a full path
and not require dir=.
|