Skip to content

baremetal: incorrect checksum used for bootstrap vm with bootstrapOSImage override #2845

@hardys

Description

@hardys

Since #2757 landed it is possible to override the bootstrap image for disconnected installs, and I tried that like this:

platform:
  baremetal:
    bootstrapOSImage: http://192.168.111.1/images/rhcos-43.81.201912110942.0-qemu.x86_64.qcow2.gz?sha256=fb31404bbd8b7cb4726799e0a839799060a496679e5c67b06a17929d757e5e9e

However we see that although the installer cache code downloads from the expected location, the checksum is not recalculated before passing to terraform, so the validation fails:

level=info msg="Obtaining RHCOS image file from 'http://192.168.111.1/images/rhcos-43.81.201912110942.0-qemu.x86_64.qcow2.gz?sha256=fb31404bbd8b7cb4726799e0a839799060a496679e5c67b06a17929d757e5e9e'"
level=debug msg="Unpacking file into \"/home/shardy/.cache/openshift-installer/image_cache/59c9306c6a41ee6d900e99b4a0b2697a\"..."
level=debug msg="content type of /home/shardy/.cache/openshift-installer/image_cache/59c9306c6a41ee6d900e99b4a0b2697a is application/x-gzip"
level=error msg="File sha256 checksum is invalid."
level=fatal msg="failed to fetch Terraform Variables: failed to generate asset \"Terraform Variables\": failed to get baremetal Terraform variables: failed to use cached bootstrap libvirt image: Checksum mismatch for /home/shardy/.cache/openshift-installer/image_cache/59c9306c6a41ee6d900e99b4a0b2697a; expected=fb31404bbd8b7cb4726799e0a839799060a496679e5c67b06a17929d757e5e9e found=6a019c55a13c6ff4c6527d8b2c965bdc657bf444258ee7a420694d6f3ab3a8e8"

Here we can see the compressed and uncompressed checksum - I think in the case where bootstrapOSImage is specified the sha256 should be used to validate the downloaded image, then a new checksum calculated for the gunzipped file?

$ sha256sum /home/dev-scripts/ironic/html/images/rhcos-43.81.201912110942.0-qemu.x86_64.qcow2.gz
fb31404bbd8b7cb4726799e0a839799060a496679e5c67b06a17929d757e5e9e  /home/dev-scripts/ironic/html/images/rhcos-43.81.201912110942.0-qemu.x86_64.qcow2.gz
$ gunzip -c /home/dev-scripts/ironic/html/images/rhcos-43.81.201912110942.0-qemu.x86_64.qcow2.gz | sha256sum
6a019c55a13c6ff4c6527d8b2c965bdc657bf444258ee7a420694d6f3ab3a8e8  -

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.platform/baremetalIPI bare metal hosts platform

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions