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 option to bind mount (pod managed) /etc/* files to nonstandard locations #12691

Closed
LStandman opened this issue Dec 23, 2021 · 16 comments · Fixed by #13221
Closed

add option to bind mount (pod managed) /etc/* files to nonstandard locations #12691

LStandman opened this issue Dec 23, 2021 · 16 comments · Fixed by #13221
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. stale-issue

Comments

@LStandman
Copy link
Contributor

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind feature

Description

There are programs that allow some daemons to run chrooted for some added security within the program. (e.g., Postfix.)
Within a pod /etc/hosts is managed by the pod and automatically bind mounted to guest:/etc/hosts.

Perhaps podman run should expose an option to bind mount that pod-managed hosts file into alternative/additional locations within the guest. E.g., podman run --hostsfile-targets=/var/run/foo bar

Best regards,
LS

@openshift-ci openshift-ci bot added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 23, 2021
@rhatdan
Copy link
Member

rhatdan commented Dec 23, 2021

Not sure what the issue you are attempting to fix. Do you want to have a chroot within a container which would see the hosts file created within the pod?
BTW Not sure how much security a chroot within a container adds. A container is already a super secure chroot.

@LStandman
Copy link
Contributor Author

LStandman commented Dec 23, 2021

Not sure what the issue you are attempting to fix. Do you want to have a chroot within a container which would see the hosts file created within the pod?

Exactly

BTW Not sure how much security a chroot within a container adds. A container is already a super secure chroot.

I believe that a container separates an abstract service (e.g., an SMTP server) from the host that runs the server.
A within-container chroot would create a layer of separation between the processes that comprise that abstract service (assuming you cannot neatly containerize these processes).

@rhatdan
Copy link
Member

rhatdan commented Dec 23, 2021

In this case you would want the hosts file mounted twice. What about the resolv.conf and other files created by Podman to be mounted into the container.

@LStandman
Copy link
Contributor Author

Then I suppose we should generalize the issue. :)
Maybe the command line option should be used point to all "etc/" directories, and then podman will mount all those specially-treated files more than once. E.g., podman run --etc-targets=/etc,/var/run/foo,/var/run/bar

@LStandman LStandman changed the title add option to bind mount (pod managed) /etc/hosts to nonstandard locations add option to bind mount (pod managed) /etc/* files to nonstandard locations Dec 23, 2021
@rhatdan
Copy link
Member

rhatdan commented Dec 23, 2021

Are you mounting these in the same location under the chroot IE would
--rootfstargets=/, /var/run/foo

And you end up with /var/run/foo/etc/hosts?

@LStandman
Copy link
Contributor Author

LStandman commented Dec 23, 2021

I hope I am understanding you correctly.
Yes, there is always a corresponding etc/ folder under the chroot
Just like in your example.

@rhatdan
Copy link
Member

rhatdan commented Dec 23, 2021

I just don't want to be specific to etc. Not that we currently generate other files, I believe but keep out options open.
I think keeping it
--altrootfs=/var/run/foo and still mounting in / would be a better alternative.

@LStandman
Copy link
Contributor Author

Indeed, yours is the better alternative. :)

@rhatdan
Copy link
Member

rhatdan commented Dec 23, 2021

@vrothberg @giuseppe Thoughts?

@vrothberg
Copy link
Member

I am OK with it.

@rhatdan
Copy link
Member

rhatdan commented Jan 10, 2022

@LStandman interested in opening a PR for this?

@LStandman
Copy link
Contributor Author

@LStandman interested in opening a PR for this?

Sure why not

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Feb 10, 2022

@LStandman did you ever make any progress?

@LStandman
Copy link
Contributor Author

@LStandman did you ever make any progress?

Hi, yes I'm about done with it.
I expect to PR in a couple of weeks

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@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 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. stale-issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants