Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Nest
Puppet
Commits
628c5324
Commit
628c5324
authored
Jun 02, 2019
by
James T. Lee
Browse files
zfs: Load file based keys at boot
parent
08b773b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
6 deletions
+34
-6
files/zfs/zfs-load-key.sh
files/zfs/zfs-load-key.sh
+11
-6
manifests/profile/base/zfs.pp
manifests/profile/base/zfs.pp
+23
-0
No files found.
files/zfs/zfs-load-key.sh
View file @
628c5324
...
@@ -37,11 +37,16 @@ if [ "$(zpool list -H -o feature@encryption $(echo "${root}" | awk -F\/ '{print
...
@@ -37,11 +37,16 @@ if [ "$(zpool list -H -o feature@encryption $(echo "${root}" | awk -F\/ '{print
# if the root dataset has encryption enabled
# if the root dataset has encryption enabled
ENCRYPTIONROOT
=
$(
zfs get
-H
-o
value encryptionroot
"
${
root
}
"
)
ENCRYPTIONROOT
=
$(
zfs get
-H
-o
value encryptionroot
"
${
root
}
"
)
if
!
[
"
${
ENCRYPTIONROOT
}
"
=
"-"
]
;
then
if
!
[
"
${
ENCRYPTIONROOT
}
"
=
"-"
]
;
then
# decrypt them
KEYFORMAT
=
$(
zfs get
-H
-o
value keyformat
"
${
root
}
"
)
TRY_COUNT
=
5
if
[
"
${
KEYFORMAT
}
"
=
"passphrase"
]
;
then
while
[
$TRY_COUNT
-gt
0
]
;
do
# decrypt them
systemd-ask-password
"Encrypted ZFS password for
${
root
}
"
--no-tty
| zfs load-key
"
${
ENCRYPTIONROOT
}
"
&&
break
TRY_COUNT
=
5
TRY_COUNT
=
$((
TRY_COUNT
-
1
))
while
[
$TRY_COUNT
-gt
0
]
;
do
done
systemd-ask-password
"Encrypted ZFS password for
${
root
}
"
--no-tty
| zfs load-key
"
${
ENCRYPTIONROOT
}
"
&&
break
TRY_COUNT
=
$((
TRY_COUNT
-
1
))
done
else
zfs load-key
"
${
ENCRYPTIONROOT
}
"
fi
fi
fi
fi
fi
manifests/profile/base/zfs.pp
View file @
628c5324
...
@@ -3,6 +3,29 @@ class nest::profile::base::zfs {
...
@@ -3,6 +3,29 @@ class nest::profile::base::zfs {
ensure
=>
installed
,
ensure
=>
installed
,
}
}
$zfs_mount_override
=
@
(
EOF
)
[
Service
]
ExecStart
=
ExecStart
=/
sbin
/
zfs
mount
-
al
|
EOF
file
{
default
:
mode
=>
'0644'
,
owner
=>
'root'
,
group
=>
'root'
,
;
'/etc/systemd/system/zfs-mount.service.d'
:
ensure
=>
directory
,
;
'/etc/systemd/system/zfs-mount.service.d/load-key.conf'
:
content
=>
$zfs_mount_override
,
notify
=>
Nest
::
Systemd_reload
[
'zfs'
],
;
}
file
{
'/usr/lib/dracut/modules.d/90zfs/zfs-load-key.sh'
:
file
{
'/usr/lib/dracut/modules.d/90zfs/zfs-load-key.sh'
:
mode
=>
'0755'
,
mode
=>
'0755'
,
owner
=>
'root'
,
owner
=>
'root'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment