Skip to content
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

Rework default list of capabilities to minimal #1240

Merged
merged 1 commit into from
Nov 23, 2022

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Nov 22, 2022

For a couple of years now we have been shipping containers.conf settings to use only 10 capabities. Docker uses 14, with the difference being CAP_AUDIT_ALLOW, CAP_NET_RAW, CAP_MKNOD, CAP_CHROOT.

This allows us to run with a tighter security then Docker.

This PR makes the change to default config, so that if no containers.conf overrides are present, we will run with the tighter security. Currently most distros that ship the containers.conf already run with this setting, but this makes it formal, and changes the man page to match the defaults.

Signed-off-by: Daniel J Walsh dwalsh@redhat.com

@rhatdan
Copy link
Member Author

rhatdan commented Nov 22, 2022

@vrothberg PTAL

@rhatdan
Copy link
Member Author

rhatdan commented Nov 22, 2022

Fixes: #1234

@rhatdan
Copy link
Member Author

rhatdan commented Nov 22, 2022

@TomSweeneyRedHat PTAL

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just nits but LGTM 👍

Thank you, Dan!

docs/containers.conf.5.md Outdated Show resolved Hide resolved
docs/containers.conf.5.md Outdated Show resolved Hide resolved
For a couple of years now we have been shipping containers.conf settings
to use only 10 capabities. Docker uses 14, with the difference being
CAP_AUDIT_ALLOW, CAP_NET_RAW, CAP_MKNOD, CAP_CHROOT.

This allows us to run with a tighter security then Docker.

This PR makes the change to default config, so that if no
containers.conf overrides are present, we will run with the tighter
security. Currently most distros that ship the containers.conf already
run with this setting, but this makes it formal, and changes the man
page to match the defaults.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 23, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Nov 23, 2022
@openshift-merge-robot openshift-merge-robot merged commit fd4f514 into containers:main Nov 23, 2022
@rhatdan
Copy link
Member Author

rhatdan commented Nov 23, 2022

One problem with this change, is we can not let the containers.conf change out until we release updated versions of Podman/Buildah

@vrothberg
Copy link
Member

One problem with this change, is we can not let the containers.conf change out until we release updated versions of Podman/Buildah

Are you thinking about CI?

@rhatdan
Copy link
Member Author

rhatdan commented Nov 23, 2022

No sometimes we release containers-common rpm package with updated content, prior to a new release of podman or on a bugfix release of podman.

@vrothberg
Copy link
Member

No sometimes we release containers-common rpm package with updated content, prior to a new release of podman or on a bugfix release of podman.

That's a fair concern but I think we can avoid it by being careful: Unless there's a bug, we shouldn't bump c/common in the package. If there's a bug, we should backport it to exactly the version c/common that is being used by the containers-common package.

@rhatdan
Copy link
Member Author

rhatdan commented Nov 23, 2022

Yup usually there is only docs changes, but in this case there would be security changes.

Note, by default container engines using containers.conf, run with less
capabilities than Docker. Docker runs additionally with "AUDIT_WRITE", "MKNOD",
"NET_RAW", "CHROOT". If you need to add one of these capabilities for a
particular container, you can use the --cap-add option or edit your system's containers.conf.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Late to the party, but pronouns aren't hip in man pages

Note, by default, container engines using containers.conf run with fewer
capabilities than Docker. Docker runs additionally with "AUDIT_WRITE", "MKNOD",
"NET_RAW" and "CHROOT" capabilities. If one of these capabilities is required for a particular container, the --cap-add option can be used, or the system's containers.conf can be edited.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to go through all man pages and remove you, and then add a test to look for you in a man page PR and block it.

@nalind
Copy link
Member

nalind commented Feb 17, 2023

A reminder that buildah's chroot isolation, which we configure in the default buildah image, depends on chroot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants