torizon / meta-toradex-torizon

Torizon OS OpenEmbedded Distro Layer
MIT License
6 stars 10 forks source link

Make required changes to the OS to boot from a composefs image #32

Closed leograba closed 4 months ago

leograba commented 4 months ago

Scope

This ticket applies exclusively to OS images built with ECoT support.

Goals

Make changes to the OS so as to cause it to boot with a composefs image as the root mount. This includes:

Depending on the results, we may also decide to deal with the /etc directory on a separate ticket.

Notice that this ticket does not cover ensuring authenticity. We’ll cover this on a separate ticket because that depends on changes in the kernel which in our case will require back-ports.

Background

We have previously done some investigation and even a proof-of-concept (PoC) using composefs; in the PoC, the ostree generated deployment (hardlink farm) was still used and composefs was employed to protect only the /usr directory. Unfortunately this approach does not add much protection to the system since the composefs protection can be easily bypassed. One obvious way to do it is by replacing any of the various symlinks existing in the root directory of the deployment. Another way is changing /etc/fstab and overriding the contents of /usr with a bind mount. These two methods would allow an attacker to make persistent changes to the system to execute unsigned code at boot time which would defeat the purpose of secure boot.

The solution to the above problem is what was done by ostree, where the root directory is a mount of a composefs image. Thus, we should try to use inasmuch as possible everything that is currently provided by ostree, possibly adapting things to our use case.