src/zlevis: removed key option

This commit is contained in:
Luc Bijl 2025-02-19 21:09:44 +01:00
parent 9ac3017da4
commit 5b914c13a3

View file

@ -15,14 +15,14 @@ fi
# Function to display usage information of zlevis
info() {
exec >&2
echo "Usage: \"zlevis {decrypt|encrypt} {pool|key}\""
echo "Usage: \"zlevis {decrypt|encrypt} <pool>\""
exit 2
}
# Function to display usage information of zlevis encrypt pool
encrypt_pool_info() {
exec >&2
echo "Usage: \"zlevis encrypt pool <pool> '{\"property\":\"value\"}' < file.key\""
echo "Usage: \"zlevis encrypt <pool> '{\"property\":\"value\"}' < file.key\""
echo
echo "This command uses the following configuration properties:"
echo " hash: <string> -> Hash algorithm used in the computation of the object name (default: sha256)."
@ -39,14 +39,12 @@ if [ -t 0 ]; then
"decrypt")
case "$2" in
"pool") zfs list -Ho tpm:jwe "$3" | zlevis-decrypt;;
"key") zlevis-decrypt;;
*) info;;
esac
;;
"encrypt")
case "$2" in
"pool") encrypt_pool_info;;
"key") zlevis-encrypt;;
*) info;;
esac
;;
@ -54,16 +52,9 @@ if [ -t 0 ]; then
esac
else
case "$1" in
"decrypt")
case "$2" in
"key") zlevis-decrypt;;
*) info;;
esac
;;
"encrypt")
case "$2" in
"pool") read -r -d . key || zfs set tpm:jwe=$(printf "%s" "$key" | zlevis-encrypt "$4") "$3";;
"key") zlevis-encrypt "$3";;
*) info;;
esac
;;