Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TPM2 LUKS setup
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Robotka István Adrián
TPM2 LUKS setup
Commits
b42ebd59
Verified
Commit
b42ebd59
authored
Aug 5, 2020
by
Robotka István Adrián
Browse files
Options
Downloads
Patches
Plain Diff
improved passphrase-from-tpm
parent
c176c241
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+1
-0
1 addition, 0 deletions
README.md
passphrase-from-tpm
+25
-5
25 additions, 5 deletions
passphrase-from-tpm
setup-tpm.sh
+5
-1
5 additions, 1 deletion
setup-tpm.sh
with
31 additions
and
6 deletions
README.md
+
1
−
0
View file @
b42ebd59
...
@@ -12,6 +12,7 @@ sudo apt install tpm2-tools
...
@@ -12,6 +12,7 @@ sudo apt install tpm2-tools
sudo cp
passphrase-from-tpm /usr/local/bin/passphrase-from-tpm
sudo cp
passphrase-from-tpm /usr/local/bin/passphrase-from-tpm
sudo cp
initramfs-hook /etc/initramfs-tools/hooks/tpm2
sudo cp
initramfs-hook /etc/initramfs-tools/hooks/tpm2
# add to your crypttab: ",keyscript=/usr/local/bin/passphrase-from-tpm"
sudo
nano /etc/crypttab
sudo
nano /etc/crypttab
sudo
update-initramfs
-u
sudo
update-initramfs
-u
reboot
reboot
...
...
This diff is collapsed.
Click to expand it.
passphrase-from-tpm
+
25
−
5
View file @
b42ebd59
#!/bin/sh
#!/bin/sh
# halt on error
set
-e
set
-e
echo
"Unlocking via TPM"
>
&2
export
TPM2TOOLS_TCTI
=
"device:/dev/tpm0"
/usr/local/bin/tpm2_unseal
--object-context
0x81000000
--auth
pcr:sha256:0,5,7
[
$?
-eq
0
]
&&
exit
# successful TPM unseal
LOCK
=
"/tmp/tpm_unlock"
#export TPM2TOOLS_TCTI="device:/dev/tpm0"
user_pass
()
{
/lib/cryptsetup/askpass
\
"Unlocking the disk fallback
$CRYPTTAB_SOURCE
(
$CRYPTTAB_NAME
)
\n
Enter passphrase: "
}
/lib/cryptsetup/askpass
"Unlocking the disk fallback
$CRYPTTAB_SOURCE
(
$CRYPTTAB_NAME
)
\n
Enter passphrase: "
tpm_pass
()
{
/usr/local/bin/tpm2_unseal
\
--object-context
0x81000000
\
--auth
pcr:sha256:0,5,7
\
|
tr
-d
'\n'
}
if
[
-e
"
$LOCK
"
]
;
then
user_pass
else
echo
1
>
$LOCK
echo
"Unlocking via TPM"
>
&2
tpm_pass
[
$?
-eq
0
]
&&
exit
# successful TPM unseal
user+pass
fi
This diff is collapsed.
Click to expand it.
setup-tpm.sh
+
5
−
1
View file @
b42ebd59
...
@@ -108,4 +108,8 @@ fi
...
@@ -108,4 +108,8 @@ fi
log
"Profit"
log
"Profit"
echo
"Generated LUKS key:
$(
cat
$LUKS_PASS
)
"
echo
"Generated LUKS key:
$(
cat
$LUKS_PASS
)
"
echo
"Run: cryptsetup luksAddKey /dev/sda42"
echo
"Do NOT forget to delete folder:
$BASE
"
echo
"!!!!!!!"
echo
"! Run: cryptsetup luksAddKey /dev/sda42"
echo
"!!!!!!!"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment