Repository navigation
function-oci-v0.2.0
function-oci 0.2.0 runs an image's process as a non-root user with no Linux capabilities, and refuses an image that would run it as root. An image built without a USER line worked on 0.1.0 and doesn't load on 0.2.0, so check your images before you upgrade. function-oci is still 0.x: a release may break what the one before it accepted.
Before you upgrade
Give every image a non-root user. The runtime refuses an image whose config sets no user, sets the number 0, or names a user that the image's /etc/passwd gives UID 0. The step fails with a fatal result:
cannot load module …: image runs as root (its config sets no user): the OCI runtime runs a process as a non-root user only (docs/oci/modules.md)
Add a numeric user to the Dockerfile, for example USER 65532:65532, which needs no /etc/passwd in the image. Rebuild and push the image, run guestfn push --image again, and put the new digest in the Composition.
Check anything the process did that needed privilege. A setuid binary or a file capability in the image no longer raises what the process may do, the process can't bind a port below 1024, and it writes only where its user may: /tmp, and the paths the image gives that user.
For operators
Images that run as root are refused at load
On 0.1.0 the process ran as whatever user the image named, root included. On 0.2.0 the runtime refuses such an image when it loads the module, before a VM boots. For an image that sets no user or the number 0 it decides from the image config alone, before it unpacks a layer, and function validate --resolve prints the same verdict. A user given by name is resolved against the image's /etc/passwd first. There is no flag to turn the check off. Troubleshooting has the refusal (#333).
For module authors
The process has no capabilities
Before it starts the process, the init in the VM empties the capability bounding set, clears the permitted, effective, inheritable and ambient sets, and sets no_new_privs. Root in the guest is then the init alone, so the process can't change the memory limit of its own run or interfere with the init. This is also what the egress proxy planned in #280 depends on. The function's gRPC server on port 9443 is unaffected. OCI modules describes what the process sees (#333).
Merged pull requests
- docs: drop the experimental banner by @jonasz-lasut in #330
- chore(release): record the tested versions by @jonasz-lasut in #329
- chore(deps): update rust crate kube to v5.1.0 by @renovate[bot] in #332
- chore(deps): update cgr.dev/chainguard/glibc-dynamic:latest docker digest to cb7aa46 by @renovate[bot] in #331
- chore(deps): update rust by @renovate[bot] in #328
- chore(release): describe changes, list merged PRs by @jonasz-lasut in #335
- chore(deps): update vale by @renovate[bot] in #334
- feat(oci): refuse root and drop capabilities by @jonasz-lasut in #333
- docs(oci): name function-oci v0.2.0 in the example by @jonasz-lasut in #336
Full changelog: function-oci-v0.1.0...function-oci-v0.2.0