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

Allow relabeling of files/directories under /usr prefix #180

Merged
merged 1 commit into from Sep 26, 2022

Conversation

rhatdan
Copy link
Collaborator

@rhatdan rhatdan commented Sep 23, 2022

We already check to make sure users do not accidentily relabel these excluded paths:

exclude_paths := map[string]bool{
	"/":           true,
	"/bin":        true,
	"/boot":       true,
	"/dev":        true,
	"/etc":        true,
	"/etc/passwd": true,
	"/etc/pki":    true,
	"/etc/shadow": true,
	"/home":       true,
	"/lib":        true,
	"/lib64":      true,
	"/media":      true,
	"/opt":        true,
	"/proc":       true,
	"/root":       true,
	"/run":        true,
	"/sbin":       true,
	"/srv":        true,
	"/sys":        true,
	"/tmp":        true,
	"/usr":        true,
	"/var":        true,
	"/var/lib":    true,
	"/var/log":    true,
}

But some users put homedirectories under /usr, and I see no reason to block them from relabeling.

At a certain point if users do something dumb with relableing we can not stop them.

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

We already check to make sure users do not accidentily relabel these
excluded paths:

	exclude_paths := map[string]bool{
		"/":           true,
		"/bin":        true,
		"/boot":       true,
		"/dev":        true,
		"/etc":        true,
		"/etc/passwd": true,
		"/etc/pki":    true,
		"/etc/shadow": true,
		"/home":       true,
		"/lib":        true,
		"/lib64":      true,
		"/media":      true,
		"/opt":        true,
		"/proc":       true,
		"/root":       true,
		"/run":        true,
		"/sbin":       true,
		"/srv":        true,
		"/sys":        true,
		"/tmp":        true,
		"/usr":        true,
		"/var":        true,
		"/var/lib":    true,
		"/var/log":    true,
	}

But some users put homedirectories under /usr, and I see no
reason to block them from relabeling.

At a certain point if users do something dumb with relableing we
can not stop them.

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

rhatdan commented Sep 23, 2022

@rhatdan
Copy link
Collaborator Author

rhatdan commented Sep 23, 2022

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

Copy link
Collaborator

@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

@thaJeztah
Copy link
Member

We already check to make sure users do not accidentily relabel these excluded paths

Double-checking; it looks like exclude_paths is only used by label.Relabel(); selinux.Chcon() is not checking for any of these; should it ?

@rhatdan
Copy link
Collaborator Author

rhatdan commented Sep 26, 2022

We could move it into that function instead of label.Relabel. Where we use this in Podman and Buildah is always throught lable.Relabel.

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

Successfully merging this pull request may close these issues.

None yet

4 participants