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 documentation on running systemd on SELinux systems #2269

Merged
merged 1 commit into from Feb 7, 2019

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Feb 5, 2019

Lots of users are attempting to run systemd within a container. They are
being blocked from running SELinux systems since they need the
container_manage_cgroup which is not enabled by default.

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

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 5, 2019
@rhatdan
Copy link
Member Author

rhatdan commented Feb 5, 2019

@TomSweeneyRedHat PTAL

@@ -610,6 +610,13 @@ It will also set the default stop signal to SIGRTMIN+3.

This allow systemd to run in a confined container without any modifications.

Note: On `SELinux` systems, systemd attempts to write to the cgroup
file system. Containers writing to the cgroup file system is denied by default.
Copy link
Member

Choose a reason for hiding this comment

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

s/is denied/are denied/

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@@ -610,6 +610,13 @@ It will also set the default stop signal to SIGRTMIN+3.

This allow systemd to run in a confined container without any modifications.

Note: On `SELinux` systems, systemd attempts to write to the cgroup
file system. Containers writing to the cgroup file system is denied by default.
You need to turn on the container_manage_cgroup boolean, on SELinux separated
Copy link
Member

Choose a reason for hiding this comment

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

Suggest: "To allow systemd to have access, use the setsebool utility to set the 'container_manage_cgroup' variable to 1."

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

You need to turn on the container_manage_cgroup boolean, on SELinux separated
system, to allow this access.

`setsebool -P container_manage_cgroup 1`
Copy link
Member

Choose a reason for hiding this comment

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

Probably ought to add setsebool (8) to our list of man pages at the bottom of this and any other page referencing it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added

system, to allow this access.

`setsebool -P container_manage_cgroup 1`

Copy link
Member

Choose a reason for hiding this comment

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

See prior comments please.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed


#### Symptom

Systemd getse permission denied when attempting to write to the cgroup file
Copy link
Member

Choose a reason for hiding this comment

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

s/getse/gets/

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

SELinux provides a Boolean, `container_manage_cgroup`, that allows container
processes to write to the cgroup file system. You need to turn on this boolean, on SELinux separated systems.

`setsebool -P container_manage_cgroup 1`
Copy link
Member

Choose a reason for hiding this comment

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

I find it's strange that this is a bool that gets set to 1 and not true. But shrug.

Copy link
Member Author

Choose a reason for hiding this comment

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

True will work.

These all work

sh-4.4# setsebool -P container_manage_cgroup true
sh-4.4# setsebool -P container_manage_cgroup on
sh-4.4# setsebool -P container_manage_cgroup 1

Just typing 1 is the easiest. :^)

@openshift-merge-robot
Copy link
Collaborator

/retest

@rhatdan rhatdan force-pushed the selinux branch 2 times, most recently from 661721f to da86c52 Compare February 6, 2019 12:54
@rhatdan
Copy link
Member Author

rhatdan commented Feb 6, 2019

@TomSweeneyRedHat Reworked to remove the yous. And switched to true. I think this is ready to merge.

@@ -610,6 +610,12 @@ It will also set the default stop signal to SIGRTMIN+3.

This allow systemd to run in a confined container without any modifications.

Note: On `SELinux` systems, systemd attempts to write to the cgroup
file system. Containers writing to the cgroup file system are denied by default.
The `container_manage_cgroup` boolean must be enabled for this to be allowed on SELinux separated system.
Copy link
Member

Choose a reason for hiding this comment

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

nit of 'a' nit: s/on SELinux separated/on a SELinux separated/

Copy link
Member Author

Choose a reason for hiding this comment

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

FIxed to allowed on an SELinux...

@@ -612,6 +612,12 @@ It will also set the default stop signal to SIGRTMIN+3.

This allow systemd to run in a confined container without any modifications.

Note: On `SELinux` systems, systemd attempts to write to the cgroup
file system. Containers writing to the cgroup file system are denied by default.
The `container_manage_cgroup` boolean must be enabled for this to be allowed on SELinux separated system.
Copy link
Member

Choose a reason for hiding this comment

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

nit 'a' here too.

Copy link
Member Author

Choose a reason for hiding this comment

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

FIxed to allowed on an SELinux...

#### Solution

SELinux provides a boolean, `container_manage_cgroup`, which allows container
processes to write to the cgroup file system. Turn on this boolean, on SELinux separated systems, to allow systemd to run properlay in the container.
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you need the first comma after 'boolean', but regardless, please change 'properlay' to 'properly' (I think I found your missing 'a'!)

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

Lots of users are attempting to run systemd within a container.  They are
being blocked from running SELinux systems since they need the
container_manage_cgroup which is not enabled by default.

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

@TomSweeneyRedHat TomSweeneyRedHat left a comment

Choose a reason for hiding this comment

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

LGTM

@rhatdan
Copy link
Member Author

rhatdan commented Feb 6, 2019

@openshift-merge-robot
Copy link
Collaborator

/retest

@rhatdan
Copy link
Member Author

rhatdan commented Feb 6, 2019

@giuseppe @umohnani8 @mheon @baude @vrothberg Someone please give us a /lgtm

@mheon
Copy link
Member

mheon commented Feb 7, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 7, 2019
@openshift-merge-robot openshift-merge-robot merged commit f250745 into containers:master Feb 7, 2019
@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 27, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 27, 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.

None yet

5 participants