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

Support multiple encrypted devices #54

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions features.d/keyctl.files
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/keyctl
16 changes: 14 additions & 2 deletions initramfs-init.in
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ myopts="alpine_dev autodetect autoraid chart cryptroot cryptdm cryptheader crypt
cryptdiscards cryptkey debug_init dma init init_args keep_apk_new modules ovl_dev
pkgs quiet root_size root usbdelay ip alpine_repo apkovl alpine_start splash
blacklist overlaytmpfs overlaytmpfsflags rootfstype rootflags nbd resume s390x_net
dasd ssh_key BOOTIF zfcp"
dasd ssh_key BOOTIF zfcp luksuuid lukskeydesc"

for opt; do
case "$opt" in
Expand All @@ -364,7 +364,7 @@ for opt; do

for i in $myopts; do
case "$opt" in
$i=*) eval "KOPT_${i}"='${opt#*=}';;
$i=*) eval "KOPT_${i}=\${KOPT_${i}:+\$KOPT_${i} }${opt#*=}";;
$i) eval "KOPT_${i}=yes";;
no$i) eval "KOPT_${i}=no";;
esac
Expand Down Expand Up @@ -492,6 +492,18 @@ if [ -n "$KOPT_cryptroot" ]; then
fi
fi

if [ -n "$KOPT_lukskeydesc" ]; then
read -s -p "Passphrase for key $KOPT_lukskeydesc: "
echo -n "$REPLY" | /bin/keyctl padd user "$KOPT_lukskeydesc" @u
fi

for uuid in $KOPT_luksuuid; do
nlplug-findfs $cryptopts -p /sbin/mdev ${KOPT_debug_init:+-d} UUID=$uuid
dev=$(findfs UUID=$uuid)
echo "Unlocking $dev as luks-$uuid"
/sbin/cryptsetup open $dev luks-$uuid
done

if [ -n "$KOPT_nbd" ]; then
# TODO: Might fail because nlplug-findfs hasn't plugged eth0 yet
configure_ip
Expand Down