From nobody Thu Sep 12 16:34:28 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4X4NLr70dwz5WCcs; Thu, 12 Sep 2024 16:34:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4X4NLr6DGNz4Q82; Thu, 12 Sep 2024 16:34:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726158868; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vquoGdNfnnHC1iCYD3BkLXnGCw4m1wBTnyDWS9xcWfc=; b=leAr6u9dm5PCMmvFXtSi0Ve5l3iBCsDMDbXvghqbjQfupa93lr1OGJ+xR5DAqp6V/s+wJ9 0rvbHMjCceXyX9YhqWZjyVHQYRTNSp3lYd9hUvo5BWEVj8h4xCjEW4yFpWjOzikvLbBfg7 u/6rTBqbhydOMQ31excu+jUhgbReLksJgSpA5srnVwbxKrfL1ocGMQ7PZO+s9g0eVH61kN qETTn7zmb94BhIWKQMA4rB4feefTjUevBrruLXXWFR97U7EDznnN8NuRLHlB/g1tuIZIe7 oIjdceHf1hkOPcGrSZ4OUrsrhyrBVR2SoJCFUTPZeGfsrhNszLtIw2VeRFrkIA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1726158868; a=rsa-sha256; cv=none; b=j74GCZPgPVWxJJbntwhVziTRcDPStQhYCiIPLTOY2hXF7a0yBxH7sODUzBat4R/9d3CI3X 4JTNudqyittZVpArro6n1t9UfPAvqoBkjkByj0WGpj0lcgpsy0R6CnA+6q+ybnuNuQYphU 4RLPSuHmVxYVrGqhyMLfmLI1XHIZw3Lh+NTN9TMyLbNIKDoqqLYczU9etp1XEcRkBvm+55 vUyLwEDretbjtjs7JJKbtb16wtzMpjYBLjdMlKI9K1sWW7xwR9ys8C8K7sWooDZ6EqmbmG 9ANxl04vfxGdh/GNpfE3gulOSeOFoM9Ukdecnomj5TDHoDub6bFUmAzemLGTfw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726158868; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vquoGdNfnnHC1iCYD3BkLXnGCw4m1wBTnyDWS9xcWfc=; b=BD6s0xD1PKXa24qJFG1Cl5BcWrU3GBbEzIhB03RGH83GrsNyiiNi0sjVFez4p72WmYCpCI iYZy4Il0ds5huZOti6bJYXroVcTP1kAlX9GGufMi/T+8NroskhTIXBjDlnAFvq8ne1xwuM H/iU6a5OXlFzTVYY0lfiQ98oXvGNpaAgxv3EHthQ4ZNqm35rMK/JkKNj2uMTTEfOzTZvme o8vPAMxUDp6rIYUW/zjwAGU2e3eozAko+N3nb4scQP+tGX/sCTict2kZaWC0osquyJbwWd 6pG4RdfLoaSUdmRO5AF6IFBOWu4xlP2/GFzfmn7gWxNAO6pRXOSd1DlUpBm30w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4X4NLr5jY2z1M0H; Thu, 12 Sep 2024 16:34:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48CGYSUM059402; Thu, 12 Sep 2024 16:34:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48CGYSAX059399; Thu, 12 Sep 2024 16:34:28 GMT (envelope-from git) Date: Thu, 12 Sep 2024 16:34:28 GMT Message-Id: <202409121634.48CGYSAX059399@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Ambrisko Subject: git: 408087f128fe - main - zfskeys: allow prompt to entered during boot up List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ambrisko X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 408087f128fe745dbfb2b8423f0afd9e0ce2d11a Auto-Submitted: auto-generated The branch main has been updated by ambrisko: URL: https://cgit.FreeBSD.org/src/commit/?id=408087f128fe745dbfb2b8423f0afd9e0ce2d11a commit 408087f128fe745dbfb2b8423f0afd9e0ce2d11a Author: Doug Ambrisko AuthorDate: 2024-09-12 15:43:03 +0000 Commit: Doug Ambrisko CommitDate: 2024-09-12 15:46:49 +0000 zfskeys: allow prompt to entered during boot up If the ZFS key is setup in prompt mode, use zfs to prompt to load the key during boot to unlock it. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D36081 --- libexec/rc/rc.d/zfskeys | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/zfskeys b/libexec/rc/rc.d/zfskeys index ea38182a66c7..aff0224d5c9d 100755 --- a/libexec/rc/rc.d/zfskeys +++ b/libexec/rc/rc.d/zfskeys @@ -45,7 +45,15 @@ unlock_fs() local kl="$2" local k="${kl##file://}" - if [ "$k" ] && [ -f "$k" ] && [ -s "$k" ] && [ -r "$k" ]; then + if [ "$kl" == "prompt" ] + then + echo "Key prompt for $fs." + if zfs load-key -L "$kl" "$fs" < /dev/tty > /dev/tty 2>/dev/tty ; then + echo "Key loaded for $fs." + else + echo "Key failed to load for $fs." + fi + elif [ "$k" ] && [ -f "$k" ] && [ -s "$k" ] && [ -r "$k" ]; then if [ "$(zfs get -Ho value keystatus "$fs")" = 'available' ]; then echo "Key already loaded for $fs." elif keytest=$(zfs load-key -n -L "$kl" "$fs" 2>&1); then