-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
automatticlly add keyscript to crypttab #52
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,4 +93,21 @@ else | |
if [ "$DBG" = "1" ]; then echo "LUKS key: $R"; fi | ||
fi | ||
|
||
# add keyscript to /etc/crypttab | ||
|
||
if [[ -b ${DISK} ]] | ||
then | ||
echo "${DISK} searching from disk/by-uuid" | ||
UUID="$( ls -l /dev/disk/by-uuid/ | grep $( basename ${DISK} ) | awk '{ print $9 }' )" | ||
else | ||
echo "${DISK} searching from crypttab" | ||
eval $( grep ${DISK} /etc/crypttab | awk '{ print $2 }' ) | ||
fi | ||
|
||
if ! grep 'keyscript=/usr/share/yubikey-luks/ykluks-keyscript' /etc/crypttab | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use square brackets here, to have a consistent code style. Also: I think we should only match for "keyscript"; so that we do not add a 2nd keyscript if another keyscript was already configured! |
||
then | ||
sed -i "/${UUID}/ s/$/,keyscript=\/usr\/share\/yubikey-luks\/ykluks-keyscript/" /etc/crypttab | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately this breaks for me. I think this is not very robust. Even in another shell (bash), this starts to break. |
||
update-initramfs -u | ||
fi | ||
|
||
exit 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are several yubikeys connected to a machine I would not like to update the initramfs each time a yubikey is added. So we should use a command line parameter here. Like