-
Notifications
You must be signed in to change notification settings - Fork 159
cli: add install print-configuration --root-dir
#1825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cgwalters
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, seems fine to me. That said:
We would like to only inspect a container image with
{bootc,}image-builder and not actually run the container. One reason is (too much?) paranoia, i.e. we want to eventually
support bootc containers coming from the users that get passed
into the service and not having to run anything on the container
initially to generate the osbuild manifest minimizes the risk.
And in this model the bootc binary being invoked would come from the bootc-image-builder container, and not the users' container so would be theoretically more predictable? I guess but...I think doing this via the equivalent of RUN --network=none bootc install print-configuration would constrain unpredictability enough too.
|
[..]
I will talk to the rest of the team about this, honestly I'm not sure myself, I would like to minimize the attack surface in the service as much as possible and and ideally run no-user provided code at the manifest generation time (where we are much less isolated than at build time). But maybe I'm just overly paranoid, this is run inside containers and as you pointed out, there are ways like "network=none" to heavily restrict what the container can do. Therefore I leave this as "draft" until we discussed this internally again. But thanks a lot for your excellent review, even though its a tiny amount of code I enjoyed the codebase (and rust). |
bf04398 to
c78fa5c
Compare
cgwalters
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but needs a rebase and DCO
crates/lib/src/install.rs
Outdated
|
|
||
| /// Set an alternative rootdir | ||
| #[clap(long, default_value = "/")] | ||
| pub(crate) root_dir: Option<String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To have default_value work just drop the Option
We would like to only inspect a container image with
{bootc,}image-builder and not actually run the container.
One reason is (too much?) paranoia, i.e. we want to eventually
support bootc containers coming from the users that get passed
into the service and not having to run anything on the container
initially to generate the osbuild manifest minimizes the risk.
So to still get the require parameters like preferred rootfs
or kargs we would like to run our own bootc and then pass
```
bootc install print-configuration --sysroot /path/to/mounted/cnt
```
to generate the manifest. The actual build will still run
the `boots install to-filesystem` from the container. But that
step happens in an isolated instance that is destroyed after
each build (we already do this for package based image builds
as users can also inject custom content/rpms here).
It also tweaks print_configuration to make it easier to
test. With that we could drop parts of the tests for
PR#1820 from the container.rs and move them in here.
Signed-off-by: Michael Vogt <michael.vogt@gmail.com>
Co-authored-by: Colin Walters <walters@verbum.org>
c78fa5c to
d1e50d9
Compare
|
I tweaked this
|
Thanks a lot for these tweaks/fixes! When I talked in my team there was a bit of uncertainty if/when we need this so I am hesitant to push for it. I would feel bad to push for this and then its not being used in the "images" library :/ So I'm inclined to close it (for now) but I have the suspicion that this will come back (but its up to the image-builder team to decide that). |
|
OK sure. For posterity here's the current diff so it survives even if you delete your fork. |
[draft as this is potentially controversial, also build on top f #1820 mostly to avoid conflicts]
We would like to only inspect a container image with
{bootc,}image-builder and not actually run the container.
One reason is (too much?) paranoia, i.e. we want to eventually
support bootc containers coming from the users that get passed
into the service and not having to run anything on the container
initially to generate the osbuild manifest minimizes the risk.
So to still get the require parameters like preferred rootfs
or kargs we would like to run our own bootc and then pass
to generate the manifest. The actual build will still run
the
boots install to-filesystemfrom the container. But thatstep happens in an isolated instance that is destroyed after
each build (we already do this for package based image builds
as users can also inject custom content/rpms here).
This PR implements this new "--root-dir" option.
It also tweaks print_configuration to make it easier to
test. With that we could drop parts of the tests for
PR#1820 from the container.rs and move them in here.
(c.f. osbuild/images#1988)