Received: from list by lists.gnu.org with archive (Exim 4.71) id 1elXFI-0003S8-Nx for mharc-grub-devel@gnu.org; Tue, 13 Feb 2018 04:51:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elXFF-0003Pr-53 for Grub-devel@gnu.org; Tue, 13 Feb 2018 04:51:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elXFC-000301-0s for Grub-devel@gnu.org; Tue, 13 Feb 2018 04:51:25 -0500 Received: from mail-out1.informatik.tu-muenchen.de ([131.159.0.8]:41663) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1elXFB-0002wk-JQ for Grub-devel@gnu.org; Tue, 13 Feb 2018 04:51:21 -0500 Received: by mail.in.tum.de (Postfix, from userid 107) id CC51F1C2A44; Tue, 13 Feb 2018 10:51:13 +0100 (CET) Received: (Authenticated sender: harmathy) by mail.in.tum.de (Postfix) with ESMTPSA id 3A9561C2A11; Tue, 13 Feb 2018 10:51:10 +0100 (CET) (Extended-Queue-bit tech_rjtcl@fff.in.tum.de) From: Max Harmathy Subject: LiMux GRUB-Patches To: phcoder@gmail.com, Grub-devel@gnu.org Message-ID: <0fe1f5fe-01b2-7db8-7f64-143880dcaefb@in.tum.de> Date: Tue, 13 Feb 2018 10:49:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------5D1697332E5A302DB29173A3" Content-Language: en-GB X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 131.159.0.8 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 09:51:27 -0000 This is a multi-part message in MIME format. --------------5D1697332E5A302DB29173A3 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Greetings from Munich! I talked at FOSDEM with Vladimir Serbinenko about the patches we have on top of Ubuntu patches in the grub2 package in our current LiMux release based on Ubuntu 14.04 (trusty). The main reason why we have a patched version is to restrict the fallback options using a password provided by the administrators (see attachment). The fallback options basically provide the possibility to drop to a root shell, which is not what you want on client systems in a large enterprise environment. There is a way to set a password in the Ubuntu package. I haven't looked up in which way that mechanism comes from upstream grub or is added by debian/ubuntu. Anyway it lets you set a password for all the entries or for none. Thus we use the debian debconf mechanism to set a password for the fallback options only. We very much appreciate the proposal for adding a simple configuration interface as presented at FOSDEM. Please keep our use case in mind while developing. I guess every desktop distribution would benefit from it, since most of them have such fallback options. Max --------------5D1697332E5A302DB29173A3 Content-Type: text/x-patch; name="lhm_secure_recoveryshell.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="lhm_secure_recoveryshell.patch" --- a/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in @@ -388,3 +388,14 @@ if [ "x${GRUB_BADRAM}" !=3D "x" ] ; then echo "badram ${GRUB_BADRAM}" fi + +# +# Setting up lhm password protection with password read from debconf par= am. +# +if [ "$secure_recovery_shell" =3D "true" ]; then + grubsu_GRUB_PASSWORD=3D$(debconf-show grub-pc | grep grub-pc/grub_pass= word | awk '{ print $NF }') + echo "set superusers=3D'grubsu'" + echo "password_pbkdf2 grubsu $grubsu_GRUB_PASSWORD" +fi + + --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -114,9 +114,12 @@ if [ x$type !=3D xsimple ] ; then case $type in recovery) - title=3D"$(gettext_printf "%s, with Linux %s (%s)" "${os}" "${ver= sion}" "$(gettext "${GRUB_RECOVERY_TITLE}")")" ;; + title=3D"$(gettext_printf "%s, with Linux %s (%s)" "${os}" "${ver= sion}" "$(gettext "${GRUB_RECOVERY_TITLE}")")" + [ "$secure_recovery_shell" =3D "false" ] || permission=3D"--users= grubsu" + ;; *) - title=3D"$(gettext_printf "%s, with Linux %s" "${os}" "${version}= ")" ;; + title=3D"$(gettext_printf "%s, with Linux %s" "${os}" "${version}= ")" + ;; esac if [ x"$title" =3D x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux= versions>$title" =3D x"$GRUB_ACTUAL_DEFAULT" ]; then replacement_title=3D"$(echo "Advanced options for ${OS}" | sed 's,>,>= >,g')>$(echo "$title" | sed 's,>,>>,g')" @@ -124,9 +127,9 @@ title_correction_code=3D"${title_correction_code}if [ \"x\$default\" = =3D '$quoted' ]; then default=3D'$(echo "$replacement_title" | grub_quote= )'; fi;" grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRU= B_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or lat= er)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot= _device_id>gnulinux-$version-$type-$boot_device_id")" fi - echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuent= ry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$sub= menu_indentation/" + echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuent= ry_id_option 'gnulinux-$version-$type-$boot_device_id' ${permission} {" |= sed "s/^/$submenu_indentation/" else - echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_= id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indent= ation/" + echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_= id_option 'gnulinux-simple-$boot_device_id' ${permission} {" | sed "s/^/$= submenu_indentation/" fi =20 if [ "$quick_boot" =3D 1 ]; then echo " recordfail" | sed "s/^/$submenu_indentation/" --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -393,3 +393,12 @@ sed -e "s/^/$grub_tab/" } =20 +# +# Get debconf parameter without +# +secure_recovery_shell=3D$(debconf-show grub-pc | grep grub-pc/secure_rec= overyshell | awk '{ print $NF }') +[ -n "$secure_recovery_shell" ] || secure_recovery_shell=3D"true" +[ "$secure_recovery_shell" =3D "false" ] || permission=3D"--unrestricted= " + + + --- a/util/grub.d/10_hurd.in +++ b/util/grub.d/10_hurd.in @@ -89,6 +89,7 @@ if [ x$type !=3D xsimple ] ; then if [ x$type =3D xrecovery ] ; then title=3D"$(gettext_printf "%s, with Hurd %s (%s)" "${OS}" "${kernel_b= ase}" "$(gettext "${GRUB_RECOVERY_TITLE}")")" + [ "$secure_recovery_shell" =3D "false" ] || permission=3D"--users gru= bsu" oldtitle=3D"$OS using $kernel_base ($GRUB_RECOVERY_TITLE)" else title=3D"$(gettext_printf "%s, with Hurd %s" "${OS}" "${kernel_base}"= )" @@ -100,11 +101,11 @@ grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRU= B_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or lat= er)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnuhurd-advanced-$boot_= device_id>'gnuhurd-$kernel-$type-$(grub_get_device_id "${GRUB_DEVICE_BOOT= }")'")" fi sed "s/^/$submenu_indentation/" << EOF -menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option= 'gnuhurd-$kernel-$type-$(grub_get_device_id "${GRUB_DEVICE_BOOT}")' { +menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option= 'gnuhurd-$kernel-$type-$(grub_get_device_id "${GRUB_DEVICE_BOOT}")' ${pe= rmission} { EOF else sed "s/^/$submenu_indentation/" << EOF -menuentry '$(echo "$OS" | grub_quote)' ${CLASS} \$menuentry_id_option 'g= nuhurd-simple-$(grub_get_device_id "${GRUB_DEVICE_BOOT}")' { +menuentry '$(echo "$OS" | grub_quote)' ${CLASS} \$menuentry_id_option 'g= nuhurd-simple-$(grub_get_device_id "${GRUB_DEVICE_BOOT}")' ${permission} = { EOF fi =20 --- a/util/grub.d/10_illumos.in +++ b/util/grub.d/10_illumos.in @@ -34,7 +34,7 @@ ;; esac =20 -echo "menuentry '$(echo "$OS" | grub_quote)' ${CLASS} \$menuentry_id_opt= ion 'illumos-$(grub_get_device_id "${GRUB_DEVICE_BOOT}")' {" +echo "menuentry '$(echo "$OS" | grub_quote)' ${CLASS} \$menuentry_id_opt= ion 'illumos-$(grub_get_device_id "${GRUB_DEVICE_BOOT}")' ${permission} {= " save_default_entry | grub_add_tab prepare_grub_to_access_device "${GRUB_DEVICE_BOOT}" | grub_add_tab message=3D"$(gettext_printf "Loading kernel of Illumos ...")" --- a/util/grub.d/10_kfreebsd.in +++ b/util/grub.d/10_kfreebsd.in @@ -77,6 +77,7 @@ if [ x$type !=3D xsimple ] ; then if [ x$type =3D xrecovery ] ; then title=3D"$(gettext_printf "%s, with kFreeBSD %s (%s)" "${os}" "${vers= ion}" "$(gettext "${GRUB_RECOVERY_TITLE}")")" + [ "$secure_recovery_shell" =3D "false" ] || permission=3D"--users gru= bsu" else title=3D"$(gettext_printf "%s, with kFreeBSD %s" "${os}" "${version}"= )" fi @@ -86,9 +87,9 @@ title_correction_code=3D"${title_correction_code}if [ \"x\$default\" = =3D '$quoted' ]; then default=3D'$(echo "$replacement_title" | grub_quote= )'; fi;" grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRU= B_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or lat= er)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "kfreebsd-advanced-$boot= _device_id>kfreebsd-$version-$type-$boot_device_id")" fi - echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuent= ry_id_option 'kfreebsd-$version-$type-$boot_device_id' {" | sed "s/^/$sub= menu_indentation/" + echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuent= ry_id_option 'kfreebsd-$version-$type-$boot_device_id' ${permission} {" |= sed "s/^/$submenu_indentation/" else - echo "menuentry '$(echo "$OS" | grub_quote)' ${CLASS} \$menuentry_= id_option 'kfreebsd-simple-$boot_device_id' {" | sed "s/^/$submenu_indent= ation/" + echo "menuentry '$(echo "$OS" | grub_quote)' ${CLASS} \$menuentry_= id_option 'kfreebsd-simple-$boot_device_id' ${permission} {" | sed "s/^/$= submenu_indentation/" fi if [ x$type !=3D xrecovery ] ; then save_default_entry | grub_add_tab | sed "s/^/$submenu_indentation/= " --- a/util/grub.d/10_netbsd.in +++ b/util/grub.d/10_netbsd.in @@ -103,6 +103,7 @@ if [ x$type !=3D xsimple ] ; then if [ x$type =3D xrecovery ] ; then title=3D"$(gettext_printf "%s, with kernel %s (via %s, %s)" "${OS}" "= $(echo ${kernel} | sed -e 's,^.*/,,')" "${loader}" "$(gettext "${GRUB_REC= OVERY_TITLE}")")" + [ "$secure_recovery_shell" =3D "false" ] || permission=3D"--users gru= bsu" else title=3D"$(gettext_printf "%s, with kernel %s (via %s)" "${OS}" "$(ec= ho ${kernel} | sed -e 's,^.*/,,')" "${loader}")" fi @@ -113,9 +114,9 @@ grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRU= B_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or lat= er)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "netbsd-advanced-$boot_d= evice_id>netbsd-${loader}-$kernel-$type-$boot_device_id")" fi =20 - echo "menuentry '$(echo "$title" | grub_quote)' \$menuentry_id_opt= ion 'netbsd-${loader}-$kernel-$type-$boot_device_id' {" | sed "s/^/$subm= enu_indentation/" + echo "menuentry '$(echo "$title" | grub_quote)' \$menuentry_id_opt= ion 'netbsd-${loader}-$kernel-$type-$boot_device_id' ${permission} {" | = sed "s/^/$submenu_indentation/" else - echo "menuentry '$(echo "$OS" | grub_quote)' \$menuentry_id_option= 'netbsd-${loader}-simple-$boot_device_id' {" | sed "s/^/$submenu_indent= ation/" + echo "menuentry '$(echo "$OS" | grub_quote)' \$menuentry_id_option= 'netbsd-${loader}-simple-$boot_device_id' ${permission} {" | sed "s/^/$= submenu_indentation/" fi =20 printf "%s\n" "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/= " --- a/util/grub.d/10_windows.in +++ b/util/grub.d/10_windows.in @@ -84,7 +84,7 @@ =20 gettext_printf "Found %s on %s (%s)\n" "$OS" "$drv" "$dev" >&2 cat << EOF -menuentry '$(echo "$OS" | grub_quote)' \$menuentry_id_option '$osid-$(gr= ub_get_device_id "${dev}")' { +menuentry '$(echo "$OS" | grub_quote)' \$menuentry_id_option '$osid-$(gr= ub_get_device_id "${dev}")' ${permission} { EOF =20 save_default_entry | sed -e 's,^,$grub_tab,' --- a/util/grub.d/10_xnu.in +++ b/util/grub.d/10_xnu.in @@ -37,7 +37,7 @@ # TRANSLATORS: it refers on the OS residing on device %s onstr=3D"$(gettext_printf "(on %s)" "${GRUB_DEVICE}")" cat << EOF -menuentry '$(echo "Darwin/Mac OS X $bitstr $onstr" | grub_quote)' --clas= s osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(= grub_get_device_id "${GRUB_DEVICE}")' { +menuentry '$(echo "Darwin/Mac OS X $bitstr $onstr" | grub_quote)' --clas= s osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(= grub_get_device_id "${GRUB_DEVICE}")' ${permission} { EOF save_default_entry | grub_add_tab prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -94,6 +94,7 @@ if [ x$type !=3D xsimple ] ; then if [ x$type =3D xrecovery ] ; then title=3D"$(gettext_printf "%s, with Xen %s and Linux %s (%s)" "${os}"= "${xen_version}" "${version}" "$(gettext "${GRUB_RECOVERY_TITLE}")")" + [ "$secure_recovery_shell" =3D "false" ] || permission=3D"--users gru= bsu" else title=3D"$(gettext_printf "%s, with Xen %s and Linux %s" "${os}" "${x= en_version}" "${version}")" fi @@ -103,10 +104,10 @@ title_correction_code=3D"${title_correction_code}if [ \"x\$defa= ult\" =3D '$quoted' ]; then default=3D'$(echo "$replacement_title" | grub= _quote)'; fi;" grub_warn "$(gettext_printf "Please don't use old title \`%s' f= or GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 = or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced= -$boot_device_id>gnulinux-$version-$type-$boot_device_id")" fi - echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuent= ry_id_option 'xen-gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/= $submenu_indentation/" + echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuent= ry_id_option 'xen-gnulinux-$version-$type-$boot_device_id' ${permission} = {" | sed "s/^/$submenu_indentation/" else title=3D"$(gettext_printf "%s, with Xen hypervisor" "${os}")" - echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuent= ry_id_option 'xen-gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu= _indentation/" + echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuent= ry_id_option 'xen-gnulinux-simple-$boot_device_id' ${permission} {" | sed= "s/^/$submenu_indentation/" fi if [ x$type !=3D xrecovery ] ; then save_default_entry | grub_add_tab | sed "s/^/$submenu_indentation/= " --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -67,7 +67,7 @@ # TRANSLATORS: it refers on the OS residing on device %s onstr=3D"$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF -menuentry '$(echo "${LONGNAME} $bitstr $onstr" | grub_quote)' --class os= x --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub= _get_device_id "${DEVICE}")' { +menuentry '$(echo "${LONGNAME} $bitstr $onstr" | grub_quote)' --class os= x --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub= _get_device_id "${DEVICE}")' ${permission} { EOF save_default_entry | grub_add_tab prepare_grub_to_access_device ${DEVICE} | grub_add_tab @@ -177,7 +177,7 @@ found_other_os=3D1 onstr=3D"$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF -menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --= class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DE= VICE}")' { +menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --= class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DE= VICE}")' ${permission} { EOF save_default_entry | grub_add_tab prepare_grub_to_access_device ${DEVICE} | grub_add_tab @@ -210,7 +210,7 @@ DEVICE=3D${DEVICE%@*} onstr=3D"$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF -menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --= class os \$menuentry_id_option 'osprober-efi-$(grub_get_device_id "${DEVI= CE}")' { +menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --= class os \$menuentry_id_option 'osprober-efi-$(grub_get_device_id "${DEVI= CE}")' ${permission} { EOF save_default_entry | sed -e "s/^/\t/" prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/" @@ -268,7 +268,7 @@ =20 if [ "x$is_top_level" =3D xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" !=3D = xy ]; then cat << EOF -menuentry '$(echo "$OS $onstr" | grub_quote)' --class gnu-linux --class = gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_devi= ce_id' { +menuentry '$(echo "$OS $onstr" | grub_quote)' --class gnu-linux --class = gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_devi= ce_id' ${permission} { EOF save_default_entry | grub_add_tab printf '%s\n' "${prepare_boot_cache}" @@ -326,7 +326,7 @@ found_other_os=3D1 onstr=3D"$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF -menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --cla= ss gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.g= z-false-$(grub_get_device_id "${DEVICE}")' { +menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --cla= ss gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.g= z-false-$(grub_get_device_id "${DEVICE}")' ${permission} { EOF save_default_entry | grub_add_tab prepare_grub_to_access_device ${DEVICE} | grub_add_tab @@ -351,7 +351,7 @@ ;; minix) cat << EOF -menuentry "${LONGNAME} (on ${DEVICE}, Multiboot)" { +menuentry "${LONGNAME} (on ${DEVICE}, Multiboot)" ${permission} { EOF save_default_entry | sed -e "s/^/\t/" prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/" --- a/util/grub.d/30_uefi-firmware.in +++ b/util/grub.d/30_uefi-firmware.in @@ -39,7 +39,7 @@ onstr=3D"$(gettext_printf "(on %s)" "${DEVICE}")" =20 cat << EOF -menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' { +menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' ${permission} {= fwsetup } EOF --------------5D1697332E5A302DB29173A3--