mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60c687238d | ||
|
|
57b992ffa1 | ||
|
|
1f07a41d5a | ||
|
|
512b47c004 | ||
|
|
818ffbc4b0 | ||
|
|
5e65df7375 | ||
|
|
4eb80d14a0 | ||
|
|
7247a61e0b | ||
|
|
c856f28e11 | ||
|
|
ca30cfd341 | ||
|
|
58ecf1f363 | ||
|
|
d36ff82999 | ||
|
|
d4398aea89 | ||
|
|
672548ce30 | ||
|
|
344965bd29 | ||
|
|
d6a96f07c1 | ||
|
|
6a99d95d4f |
@@ -16,6 +16,7 @@ List of all individuals having contributed content to s390-tools
|
||||
- Clemens von Mann
|
||||
- Dan Horak
|
||||
- Despina Papadopoulou
|
||||
- Dimitri John Ledkov
|
||||
- Eberhard Pasch
|
||||
- Einar Lueck
|
||||
- Erwin Vicari
|
||||
|
||||
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,5 +1,19 @@
|
||||
Release history for s390-tools (MIT version)
|
||||
--------------------------------------------
|
||||
* __v2.6.0 (2018-08-10)__
|
||||
|
||||
For Linux kernel version: 4.18
|
||||
|
||||
Add new tool:
|
||||
- zkey: Add zkey-cryptsetup tool
|
||||
Changes of existing tools:
|
||||
- netboot: add BOOTIF support
|
||||
|
||||
Bug Fixes:
|
||||
- mon_procd: fix parsing of /proc/<pid>/stat
|
||||
- netboot: Include compressed kernel modules in initramfs
|
||||
- netboot: Send client architecture and handle path prefix
|
||||
|
||||
* __v2.5.0 (2018-06-08)__
|
||||
|
||||
For Linux kernel version: 4.17
|
||||
|
||||
13
README.md
13
README.md
@@ -265,6 +265,8 @@ build options:
|
||||
| net-snmp | `HAVE_SNMP` | osasnmpd |
|
||||
| glibc-static | `HAVE_LIBC_STATIC` | zfcpdump |
|
||||
| openssl | `HAVE_OPENSSL` | zkey |
|
||||
| cryptsetup | `HAVE_CRYPTSETUP2` | zkey-cryptsetup |
|
||||
| json-c | `HAVE_JSONC` | zkey-cryptsetup |
|
||||
|
||||
This table lists additional build or install options:
|
||||
|
||||
@@ -371,9 +373,12 @@ the different tools are provided:
|
||||
|
||||
* zkey:
|
||||
For building the zkey tools you need openssl version 0.9.7 or newer installed
|
||||
(openssl-devel.rpm). Tip: you may skip the zkey build by adding
|
||||
`HAVE_OPENSSL=0` to the make invocation.
|
||||
(openssl-devel.rpm). Also required are cryptsetup version 2.0.3 or newer
|
||||
(cryptsetup-devel.rpm), and json-c version 0.12 or newer (json-c-devel.rpm).
|
||||
Tip: you may skip the zkey build by adding `HAVE_OPENSSL=0`, and you may
|
||||
may skip the zkey-cryptsetup build by adding `HAVE_CRYPTSETUP2=0`, or
|
||||
`HAVE_JSONC=0` to the make invocation.
|
||||
A new group 'zkeyadm' needs to be created and all users intending to use the
|
||||
tool must be added to this group. The owner of the default key repository
|
||||
tool must be added to this group. The owner of the default key repository
|
||||
'/etc/zkey/repository' must be set to group 'zkeyadm' with write permission
|
||||
for this group.
|
||||
for this group.
|
||||
|
||||
@@ -5,7 +5,7 @@ COMMON_INCLUDED = true
|
||||
# The variable "DISTRELEASE" should be overwritten in rpm spec files with:
|
||||
# "make DISTRELEASE=%{release}" and "make install DISTRELEASE=%{release}"
|
||||
VERSION = 2
|
||||
RELEASE = 5
|
||||
RELEASE = 6
|
||||
PATCHLEVEL = 0
|
||||
DISTRELEASE = build-$(shell date +%Y%m%d)
|
||||
S390_TOOLS_RELEASE = $(VERSION).$(RELEASE).$(PATCHLEVEL)-$(DISTRELEASE)
|
||||
|
||||
@@ -594,17 +594,18 @@ static void cal_task_pcpu(struct task_t *task, const unsigned long long tics)
|
||||
*/
|
||||
static int read_stat(struct task_t *task)
|
||||
{
|
||||
int ppid, tty, proc;
|
||||
unsigned long flags, pri, nice;
|
||||
unsigned long long maj_flt, utime, stime, cutime, cstime;
|
||||
unsigned long long maj_flt = 0, utime = 0, stime = 0, cutime = 0,
|
||||
cstime = 0;
|
||||
unsigned long flags = 0, pri = 0, nice = 0;
|
||||
char *cmd_start, *cmd_end, *cmdlenp, *cmdp;
|
||||
int ppid = 0, tty = 0, proc = 0, rc;
|
||||
|
||||
snprintf(fname, sizeof(fname), "/proc/%u/stat", task->pid);
|
||||
if (read_file(fname, buf, sizeof(buf) - 1) == -1)
|
||||
return 0;
|
||||
|
||||
cmd_start = strchr(buf, '(') + 1;
|
||||
cmd_end = strchr(cmd_start, ')');
|
||||
cmd_end = strrchr(cmd_start, ')');
|
||||
name_lens.cmd_len = cmd_end - cmd_start;
|
||||
cmdlenp = mon_record + sizeof(struct monwrite_hdr);
|
||||
cmdlenp += sizeof(struct procd_hdr);
|
||||
@@ -625,7 +626,7 @@ static int read_stat(struct task_t *task)
|
||||
memcpy(cmdlenp, &name_lens.cmd_len, sizeof(__u16));
|
||||
|
||||
cmd_end += 2;
|
||||
sscanf(cmd_end,
|
||||
rc = sscanf(cmd_end,
|
||||
"%c %d %*d %*d %d %*d "
|
||||
"%lu %*s %*s %Lu %*s "
|
||||
"%Lu %Lu %Lu %Lu "
|
||||
@@ -642,6 +643,8 @@ static int read_stat(struct task_t *task)
|
||||
&utime, &stime, &cutime, &cstime,
|
||||
&pri, &nice,
|
||||
&proc);
|
||||
if (rc != 12)
|
||||
syslog(LOG_ERR, "bad data in %s \n", fname);
|
||||
task->ppid = (__u32)ppid;
|
||||
task->tty = (__u16)tty;
|
||||
task->flags = (__u32)flags;
|
||||
|
||||
@@ -134,8 +134,8 @@ echo "$cmd: Copying virtio modules"
|
||||
mkdir -p $builddir/$netdir
|
||||
mkdir -p $builddir/$blkdir
|
||||
set +e
|
||||
cp $netdir/virtio_net.ko $builddir/$netdir 2> /dev/null
|
||||
cp $blkdir/virtio_blk.ko $builddir/$blkdir 2> /dev/null
|
||||
cp $netdir/virtio_net.ko* $builddir/$netdir 2> /dev/null
|
||||
cp $blkdir/virtio_blk.ko* $builddir/$blkdir 2> /dev/null
|
||||
set -e
|
||||
|
||||
# Busybox (+ dependencies)
|
||||
@@ -170,7 +170,7 @@ cat <<'EOF' > $builddir/init
|
||||
/bin/mount -t tmpfs none /run
|
||||
|
||||
/sbin/modprobe virtio_net
|
||||
/sbin/udhcpc -O pxeconffile -O pxepathprefix &
|
||||
/sbin/udhcpc -O pxeconffile -O pxepathprefix -x 93:001F &
|
||||
|
||||
/sbin/pxeboot.script
|
||||
EOF
|
||||
@@ -237,6 +237,7 @@ case "$1" in
|
||||
echo " router: $router"
|
||||
echo " domain: $domain $dns"
|
||||
echo " tftp: $siaddr"
|
||||
echo " pxepathprefix: $pxepathprefix"
|
||||
# flush routes
|
||||
/sbin/ip route flush table all
|
||||
# setup if link
|
||||
@@ -272,6 +273,7 @@ case "$1" in
|
||||
echo "siaddr=$siaddr" > $PXECONF
|
||||
echo "interface=$interface" >> $PXECONF
|
||||
echo "ip=$ip" >> $PXECONF
|
||||
echo "pxepathprefix=$pxepathprefix" >> $PXECONF
|
||||
fi
|
||||
;;
|
||||
|
||||
@@ -354,7 +356,7 @@ then
|
||||
for c in $CONFIGS
|
||||
do
|
||||
echo "fetching config pxelinux.cfg/$c from $siaddr"
|
||||
if /usr/bin/tftp -g -l /tmp/config -r pxelinux.cfg/$c $siaddr
|
||||
if /usr/bin/tftp -g -l /tmp/config -r ${pxepathprefix}pxelinux.cfg/$c $siaddr
|
||||
then
|
||||
break
|
||||
fi
|
||||
@@ -371,6 +373,7 @@ fi
|
||||
kernel=$(/bin/grep -i "^[[:space:]]*kernel" /tmp/config | sed "s/^[[:space:]]*kernel[[:space:]]*//I")
|
||||
initrd=$(/bin/grep -i "^[[:space:]]*initrd" /tmp/config | sed "s/^[[:space:]]*initrd[[:space:]]*//I")
|
||||
append=$(/bin/grep -i "^[[:space:]]*append" /tmp/config | sed "s/^[[:space:]]*append[[:space:]]*//I")
|
||||
ipappend=$(/bin/grep -i "^[[:space:]]*ipappend" /tmp/config | sed "s/^[[:space:]]*ipappend[[:space:]]*//I")
|
||||
|
||||
if [ -z "$kernel" ]
|
||||
then
|
||||
@@ -378,13 +381,13 @@ then
|
||||
exit
|
||||
else
|
||||
echo fetch kernel $kernel from $siaddr
|
||||
/usr/bin/tftp -g -l /tmp/kernel -r $kernel $siaddr
|
||||
/usr/bin/tftp -g -l /tmp/kernel -r $pxepathprefix$kernel $siaddr
|
||||
fi
|
||||
|
||||
if [ -n "$initrd" ]
|
||||
then
|
||||
echo fetch initrd $initrd from $siaddr
|
||||
/usr/bin/tftp -g -l /tmp/initrd -r $initrd $siaddr
|
||||
/usr/bin/tftp -g -l /tmp/initrd -r $pxepathprefix$initrd $siaddr
|
||||
INITRD="--initrd=/tmp/initrd"
|
||||
else
|
||||
INITRD=""
|
||||
@@ -394,6 +397,9 @@ if [ -z "$append" ]; then
|
||||
echo "Kexec load: kexec -l /tmp/kernel $INITRD"
|
||||
kexec -l /tmp/kernel $INITRD
|
||||
else
|
||||
if [ "$ipappend" = "2" ]; then
|
||||
$append="$append BOOTIF=01-$ifaddr"
|
||||
fi
|
||||
echo "Kexec load: kexec -l /tmp/kernel $INITRD --append=\"$append\""
|
||||
kexec -l /tmp/kernel $INITRD --append="$append"
|
||||
fi
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# dbginfo.sh - Tool to collect runtime, configuration, and trace information
|
||||
#
|
||||
# Copyright IBM Corp. 2002, 2017
|
||||
# Copyright IBM Corp. 2002, 2018
|
||||
#
|
||||
# s390-tools is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the MIT license. See LICENSE for details.
|
||||
@@ -21,7 +21,7 @@ readonly SCRIPTNAME="${0##*/}"
|
||||
print_version() {
|
||||
cat <<EOF
|
||||
${SCRIPTNAME}: Debug information script version %S390_TOOLS_VERSION%
|
||||
Copyright IBM Corp. 2002, 2017
|
||||
Copyright IBM Corp. 2002, 2018
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -480,6 +480,7 @@ VM_CMDS="q userid\
|
||||
:q cpus\
|
||||
:q srm\
|
||||
:q vtod\
|
||||
:q time full\
|
||||
:q timezone\
|
||||
:q loaddev\
|
||||
:q v osa\
|
||||
@@ -1016,25 +1017,31 @@ environment_setup()
|
||||
# create gzip-ped tar file
|
||||
create_package()
|
||||
{
|
||||
local rc_tar
|
||||
pr_stdout "Finalizing: Creating archive with collected data"
|
||||
cd "${WORKDIR_BASE}"
|
||||
|
||||
if ! tar -czf "${WORKARCHIVE}" "${WORKDIR_CURRENT}"; then
|
||||
pr_stdout " "
|
||||
pr_stdout "${SCRIPTNAME}: Error: Collection of data failed!"
|
||||
pr_stdout " The creation of \"${WORKARCHIVE}\" was not successful."
|
||||
pr_stdout " Please check the directory \"${WORKDIR_BASE}\""
|
||||
pr_stdout " to provide enough free available space."
|
||||
tar -czf "${WORKARCHIVE}" "${WORKDIR_CURRENT}"
|
||||
rc_tar=$?
|
||||
if [ $rc_tar -eq 0 ]; then
|
||||
chmod 0600 "${WORKARCHIVE}"
|
||||
pr_stdout " "
|
||||
pr_stdout "Collected data was saved to:"
|
||||
pr_stdout " >> ${WORKARCHIVE} <<"
|
||||
pr_stdout " "
|
||||
pr_stdout "Review the collected data before sending to your service organization. "
|
||||
pr_stdout " "
|
||||
elif [ $rc_tar -eq 127 ]; then
|
||||
pr_stdout " "
|
||||
pr_stdout "${SCRIPTNAME}: Error: tar command is not available!"
|
||||
pr_stdout " Please install the corresponding package!"
|
||||
else
|
||||
chmod 0600 "${WORKARCHIVE}"
|
||||
pr_stdout " "
|
||||
pr_stdout "Collected data was saved to:"
|
||||
pr_stdout " >> ${WORKARCHIVE} <<"
|
||||
pr_stdout " "
|
||||
pr_stdout "${SCRIPTNAME}: Error: Collection of data failed!"
|
||||
pr_stdout " The creation of \"${WORKARCHIVE}\" was not successful."
|
||||
pr_stdout " Please check the directory \"${WORKDIR_BASE}\""
|
||||
pr_stdout " to provide enough free available space."
|
||||
fi
|
||||
|
||||
pr_stdout " "
|
||||
pr_stdout "Review the collected data before sending to your service organization. "
|
||||
pr_stdout " "
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -111,6 +111,10 @@ In rare situations a device might temporarily not be accessible to
|
||||
the subchannel. Then "none" is displayed as the device identifier and the
|
||||
other device attributes are empty.
|
||||
|
||||
For subchannels bound to an alternate driver (most notably vfio_ccw) the
|
||||
device identifier may also be displayed as "none". In this case use the
|
||||
\fB--vfio\fR option to show VFIO specific subchannel information.
|
||||
|
||||
.SH AUTHOR
|
||||
.nf
|
||||
This man-page was written by Stefan Bader <shbader@de.ibm.com>.
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#define UDEV_SUFFIX ".rules"
|
||||
|
||||
#define PATH_MODPROBE_CONF "/etc/modprobe.d"
|
||||
#define PATH_MODPROBE "/usr/sbin/modprobe"
|
||||
#define PATH_MODPROBE "/sbin/modprobe"
|
||||
#define PATH_CCW_BUS "/sys/bus/ccw"
|
||||
#define PATH_CCWGROUP_BUS "/sys/bus/ccwgroup"
|
||||
#define PATH_UDEV_RULES "/etc/udev/rules.d"
|
||||
|
||||
@@ -1,47 +1,97 @@
|
||||
include ../common.mak
|
||||
|
||||
ifeq (${HAVE_OPENSSL},0)
|
||||
|
||||
all:
|
||||
$(SKIP) HAVE_OPENSSL=0
|
||||
|
||||
install:
|
||||
$(SKIP) HAVE_OPENSSL=0
|
||||
|
||||
ifneq (${HAVE_OPENSSL},0)
|
||||
BUILD_TARGETS += zkey
|
||||
INSTALL_TARGETS += install-zkey
|
||||
else
|
||||
BUILD_TARGETS += zkey-skip
|
||||
INSTALL_TARGETS += zkey-skip
|
||||
endif
|
||||
|
||||
check_dep:
|
||||
ifneq (${HAVE_CRYPTSETUP2},0)
|
||||
ifneq (${HAVE_JSONC},0)
|
||||
BUILD_TARGETS += zkey-cryptsetup
|
||||
INSTALL_TARGETS += install-zkey-cryptsetup
|
||||
CPPFLAGS += -DHAVE_LUKS2_SUPPORT
|
||||
else
|
||||
BUILD_TARGETS += zkey-cryptsetup-skip-jsonc
|
||||
INSTALL_TARGETS += zkey-cryptsetup-skip-jsonc
|
||||
endif
|
||||
else
|
||||
BUILD_TARGETS += zkey-cryptsetup-skip-cryptsetup2
|
||||
INSTALL_TARGETS += zkey-cryptsetup-skip-cryptsetup2
|
||||
endif
|
||||
|
||||
CPPFLAGS += -I../include
|
||||
LIBS = $(rootdir)/libutil/libutil.a
|
||||
|
||||
detect-libcryptsetup.h:
|
||||
echo "#include <libcryptsetup.h>" > detect-libcryptsetup.h
|
||||
echo "#ifndef CRYPT_LUKS2" >> detect-libcryptsetup.h
|
||||
echo " #error libcryptsetup version 2.0.3 is required" >> detect-libcryptsetup.h
|
||||
echo "#endif" >> detect-libcryptsetup.h
|
||||
echo "int i = CRYPT_SLOT_UNBOUND;" >> detect-libcryptsetup.h
|
||||
|
||||
check-dep-zkey:
|
||||
$(call check_dep, \
|
||||
"zkey", \
|
||||
"openssl/evp.h", \
|
||||
"openssl-devel", \
|
||||
"HAVE_OPENSSL=0")
|
||||
|
||||
CPPFLAGS += -I../include
|
||||
LDLIBS += -ldl -lcrypto
|
||||
check-dep-zkey-cryptsetup: detect-libcryptsetup.h
|
||||
$(call check_dep, \
|
||||
"zkey-cryptsetup", \
|
||||
"detect-libcryptsetup.h", \
|
||||
"cryptsetup-devel version 2.0.3", \
|
||||
"HAVE_CRYPTSETUP2=0", \
|
||||
"-I.")
|
||||
$(call check_dep, \
|
||||
"zkey-cryptsetup", \
|
||||
"json-c/json.h", \
|
||||
"json-c-devel", \
|
||||
"HAVE_JSONC=0")
|
||||
|
||||
all: check_dep zkey
|
||||
zkey-skip:
|
||||
echo " SKIP zkey due to HAVE_OPENSSL=0"
|
||||
|
||||
libs = $(rootdir)/libutil/libutil.a
|
||||
zkey-cryptsetup-skip-cryptsetup2:
|
||||
echo " SKIP zkey-cryptsetup due to HAVE_CRYPTSETUP2=0"
|
||||
|
||||
zkey-cryptsetup-skip-jsonc:
|
||||
echo " SKIP zkey-cryptsetup due to HAVE_JSONC=0"
|
||||
|
||||
all: $(BUILD_TARGETS)
|
||||
|
||||
zkey.o: zkey.c pkey.h misc.h
|
||||
pkey.o: pkey.c pkey.h
|
||||
properties.o: properties.c properties.h
|
||||
properties.o: check-dep-zkey properties.c properties.h
|
||||
keystore.o: keystore.c keystore.h properties.h
|
||||
zkey-cryptsetup.o: check-dep-zkey-cryptsetup zkey-cryptsetup.c pkey.h misc.h
|
||||
|
||||
zkey: zkey.o pkey.o properties.o keystore.o $(libs)
|
||||
zkey: LDLIBS = -ldl -lcrypto
|
||||
zkey: zkey.o pkey.o properties.o keystore.o $(LIBS)
|
||||
|
||||
install: all
|
||||
zkey-cryptsetup: LDLIBS = -ldl -lcryptsetup -ljson-c
|
||||
zkey-cryptsetup: zkey-cryptsetup.o pkey.o $(LIBS)
|
||||
|
||||
install-common:
|
||||
$(INSTALL) -d -m 755 $(DESTDIR)$(USRBINDIR)
|
||||
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 zkey $(DESTDIR)$(USRBINDIR)
|
||||
$(INSTALL) -d -m 755 $(DESTDIR)$(MANDIR)/man1
|
||||
|
||||
install-zkey:
|
||||
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 zkey $(DESTDIR)$(USRBINDIR)
|
||||
$(INSTALL) -m 644 -c zkey.1 $(DESTDIR)$(MANDIR)/man1
|
||||
$(INSTALL) -d -m 770 $(DESTDIR)$(SYSCONFDIR)/zkey
|
||||
$(INSTALL) -d -m 770 $(DESTDIR)$(SYSCONFDIR)/zkey/repository
|
||||
|
||||
endif
|
||||
install-zkey-cryptsetup:
|
||||
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 zkey-cryptsetup $(DESTDIR)$(USRBINDIR)
|
||||
$(INSTALL) -m 644 -c zkey-cryptsetup.1 $(DESTDIR)$(MANDIR)/man1
|
||||
|
||||
install: all install-common $(INSTALL_TARGETS)
|
||||
|
||||
clean:
|
||||
rm -f *.o zkey
|
||||
rm -f *.o zkey zkey-cryptsetup detect-libcryptsetup.h
|
||||
|
||||
.PHONY: all install clean
|
||||
|
||||
584
zkey/keystore.c
584
zkey/keystore.c
File diff suppressed because it is too large
Load Diff
@@ -30,16 +30,17 @@ int keystore_generate_key(struct keystore *keystore, const char *name,
|
||||
const char *description, const char *volumes,
|
||||
const char *apqns, size_t sector_size,
|
||||
size_t keybits, bool xts, const char *clear_key_file,
|
||||
int pkey_fd);
|
||||
const char *volume_type, int pkey_fd);
|
||||
|
||||
int keystore_import_key(struct keystore *keystore, const char *name,
|
||||
const char *description, const char *volumes,
|
||||
const char *apqns, size_t sector_size,
|
||||
const char *import_file);
|
||||
const char *import_file, const char *volume_type);
|
||||
|
||||
int keystore_change_key(struct keystore *keystore, const char *name,
|
||||
const char *description, const char *volumes,
|
||||
const char *apqns, long int sector_size);
|
||||
const char *apqns, long int sector_size,
|
||||
const char *volume_type);
|
||||
|
||||
int keystore_rename_key(struct keystore *keystore, const char *name,
|
||||
const char *newname);
|
||||
@@ -63,12 +64,14 @@ int keystore_remove_key(struct keystore *keystore, const char *name,
|
||||
bool quiet);
|
||||
|
||||
int keystore_list_keys(struct keystore *keystore, const char *name_filter,
|
||||
const char *volume_filter, const char *apqn_filter);
|
||||
const char *volume_filter, const char *apqn_filter,
|
||||
const char *volume_type);
|
||||
|
||||
int keystore_cryptsetup(struct keystore *keystore, const char *volume_filter,
|
||||
bool execute);
|
||||
bool execute, const char *volume_type);
|
||||
|
||||
int keystore_crypttab(struct keystore *keystore, const char *volume_filter);
|
||||
int keystore_crypttab(struct keystore *keystore, const char *volume_filter,
|
||||
const char *volume_type);
|
||||
|
||||
void keystore_free(struct keystore *keystore);
|
||||
|
||||
|
||||
158
zkey/pkey.c
158
zkey/pkey.c
@@ -11,11 +11,13 @@
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/if_alg.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -25,6 +27,12 @@
|
||||
|
||||
#include "pkey.h"
|
||||
|
||||
#ifndef AF_ALG
|
||||
#define AF_ALG 38
|
||||
#endif
|
||||
#ifndef SOL_ALG
|
||||
#define SOL_ALG 279
|
||||
#endif
|
||||
|
||||
#define pr_verbose(verbose, fmt...) do { \
|
||||
if (verbose) \
|
||||
@@ -34,6 +42,8 @@
|
||||
#define DOUBLE_KEYSIZE_FOR_XTS(keysize, xts) ((xts) ? 2 * (keysize) : (keysize))
|
||||
#define HALF_KEYSIZE_FOR_XTS(keysize, xts) ((xts) ? (keysize) / 2 : (keysize))
|
||||
|
||||
#define MAX_CIPHER_LEN 32
|
||||
|
||||
/*
|
||||
* Definitions for the CCA library
|
||||
*/
|
||||
@@ -367,6 +377,8 @@ int generate_secure_key_random(int pkey_fd, const char *keyfile,
|
||||
if (rc < 0) {
|
||||
rc = -errno;
|
||||
warnx("Failed to generate a secure key: %s", strerror(errno));
|
||||
warnx("Make sure that all available CCA crypto adapters are "
|
||||
"setup with the same master key");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -378,6 +390,8 @@ int generate_secure_key_random(int pkey_fd, const char *keyfile,
|
||||
rc = -errno;
|
||||
warnx("Failed to generate a secure key: %s",
|
||||
strerror(errno));
|
||||
warnx("Make sure that all available CCA crypto "
|
||||
"adapters are setup with the same master key");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -465,6 +479,8 @@ int generate_secure_key_clear(int pkey_fd, const char *keyfile,
|
||||
rc = -errno;
|
||||
warnx("Failed to generate a secure key from a "
|
||||
"clear key: %s", strerror(errno));
|
||||
warnx("Make sure that all available CCA crypto adapters are "
|
||||
"setup with the same master key");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -479,6 +495,8 @@ int generate_secure_key_clear(int pkey_fd, const char *keyfile,
|
||||
rc = -errno;
|
||||
warnx("Failed to generate a secure key from "
|
||||
"a clear key: %s", strerror(errno));
|
||||
warnx("Make sure that all available CCA crypto "
|
||||
"adapters are setup with the same master key");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -746,3 +764,143 @@ int validate_secure_key(int pkey_fd,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a key verification pattern of a secure key by encrypting the all
|
||||
* zero message with the secure key using the AF_ALG interface
|
||||
*
|
||||
* @param[in] key the secure key token
|
||||
* @param[in] key_size the size of the secure key
|
||||
* @param[in] vp buffer where the verification pattern is returned
|
||||
* @param[in] vp_len the size of the buffer
|
||||
* @param[in] verbose if true, verbose messages are printed
|
||||
*
|
||||
* @returns 0 on success, a negative errno in case of an error
|
||||
*/
|
||||
int generate_key_verification_pattern(const char *key, size_t key_size,
|
||||
char *vp, size_t vp_len, bool verbose)
|
||||
{
|
||||
int tfmfd = -1, opfd = -1, rc = 0;
|
||||
char null_msg[ENC_ZERO_LEN];
|
||||
char enc_zero[ENC_ZERO_LEN];
|
||||
struct af_alg_iv *alg_iv;
|
||||
struct cmsghdr *header;
|
||||
uint32_t *type;
|
||||
ssize_t len;
|
||||
size_t i;
|
||||
|
||||
struct sockaddr_alg sa = {
|
||||
.salg_family = AF_ALG,
|
||||
.salg_type = "skcipher",
|
||||
};
|
||||
struct iovec iov = {
|
||||
.iov_base = (void *)null_msg,
|
||||
.iov_len = sizeof(null_msg),
|
||||
};
|
||||
int iv_msg_size = CMSG_SPACE(sizeof(*alg_iv) + PAES_BLOCK_SIZE);
|
||||
char buffer[CMSG_SPACE(sizeof(*type)) + iv_msg_size];
|
||||
struct msghdr msg = {
|
||||
.msg_control = buffer,
|
||||
.msg_controllen = sizeof(buffer),
|
||||
.msg_iov = &iov,
|
||||
.msg_iovlen = 1,
|
||||
};
|
||||
|
||||
if (vp_len < VERIFICATION_PATTERN_LEN) {
|
||||
rc = -EMSGSIZE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
snprintf((char *)sa.salg_name, sizeof(sa.salg_name), "%s(paes)",
|
||||
key_size > SECURE_KEY_SIZE ? "xts" : "cbc");
|
||||
|
||||
tfmfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
|
||||
if (tfmfd < 0) {
|
||||
rc = -errno;
|
||||
pr_verbose(verbose, "Failed to open an AF_ALG socket");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (bind(tfmfd, (struct sockaddr *)&sa, sizeof(sa)) < 0) {
|
||||
rc = -errno;
|
||||
pr_verbose(verbose, "Failed to bind the AF_ALG socket, "
|
||||
"salg_name='%s' ", sa.salg_name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (setsockopt(tfmfd, SOL_ALG, ALG_SET_KEY, key,
|
||||
key_size) < 0) {
|
||||
rc = -errno;
|
||||
pr_verbose(verbose, "Failed to set the key");
|
||||
goto out;
|
||||
}
|
||||
|
||||
opfd = accept(tfmfd, NULL, 0);
|
||||
if (opfd < 0) {
|
||||
rc = -errno;
|
||||
pr_verbose(verbose, "Failed to accept on the AF_ALG socket");
|
||||
goto out;
|
||||
}
|
||||
|
||||
memset(null_msg, 0, sizeof(null_msg));
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
|
||||
header = CMSG_FIRSTHDR(&msg);
|
||||
if (header == NULL) {
|
||||
pr_verbose(verbose, "Failed to obtain control message header");
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
header->cmsg_level = SOL_ALG;
|
||||
header->cmsg_type = ALG_SET_OP;
|
||||
header->cmsg_len = CMSG_LEN(sizeof(*type));
|
||||
type = (void *)CMSG_DATA(header);
|
||||
*type = ALG_OP_ENCRYPT;
|
||||
|
||||
header = CMSG_NXTHDR(&msg, header);
|
||||
if (header == NULL) {
|
||||
pr_verbose(verbose, "Failed to obtain control message "
|
||||
"header");
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
header->cmsg_level = SOL_ALG;
|
||||
header->cmsg_type = ALG_SET_IV;
|
||||
header->cmsg_len = iv_msg_size;
|
||||
alg_iv = (void *)CMSG_DATA(header);
|
||||
alg_iv->ivlen = PAES_BLOCK_SIZE;
|
||||
memcpy(alg_iv->iv, null_msg, PAES_BLOCK_SIZE);
|
||||
|
||||
len = sendmsg(opfd, &msg, 0);
|
||||
if (len != ENC_ZERO_LEN) {
|
||||
pr_verbose(verbose, "Failed to send to the AF_ALG socket");
|
||||
rc = -errno;
|
||||
goto out;
|
||||
}
|
||||
|
||||
len = read(opfd, enc_zero, sizeof(enc_zero));
|
||||
if (len != ENC_ZERO_LEN) {
|
||||
pr_verbose(verbose, "Failed to receive from the AF_ALG socket");
|
||||
rc = -errno;
|
||||
goto out;
|
||||
}
|
||||
|
||||
memset(vp, 0, vp_len);
|
||||
for (i = 0; i < sizeof(enc_zero); i++)
|
||||
sprintf(&vp[i * 2], "%02x", enc_zero[i]);
|
||||
|
||||
pr_verbose(verbose, "Key verification pattern: %s", vp);
|
||||
|
||||
out:
|
||||
if (opfd != -1)
|
||||
close(opfd);
|
||||
if (tfmfd != -1)
|
||||
close(tfmfd);
|
||||
|
||||
if (rc != 0)
|
||||
pr_verbose(verbose, "Failed to generate the key verification "
|
||||
"pattern: %s", strerror(-rc));
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -93,6 +93,10 @@ typedef void (*t_CSNBKTC)(long *return_code,
|
||||
unsigned char *rule_array,
|
||||
unsigned char *key_identifier);
|
||||
|
||||
#define PAES_BLOCK_SIZE 16
|
||||
#define ENC_ZERO_LEN (2 * PAES_BLOCK_SIZE)
|
||||
#define VERIFICATION_PATTERN_LEN (2 * ENC_ZERO_LEN + 1)
|
||||
|
||||
int load_cca_library(void **lib_csulcca, t_CSNBKTC *dll_CSNBKTC, bool verbose);
|
||||
|
||||
int open_pkey_device(bool verbose);
|
||||
@@ -122,4 +126,7 @@ int key_token_change(t_CSNBKTC dll_CSNBKTC,
|
||||
u8 *secure_key, unsigned int secure_key_size,
|
||||
char *method, bool verbose);
|
||||
|
||||
int generate_key_verification_pattern(const char *key, size_t key_size,
|
||||
char *vp, size_t vp_len, bool verbose);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -149,6 +149,7 @@ void properties_free(struct properties *properties)
|
||||
free(property->name);
|
||||
free(property->value);
|
||||
util_list_remove(&properties->list, property);
|
||||
free(property);
|
||||
}
|
||||
|
||||
free(properties);
|
||||
@@ -259,6 +260,7 @@ int properties_remove(struct properties *properties, const char *name)
|
||||
free(property->name);
|
||||
free(property->value);
|
||||
util_list_remove(&properties->list, property);
|
||||
free(property);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -614,10 +616,13 @@ char *str_list_remove(const char *str_list, const char *str)
|
||||
*/
|
||||
void str_list_free_string_array(char **strings)
|
||||
{
|
||||
char **list = strings;
|
||||
|
||||
util_assert(strings != NULL, "Internal error: strings is NULL");
|
||||
|
||||
while (*strings != NULL) {
|
||||
free((void *)*strings);
|
||||
strings++;
|
||||
}
|
||||
free(list);
|
||||
}
|
||||
|
||||
403
zkey/zkey-cryptsetup.1
Normal file
403
zkey/zkey-cryptsetup.1
Normal file
@@ -0,0 +1,403 @@
|
||||
.\" Copyright IBM Corp. 2018
|
||||
.\" s390-tools is free software; you can redistribute it and/or modify
|
||||
.\" it under the terms of the MIT license. See LICENSE for details.
|
||||
.\"
|
||||
.TH ZKEY\-CRYPTSETUP 1 "May 2018" "s390-tools"
|
||||
.SH NAME
|
||||
zkey\-cryptsetup \- Manage secure AES volume keys of volumes encrypted with
|
||||
\fBLUKS2\fP and the \fBpaes\fP cipher
|
||||
.
|
||||
.
|
||||
.SH SYNOPSIS
|
||||
.B zkey\-cryptsetup
|
||||
.I command
|
||||
.I device
|
||||
.RI [ OPTIONS ]
|
||||
.
|
||||
.PP
|
||||
.B zkey\-cryptsetup
|
||||
.RI [ command ]
|
||||
.BR \-\-help | \-h
|
||||
.br
|
||||
.B zkey\-cryptsetup
|
||||
.BR \-\-version | \-v
|
||||
.
|
||||
.
|
||||
.
|
||||
.SH DESCRIPTION
|
||||
Use \fBzkey\-cryptsetup\fP to validate and re-encipher secure AES
|
||||
volume keys of volumes encrypted with \fBLUKS2\fP and the \fBpaes\fP cipher.
|
||||
These secure AES volume keys are enciphered with a master key of an IBM
|
||||
cryptographic adapter in CCA coprocessor mode.
|
||||
.PP
|
||||
To encrypt a volume using \fBLUKS2\fP and the \fBpaes\fP cipher, generate a
|
||||
secure AES key using \fBzkey\fP: \fB'zkey generate luks.key --xts'\fP.
|
||||
Then format the device with \fBcryptsetup\fP using the just generated secure
|
||||
AES key from file luks.key: \fB'cryptsetup luksFormat <device> --type luks2
|
||||
--cipher paes-xts-plain64 --master-key-file luks.key --key-size 1024'\fP. For
|
||||
more details about \fBzkey\fP or \fBcryptsetup\fP see the
|
||||
corresponding man pages.
|
||||
.
|
||||
.
|
||||
.
|
||||
.SH COMMANDS
|
||||
.
|
||||
.
|
||||
.SS "Validate secure AES volume keys"
|
||||
.
|
||||
.B zkey\-cryptsetup
|
||||
.BR validate | val
|
||||
.I device
|
||||
.RB [ \-\-key\-file | \-d
|
||||
.IR file-name ]
|
||||
.RB [ \-\-keyfile\-offset | \-o
|
||||
.IR bytes ]
|
||||
.RB [ \-\-keyfile\-size | \-l
|
||||
.IR bytes ]
|
||||
.RB [ \-\-tries | \-T
|
||||
.IR number ]
|
||||
.RB [ \-\-verbose | \-V ]
|
||||
.RB [ \-\-debug | \-D ]
|
||||
.PP
|
||||
Use the
|
||||
.B validate
|
||||
command to validate a secure AES volume key of a volume encrypted with
|
||||
\fBLUKS2\fP and the \fBpaes\fP cipher.
|
||||
It checks if the LUKS2 header of the volume contains a valid secure key.
|
||||
It also displays the attributes of the secure key, such as key size, whether
|
||||
it is a secure key that can be used for the XTS cipher mode, and the master key
|
||||
register (CURRENT or OLD) with which the secure key is enciphered.
|
||||
For further information about master key registers, see the
|
||||
\fBreencipher\fP command.
|
||||
.PP
|
||||
To open a key slot contained in the LUKS2 header of the volume, a passphrase is
|
||||
required. You are prompted for the passphrase, unless option
|
||||
.B \-\-key\-file
|
||||
is specified. Option
|
||||
.B \-\-tries
|
||||
specifies how often a passphrase can be re-entered. When option
|
||||
.B \-\-key\-file
|
||||
is specified, the passphrase is read from the specified file. You can specify
|
||||
options
|
||||
.B \-\-keyfile\-offset
|
||||
and
|
||||
.B \-\-keyfile\-size
|
||||
to control which part of the key file is used as passphrase. These options
|
||||
behave in the same way as with \fBcryptsetup\fP.
|
||||
.
|
||||
.SS "Re-encipher secure AES volume keys"
|
||||
.
|
||||
.PP
|
||||
.B zkey\-cryptsetup
|
||||
.BR reencipher | re
|
||||
.I device
|
||||
.RB [ \-\-staged | \-s ]
|
||||
.RB [ \-\-in\-place | \-i ]
|
||||
.RB [ \-\-complete | \-c ]
|
||||
.RB [ \-\-key\-file | \-d
|
||||
.IR file-name ]
|
||||
.RB [ \-\-keyfile\-offset | \-o
|
||||
.IR bytes ]
|
||||
.RB [ \-\-keyfile\-size | \-l
|
||||
.IR bytes ]
|
||||
.RB [ \-\-tries | \-T
|
||||
.IR number ]
|
||||
.RB [ \-\-verbose | \-V ]
|
||||
.RB [ \-\-debug | \-D ]
|
||||
.PP
|
||||
Use the
|
||||
.B reencipher
|
||||
command to re-encipher a secure AES volume key of a volume encrypted with
|
||||
\fBLUKS2\fP and the \fBpaes\fP cipher. A secure AES volume key must be
|
||||
re-enciphered when the master key of the cryptographic adapter in CCA
|
||||
coprocessor mode changes.
|
||||
.PP
|
||||
The cryptographic adapter in CCA coprocessor mode has three different registers
|
||||
to store master keys:
|
||||
.RS 2
|
||||
.IP "\(bu" 2
|
||||
The \fBCURRENT\fP register contains the current master key.
|
||||
.
|
||||
.IP "\(bu" 2
|
||||
The \fBOLD\fP register contains the previously used master key.
|
||||
Secure keys enciphered with the master key contained in the \fBOLD\fP
|
||||
register can still be used until the master key is changed again.
|
||||
.
|
||||
.IP "\(bu" 2
|
||||
The \fBNEW\fP register contains the new master key to be set.
|
||||
The master key in the \fBNEW\fP register cannot be used until it is made
|
||||
the current master key. You can pro-actively re-encipher a secure key with the
|
||||
\fBNEW\fP master key before this key is made the \fBCURRENT\fP key.
|
||||
.RE
|
||||
.PP
|
||||
\fBzkey\-cryptsetup\fP automatically detects whether the secure volume key
|
||||
is currently enciphered with the master key in the \fBOLD\fP register or with
|
||||
the master key in the \fBCURRENT\fP register. If currently enciphered with the
|
||||
master key in the \fBOLD\fP register, it is re-enciphered with the master key
|
||||
in the \fBCURRENT\fP register. If it is currently enciphered with the master
|
||||
key in the \fBCURRENT\fP register, it is re-enciphered with the master key in
|
||||
the \fBNEW\fP register. If for this case the \fBNEW\fP register does not
|
||||
contain a valid master key, then the re-encipher operation fails.
|
||||
.PP
|
||||
Re-enciphering a secure volume key of a volume encrypted with
|
||||
\fBLUKS2\fP and the \fBpaes\fP cipher can be performed \fBin-place\fP, or in
|
||||
\fBstaged\fP mode.
|
||||
.PP
|
||||
\fB"In-place"\fP immediately replaces the secure volume key in the LUKS2
|
||||
header of the encrypted volume with the re-enciphered secure volume key.
|
||||
Re-enciphering from \fBOLD\fP to \fBCURRENT\fP is performed in-place per
|
||||
default. You can use option \fB--in-place\fP to force an in-place
|
||||
re-enciphering for the \fBCURRENT\fP to \fBNEW\fP case. Be aware that
|
||||
an encrypted volume with a secure volume key that was re-enciphered in-place
|
||||
from \fBCURRENT\fP to \fBNEW\fP is no longer usable, until the new CCA master
|
||||
key has been made the current one.
|
||||
.PP
|
||||
\fBStaged\fP mode means that the re-enciphered secure volume key is stored in a
|
||||
separate (unbound) key slot in the LUKS2 header of the encrypted volume. Thus
|
||||
all key slots containing the current secure volume key are still valid at this
|
||||
point. Once the new CCA master key has been set (made active), you must rerun
|
||||
the reencipher command with option \fB--complete\fP to complete the staged
|
||||
re-enciphering. When completing the staged re-enciphering, the (unbound) key
|
||||
slot containing the re-enciphered secure volume key becomes the active
|
||||
key slot and, optionally, all key slots containing the old secure volume key
|
||||
are removed.
|
||||
Re-enciphering from \fBCURRENT\fP to \fBNEW\fP is performed in staged mode per
|
||||
default. You can use option \fB--staged\fP to force a staged re-enciphering for
|
||||
the \fBOLD\fP to \fBCURRENT\fP case.
|
||||
.PP
|
||||
To open a key slot contained in the LUKS2 header of the volume, a passphrase is
|
||||
required. You are prompted for the passphrase, unless option
|
||||
.B \-\-key\-file
|
||||
is specified. Option
|
||||
.B \-\-tries
|
||||
specifies how often a passphrase can be re-entered. When option
|
||||
.B \-\-key\-file
|
||||
is specified, the passphrase is read from the specified file. You can specify
|
||||
options
|
||||
.B \-\-keyfile\-offset
|
||||
and
|
||||
.B \-\-keyfile\-size
|
||||
to control which part of the key file is used as passphrase. These options
|
||||
behave in the same way as with \fBcryptsetup\fP.
|
||||
.PP
|
||||
.B Note:
|
||||
The \fBreencipher\fP command requires the CCA host library (libcsulcca.so)
|
||||
to be installed.
|
||||
.
|
||||
.
|
||||
.
|
||||
.SS "Set a verification pattern of the secure AES volume key"
|
||||
.
|
||||
.B zkey\-cryptsetup
|
||||
.BR setvp | setv
|
||||
.I device
|
||||
.RB [ \-\-key\-file | \-d
|
||||
.IR file-name ]
|
||||
.RB [ \-\-keyfile\-offset | \-o
|
||||
.IR bytes ]
|
||||
.RB [ \-\-keyfile\-size | \-l
|
||||
.IR bytes ]
|
||||
.RB [ \-\-tries | \-T
|
||||
.IR number ]
|
||||
.RB [ \-\-verbose | \-V ]
|
||||
.RB [ \-\-debug | \-D ]
|
||||
.PP
|
||||
Use the
|
||||
.B setvp
|
||||
command to set a verification pattern of the secure AES volume key of a volume
|
||||
encrypted with \fBLUKS2\fP and the \fBpaes\fP cipher. The verification pattern
|
||||
identifies the effective key used to encrypt the volume's data.
|
||||
The verification pattern is stored in a token named
|
||||
\fBpaes-verification-pattern\fP in the LUKS2 header.
|
||||
.PP
|
||||
.B Note:
|
||||
Set the verification pattern right after formatting the volume using
|
||||
\fB'cryptsetup luksFormat'\fP.
|
||||
.PP
|
||||
To open a key slot contained in the LUKS2 header of the volume, a passphrase is
|
||||
required. You are prompted for the passphrase, unless option
|
||||
.B \-\-key\-file
|
||||
is specified. Option
|
||||
.B \-\-tries
|
||||
specifies how often a passphrase can be re-entered. When option
|
||||
.B \-\-key\-file
|
||||
is specified, the passphrase is read from the specified file. You can specify
|
||||
options
|
||||
.B \-\-keyfile\-offset
|
||||
and
|
||||
.B \-\-keyfile\-size
|
||||
to control which part of the key file is used as passphrase. These options
|
||||
behave in the same way as with \fBcryptsetup\fP.
|
||||
.
|
||||
.
|
||||
.
|
||||
.SS "Set a new secure AES volume key for a volume"
|
||||
.
|
||||
.B zkey\-cryptsetup
|
||||
.BR setkey | setk
|
||||
.I device
|
||||
.BR \-\-master\-key\-file | \-m
|
||||
.IR file-name
|
||||
.RB [ \-\-key\-file | \-d
|
||||
.IR file-name ]
|
||||
.RB [ \-\-keyfile\-offset | \-o
|
||||
.IR bytes ]
|
||||
.RB [ \-\-keyfile\-size | \-l
|
||||
.IR bytes ]
|
||||
.RB [ \-\-tries | \-T
|
||||
.IR number ]
|
||||
.RB [ \-\-verbose | \-V ]
|
||||
.RB [ \-\-debug | \-D ]
|
||||
.PP
|
||||
Use the
|
||||
.B setkey
|
||||
command to set a new secure AES volume key for a volume encrypted with
|
||||
\fBLUKS2\fP and the \fBpaes\fP cipher. Use this command to recover from an
|
||||
invalid secure AES volume key contained in the LUKS2 header.
|
||||
A secure AES volume key contained in the LUKS2 header can become invalid when
|
||||
the CCA master key is changed without re-enciphering the secure volume key.
|
||||
.PP
|
||||
You can recover the secure volume key only if you have a copy of the secure key
|
||||
in a file, and this copy was re-enciphered when the CCA master key has been
|
||||
changed. Thus, the copy of the secure key must be currently enciphered with the
|
||||
CCA master key in the CURRENT or OLD master key register.
|
||||
Specify the secure key file with option
|
||||
.B \-\-master\-key\-file
|
||||
to set this secure key as the new volume key.
|
||||
.PP
|
||||
In case the LUKS2 header of the volume contains a verification pattern token,
|
||||
it is used to ensure that the new volume key contains the same effective key.
|
||||
If no verification pattern token is available, then you are prompted to confirm
|
||||
that the specified secure key is the correct one.
|
||||
.B ATTENTION:
|
||||
If you set a wrong secure key you will loose all the data on the encrypted
|
||||
volume!
|
||||
.PP
|
||||
To open a key slot contained in the LUKS2 header of the volume, a passphrase is
|
||||
required. You are prompted for the passphrase, unless option
|
||||
.B \-\-key\-file
|
||||
is specified. Option
|
||||
.B \-\-tries
|
||||
specifies how often a passphrase can be re-entered. When option
|
||||
.B \-\-key\-file
|
||||
is specified, the passphrase is read from the specified file. You can specify
|
||||
options
|
||||
.B \-\-keyfile\-offset
|
||||
and
|
||||
.B \-\-keyfile\-size
|
||||
to control which part of the key file is used as passphrase. These options
|
||||
behave in the same way the same as with \fBcryptsetup\fP.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.SH OPTIONS
|
||||
.
|
||||
.SS "Options for the reencipher command"
|
||||
.TP
|
||||
.BR \-i ", " \-\-in-place
|
||||
Forces an in-place re-enciphering of a secure volume key in the LUKS2
|
||||
header. This option immediately replaces the secure volume key in the LUKS2
|
||||
header of the encrypted volume with the re-enciphered secure volume key.
|
||||
Re-enciphering from \fBOLD\fP to \fBCURRENT\fP is performed in-place per
|
||||
default.
|
||||
.TP
|
||||
.BR \-s ", " \-\-staged
|
||||
Forces that the re-enciphering of a secure volume key in the LUKS2
|
||||
header is performed in staged mode. Staged mode means that the re-enciphered
|
||||
secure volume key is stored in a separate (unbound) key slot in the LUKS2
|
||||
header of the encrypted volume. Thus all key slots containing the current
|
||||
secure volume key are still valid at this point. Once the new CCA master key
|
||||
has been set (made active), you must rerun the reencipher command with option
|
||||
\fB--complete\fP to complete the staged re-enciphering. Re-enciphering from
|
||||
\fBCURRENT\fP to \fBNEW\fP is performed in staged mode per default.
|
||||
.TP
|
||||
.BR \-p ", " \-\-complete
|
||||
Completes a staged re-enciphering. Use this option after the new CCA master key
|
||||
has been set (made active). When completing the staged re-enciphering, the
|
||||
(unbound) key slot containing the re-enciphered secure volume key becomes
|
||||
the active key slot and, optionally, all key slots containing the old secure
|
||||
volume key are removed.
|
||||
.
|
||||
.
|
||||
.
|
||||
.SS "Options for the setkey command"
|
||||
.TP
|
||||
.BR \-m ", " \-\-master\-key\-file\~\fIfile\-name\fP
|
||||
Specifies the name of a file containing the secure AES key that is set as the
|
||||
new volume key.
|
||||
.
|
||||
.
|
||||
.
|
||||
.SS "Options for supplying the passphrase"
|
||||
.TP
|
||||
.BR \-d ", " \-\-key\-file\~\fIfile\-name\fP
|
||||
Reads the passphrase from the specified file. If this option is omitted,
|
||||
or if the file\-name is \fI-\fP (a dash), then you are prompted to enter the
|
||||
passphrase interactively.
|
||||
.TP
|
||||
.BR \-o ", " \-\-keyfile\-offset\~\fIbytes\fP
|
||||
Specifies the number of bytes to skip before starting to read in the file
|
||||
specified with option \fB\-\-key\-file\fP. If omitted, the file is read
|
||||
from the beginning. When option \fB\-\-key\-file\fP is not specified, this
|
||||
option is ignored.
|
||||
.TP
|
||||
.BR \-l ", " \-\-keyfile\-size\~\fIbytes\fP
|
||||
Specifies the number of bytes to be read from the beginning of the file
|
||||
specified with option \fB\-\-key\-file\fP. If omitted, the file is read
|
||||
until the end. When \fB\-\-keyfile\-offset\fP is also specified, reading starts
|
||||
at the offset. When option \fB\-\-key\-file\fP is not specified, this option is
|
||||
ignored.
|
||||
.TP
|
||||
.BR \-T ", " \-\-tries\~\fInumber\fP
|
||||
Specifies how often the interactive input of the passphrase can be re-entered.
|
||||
The default is 3 times. When option \fB\-\-key\-file\fP is specified, this
|
||||
option is ignored, and the passphrase is read only once from the file.
|
||||
.
|
||||
.
|
||||
.
|
||||
.SS "General options"
|
||||
.TP
|
||||
.BR \-V ", " \-\-verbose
|
||||
Displays additional information messages during processing.
|
||||
.TP
|
||||
.BR \-D ", " \-\-debug
|
||||
Displays additional debugging messages during processing. This option also
|
||||
implies \fB\-\-verbose\fP.
|
||||
.TP
|
||||
.BR \-h ", " \-\-help
|
||||
Displays help text and exits.
|
||||
.TP
|
||||
.BR \-v ", " \-\-version
|
||||
Displays version information and exits.
|
||||
.
|
||||
.
|
||||
.
|
||||
.SH EXAMPLES
|
||||
.TP
|
||||
.B zkey-cryptsetup reencipher /dev/dasdd1
|
||||
Re-enciphers the secure volume key of the encrypted volume /dev/dasdd1.
|
||||
.TP
|
||||
.B zkey-cryptsetup reencipher /dev/dasdd1 \-\-staged
|
||||
Re-enciphers the secure volume key of the encrypted volume /dev/dasdd1 in
|
||||
staged mode.
|
||||
.TP
|
||||
.B zkey-cryptsetup reencipher /dev/dasdd1 \-\-complete
|
||||
Completes re-enciphers the secure volume key of the encrypted
|
||||
volume /dev/dasdd1.
|
||||
.TP
|
||||
.B zkey-cryptsetup reencipher /dev/dasdd1 \-\-in\-place
|
||||
Re-enciphers the secure volume key of the encrypted volume /dev/dasdd1 in
|
||||
in-place mode.
|
||||
.TP
|
||||
.B zkey-cryptsetup validate /dev/dasdd1
|
||||
Validates the secure volume key of the encrypted volume /dev/dasdd1 and
|
||||
displays its attributes.
|
||||
.TP
|
||||
.B zkey-cryptsetup setvp /dev/dasdd1
|
||||
Sets the verification pattern of the secure volume key of the encrypted
|
||||
volume /dev/dasdd1.
|
||||
.TP
|
||||
.B zkey-cryptsetup setkey /dev/dasdd1 --master-key-file seckey.key
|
||||
Sets the secure key contained in file seckey.key as the new volume key
|
||||
for the encrypted volume /dev/dasdd1.
|
||||
2270
zkey/zkey-cryptsetup.c
Normal file
2270
zkey/zkey-cryptsetup.c
Normal file
File diff suppressed because it is too large
Load Diff
296
zkey/zkey.1
296
zkey/zkey.1
@@ -75,30 +75,32 @@ key repository.
|
||||
.BR generate | gen
|
||||
.I secure\-key\-file
|
||||
.RB [ \-\-keybits | \-k
|
||||
.IB size ]
|
||||
.IR size ]
|
||||
.RB [ \-\-xts | \-x ]
|
||||
.RB [ \-\-clearkey | \-c
|
||||
.IB clear\-key\-file ]
|
||||
.IR clear\-key\-file ]
|
||||
.RB [ \-\-verbose | \-V ]
|
||||
.
|
||||
.PP
|
||||
.B zkey
|
||||
.BR generate | gen
|
||||
.B \-\-name | \-N
|
||||
.IB key-name
|
||||
.IR key-name
|
||||
.RB [ \-\-description | \-d
|
||||
.IB description ]
|
||||
.IR description ]
|
||||
.RB [ \-\-volumes | \-l
|
||||
.IB volume1:dmname1[,volume2:dmname2[,...]] ]
|
||||
.IR volume1:dmname1[,volume2:dmname2[,...]] ]
|
||||
.RB [ \-\-apqns | \-a
|
||||
.IB card1.domain1[,card2.domain2[,...]] ]
|
||||
.IR card1.domain1[,card2.domain2[,...]] ]
|
||||
.RB [ \-\-sector-size | \-S
|
||||
.IB bytes ]
|
||||
.IR bytes ]
|
||||
.RB [ \-\-volume-type | \-t
|
||||
.IR type ]
|
||||
.RB [ \-\-keybits | \-k
|
||||
.IB size ]
|
||||
.IR size ]
|
||||
.RB [ \-\-xts | \-x ]
|
||||
.RB [ \-\-clearkey | \-c
|
||||
.IB clear\-key\-file ]
|
||||
.IR clear\-key\-file ]
|
||||
.RB [ \-\-verbose | \-V ]
|
||||
.PP
|
||||
Use the
|
||||
@@ -115,16 +117,16 @@ The generated secure key can either be stored in a file in the file system,
|
||||
or in the secure key repository. To store the generated secure key in a
|
||||
file, specify the file name with option \fIsecure\-key\-file\fP. To store the
|
||||
secure key in the secure key repository, specify the name of the key using the
|
||||
.B --name
|
||||
.B \-\-name
|
||||
option. When storing the secure key in a key repository,
|
||||
additional information can be associated with a secure key using the
|
||||
.B --description
|
||||
.B \-\-description
|
||||
,
|
||||
.B --volumes
|
||||
.B \-\-volumes
|
||||
,
|
||||
.B --apqns
|
||||
.B \-\-apqns
|
||||
, or the
|
||||
.B --sector-size
|
||||
.B \-\-sector-size
|
||||
options.
|
||||
.
|
||||
.SS "Validating secure AES keys"
|
||||
@@ -138,7 +140,7 @@ options.
|
||||
.B zkey
|
||||
.BR validate | val
|
||||
.RB [ \-\-name | \-N
|
||||
.IB key-name ]
|
||||
.IR key-name ]
|
||||
.RB [ \-\-verbose | \-V ]
|
||||
.PP
|
||||
Use the
|
||||
@@ -156,10 +158,10 @@ secure key repository. To validate a secure key contained in a file, specify
|
||||
the file name with option \fIsecure\-key\-file\fP. To validate secure keys
|
||||
contained in the secure key repository, specify the name of the key
|
||||
or a pattern containing wildcards using the
|
||||
.B --name
|
||||
.B \-\-name
|
||||
option. When wildcards are used you must quote the value.
|
||||
If neither option \fIsecure\-key\-file\fP nor option
|
||||
.B --name
|
||||
.B \-\-name
|
||||
are specified, then all secure keys contained in the key repository
|
||||
are validated.
|
||||
.
|
||||
@@ -171,15 +173,15 @@ are validated.
|
||||
.RB [ \-\-to\-new | \-n ]
|
||||
.RB [ \-\-from\-old | \-o ]
|
||||
.RB [ \-\-output | \-f
|
||||
.IB output\-file ]
|
||||
.IR output\-file ]
|
||||
.RB [ \-\-verbose | \-V ]
|
||||
.PP
|
||||
.B zkey
|
||||
.BR reencipher | re
|
||||
.RB [ \-\-name | \-N
|
||||
.IB key-name ]
|
||||
.IR key-name ]
|
||||
.RB [ \-\-apqns | \-a
|
||||
.IB card1.domain1[,card2.domain2[,...]] ]
|
||||
.IR card1.domain1[,card2.domain2[,...]] ]
|
||||
.RB [ \-\-to\-new | \-n ]
|
||||
.RB [ \-\-from\-old | \-o ]
|
||||
.RB [ \-\-in-place | \-i ]
|
||||
@@ -190,7 +192,7 @@ are validated.
|
||||
Use the
|
||||
.B reencipher
|
||||
command to re-encipher an existing secure key with a new master key.
|
||||
A secure key bust be re-enciphered when the master key of the CCA
|
||||
A secure key must be re-enciphered when the master key of the CCA
|
||||
cryptographic adapter changes.
|
||||
.PP
|
||||
The CCA cryptographic adapter has three different registers to store
|
||||
@@ -243,18 +245,18 @@ secure key repository. To re-encipher a secure key contained in a file,
|
||||
specify the file name with option \fIsecure\-key\-file\fP. To re-encipher
|
||||
secure keys contained in the secure key repository, specify the name of the key
|
||||
or a pattern containing wildcards using the
|
||||
.B --name
|
||||
.B \-\-name
|
||||
option. When wildcards are used you must quote the value.
|
||||
You can also specify the
|
||||
.B --apqns
|
||||
.B \-\-apqns
|
||||
option to re-encipher those secure
|
||||
keys which are associated with the specified cryptographic adapters (APQNs).
|
||||
You can use wildcards for the APQN specification.
|
||||
When wildcards are used you must quote the value.
|
||||
If both option
|
||||
.B --name
|
||||
.B \-\-name
|
||||
and option
|
||||
.B --apqns
|
||||
.B \-\-apqns
|
||||
are specified then all secure keys
|
||||
contained in the key repository that match both patterns are re-enciphered.
|
||||
If all both options are omitted, then all secure keys contained in the key
|
||||
@@ -265,7 +267,7 @@ performed \fBin-place\fP, or in \fBstaged\fP mode.
|
||||
.PP
|
||||
\fB"In-place"\fP immediately replaces the secure key in the repository with
|
||||
the re-enciphered secure key. Re-enciphering from \fBOLD\fP to \fBCURRENT\fP is
|
||||
performed in-place per default. You can use option \fB--in-place\fP to force an
|
||||
performed in-place per default. You can use option \fB\-\-in-place\fP to force an
|
||||
in-place re-enciphering for the \fBCURRENT\fP to \fBNEW\fP case. Be aware that
|
||||
a secure key that was re-enciphered in-place from \fBCURRENT\fP to \fBNEW\fP
|
||||
is no longer valid, until the new CCA master key has been made the current one.
|
||||
@@ -273,9 +275,9 @@ is no longer valid, until the new CCA master key has been made the current one.
|
||||
\fBStaged\fP mode means that the re-enciphered secure key is stored in a
|
||||
separate file in the secure key repository. Thus the current secure key is still
|
||||
valid at this point. Once the new CCA master key has been set (made active), you
|
||||
must rerun the reencipher command with option \fB--complete\fP to complete the
|
||||
must rerun the reencipher command with option \fB\-\-complete\fP to complete the
|
||||
staged re-enciphering. Re-enciphering from \fBCURRENT\fP to \fBNEW\fP is
|
||||
performed in staged mode per default. You can use option \fB--staged\fP to force
|
||||
performed in staged mode per default. You can use option \fB\-\-staged\fP to force
|
||||
a staged re-enciphering for the \fBOLD\fP to \fBCURRENT\fP case.
|
||||
.PP
|
||||
.B Note:
|
||||
@@ -288,15 +290,17 @@ to be installed.
|
||||
.BR import | im
|
||||
.I secure\-key\-file
|
||||
.B \-\-name | \-N
|
||||
.IB key-name
|
||||
.IR key-name
|
||||
.RB [ \-\-description | \-d
|
||||
.IB description ]
|
||||
.IR description ]
|
||||
.RB [ \-\-volumes | \-l
|
||||
.IB volume1:dmname1[,volume2:dmname2[,...]] ]
|
||||
.IR volume1:dmname1[,volume2:dmname2[,...]] ]
|
||||
.RB [ \-\-apqns | \-a
|
||||
.IB card1.domain1[,card2.domain2[,...]] ]
|
||||
.IR card1.domain1[,card2.domain2[,...]] ]
|
||||
.RB [ \-\-sector-size | \-S
|
||||
.IB bytes ]
|
||||
.IR bytes ]
|
||||
.RB [ \-\-volume-type | \-t
|
||||
.IR type ]
|
||||
.RB [ \-\-verbose | \-V ]
|
||||
.
|
||||
.PP
|
||||
@@ -305,13 +309,13 @@ Use the
|
||||
command to import an existing secure key contained in a file into the the
|
||||
secure key repository. When importing a secure key in a key repository,
|
||||
additional information can be associated with a secure key using the
|
||||
.B --description
|
||||
.B \-\-description
|
||||
,
|
||||
.B --volumes
|
||||
.B \-\-volumes
|
||||
,
|
||||
.B --apqns
|
||||
.B \-\-apqns
|
||||
, or the
|
||||
.B --sector-size
|
||||
.B \-\-sector-size
|
||||
options.
|
||||
.
|
||||
.SS "Export AES secure keys from the secure key repository"
|
||||
@@ -320,7 +324,7 @@ options.
|
||||
.BR export | ex
|
||||
.I secure\-key\-file
|
||||
.B \-\-name | \-N
|
||||
.IB key-name
|
||||
.IR key-name
|
||||
.RB [ \-\-verbose | \-V ]
|
||||
.
|
||||
.PP
|
||||
@@ -329,7 +333,7 @@ Use the
|
||||
command to export an existing secure key contained in the secure key repository
|
||||
to a file in the file system. Specify the name of the key that is to be exported
|
||||
using the
|
||||
.B --name
|
||||
.B \-\-name
|
||||
option. You cannot use wildcards.
|
||||
When wildcards are used you must quote the value.
|
||||
The exported secure key also remains in the secure key repository.
|
||||
@@ -339,20 +343,22 @@ The exported secure key also remains in the secure key repository.
|
||||
.B zkey
|
||||
.BR list | li
|
||||
.RB [ \-\-name | \-N
|
||||
.IB key-name ]
|
||||
.IR key-name ]
|
||||
.RB [ \-\-volumes | \-l
|
||||
.IB volume1[:dmname1][,volume2[:dmname2][,...]] ]
|
||||
.IR volume1[:dmname1][,volume2[:dmname2][,...]] ]
|
||||
.RB [ \-\-apqns | \-a
|
||||
.IB card1.domain1[,card2.domain2[,...]] ]
|
||||
.IR card1.domain1[,card2.domain2[,...]] ]
|
||||
.RB [ \-\-volume-type | \-t
|
||||
.IR type ]
|
||||
.RB [ \-\-verbose | \-V ]
|
||||
.
|
||||
.PP
|
||||
Use the
|
||||
.B list
|
||||
command to display a list of secure keys contained in the secure key repository.
|
||||
You can filter the displayed list by key name, associated volumes, and
|
||||
associated cryptographic adapters (APQNs). You can use wildcards for the key
|
||||
name, associated APQNs, and associated volumes. The device-mapper name of an
|
||||
You can filter the displayed list by key name, associated volumes, associated
|
||||
cryptographic adapters (APQNs), and volume type. You can use wildcards for the
|
||||
key name, associated APQNs, and associated volumes. The device-mapper name of an
|
||||
associated volume can be omitted; if it is specified then only those keys are
|
||||
listed that are associated with the specified volume and device-mapper name.
|
||||
.PP
|
||||
@@ -361,15 +367,15 @@ The
|
||||
command displays the attributes of the secure keys, such as key sizes,
|
||||
whether it is a secure key that can be used for the XTS cipher mode, the textual
|
||||
description, associated cryptographic adapters (APQNs) and volumes, the
|
||||
sector size, and timestamps for key creation, last modification and last
|
||||
re-encipherment.
|
||||
sector size, the key verification pattern, and timestamps for key creation, last
|
||||
modification and last re-encipherment.
|
||||
.
|
||||
.SS "Remove existing AES secure keys from the secure key repository"
|
||||
.
|
||||
.B zkey
|
||||
.BR remove | rem
|
||||
.B \-\-name | \-N
|
||||
.IB key-name
|
||||
.IR key-name
|
||||
.RB [ \-\-force | \-F ]
|
||||
.RB [ \-\-verbose | \-V ]
|
||||
.
|
||||
@@ -378,10 +384,10 @@ Use the
|
||||
.B remove
|
||||
command to remove an existing secure key from the secure key repository.
|
||||
Specify the name of the key that is to be removed using the
|
||||
.B --name
|
||||
.B \-\-name
|
||||
option. You cannot use wildcards. The remove command prompts for
|
||||
a confirmation, unless you specify the
|
||||
.B --force
|
||||
.B \-\-force
|
||||
option.
|
||||
.PP
|
||||
.B Note:
|
||||
@@ -395,43 +401,45 @@ secure key.
|
||||
.B zkey
|
||||
.BR change | ch
|
||||
.B \-\-name | \-N
|
||||
.IB key-name
|
||||
.IR key-name
|
||||
.RB [ \-\-description | \-d
|
||||
.IB description ]
|
||||
.IR description ]
|
||||
.RB [ \-\-volumes | \-l
|
||||
.IB [+|-]volume1:dmname1[,volume2:dmname2[,...]] ]
|
||||
.IR [+|-]volume1:dmname1[,volume2:dmname2[,...]] ]
|
||||
.RB [ \-\-apqns | \-a
|
||||
.IB [+|-]card1.domain1[,card2.domain2[,...]] ]
|
||||
.IR [+|-]card1.domain1[,card2.domain2[,...]] ]
|
||||
.RB [ \-\-sector-size | \-S
|
||||
.IB bytes ]
|
||||
.IR bytes ]
|
||||
.RB [ \-\-volume-type | \-t
|
||||
.IR type ]
|
||||
.RB [ \-\-verbose | \-V ]
|
||||
.
|
||||
.PP
|
||||
Use the
|
||||
.B change
|
||||
command to change the description, the associated volumes, the associated
|
||||
cryptographic adapters (APQNs), and the sector size of a secure key contained
|
||||
in the secure key repository. Specify the name of the key that is to be changed
|
||||
using the
|
||||
.B --name
|
||||
cryptographic adapters (APQNs), the sector size, and the volume type of a secure
|
||||
key contained in the secure key repository. Specify the name of the key that is
|
||||
to be changed using the
|
||||
.B \-\-name
|
||||
option. You cannot use wildcards.
|
||||
.PP
|
||||
You can set (replace), add, or
|
||||
remove volume and cryptographic adapters (APQN) associations. To set
|
||||
(replace) an association, specify the association with the
|
||||
.B --volumes
|
||||
.B \-\-volumes
|
||||
or the
|
||||
.B --apqns
|
||||
.B \-\-apqns
|
||||
options. To add an association,
|
||||
specify the new association prefixed with a \fI+\fP with the
|
||||
.B --volumes
|
||||
.B \-\-volumes
|
||||
or the
|
||||
.B --apqns
|
||||
.B \-\-apqns
|
||||
options. To remove an association,
|
||||
specify the association to remove prefixed with a \fI-\fP with the
|
||||
.B --volumes
|
||||
.B \-\-volumes
|
||||
or the
|
||||
.B --apqns
|
||||
.B \-\-apqns
|
||||
options. You cannot mix \fI+\fP and
|
||||
\fI-\fP in one specification. You can either add or remove (or set) the
|
||||
associations with one command.
|
||||
@@ -447,9 +455,9 @@ command.
|
||||
.B zkey
|
||||
.BR rename | ren
|
||||
.B \-\-name | \-N
|
||||
.IB key-name
|
||||
.IR key-name
|
||||
.B \-\-new-name | \-w
|
||||
.IB new-key-name
|
||||
.IR new-key-name
|
||||
.RB [ \-\-verbose | \-V ]
|
||||
.
|
||||
.PP
|
||||
@@ -457,9 +465,9 @@ Use the
|
||||
.B rename
|
||||
command to rename an existing secure key in the secure key repository.
|
||||
Specify the name of the key that is to be renamed using the
|
||||
.B --name
|
||||
.B \-\-name
|
||||
option and the new name using the
|
||||
.B --new-name
|
||||
.B \-\-new-name
|
||||
option. You cannot use wildcards.
|
||||
.
|
||||
.SS "Copy (duplicate) existing AES secure keys in the secure key repository"
|
||||
@@ -467,11 +475,11 @@ option. You cannot use wildcards.
|
||||
.B zkey
|
||||
.B copy | co
|
||||
.RB \-\-name | \-N
|
||||
.IB key-name
|
||||
.IR key-name
|
||||
.B \-\-new-key-name | \-w
|
||||
.IB new-name
|
||||
.IR new-name
|
||||
.RB [ \-\-volumes | \-l
|
||||
.IB volume1:dmname1[,volume2:dmname2[,...]] ]
|
||||
.IR volume1:dmname1[,volume2:dmname2[,...]] ]
|
||||
.RB [ \-\-verbose | \-V ]
|
||||
.
|
||||
.PP
|
||||
@@ -479,15 +487,15 @@ Use the
|
||||
.B copy
|
||||
command to copy (duplicate) an existing secure key in the secure key repository.
|
||||
Specify the name of the key that is to be copied using the
|
||||
.B --name
|
||||
.B \-\-name
|
||||
option and the name of the copied key using the
|
||||
.B --new-name
|
||||
.B \-\-new-name
|
||||
option. You cannot use wildcards.
|
||||
.PP
|
||||
.B Note:
|
||||
When copying a secure key, the volume associations are not copied, because
|
||||
a specific volume can only be associated with a single secure key. Specify the
|
||||
.B --volumes
|
||||
.B \-\-volumes
|
||||
option to associate different
|
||||
volumes with the copied secure key, or use the \fBchange\fP command to associate
|
||||
volumes afterwards.
|
||||
@@ -497,45 +505,56 @@ volumes afterwards.
|
||||
.B zkey
|
||||
.BR crypttab | cryptt
|
||||
.RB [ \-\-volumes | \-l
|
||||
.IB volume1[:dmname1][,volume2[:dmname2][,...]] ]
|
||||
.IR volume1[:dmname1][,volume2[:dmname2][,...]] ]
|
||||
.RB [ \-\-volume-type | \-t
|
||||
.IR type ]
|
||||
.RB [ \-\-verbose | \-V ]
|
||||
.
|
||||
.PP
|
||||
Use the
|
||||
.B crypttab
|
||||
command to generate crypttab entries using the \fBplain\fP dm-crypt mode
|
||||
for volumes that are associated with secure keys contained in the secure key
|
||||
repository. Specify the
|
||||
.B --volumes
|
||||
command to generate crypttab entries using the \fBplain\fP or \fBLUKS2\fP
|
||||
dm-crypt mode for volumes that are associated with secure keys contained in the
|
||||
secure key repository. Specify the
|
||||
.B \-\-volumes
|
||||
option to limit the list
|
||||
of volumes where crypttab entries are generated for. You can use wildcards.
|
||||
When wildcards are used you must quote the value.
|
||||
The device-mapper name of an associated volume can be omitted; if it is
|
||||
specified then only those volumes with the specified volume and device-mapper
|
||||
name are selected.
|
||||
Specify the
|
||||
.B \-\-volume-type
|
||||
option to generate crypttab entries for the specified volume type only.
|
||||
.
|
||||
.SS "Generate cryptsetup commands for volumes associated with secure AES keys"
|
||||
.
|
||||
.B zkey
|
||||
.BR cryptsetup | crypts
|
||||
.RB [ \-\-volumes | \-l
|
||||
.IB volume1[:dmname1][,volume2[:dmname2][,...]] ]
|
||||
.IR volume1[:dmname1][,volume2[:dmname2][,...]] ]
|
||||
.RB [ \-\-volume-type | \-t
|
||||
.IR type ]
|
||||
.RB [ \-\-run | \-r ]
|
||||
.RB [ \-\-verbose | \-V ]
|
||||
.
|
||||
.PP
|
||||
Use the
|
||||
.B cryptsetup
|
||||
command to generate \fBcryptsetup plainOpen\fP commands for volumes that are
|
||||
associated with secure keys contained in the secure key repository. Specify the
|
||||
.B --volumes
|
||||
command to generate \fBcryptsetup plainOpen\fP or \fBcryptsetup luksFormat\fP
|
||||
commands for volumes that are associated with secure keys contained in the
|
||||
secure key repository. Specify the
|
||||
.B \-\-volumes
|
||||
option to limit the list
|
||||
of volumes where cryptsetup commands are generated for. You can use wildcards.
|
||||
When wildcards are used you must quote the value.
|
||||
The device-mapper name of an associated volume can be omitted; if it is
|
||||
specified then only those volumes with the specified volume and device-mapper
|
||||
name are selected. Specify the
|
||||
.B --run
|
||||
.B \-\-volume-type
|
||||
option to generate cryptsetup commands for the specified volume type only.
|
||||
Specify the
|
||||
.B \-\-run
|
||||
option to run the generated cryptsetup commands.
|
||||
.
|
||||
.
|
||||
@@ -589,8 +608,17 @@ This option is only used for secure keys contained in the secure key repository.
|
||||
.TP
|
||||
.BR \-S ", " \-\-sector-size\~\fIbytes\fP
|
||||
Specifies the sector size in bytes used with dm-crypt. It must be a power of two
|
||||
and in the range 512 - 4096 bytes. If omitted, the system default sector size
|
||||
is used.
|
||||
and in the range of 512 to 4096 bytes. If omitted, the system default sector
|
||||
size is used.
|
||||
This option is only used for secure keys contained in the secure key repository.
|
||||
.TP
|
||||
.BR \-t ", " \-\-volume-type\~\fItype\fP
|
||||
Specifies the volume type of the associated volumes used with dm-crypt. Possible
|
||||
values are \fBplain\fP and \fBluks2\fP. If omitted, \fBluks2\fP is used.
|
||||
This option is only available if
|
||||
.B zkey
|
||||
has been compiled with LUKS2 support enabled. If LUKS2 support is not enabled,
|
||||
the default volume type is \fBplain\fP.
|
||||
This option is only used for secure keys contained in the secure key repository.
|
||||
.
|
||||
.
|
||||
@@ -650,7 +678,7 @@ repository is performed in staged mode. Staged mode means that the re-enciphered
|
||||
secure key is stored in a separate file in the secure key repository. Thus the
|
||||
current secure key is still valid at this point. Once the new CCA master key has
|
||||
been set (made active), you must rerun the reencipher command with option
|
||||
\fB--complete\fP to complete the staged re-enciphering.
|
||||
\fB\-\-complete\fP to complete the staged re-enciphering.
|
||||
Re-enciphering from CURRENT to NEW is performed in staged mode per default.
|
||||
This option is only used for secure keys contained in the secure key repository.
|
||||
.TP
|
||||
@@ -690,8 +718,17 @@ This option is only used for secure keys contained in the secure key repository.
|
||||
.TP
|
||||
.BR \-S ", " \-\-sector-size\~\fIbytes\fP
|
||||
Specifies the sector size in bytes used with dm-crypt. It must be a power of two
|
||||
and in the range 512 - 4096 bytes. If omitted, the system default sector size
|
||||
is used.
|
||||
and in the range of 512 to 4096 bytes. If omitted, the system default sector
|
||||
size is used.
|
||||
This option is only used for secure keys contained in the secure key repository.
|
||||
.TP
|
||||
.BR \-t ", " \-\-volume-type\~\fItype\fP
|
||||
Specifies the volume type of the associated volumes used with dm-crypt. Possible
|
||||
values are \fBplain\fP and \fBluks2\fP. If omitted, \fBluks2\fP is used.
|
||||
This option is only available if
|
||||
.B zkey
|
||||
has been compiled with LUKS2 support enabled. If LUKS2 support is not enabled,
|
||||
the default volume type is \fBplain\fP.
|
||||
This option is only used for secure keys contained in the secure key repository.
|
||||
.
|
||||
.
|
||||
@@ -734,6 +771,15 @@ APQNs. Each APQN association specifies a card and domain number separated
|
||||
by a period (like lszcrypt displays it). You can use wildcards in the APQN
|
||||
specification.
|
||||
This option is only used for secure keys contained in the secure key repository.
|
||||
.TP
|
||||
.BR \-t ", " \-\-volume-type\~\fItype\fP
|
||||
Specifies the volume type of the associated volumes used with dm-crypt. Possible
|
||||
values are \fBplain\fP and \fBluks2\fP. Only keys with the specified volume
|
||||
type are listed.
|
||||
This option is only available if
|
||||
.B zkey
|
||||
has been compiled with LUKS2 support enabled.
|
||||
This option is only used for secure keys contained in the secure key repository.
|
||||
.
|
||||
.
|
||||
.
|
||||
@@ -791,9 +837,16 @@ This option is only used for secure keys contained in the secure key repository.
|
||||
.TP
|
||||
.BR \-S ", " \-\-sector-size\~\fIbytes\fP
|
||||
Specifies the sector size in bytes used with dm-crypt. It must be a power of two
|
||||
and in the range 512 - 4096 bytes. If omitted, the system default sector size
|
||||
is used. Specify \fI0\fP to un-set the sector size so that the system default
|
||||
is used.
|
||||
and in the range of 512 to 4096 bytes. Specify \fI0\fP to set the sector size
|
||||
to the system default.
|
||||
This option is only used for secure keys contained in the secure key repository.
|
||||
.TP
|
||||
.BR \-t ", " \-\-volume-type\~\fItype\fP
|
||||
Specifies the volume type of the associated volumes used with dm-crypt. Possible
|
||||
values are \fBplain\fP and \fBluks2\fP.
|
||||
This option is only available if
|
||||
.B zkey
|
||||
has been compiled with LUKS2 support enabled.
|
||||
This option is only used for secure keys contained in the secure key repository.
|
||||
.
|
||||
.
|
||||
@@ -845,6 +898,15 @@ specified volume and device-mapper name. You can use wildcards to specify
|
||||
the volumes and device-mapper names.
|
||||
When wildcards are used you must quote the value.
|
||||
This option is only used for secure keys contained in the secure key repository.
|
||||
.TP
|
||||
.BR \-t ", " \-\-volume-type\~\fItype\fP
|
||||
Specifies the volume type of the associated volumes used with dm-crypt. Possible
|
||||
values are \fBplain\fP and \fBluks2\fP. Only keys with the specified volume
|
||||
type are selected to generate crypttab entries for.
|
||||
This option is only available if
|
||||
.B zkey
|
||||
has been compiled with LUKS2 support enabled.
|
||||
This option is only used for secure keys contained in the secure key repository.
|
||||
.
|
||||
.
|
||||
.
|
||||
@@ -861,10 +923,18 @@ the volumes and device-mapper names.
|
||||
When wildcards are used you must quote the value.
|
||||
This option is only used for secure keys contained in the secure key repository.
|
||||
.TP
|
||||
.BR \-r ", " \-\-run\fP
|
||||
Runs the generated cryptsetup commands. When an execution of a cryptsetup
|
||||
command fails, no further cryptsetup commands are executed, and zkey ends
|
||||
with an error.
|
||||
.BR \-t ", " \-\-volume-type\~\fItype\fP
|
||||
Specifies the volume type of the associated volumes used with dm-crypt. Possible
|
||||
values are \fBplain\fP and \fBluks2\fP. Only keys with the specified volume
|
||||
type are selected to generate cryptsetup commands for.
|
||||
This option is only available if
|
||||
.B zkey
|
||||
has been compiled with LUKS2 support enabled.
|
||||
This option is only used for secure keys contained in the secure key repository.
|
||||
.TP
|
||||
.BR \-r ", " \-\-run
|
||||
Runs the generated cryptsetup commands. When one of the cryptsetup command fail,
|
||||
no further cryptsetup commands are run, and zkey ends with an error.
|
||||
This option is only used for secure keys contained in the secure key repository.
|
||||
.
|
||||
.
|
||||
@@ -895,15 +965,20 @@ in file 'seckey.bin'.
|
||||
Generates a secure AES key from the clear key in file 'clearkey.bin' and
|
||||
stores it in file 'seckey.bin'.
|
||||
.TP
|
||||
.B zkey generate --name seckey
|
||||
.B zkey generate \-\-name seckey
|
||||
Generates a random 256-bit secure AES key and stores it in the secure key
|
||||
repository under the name 'seckey'.
|
||||
repository using the name 'seckey'.
|
||||
.TP
|
||||
.B zkey generate --name seckey --volumes /dev/dasdc1:encvol --apqns 03.004c
|
||||
.B zkey generate \-\-name seckey \-\-volumes /dev/dasdc1:encvol \-\-apqns 03.004c
|
||||
Generates a random 256-bit secure AES key and stores it in the secure key
|
||||
repository under the name 'seckey' and associates it with block
|
||||
repository using the name 'seckey' and associates it with block
|
||||
device '/dev/dasdc1' and device-mapper name 'encvol', and APQN '03.004c'.
|
||||
.TP
|
||||
.B zkey generate \-\-name seckey \-\-volumes /dev/dasdc1:encvol \-\-volume-type luks2
|
||||
Generates a random 256-bit secure AES key and stores it in the secure key
|
||||
repository using the name 'seckey' and associates it with block
|
||||
device '/dev/dasdc1' and device-mapper name 'encvol', and a volume type of luks2.
|
||||
.TP
|
||||
.B zkey reencipher seckey.bin \-\-from\-old
|
||||
Re-enciphers the secure key in file 'seckey.bin' which is currently enciphered
|
||||
with the master key in the OLD register with the master key in the CURRENT
|
||||
@@ -915,17 +990,17 @@ Re-enciphers the secure key in file 'seckey.bin' which is currently enciphered
|
||||
with the master key in the CURRENT register with the master key in the NEW
|
||||
register, and saves the re-enciphered secure key to file 'seckey2.bin'.
|
||||
.TP
|
||||
.B zkey reencipher --name seckey
|
||||
.B zkey reencipher \-\-name seckey
|
||||
Re-enciphers the secure key 'seckey' in the secure key repository.
|
||||
.TP
|
||||
.B zkey reencipher --apqns 03.004c
|
||||
.B zkey reencipher \-\-apqns 03.004c
|
||||
Re-enciphers all secure keys contained in the secure key repository that are
|
||||
associated with APQN '03.004c'.
|
||||
.TP
|
||||
.B zkey validate seckey.bin
|
||||
Validates the secure key in file 'seckey.bin' and displays its attributes.
|
||||
.TP
|
||||
.B zkey validate --name seckey
|
||||
.B zkey validate \-\-name seckey
|
||||
Validates the secure key 'seckey' in the secure key repository and displays its
|
||||
attributes.
|
||||
.TP
|
||||
@@ -933,25 +1008,28 @@ attributes.
|
||||
Lists all secure keys in the secure key repository and displays its
|
||||
attributes.
|
||||
.TP
|
||||
.B zkey list --name '*key'
|
||||
.B zkey list \-\-name '*key'
|
||||
Lists all secure keys in the secure key repository with names ending with 'key'
|
||||
and displays its attributes.
|
||||
.TP
|
||||
.B zkey change --name seckey --volumes +/dev/dasdc2:encvol2
|
||||
.B zkey change \-\-name seckey \-\-volumes +/dev/dasdc2:encvol2
|
||||
Changes the secure key 'seckey' in the secure key repository and adds
|
||||
volume '/dev/dasdc2' with device-mapper name 'encvol2' to the list of associated
|
||||
volumes of this secure key.
|
||||
.TP
|
||||
.B zkey change --name seckey --apqns -03.004c
|
||||
.B zkey change \-\-name seckey \-\-apqns -03.004c
|
||||
Changes the secure key 'seckey' in the secure key repository and removes
|
||||
APQN '03.004c' from the list of associated APQNs of this secure key.
|
||||
.TP
|
||||
.B zkey crypttab --volumes '/dev/dasdc*'
|
||||
.B zkey crypttab \-\-volumes '/dev/dasdc*'
|
||||
Generates crypttab entries for all volumes that match the pattern '/dev/dasdc*'.
|
||||
.TP
|
||||
.B zkey cryptsetup --volumes '*:enc_dasd'
|
||||
.B zkey cryptsetup \-\-volumes '*:enc_dasd'
|
||||
Generates cryptsetup commands for the volumes that uses the device-mapper
|
||||
name 'enc_dasd'.
|
||||
.TP
|
||||
.B zkey cryptsetup \-\-volume-type luks2
|
||||
Generates cryptsetup commands for all volumes of type luks2.
|
||||
.
|
||||
.SH ENVIRONMENT
|
||||
.TP
|
||||
|
||||
127
zkey/zkey.c
127
zkey/zkey.c
@@ -68,6 +68,7 @@ static struct zkey_globals {
|
||||
char *volumes;
|
||||
char *apqns;
|
||||
long int sector_size;
|
||||
char *volume_type;
|
||||
char *newname;
|
||||
bool run;
|
||||
bool force;
|
||||
@@ -180,6 +181,16 @@ static struct util_opt opt_vec[] = {
|
||||
"used",
|
||||
.command = COMMAND_GENERATE,
|
||||
},
|
||||
#ifdef HAVE_LUKS2_SUPPORT
|
||||
{
|
||||
.option = { "volume-type", required_argument, NULL, 't'},
|
||||
.argument = "type",
|
||||
.desc = "The type of the associated volume(s). Possible values "
|
||||
"are 'plain' and 'luks2'. When this option is omitted, "
|
||||
"the default is 'luks2'",
|
||||
.command = COMMAND_GENERATE,
|
||||
},
|
||||
#endif
|
||||
/***********************************************************/
|
||||
{
|
||||
.flags = UTIL_OPT_FLAG_SECTION,
|
||||
@@ -211,19 +222,23 @@ static struct util_opt opt_vec[] = {
|
||||
},
|
||||
{
|
||||
.option = {"complete", 0, NULL, 'p'},
|
||||
.desc = "Completes a pending re-enciphering of a secure AES "
|
||||
"key that was re-enciphered with the master key in the "
|
||||
"NEW register",
|
||||
.desc = "Completes a staged re-enciphering. Use this option "
|
||||
"after the new CCA master key has been set (made "
|
||||
"active)",
|
||||
.command = COMMAND_REENCIPHER,
|
||||
},
|
||||
{
|
||||
.option = {"in-place", 0, NULL, 'i'},
|
||||
.desc = "Forces an in-place re-enchipering of a secure AES key",
|
||||
.desc = "Forces an in-place re-enchipering of a secure AES "
|
||||
"key. Re-enciphering from OLD to CURRENT is performed "
|
||||
"in-place per default",
|
||||
.command = COMMAND_REENCIPHER,
|
||||
},
|
||||
{
|
||||
.option = {"staged", 0, NULL, 's'},
|
||||
.desc = "Forces a staged re-enchipering of a secure AES key",
|
||||
.desc = "Forces that the re-enciphering of a secure AES key is "
|
||||
"performed in staged mode. Re-enciphering from CURRENT "
|
||||
"to NEW is performed in staged mode per default",
|
||||
.command = COMMAND_REENCIPHER,
|
||||
},
|
||||
{
|
||||
@@ -310,6 +325,16 @@ static struct util_opt opt_vec[] = {
|
||||
"used",
|
||||
.command = COMMAND_IMPORT,
|
||||
},
|
||||
#ifdef HAVE_LUKS2_SUPPORT
|
||||
{
|
||||
.option = { "volume-type", required_argument, NULL, 't'},
|
||||
.argument = "type",
|
||||
.desc = "The type of the associated volume(s). Possible values "
|
||||
"are 'plain' and 'luks2'. When this option is omitted, "
|
||||
"the default is 'luks2'",
|
||||
.command = COMMAND_IMPORT,
|
||||
},
|
||||
#endif
|
||||
/***********************************************************/
|
||||
{
|
||||
.flags = UTIL_OPT_FLAG_SECTION,
|
||||
@@ -358,6 +383,16 @@ static struct util_opt opt_vec[] = {
|
||||
"associated with specific crypto cards",
|
||||
.command = COMMAND_LIST,
|
||||
},
|
||||
#ifdef HAVE_LUKS2_SUPPORT
|
||||
{
|
||||
.option = { "volume-type", required_argument, NULL, 't'},
|
||||
.argument = "type",
|
||||
.desc = "The type of the associated volume(s). Possible values "
|
||||
"are 'plain' and 'luks2'. Use this option to list all "
|
||||
"keys with the specified volumes type.",
|
||||
.command = COMMAND_LIST,
|
||||
},
|
||||
#endif
|
||||
/***********************************************************/
|
||||
{
|
||||
.flags = UTIL_OPT_FLAG_SECTION,
|
||||
@@ -422,11 +457,19 @@ static struct util_opt opt_vec[] = {
|
||||
.option = { "sector-size", required_argument, NULL, 'S'},
|
||||
.argument = "0|512|4096",
|
||||
.desc = "The sector size used with dm-crypt. It must be power "
|
||||
"of two and in range 512 - 4096 bytes. If this option "
|
||||
"is omitted, the system default sector size (512) is "
|
||||
"used",
|
||||
"of two and in range 512 - 4096 bytes. Specify 0 to "
|
||||
"use the system default sector size (512)",
|
||||
.command = COMMAND_CHANGE,
|
||||
},
|
||||
#ifdef HAVE_LUKS2_SUPPORT
|
||||
{
|
||||
.option = { "volume-type", required_argument, NULL, 't'},
|
||||
.argument = "type",
|
||||
.desc = "The type of the associated volume(s). Possible values "
|
||||
"are 'plain' and 'luks2'",
|
||||
.command = COMMAND_CHANGE,
|
||||
},
|
||||
#endif
|
||||
/***********************************************************/
|
||||
{
|
||||
.flags = UTIL_OPT_FLAG_SECTION,
|
||||
@@ -494,6 +537,17 @@ static struct util_opt opt_vec[] = {
|
||||
"volume and the device-mapper name matches",
|
||||
.command = COMMAND_CRYPTTAB,
|
||||
},
|
||||
#ifdef HAVE_LUKS2_SUPPORT
|
||||
{
|
||||
.option = { "volume-type", required_argument, NULL, 't'},
|
||||
.argument = "type",
|
||||
.desc = "The type of the associated volume(s). Possible values "
|
||||
"are 'plain' and 'luks2'. Use this option to select "
|
||||
"the keys by its volume type for which a crypttab "
|
||||
"entry is to be generated",
|
||||
.command = COMMAND_CRYPTTAB,
|
||||
},
|
||||
#endif
|
||||
/***********************************************************/
|
||||
{
|
||||
.flags = UTIL_OPT_FLAG_SECTION,
|
||||
@@ -512,6 +566,17 @@ static struct util_opt opt_vec[] = {
|
||||
"both, the volume and the device-mapper name matches",
|
||||
.command = COMMAND_CRYPTSETUP,
|
||||
},
|
||||
#ifdef HAVE_LUKS2_SUPPORT
|
||||
{
|
||||
.option = { "volume-type", required_argument, NULL, 't'},
|
||||
.argument = "type",
|
||||
.desc = "The type of the associated volume(s). Possible values "
|
||||
"are 'plain' and 'luks2'. Use this option to select "
|
||||
"the keys by its volume type for which a crypttab "
|
||||
"entry is to be generated",
|
||||
.command = COMMAND_CRYPTSETUP,
|
||||
},
|
||||
#endif
|
||||
{
|
||||
.option = {"run", 0, NULL, 'r'},
|
||||
.desc = "Runs the generated cryptsetup command",
|
||||
@@ -819,7 +884,7 @@ static int command_generate_repository(void)
|
||||
|
||||
rc = keystore_generate_key(g.keystore, g.name, g.description, g.volumes,
|
||||
g.apqns, g.sector_size, g.keybits, g.xts,
|
||||
g.clearkeyfile, g.pkey_fd);
|
||||
g.clearkeyfile, g.volume_type, g.pkey_fd);
|
||||
|
||||
return rc != 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
@@ -1057,6 +1122,7 @@ static int command_reencipher(void)
|
||||
*/
|
||||
static int command_validate_file(void)
|
||||
{
|
||||
char vp[VERIFICATION_PATTERN_LEN];
|
||||
size_t secure_key_size;
|
||||
size_t clear_key_size;
|
||||
u8 *secure_key;
|
||||
@@ -1089,14 +1155,30 @@ static int command_validate_file(void)
|
||||
goto out;
|
||||
}
|
||||
|
||||
rc = generate_key_verification_pattern((char *)secure_key,
|
||||
secure_key_size, vp, sizeof(vp),
|
||||
g.verbose);
|
||||
if (rc != 0) {
|
||||
warnx("Failed to generate the verification pattern: %s",
|
||||
strerror(-rc));
|
||||
warnx("Make sure that kernel module 'paes_s390' is loaded and "
|
||||
"that the 'paes' cipher is available");
|
||||
rc = EXIT_FAILURE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
printf("Validation of secure key in file '%s':\n", g.pos_arg);
|
||||
printf(" Status: Valid\n");
|
||||
printf(" Secure key size: %lu bytes\n", secure_key_size);
|
||||
printf(" Clear key size: %lu bits\n", clear_key_size);
|
||||
printf(" XTS type key: %s\n",
|
||||
printf(" Status: Valid\n");
|
||||
printf(" Secure key size: %lu bytes\n", secure_key_size);
|
||||
printf(" Clear key size: %lu bits\n", clear_key_size);
|
||||
printf(" XTS type key: %s\n",
|
||||
secure_key_size > SECURE_KEY_SIZE ? "Yes" : "No");
|
||||
printf(" Encrypted with: %s CCA master key\n",
|
||||
printf(" Enciphered with: %s CCA master key\n",
|
||||
is_old_mk ? "OLD" : "CURRENT");
|
||||
printf(" Verification pattern: %.*s\n", VERIFICATION_PATTERN_LEN / 2,
|
||||
vp);
|
||||
printf(" %.*s\n", VERIFICATION_PATTERN_LEN / 2,
|
||||
&vp[VERIFICATION_PATTERN_LEN / 2]);
|
||||
|
||||
out:
|
||||
free(secure_key);
|
||||
@@ -1150,7 +1232,8 @@ static int command_import(void)
|
||||
g.sector_size = 0;
|
||||
|
||||
rc = keystore_import_key(g.keystore, g.name, g.description, g.volumes,
|
||||
g.apqns, g.sector_size, g.pos_arg);
|
||||
g.apqns, g.sector_size, g.pos_arg,
|
||||
g.volume_type);
|
||||
|
||||
return rc != 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
@@ -1183,7 +1266,8 @@ static int command_list(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = keystore_list_keys(g.keystore, g.name, g.volumes, g.apqns);
|
||||
rc = keystore_list_keys(g.keystore, g.name, g.volumes, g.apqns,
|
||||
g.volume_type);
|
||||
|
||||
return rc != 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
@@ -1222,7 +1306,7 @@ static int command_change(void)
|
||||
}
|
||||
|
||||
rc = keystore_change_key(g.keystore, g.name, g.description, g.volumes,
|
||||
g.apqns, g.sector_size);
|
||||
g.apqns, g.sector_size, g.volume_type);
|
||||
|
||||
return rc != 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
@@ -1282,7 +1366,7 @@ static int command_crypttab(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = keystore_crypttab(g.keystore, g.volumes);
|
||||
rc = keystore_crypttab(g.keystore, g.volumes, g.volume_type);
|
||||
|
||||
return rc != 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
@@ -1296,7 +1380,7 @@ static int command_cryptsetup(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = keystore_cryptsetup(g.keystore, g.volumes, g.run);
|
||||
rc = keystore_cryptsetup(g.keystore, g.volumes, g.run, g.volume_type);
|
||||
|
||||
return rc != 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
@@ -1473,6 +1557,11 @@ int main(int argc, char *argv[])
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
break;
|
||||
#ifdef HAVE_LUKS2_SUPPORT
|
||||
case 't':
|
||||
g.volume_type = optarg;
|
||||
break;
|
||||
#endif
|
||||
case 'w':
|
||||
g.newname = optarg;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user