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

Add containerenv information to /run/.containerenv #8476

Merged
merged 1 commit into from
Dec 4, 2020

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Nov 25, 2020

We have been asked to leak some information into the container
to indicate:

  • The name and id of the container
  • The version of podman used to launch the container
  • The image name and ID the container is based on.
  • Whether the container engine is running in rootless mode.

Fixes: #6192

Signed-off-by: Daniel J Walsh [email protected]

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 25, 2020
containerenv := fmt.Sprintf(`\
engine="podman-%s"
name=%q
id=%q
Copy link
Collaborator

Choose a reason for hiding this comment

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

Exposing ID by default might be potentially dangerous. Could this be optional?

Copy link
Member Author

Choose a reason for hiding this comment

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

Please explain how container ID is risky?

We can add something to containers.conf to disable this, but I am not sure it is worth the effort.

Copy link
Collaborator

Choose a reason for hiding this comment

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

An attacker might want to know the container ID to determine the path of the attacker-crafted malicious file in the container rootfs.

Such path would be useful for the attacker when the attacker somehow managed to gain write access to e.g. /sys/kernel/uevent_helper.

@mheon
Copy link
Member

mheon commented Nov 25, 2020 via email

@rhatdan
Copy link
Member Author

rhatdan commented Nov 25, 2020

I am not crazy about security by obscurity. It is likely pretty easier for the processes within a container to figure out if the system is vulnerable. Doing a checksum of a couple of executables makes it easy to figure out if you are vulnerable.

@rhatdan
Copy link
Member Author

rhatdan commented Nov 25, 2020

@debarshiray
Copy link
Member

I'm a little iffy about exposing full version numbers. Usual practice for
hardening is to disable that wherever possible to make it harder to
identify if your instance is affected by vulnerabilities.

It is likely pretty easier for the processes within a container to figure out
if the system is vulnerable. Doing a checksum of a couple of executables
makes it easy to figure out if you are vulnerable.

As long as images have the package (eg., RPM) database, then one can just do rpm -q .... However, I can imagine images that don't have the database present.

@rhatdan
Copy link
Member Author

rhatdan commented Nov 25, 2020

@debarshiray You want these fields for logging, and better reporting to the user, what is going on, correct?

@TomSweeneyRedHat
Copy link
Member

Couple nits in docs. Once that and the security question is solved, LGTM.

@debarshiray
Copy link
Member

You want these fields for logging, and better reporting to the user, what
is going on, correct?

Yes, correct. eg., there is an interest to customize the shell prompt and such things to indicate which container and/or image is in play.

@rhatdan rhatdan force-pushed the containerenv branch 8 times, most recently from 66ddb97 to af8e491 Compare November 28, 2020 11:54
@rhatdan
Copy link
Member Author

rhatdan commented Nov 30, 2020

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 30, 2020
@rhatdan rhatdan force-pushed the containerenv branch 3 times, most recently from bfd07b2 to 26d1bdc Compare December 3, 2020 15:27
We have been asked to leak some information into the container
to indicate:
* The name and id of the container
* The version of podman used to launch the container
* The image name and ID the container is based on.
* Whether the container engine is running in rootless mode.

Fixes: containers#6192

Signed-off-by: Daniel J Walsh <[email protected]>
@rhatdan
Copy link
Member Author

rhatdan commented Dec 4, 2020

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 4, 2020
@rhatdan
Copy link
Member Author

rhatdan commented Dec 4, 2020

@containers/podman-maintainers PTAL
@AkihiroSuda We are now only leaking the information in --privileged mode.

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AkihiroSuda, 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

@TomSweeneyRedHat
Copy link
Member

LGTM
one of the tests isn't hip and I'm not sure why.
Do you need to touch up containers/buildah#2821 for the security issue @AkihiroSuda raised here?

@mheon
Copy link
Member

mheon commented Dec 4, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 4, 2020
@openshift-merge-robot openshift-merge-robot merged commit f01630a into containers:master Dec 4, 2020
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide metadata to identify a container from inside
7 participants