commit bb45c1fbac8c2a0491a9b20c5fa686abd4b0e9de Author: Leho Kraav Date: Thu Jun 16 14:06:37 2011 -0400 working pipe system Example key created with a pipe. This ensures that a certain token has to be present in the system for sha512 to generate a correct password for unlocking the volume. /etc/conf.d/dmcrypt: target=c3 source=/dev/sda3 pipe='ls /dev/disk/by-uuid | sha512sum' diff --git a/1.1.3-dm-crypt-start.sh b/1.1.3-dm-crypt-start.sh index bc60ba0..027ff4a 100644 --- a/1.1.3-dm-crypt-start.sh +++ b/1.1.3-dm-crypt-start.sh @@ -176,7 +176,11 @@ dm_crypt_execute_dmcrypt() { ret="$?" eend "${ret}" "failure running cryptsetup" else - cryptsetup ${options} ${arg1} ${arg2} ${arg3} + if [ -n "${pipe}" ]; then + eval "${pipe}" | cryptsetup ${options} ${arg1} ${arg2} ${arg3} + else + cryptsetup ${options} ${arg1} ${arg2} ${arg3} + fi ret="$?" eend "${ret}" "failure running cryptsetup" fi @@ -249,7 +253,7 @@ parse_opt() { } local cryptfs_status=0 -local gpg_options key loop_file target targetline options pre_mount post_mount source swap remdev +local gpg_options key loop_file target targetline options pre_mount post_mount source swap remdev pipe CMDLINE="`cat /proc/cmdline`" for x in ${CMDLINE} @@ -278,10 +282,10 @@ if [[ -f ${conf_file} ]] && [[ -x /sbin/cryptsetup ]] ; then ${execute_hook} # Prepare for the next target/swap by resetting variables - unset gpg_options key loop_file target options pre_mount post_mount source swap remdev + unset gpg_options key loop_file target options pre_mount post_mount source swap remdev pipe ;; - gpg_options=*|remdev=*|key=*|loop_file=*|options=*|pre_mount=*|post_mount=*|source=*) + gpg_options=*|remdev=*|key=*|loop_file=*|options=*|pre_mount=*|post_mount=*|source=*|pipe=*) if [[ -z ${target} && -z ${swap} ]] ; then ewarn "Ignoring setting outside target/swap section: ${targetline}" continue