[rhel7/master] Add check for the format of grub2 encrypted password (#1070327)

Vratislav Podzimek vpodzime at redhat.com
Mon Aug 11 12:59:06 UTC 2014


On Fri, 2014-08-08 at 17:20 -0700, Brian C. Lane wrote:
> Encrypted grub2 passwords need to use the grub.pbkdf2 algorithm. Check
> for this if bootloader --iscrypted is used with grub2 and raise a
> KickstartError if it is in the wrong format.
> 
> Note that --md5pass is mapped to --iscrypted
> 
> Related: rhbz#1070327
> ---
>  pyanaconda/kickstart.py | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
> index 9118854..b6316c8 100644
> --- a/pyanaconda/kickstart.py
> +++ b/pyanaconda/kickstart.py
> @@ -291,6 +291,11 @@ class Bootloader(commands.bootloader.F19_Bootloader):
>              raise KickstartValueError(formatErrorMsg(self.lineno,
>                      msg="GRUB2 does not support installation to a partition."))
>  
> +        if self.isCrypted and isinstance(get_bootloader(), GRUB2):
> +            if not self.password.startswith("grub.pbkdf2."):
> +                raise KickstartValueError(formatErrorMsg(self.lineno,
> +                        msg="GRUB2 encrypted password must be in grub.pbkdf2 format."))
> +
>          return self
>  
>      def execute(self, storage, ksdata, instClass):
Looks good to me.

-- 
Vratislav Podzimek

Anaconda Rider | RHCE | Red Hat, Inc. | Brno - Czech Republic




More information about the anaconda-patches mailing list