Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

finlstrm
Copy link

Automatically add keyscript to crypttab when enrolling if the keyscript is not already set.

thuandt added a commit to thuandt/yubikey-luks that referenced this pull request Jun 21, 2019
@@ -93,4 +93,21 @@ else
if [ "$DBG" = "1" ]; then echo "LUKS key: $R"; fi
fi

# add keyscript to /etc/crypttab

if [[ -b ${DISK} ]]
Copy link
Owner

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

-u    update initramfs config

eval $( grep ${DISK} /etc/crypttab | awk '{ print $2 }' )
fi

if ! grep 'keyscript=/usr/share/yubikey-luks/ykluks-keyscript' /etc/crypttab
Copy link
Owner

Choose a reason for hiding this comment

The 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!


if ! grep 'keyscript=/usr/share/yubikey-luks/ykluks-keyscript' /etc/crypttab
then
sed -i "/${UUID}/ s/$/,keyscript=\/usr\/share\/yubikey-luks\/ykluks-keyscript/" /etc/crypttab
Copy link
Owner

Choose a reason for hiding this comment

The 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants