Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
5b69dc7c95 |
5
PKGBUILD
5
PKGBUILD
@ -17,10 +17,13 @@ pkgver() {
|
|||||||
|
|
||||||
build() {
|
build() {
|
||||||
cargo build --release --locked --all-features --target-dir=target
|
cargo build --release --locked --all-features --target-dir=target
|
||||||
|
target/release/${pkgname} completions target
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
install -Dm 755 target/release/${pkgname} -t "${pkgdir}/usr/bin"
|
install -Dm 755 target/release/${pkgname} -t "${pkgdir}/usr/bin"
|
||||||
install -Dm 755 ../pam_mount/fido2luksmounthelper.sh -t "${pkgdir}/usr/bin"
|
install -Dm 755 ../pam_mount/fido2luksmounthelper.sh -t "${pkgdir}/usr/bin"
|
||||||
install -Dm 644 ../fido2luks.bash "${pkgdir}/usr/share/bash-completion/completions/fido2luks"
|
install -Dm 644 target/fido2luks.bash "${pkgdir}/usr/share/bash-completion/completions/fido2luks"
|
||||||
|
install -Dm 755 ../initcpio/hook.sh "${pkgdir}/usr/lib/initcpio/install/fido2luks"
|
||||||
|
install -Dm 755 ../initcpio/hook.sh "${pkgdir}/usr/lib/initcpio/hooks/fido2luks"
|
||||||
}
|
}
|
||||||
|
74
initcpio/hook.sh
Normal file
74
initcpio/hook.sh
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -ax
|
||||||
|
|
||||||
|
exit_with() {
|
||||||
|
echo "$1" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
validate() {
|
||||||
|
[ ! -e /etc/fido2luks.conf ] && exit_with "/etc/fido2luks.conf does not exist! Please configure first"
|
||||||
|
. /etc/fido2luks.conf
|
||||||
|
[ ! -e "$FIDO2LUKS_DEVICE" ] && exit_with "FIDO2LUKS_DEVICE='$FIDO2LUKS_DEVICE' does not exist!"
|
||||||
|
[ -z "$FIDO2LUKS_CREDENTIAL_ID" ] && exit_with "FIDO2LUKS_CREDENTIAL_ID must be set!"
|
||||||
|
[ -z "$FIDO2LUKS_MAPPER_NAME" ] && exit_with "FIDO2LUKS_MAPPER_NAME must be set!"
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
local mod
|
||||||
|
add_binary "cryptsetup"
|
||||||
|
add_module "dm-crypt"
|
||||||
|
add_module "dm-integrity"
|
||||||
|
if [[ $CRYPTO_MODULES ]]; then
|
||||||
|
for mod in $CRYPTO_MODULES; do
|
||||||
|
add_module "$mod"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
add_all_modules "/crypto/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
add_binary "dmsetup"
|
||||||
|
add_file "/usr/lib/udev/rules.d/10-dm.rules"
|
||||||
|
add_file "/usr/lib/udev/rules.d/13-dm-disk.rules"
|
||||||
|
add_file "/usr/lib/udev/rules.d/95-dm-notify.rules"
|
||||||
|
add_file "/usr/lib/initcpio/udev/11-dm-initramfs.rules" "/usr/lib/udev/rules.d/11-dm-initramfs.rules"
|
||||||
|
|
||||||
|
add_systemd_unit "systemd-ask-password-console.path"
|
||||||
|
add_systemd_unit "systemd-ask-password-console.service"
|
||||||
|
|
||||||
|
# cryptsetup calls pthread_create(), which dlopen()s libgcc_s.so.1
|
||||||
|
add_binary "/usr/lib/libgcc_s.so.1"
|
||||||
|
|
||||||
|
# add mkswap for creating swap space on the fly (see 'swap' in crypttab(5))
|
||||||
|
add_binary "mkswap"
|
||||||
|
|
||||||
|
[[ -f /etc/crypttab.initramfs ]] && add_file "/etc/crypttab.initramfs" "/etc/crypttab"
|
||||||
|
|
||||||
|
validate
|
||||||
|
add_file "/etc/fido2luks.conf" "/etc/fido2luks.conf"
|
||||||
|
add_binary "fido2luks"
|
||||||
|
add_runscipt
|
||||||
|
}
|
||||||
|
|
||||||
|
run_hook() {
|
||||||
|
modprobe -a -q dm-crypt
|
||||||
|
. /etc/fido2luks.conf
|
||||||
|
if [ -z "$FIDO2LUKS_PASSWORD_HELPER" ]; then
|
||||||
|
export FIDO2LUKS_PASSWORD_HELPER="systemd-ask-password 'FIDO2 password salt for $FIDO2LUKS_DEVICE'"
|
||||||
|
fi
|
||||||
|
fido2luks open
|
||||||
|
}
|
||||||
|
|
||||||
|
help() {
|
||||||
|
cat <<HELPEOF
|
||||||
|
This hook allows for an encrypted root device with systemd initramfs.
|
||||||
|
|
||||||
|
See the manpage of systemd-cryptsetup-generator(8) for available kernel
|
||||||
|
command line options. Alternatively, if the file /etc/crypttab.initramfs
|
||||||
|
exists, it will be added to the initramfs as /etc/crypttab. See the
|
||||||
|
crypttab(5) manpage for more information on crypttab syntax.
|
||||||
|
HELPEOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ft=sh ts=4 sw=4 et:
|
14
initcpio/keyscript.sh
Executable file
14
initcpio/keyscript.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -a
|
||||||
|
. /etc/fido2luks.conf
|
||||||
|
|
||||||
|
if [ -z "$FIDO2LUKS_PASSWORD_HELPER" ]; then
|
||||||
|
MSG="FIDO2 password salt for $CRYPTTAB_NAME"
|
||||||
|
export FIDO2LUKS_PASSWORD_HELPER="systemd-ask-password '$MSG'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$FIDO2LUKS_USE_TOKEN" -eq 1 ]; then
|
||||||
|
export FIDO2LUKS_CREDENTIAL_ID="$FIDO2LUKS_CREDENTIAL_ID,$(fido2luks token list --csv $CRYPTTAB_SOURCE)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fido2luks print-secret --bin
|
Loading…
x
Reference in New Issue
Block a user